@@ -17,7 +17,7 @@ defmodule Kernel.WarningTest do
17
17
def hello(arg), do: nil
18
18
end
19
19
"""
20
- end ) =~ "variable arg is unused"
20
+ end ) =~ "warning: variable arg is unused"
21
21
after
22
22
purge Sample
23
23
end
@@ -29,7 +29,7 @@ defmodule Kernel.WarningTest do
29
29
defp hello, do: nil
30
30
end
31
31
"""
32
- end ) =~ "function hello/0 is unused"
32
+ end ) =~ "warning: function hello/0 is unused"
33
33
34
34
assert capture_err ( fn ->
35
35
Code . eval_string """
@@ -49,7 +49,7 @@ defmodule Kernel.WarningTest do
49
49
defp d(x), do: x
50
50
end
51
51
"""
52
- end ) =~ "function c/2 is unused"
52
+ end ) =~ "warning: function c/2 is unused"
53
53
after
54
54
purge [ Sample1 , Sample2 , Sample3 ]
55
55
end
@@ -62,7 +62,7 @@ defmodule Kernel.WarningTest do
62
62
defp b, do: a
63
63
end
64
64
"""
65
- end ) =~ "function a/0 is unused"
65
+ end ) =~ "warning: function a/0 is unused"
66
66
after
67
67
purge Sample
68
68
end
@@ -74,7 +74,7 @@ defmodule Kernel.WarningTest do
74
74
defmacrop hello, do: nil
75
75
end
76
76
"""
77
- end ) =~ "macro hello/0 is unused"
77
+ end ) =~ "warning: macro hello/0 is unused"
78
78
after
79
79
purge Sample
80
80
end
@@ -104,7 +104,7 @@ defmodule Kernel.WarningTest do
104
104
defp b(arg1 \\ 1, arg2 \\ 2, arg3 \\ 3), do: [arg1, arg2, arg3]
105
105
end
106
106
"""
107
- end ) =~ "default arguments in b/3 are never used"
107
+ end ) =~ "warning: default arguments in b/3 are never used"
108
108
109
109
assert capture_err ( fn ->
110
110
Code . eval_string % S """
@@ -113,7 +113,7 @@ defmodule Kernel.WarningTest do
113
113
defp b(arg1 \\ 1, arg2 \\ 2, arg3 \\ 3), do: [arg1, arg2, arg3]
114
114
end
115
115
"""
116
- end ) =~ "the first 2 default arguments in b/3 are never used"
116
+ end ) =~ "warning: the first 2 default arguments in b/3 are never used"
117
117
118
118
assert capture_err ( fn ->
119
119
Code . eval_string % S """
@@ -122,7 +122,7 @@ defmodule Kernel.WarningTest do
122
122
defp b(arg1 \\ 1, arg2 \\ 2, arg3 \\ 3), do: [arg1, arg2, arg3]
123
123
end
124
124
"""
125
- end ) =~ "the first default argument in b/3 is never used"
125
+ end ) =~ "warning: the first default argument in b/3 is never used"
126
126
127
127
assert capture_err ( fn ->
128
128
Code . eval_string % S """
@@ -144,13 +144,13 @@ defmodule Kernel.WarningTest do
144
144
def a, do: nil
145
145
end
146
146
"""
147
- end ) =~ "unused import :lists"
147
+ end ) =~ "warning: unused import :lists"
148
148
149
149
assert capture_err ( fn ->
150
150
Code . compile_string """
151
151
import :lists, only: [flatten: 1]
152
152
"""
153
- end ) =~ "unused import :lists"
153
+ end ) =~ "warning: unused import :lists"
154
154
after
155
155
purge [ Sample ]
156
156
end
@@ -163,7 +163,7 @@ defmodule Kernel.WarningTest do
163
163
def a, do: nil
164
164
end
165
165
"""
166
- end ) =~ "unused alias List"
166
+ end ) =~ "warning: unused alias List"
167
167
after
168
168
purge [ Sample ]
169
169
end
@@ -179,7 +179,7 @@ defmodule Kernel.WarningTest do
179
179
flatten ( [ 1 , 2 , 3 ] )
180
180
end
181
181
end
182
- end ) =~ "unused import String"
182
+ end ) =~ "warning: unused import String"
183
183
after
184
184
purge [ Sample ]
185
185
end
@@ -197,7 +197,7 @@ defmodule Kernel.WarningTest do
197
197
end
198
198
end
199
199
"""
200
- end ) =~ "nofile:5: the guard for this clause evaluates to 'false'"
200
+ end ) =~ "nofile:5: warning: the guard for this clause evaluates to 'false'"
201
201
202
202
assert capture_err ( fn ->
203
203
Code . eval_string """
@@ -211,7 +211,7 @@ defmodule Kernel.WarningTest do
211
211
end
212
212
end
213
213
"""
214
- end ) =~ "nofile:6: this clause cannot match because a previous clause at line 5 always matches"
214
+ end ) =~ "nofile:6: warning: this clause cannot match because a previous clause at line 5 always matches"
215
215
after
216
216
purge [ Sample1 , Sample2 ]
217
217
end
@@ -224,7 +224,7 @@ defmodule Kernel.WarningTest do
224
224
def hello
225
225
end
226
226
"""
227
- end ) =~ "empty clause provided for nonexistent function or macro hello/0"
227
+ end ) =~ "warning: empty clause provided for nonexistent function or macro hello/0"
228
228
after
229
229
purge [ Sample1 ]
230
230
end
@@ -258,7 +258,7 @@ defmodule Kernel.WarningTest do
258
258
def hello, do: nil
259
259
end
260
260
"""
261
- end ) =~ "this clause cannot match because a previous clause at line 2 always matches"
261
+ end ) =~ "warning: this clause cannot match because a previous clause at line 2 always matches"
262
262
after
263
263
purge Sample
264
264
end
@@ -271,7 +271,7 @@ defmodule Kernel.WarningTest do
271
271
def hello(arg \\ 0), do: nil
272
272
end
273
273
"""
274
- end ) =~ "clause with defaults should be the first clause in def hello/1"
274
+ end ) =~ "warning: clause with defaults should be the first clause in def hello/1"
275
275
after
276
276
purge Sample
277
277
end
@@ -286,7 +286,7 @@ defmodule Kernel.WarningTest do
286
286
def hello, do: :ok
287
287
end
288
288
"""
289
- end ) =~ "function world/0 is unused"
289
+ end ) =~ "warning: function world/0 is unused"
290
290
after
291
291
purge Sample
292
292
end
@@ -312,7 +312,7 @@ defmodule Kernel.WarningTest do
312
312
@foo
313
313
end
314
314
"""
315
- end ) =~ "undefined module attribute @foo, please remove access to @foo or explicitly set it to nil before access"
315
+ end ) =~ "warning: undefined module attribute @foo, please remove access to @foo or explicitly set it to nil before access"
316
316
after
317
317
purge Sample
318
318
end
@@ -326,15 +326,15 @@ defmodule Kernel.WarningTest do
326
326
end
327
327
end
328
328
"""
329
- end ) =~ "undefined module attribute @foo, please remove access to @foo or explicitly set it to nil before access"
329
+ end ) =~ "warning: undefined module attribute @foo, please remove access to @foo or explicitly set it to nil before access"
330
330
after
331
331
purge Sample
332
332
end
333
333
334
334
test :undefined_module_attribute_with_file do
335
335
assert capture_err ( fn ->
336
336
Code . load_file ( fixture_path ( "attribute_warning.ex" ) )
337
- end ) =~ "attribute_warning.ex:2: AttributeWarning (module) undefined module attribute @foo, please remove access to @foo or explicitly set it to nil before access"
337
+ end ) =~ "attribute_warning.ex:2: AttributeWarning (module) warning: undefined module attribute @foo, please remove access to @foo or explicitly set it to nil before access"
338
338
after
339
339
purge AttributeWarning
340
340
end
@@ -346,7 +346,7 @@ defmodule Kernel.WarningTest do
346
346
def a(x) when x in [], do: x
347
347
end
348
348
"""
349
- end ) =~ "the guard for this clause evaluates to 'false'"
349
+ end ) =~ "warning: the guard for this clause evaluates to 'false'"
350
350
after
351
351
purge Sample
352
352
end
@@ -361,7 +361,7 @@ defmodule Kernel.WarningTest do
361
361
end
362
362
end
363
363
"""
364
- end ) =~ "use of operator != has no effect"
364
+ end ) =~ "warning: use of operator != has no effect"
365
365
after
366
366
purge Sample
367
367
end
@@ -378,7 +378,7 @@ defmodule Kernel.WarningTest do
378
378
@behaviour Sample1
379
379
end
380
380
"""
381
- end ) =~ "undefined behaviour function foo/0 (for behaviour Sample1)"
381
+ end ) =~ "warning: undefined behaviour function foo/0 (for behaviour Sample1)"
382
382
after
383
383
purge [ Sample1 , Sample2 , Sample3 ]
384
384
end
@@ -395,7 +395,7 @@ defmodule Kernel.WarningTest do
395
395
@behaviour Sample1
396
396
end
397
397
"""
398
- end ) =~ "undefined behaviour macro foo/0 (for behaviour Sample1)"
398
+ end ) =~ "warning: undefined behaviour macro foo/0 (for behaviour Sample1)"
399
399
after
400
400
purge [ Sample1 , Sample2 , Sample3 ]
401
401
end
@@ -410,7 +410,7 @@ defmodule Kernel.WarningTest do
410
410
defimpl Sample1, for: Atom do
411
411
end
412
412
"""
413
- end ) =~ "undefined protocol function foo/1 (for protocol Sample1)"
413
+ end ) =~ "warning: undefined protocol function foo/1 (for protocol Sample1)"
414
414
after
415
415
purge [ Sample1 , Sample1.Atom ]
416
416
end
@@ -424,7 +424,7 @@ defmodule Kernel.WarningTest do
424
424
def foo(x, 2), do: x * 2
425
425
end
426
426
"""
427
- end ) =~ "nofile:4: clauses for the same def should be grouped together, def foo/2 was previously defined (nofile:2)"
427
+ end ) =~ "nofile:4: warning: clauses for the same def should be grouped together, def foo/2 was previously defined (nofile:2)"
428
428
after
429
429
purge [ Sample ]
430
430
end
@@ -437,7 +437,7 @@ defmodule Kernel.WarningTest do
437
437
def foo(x), do: :ok
438
438
end
439
439
"""
440
- end ) =~ "sample:3: variable x is unused"
440
+ end ) =~ "sample:3: warning: variable x is unused"
441
441
after
442
442
purge [ Sample ]
443
443
end
@@ -452,7 +452,7 @@ defmodule Kernel.WarningTest do
452
452
def foo(), do: nil
453
453
end
454
454
"""
455
- end ) =~ "nofile:3: type priv/0 is private, @typedoc's are always discarded for private types"
455
+ end ) =~ "nofile:3: warning: type priv/0 is private, @typedoc's are always discarded for private types"
456
456
after
457
457
purge [ Sample ]
458
458
end
@@ -464,7 +464,7 @@ defmodule Kernel.WarningTest do
464
464
@typedoc "Something"
465
465
end
466
466
"""
467
- end ) =~ "nofile:1: @typedoc provided but no type follows it"
467
+ end ) =~ "nofile:1: warning: @typedoc provided but no type follows it"
468
468
after
469
469
purge [ Sample ]
470
470
end
0 commit comments