Changeset 92 for trunk/src/tester.erl


Ignore:
Timestamp:
01/28/10 16:21:51 (2 years ago)
Author:
dom
Message:

File and line is now provided for test failures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tester.erl

    r90 r92  
    1010    With_notify = dict: store (notify, Notify, dict: new ()), 
    1111    With_tests = dict: store (tests, dict: new (), With_notify), 
    12     State = dict: store (node, Node, With_tests), 
     12    With_binaries = dict: store (binaries, dict: new (), With_tests), 
     13    State = dict: store (node, Node, With_binaries), 
    1314    loop (State). 
    1415 
     
    3435    Test_dict = dict: fetch (tests, State), 
    3536    New_tests = dict: store (Module, Time_stamped_tests, Test_dict), 
    36     dict: store (tests, New_tests, State). 
     37    Binaries_dict = dict: fetch (binaries, State), 
     38    New_binaries = dict: store (Module, Binary, Binaries_dict), 
     39    dict: store (binaries, New_binaries, dict: store (tests, New_tests, State)). 
    3740 
    3841test (State) -> 
     
    7578    Tests = dict: fetch (tests, State), 
    7679    New_tests = dict: erase (Module, Tests), 
    77     dict :store (tests, New_tests, State). 
     80    Binaries = dict: fetch (binaries, State), 
     81    New_binaries = dict: erase (Module, Binaries), 
     82    dict: store (binaries, New_binaries, dict :store (tests, New_tests, State)). 
    7883 
    7984flatten (Tests) -> 
     
    104109    Node = dict: fetch (node, State), 
    105110    Notify = dict: fetch (notify, State), 
     111    Binaries = dict: fetch (binaries, State), 
    106112    fun (Test_definition, {Tester_state, {Run, Passed}}) -> 
    107113            {Module, Function, Stamp} = Test_definition, 
     
    111117                    {'EXIT', Pid, normal} -> 
    112118                        {Passed + 1, first_test_success (Stamp, now())}; 
    113                     {'EXIT', Pid, Reason} -> 
     119                    {'EXIT', Pid, {Error, Stack_trace}} -> 
     120                        Binary = dict: fetch (Module, Binaries), 
     121                        MFA = {Module, Function, 0}, 
     122                        {File, Line} = modules: locate (MFA, Binary), 
     123                        Location = {Module, Function, 0, File, Line}, 
     124                        List = [{error, Error}, 
     125                                {stack_trace, Stack_trace}, 
     126                                {location, Location}], 
     127                        Reason = dict: from_list (List), 
    114128                        Notify (Reason), 
    115129                        {Passed, failed} 
Note: See TracChangeset for help on using the changeset viewer.