Skip to content

Commit

Permalink
Merge pull request #23 from williamthome/docs/use-eunit-report
Browse files Browse the repository at this point in the history
Use `doctest_eunit_report` in the examples of README.md
  • Loading branch information
williamthome authored May 23, 2024
2 parents 547f623 + a1347c8 commit 46fb08d
Showing 1 changed file with 42 additions and 29 deletions.
71 changes: 42 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,22 @@ foo() ->
Running it via `rebar3 as test shell`:
```erlang
1> doctest:module(foo).
.F
Failures:

1) foo:foo/0: -doc | Ln 13
Failure/Error: ?assertEqual(foo, foo:foo())
expected: foo
got: bar
%% eunit_proc.erl:583:in `eunit_proc:run_group/2`
Output:
Output:

Finished in 0.010 seconds
2 tests, 1 failures
PASS ./test/support/foo.erl:6 -moduledoc
FAIL ./test/support/foo.erl:15 -doc

assertEqual

Expected: foo
Received: bar

151> foo:foo().
16foo
└── at ./test/support/foo.erl:15

Tests: 1 failed, 1 passed, 2 total
Time: 0.007 seconds
```

#### Options
Expand Down Expand Up @@ -123,9 +126,13 @@ bar
```

Now, by running `rebar3 eunit`:
```shell
Finished in 0.018 seconds
2 tests, 0 failures
```erlang
PASS ./src/math.erl:29 -doc
PASS ./src/math.erl:31 -doc


Tests: 2 passed, 2 total
Time: 0.008 seconds
```

By changing the first test to:
Expand All @@ -135,19 +142,25 @@ By changing the first test to:
```

And running `rebar3 eunit` again:
```shell
Failures:

1) math:add/2: -doc | Ln 15
Failure/Error: ?assertEqual(1, math:add(1, 1))
expected: 1
got: 2
%% eunit_proc.erl:583:in `eunit_proc:run_group/2`
Output:
Output:

Finished in 0.010 seconds
2 tests, 1 failures
```erlang
FAIL ./src/math.erl:15 -doc

assertEqual

Expected: 1
Received: 2

151> math:add(1, 1).
161
└── at ./src/math.erl:15

PASS ./src/math.erl:17 -doc


Tests: 1 failed, 1 passed, 2 total
Time: 0.007 seconds
```

#### Options
Expand Down

0 comments on commit 46fb08d

Please sign in to comment.