-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathcompiler_test.exs
More file actions
55 lines (42 loc) · 1.52 KB
/
compiler_test.exs
File metadata and controls
55 lines (42 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
defmodule ElixirScript.Compiler.Test do
use ExUnit.Case
test "Can compile one entry module" do
result = ElixirScript.Compiler.compile(Version)
assert is_binary(result)
end
test "Can compile multiple entry modules" do
result = ElixirScript.Compiler.compile([Atom, String, Agent])
assert is_binary(result)
end
test "Output" do
result = ElixirScript.Compiler.compile(Atom, [])
assert result =~ "export default Elixir"
end
test "Output file with default name" do
path = System.tmp_dir()
ElixirScript.Compiler.compile(Atom, [output: path])
assert File.exists?(Path.join([path, "elixirscript.build.js"]))
end
test "Output file with custom name" do
path = System.tmp_dir()
path = Path.join([path, "myfile.js"])
ElixirScript.Compiler.compile(Atom, [output: path])
assert File.exists?(path)
end
test "compile file" do
path = System.tmp_dir()
path = Path.join([path, "myfile.js"])
input_path = Path.join([File.cwd!(), "test", "beam_test.exs"])
ElixirScript.Compiler.compile(input_path, [output: path])
assert File.exists?(path)
assert String.contains?(File.read!(path), "Elixir.ElixirScript.Beam.Test")
end
test "compile wildcard" do
path = System.tmp_dir()
path = Path.join([path, "myfile.js"])
input_path = Path.join([File.cwd!(), "test", "*fi_test.exs"])
ElixirScript.Compiler.compile(input_path, [output: path])
assert File.exists?(path)
assert String.contains?(File.read!(path), "Elixir.ElixirScript.FFI.Test")
end
end