File tree Expand file tree Collapse file tree 2 files changed +16
-22
lines changed
elixir/test/elixir/kernel Expand file tree Collapse file tree 2 files changed +16
-22
lines changed Original file line number Diff line number Diff line change @@ -8,23 +8,17 @@ defmodule Kernel.FnTest do
8
8
assert ( fn + 1 -> true end ) . ( 1 )
9
9
end
10
10
11
+ defp fun_match ( x ) do
12
+ fn
13
+ ^ x -> true
14
+ _ -> false
15
+ end
16
+ end
17
+
11
18
test "pin operator on match" do
12
- x = 1
13
-
14
- refute ( fn
15
- ^ x -> true
16
- _ -> false
17
- end ) . ( 0 )
18
-
19
- assert ( fn
20
- ^ x -> true
21
- _ -> false
22
- end ) . ( 1 )
23
-
24
- refute ( fn
25
- ^ x -> true
26
- _ -> false
27
- end ) . ( 1.0 )
19
+ refute fun_match ( 1 ) . ( 0 )
20
+ assert fun_match ( 1 ) . ( 1 )
21
+ refute fun_match ( 1 ) . ( 1.0 )
28
22
end
29
23
30
24
test "guards with no args" do
Original file line number Diff line number Diff line change @@ -47,17 +47,17 @@ defmodule ExUnit.DocTestTest.GoodModule do
47
47
def single_context , do: :ok
48
48
49
49
@ doc """
50
- iex> 1 + (fn() -> "" end).()
51
- ** (ArithmeticError) bad argument in arithmetic expression
50
+ iex> raise "message"
51
+ ** (RuntimeError) message
52
52
53
- iex> 2 + (fn() -> :a end).()
54
- ** (ArithmeticError) bad argument in arithmetic expression
53
+ iex> raise "message"
54
+ ** (RuntimeError) message
55
55
"""
56
56
def two_exceptions , do: :ok
57
57
58
58
@ doc """
59
- iex> 1 + (fn() -> :a end).()
60
- ** (ArithmeticError) bad argument in arithmetic expression
59
+ iex> raise "message"
60
+ ** (RuntimeError) message
61
61
"""
62
62
def exception_test , do: :ok
63
63
You can’t perform that action at this time.
0 commit comments