@@ -296,19 +296,12 @@ defmodule IEx.HelpersTest do
296296 cleanup_modules ( [ Sample ] )
297297 end
298298
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
309304 end
310- after
311- cleanup_modules ( [ Sample ] )
312305 end
313306
314307 test "c helper with full path" do
@@ -366,21 +359,6 @@ defmodule IEx.HelpersTest do
366359 cleanup_modules ( [ :sample ] )
367360 end
368361
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-
384362 test "c helper skips unknown files" do
385363 assert_raise UndefinedFunctionError , ~r" function :sample.hello/0 is undefined" , fn ->
386364 :sample . hello
@@ -396,6 +374,20 @@ defmodule IEx.HelpersTest do
396374 cleanup_modules ( [ :sample , Sample2 ] )
397375 end
398376
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
399391
400392 test "l helper" do
401393 assert_raise UndefinedFunctionError , ~r" function Sample.run/0 is undefined" , fn ->
0 commit comments