Skip to content

Commit b01523d

Browse files
committed
Prepare beams for tests if not exist
1 parent 5ae467a commit b01523d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/test_helper.exs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
ExUnit.start()
22

3-
defmodule TestHelper do
4-
def compile_test_examples(examples_path) do
5-
ex_blob = examples_path <> "/*.ex"
3+
defmodule ExamplesCompiler do
4+
@build_path "test/examples/_build/"
65

7-
for path <- Path.wildcard(ex_blob) do
8-
System.cmd("elixirc", ["-o", examples_path, path])
6+
def compile(pattern) do
7+
case File.mkdir(@build_path) do
8+
:ok ->
9+
paths = Path.wildcard(pattern)
10+
Kernel.ParallelCompiler.compile_to_path(paths, @build_path)
11+
:ok
12+
13+
_ ->
14+
:error
915
end
1016
end
1117
end
1218

13-
# TestHelper.compile_test_examples("test/examples")
14-
# TestHelper.compile_test_examples("test/examples/basic")
15-
# TestHelper.compile_test_examples("test/examples/conditional")
19+
ExamplesCompiler.compile("test/examples/**/*.ex")

0 commit comments

Comments
 (0)