Changeset 73
- Timestamp:
- 07/15/09 10:00:25 (3 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
-
shells_tests.erl (modified) (1 diff)
-
tester.erl (modified) (2 diffs)
-
tester_test.erl (modified) (2 diffs)
-
tests.erl (modified) (1 diff)
-
tests_test.erl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shells_tests.erl
r68 r73 24 24 Paths = [modules: to_file_name (M, "../src") || M <- Modules], 25 25 Binaries = [modules: to_binary (P) || P <- Paths], 26 Tester ! lists: zip (Paths, Binaries),26 Tester ! {run, Binaries}, 27 27 {Run, Passed, Messages} = final_test_result ([]), 28 28 {passed, Run, Paths, Messages} = {passed, Passed, Paths, Messages}, -
trunk/src/tester.erl
r44 r73 23 23 {runner_end, New_state} -> 24 24 loop (New_state); 25 Modules->25 {run, Modules} -> 26 26 loop (test (load (Modules, State))) 27 27 end. … … 30 30 lists: foldl (fun load_aux/2, State, Modules). 31 31 32 load_aux ( {File_name, Binary}, State) ->33 { Module, Tests} = tests: filter_by_attribute (Binary),32 load_aux (Binary, State) -> 33 {File_name, Module, Tests} = tests: filter_by_attribute (Binary), 34 34 Node = dict: fetch (node, State), 35 35 Load_args = [Module, File_name, Binary], -
trunk/src/tester_test.erl
r45 r73 22 22 Binaries = [modules: to_binary (P) || P <- Paths], 23 23 false = lists: any (fun (M) -> code: is_loaded (M) end, Modules), 24 Tester ! lists: zip (Paths, Binaries),24 Tester ! {run, Binaries}, 25 25 Results = receive_all ([]), 26 26 false = lists: any (fun (M) -> code: is_loaded (M) end, Modules), … … 62 62 Tester = spawn_link (tester, init, [notify_me (), Node]), 63 63 Binary = modules: forms_to_binary (eg_test_form ("nok")), 64 Tester ! [{"./eg_test.erl", Binary}],64 Tester ! {run, [Binary]}, 65 65 Results = receive_all ([]), 66 66 [{1, 0, 0}, _Error, {1, 1, 0}] = Results, 67 67 Correct_binary = modules: forms_to_binary (eg_test_form ("ok")), 68 Tester ! [{"./eg_test.erl", Correct_binary}],68 Tester ! {run, [Correct_binary]}, 69 69 [{1, 0, 0}, {1, 1, 1}] = receive_all ([]), 70 Tester ! [{"./eg_test.erl", Binary}],70 Tester ! {run, [Binary]}, 71 71 [{1, 0, 0}, _Error, {1, 1, 0}] = receive_all ([]), 72 72 ok. -
trunk/src/tests.erl
r72 r73 7 7 8 8 filter_by_attribute (Binary) -> 9 {ok, Chunks} = beam_lib: chunks (Binary, [attributes]), 10 {Module, [{attributes, Attributes}]} = Chunks, 9 {ok, Chunks} = beam_lib: chunks (Binary, [attributes, compile_info]), 10 {Module, [{attributes, Attributes}, {compile_info, Info}]} = Chunks, 11 {value, {source, Filename}} = lists: keysearch (source, 1, Info), 11 12 Declarations = lists: flatten ([T || {test, T} <- Attributes]), 12 13 Tests = filter (Binary, Declarations, []), 13 { Module, Tests}.14 {Filename, Module, Tests}. 14 15 15 16 filter (Binary, [exports | Tail], Acc) -> -
trunk/src/tests_test.erl
r35 r73 15 15 non_tests_returns_empty_list () -> 16 16 Binary = modules: to_binary ("../fix/eg_code.erl"), 17 { eg_code, []} = tests: filter_by_attribute (Binary).17 {_, eg_code, []} = tests: filter_by_attribute (Binary). 18 18 19 19 test_exports_returns_list_of_tests_from_unloaded_binary () -> … … 21 21 Binary = modules: to_binary (File), 22 22 false = code: is_loaded (eg_test), 23 { eg_test, [ok, nok]} = tests: filter_by_attribute (Binary),23 {_, eg_test, [ok, nok]} = tests: filter_by_attribute (Binary), 24 24 false = code: is_loaded (eg_test). 25 25 … … 28 28 Binary = modules: to_binary (File), 29 29 false = code: is_loaded (eg_test_not_exports), 30 { eg_test_not_exports, [ok]} = tests: filter_by_attribute (Binary),30 {_, eg_test_not_exports, [ok]} = tests: filter_by_attribute (Binary), 31 31 false = code: is_loaded (eg_test_not_exports).
Note: See TracChangeset
for help on using the changeset viewer.
