@@ -296,19 +296,12 @@ defmodule IEx.HelpersTest do
296
296
cleanup_modules ( [ Sample ] )
297
297
end
298
298
299
- test "c/2 helper" do
300
- assert_raise UndefinedFunctionError , ~r" function Sample\. run/0 is undefined" , fn ->
301
- Sample . run
302
- end
303
-
304
- filename = "sample.ex"
305
- with_file filename , test_module_code ( ) , fn ->
306
- assert c ( filename , "." ) == [ Sample ]
307
- assert File . exists? ( "Elixir.Sample.beam" )
308
- assert Sample . run == :run
299
+ test "c helper with error" do
300
+ ExUnit.CaptureIO . capture_io fn ->
301
+ with_file "sample.ex" , "raise \" oops\" " , fn ->
302
+ assert_raise CompileError , fn -> c ( "sample.ex" ) end
303
+ end
309
304
end
310
- after
311
- cleanup_modules ( [ Sample ] )
312
305
end
313
306
314
307
test "c helper with full path" do
@@ -366,21 +359,6 @@ defmodule IEx.HelpersTest do
366
359
cleanup_modules ( [ :sample ] )
367
360
end
368
361
369
- test "c/2 helper erlang" do
370
- assert_raise UndefinedFunctionError , ~r" function :sample.hello/0 is undefined" , fn ->
371
- :sample . hello
372
- end
373
-
374
- filename = "sample.erl"
375
- with_file filename , erlang_module_code ( ) , fn ->
376
- assert c ( filename , "." ) == [ :sample ]
377
- assert :sample . hello == :world
378
- assert File . exists? ( "sample.beam" )
379
- end
380
- after
381
- cleanup_modules ( [ :sample ] )
382
- end
383
-
384
362
test "c helper skips unknown files" do
385
363
assert_raise UndefinedFunctionError , ~r" function :sample.hello/0 is undefined" , fn ->
386
364
:sample . hello
@@ -396,6 +374,20 @@ defmodule IEx.HelpersTest do
396
374
cleanup_modules ( [ :sample , Sample2 ] )
397
375
end
398
376
377
+ test "c helper with path" do
378
+ assert_raise UndefinedFunctionError , ~r" function Sample\. run/0 is undefined" , fn ->
379
+ Sample . run
380
+ end
381
+
382
+ filename = "sample.ex"
383
+ with_file filename , test_module_code ( ) , fn ->
384
+ assert c ( filename , "." ) == [ Sample ]
385
+ assert File . exists? ( "Elixir.Sample.beam" )
386
+ assert Sample . run == :run
387
+ end
388
+ after
389
+ cleanup_modules ( [ Sample ] )
390
+ end
399
391
400
392
test "l helper" do
401
393
assert_raise UndefinedFunctionError , ~r" function Sample.run/0 is undefined" , fn ->
0 commit comments