-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add mock functions to info_sys_test.exs p.285 #1
- Loading branch information
Showing
1 changed file
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,24 @@ | ||
defmodule InfoSysTest do | ||
use ExUnit.Case | ||
doctest InfoSys | ||
alias InfoSys.Result | ||
|
||
test "greets the world" do | ||
assert InfoSys.hello() == :world | ||
defmodule TestBackend do | ||
def name(), do: "Wolfram" | ||
|
||
def compute("result", _opts) do | ||
[%Result{backend: __MODULE__, text: "result"}] | ||
end | ||
|
||
def compute("none", _opts) do | ||
[] | ||
end | ||
|
||
def compute("timeout", _opts) do | ||
Process.sleep(:infinity) | ||
end | ||
|
||
def compute("boom", _opts) do | ||
raise "boom!" | ||
end | ||
end | ||
end |