Changeset 38


Ignore:
Timestamp:
09/04/08 07:54:31 (4 years ago)
Author:
dom
Message:

Check that tester can reload same module more than twice.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/modules.erl

    r17 r38  
    55-module (modules). 
    66-export ([to_binary/1]). 
     7-export([forms_to_binary /1]). 
    78 
    89to_binary (File_name) -> 
     10    compile (fun compile: file/2, File_name). 
     11 
     12forms_to_binary (Forms) -> 
     13    compile (fun compile: forms/2, Forms). 
     14 
     15compile (Fun, Parameter) -> 
    916    Options = [binary, return, warn_unused_import], 
    10     {ok, _, Binary, _} = compile: file (File_name, Options), 
     17    {ok, _, Binary, _} = Fun (Parameter, Options), 
    1118    Binary. 
     19 
  • trunk/src/shells.erl

    r37 r38  
    3030    ok = tester_test: runs_given_test_sequence (Test_node), 
    3131    ok = tester_test: runs_given_tests (Test_node), 
     32    ok = tester_test: reloads_corrected_module (Test_node), 
    3233    Caller ! {Caller, done}. 
    3334     
  • trunk/src/tester_test.erl

    r37 r38  
    66-export ([runs_a_test/1, reruns_a_test_when_given_module/1]). 
    77-export ([runs_given_tests/1, runs_given_test_sequence/1]). 
     8-export ([reloads_corrected_module/1]). 
    89 
    910start_tester (Node) -> 
     
    5354    ok. 
    5455 
     56reloads_corrected_module (Node) -> 
     57    Tester = start_tester (Node), 
     58    Binary = modules: forms_to_binary (eg_test_form ("nok")), 
     59    Tester ! [{"./eg_test.erl", Binary}], 
     60    Results = receive_all ([]), 
     61    [{1, 0, 0}, _Error, {1, 1, 0}] = Results, 
     62    Correct_binary = modules: forms_to_binary (eg_test_form ("ok")), 
     63    Tester ! [{"./eg_test.erl", Correct_binary}], 
     64    [{1, 0, 0}, {1, 1, 1}] = receive_all ([]), 
     65    Tester ! [{"./eg_test.erl", Binary}], 
     66    [{1, 0, 0}, _Error, {1, 1, 0}] = receive_all ([]), 
     67    ok. 
     68 
    5569receive_all (Ms) -> 
    5670    receive 
     
    6175    end. 
    6276 
     77 
     78eg_test_form (String) -> 
     79    [{attribute,1,file,{"./eg_test.erl",1}}, 
     80     {attribute,1,module,eg_test}, 
     81     {attribute,2,export,[{ok,0}]}, 
     82     {attribute,3,test,exports}, 
     83     {function,4, 
     84      ok, 
     85      0, 
     86      [{clause,4, 
     87        [], 
     88        [], 
     89        [{match,5, 
     90          {atom,5,ok}, 
     91          {call,5, 
     92           {atom,5,list_to_atom}, 
     93           [{string,5,String}]}}]}]}, 
     94     {eof,7}]. 
     95 
    6396%%% Test to be added: 
    6497%%% tests that never end (e.g. infinite loop) 
Note: See TracChangeset for help on using the changeset viewer.