Skip to content

Commit b4a5ccc

Browse files
committed
Add basic tests for type pretty printing
1 parent ec6f4f0 commit b4a5ccc

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

test/gradient/elixir_type_test.exs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
defmodule Gradient.ElixirTypeTest do
2+
use ExUnit.Case
3+
doctest Gradient.ElixirType
4+
5+
alias Gradient.ElixirType
6+
7+
test "pp integer()" do
8+
type = {:integer, 0, 12}
9+
expected = "12"
10+
actual = ElixirType.pretty_print(type)
11+
assert expected == actual
12+
end
13+
14+
test "pp atom()" do
15+
type = {:atom, 0, :ok}
16+
expected = ":ok"
17+
actual = ElixirType.pretty_print(type)
18+
assert expected == actual
19+
end
20+
21+
test "pp nil()" do
22+
type = {:atom, 0, nil}
23+
expected = "nil"
24+
actual = ElixirType.pretty_print(type)
25+
assert expected == actual
26+
end
27+
28+
test "pp false boolean()" do
29+
type = {:atom, 0, false}
30+
expected = "false"
31+
actual = ElixirType.pretty_print(type)
32+
assert expected == actual
33+
end
34+
35+
test "pp true boolean()" do
36+
type = {:atom, 0, true}
37+
expected = "true"
38+
actual = ElixirType.pretty_print(type)
39+
assert expected == actual
40+
end
41+
42+
test "pp binary()" do
43+
type = {:type, 0, :binary, []}
44+
expected = "binary()"
45+
actual = ElixirType.pretty_print(type)
46+
assert expected == actual
47+
end
48+
end

0 commit comments

Comments
 (0)