Skip to content

Commit f30c39d

Browse files
committed
Test --infer option
1 parent 2365ce6 commit f30c39d

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
1.54 KB
Binary file not shown.

test/examples/type/list_infer.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
defmodule ListInfer do
2+
def f() do
3+
v = [1, 2]
4+
g(v)
5+
end
6+
7+
@spec g(integer()) :: any()
8+
def g(val), do: val + 1
9+
end

test/mix/tasks/gradient_test.exs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ defmodule Mix.Tasks.GradientTest do
33

44
import ExUnit.CaptureIO
55

6+
@no_problems_msg "No problems found!"
7+
68
@examples_path "test/examples/"
79
@type_path Path.join([@examples_path, "type"])
810

@@ -153,7 +155,13 @@ defmodule Mix.Tasks.GradientTest do
153155
end
154156

155157
test "--infer option" do
156-
# FIXME provide implementation
158+
beam = "Elixir.ListInfer.beam"
159+
output = run_task(@type_path, ["--no-compile", "--", beam])
160+
assert String.contains?(output, @no_problems_msg)
161+
162+
output = run_task(@type_path, ["--no-compile", "--infer", "--", beam])
163+
assert not String.contains?(output, @no_problems_msg)
164+
assert String.contains?(output, "list_infer.ex: The variable on line 4")
157165
end
158166

159167
test "--code-path option" do

0 commit comments

Comments
 (0)