Skip to content
This repository was archived by the owner on Dec 17, 2018. It is now read-only.

Commit 988ae1a

Browse files
Connor RigbyConnorRigby
authored andcommitted
Wrap erlang tests so they don't print unless they fail
1 parent 595d281 commit 988ae1a

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,24 @@ the command has been added to the command-queue of the thread.
3131
Since this project was originally an Erlang package, I chose to maintain the
3232
original module name (as an alias) and it's tests to try to maintain
3333
backwards compatibility. By default these tests get ran by default.
34-
`mix test` will execute them.
34+
35+
```bash
36+
# All the tests without the bench marks.
37+
mix test
38+
39+
# Run only erlang tests.
40+
mix test --only esqlite_erlang
41+
```
3542

3643
# Benchmarks
3744
There is also a benchmark suite located in the `bench` directory.
3845
It does not get ran with the test suite since it can take quite a while.
39-
You can run the benchmarks with
46+
4047
```bash
48+
# run all the tests and the benchmarks.
4149
mix test --include bench
50+
# run just the benchmark with
51+
mix test bench --include bench
4252
```
4353

4454
# Thanks and License

erl_test/esqlite_test.exs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
defmodule EsqliteErlangTest do
2+
use ExUnit.Case
3+
import ExUnit.CaptureIO
4+
5+
@tag :esqlite_erlang
6+
test "Runs Erlang tests" do
7+
assert Code.ensure_loaded?(:esqlite_test)
8+
output = capture_io(&:esqlite_test.test/0)
9+
unless output =~ "tests pass" do
10+
flunk(output)
11+
end
12+
end
13+
end

erl_test/test_helper.exs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
:code.ensure_loaded(:esqlite_test)
2-
case :esqlite_test.test() do
3-
:error -> System.halt(1)
4-
other -> other
5-
end

0 commit comments

Comments
 (0)