Changeset 34 for trunk/src/tests_test.erl
- Timestamp:
- 08/22/08 18:46:07 (4 years ago)
- File:
-
- 1 edited
-
trunk/src/tests_test.erl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tests_test.erl
r33 r34 9 9 filter_by_attribute () -> 10 10 filtering_non_tests_returns_empty_list(), 11 filtering_tests_returns_list_of_MFA_from_unloaded_binary (), 12 filtering_fixtured_tests_returns_list_of_fixture_fun_tuples (), 13 filtering_understands_mixed_export_and_fixtured_tests (), 11 filtering_tests_returns_list_of_tests_from_unloaded_binary (), 14 12 ok. 15 13 16 14 filtering_non_tests_returns_empty_list () -> 17 Binary = modules: to_binary ("../fix/eg_code.erl"), 15 Binary = modules: to_binary ("../fix/eg_code.erl"), 18 16 {eg_code, []} = tests: filter_by_attribute (Binary). 19 17 20 filtering_tests_returns_list_of_MFA_from_unloaded_binary () -> 21 File_name = "../fix/eg_test.erl", 22 Test = fun ([Ok, Nok]) -> 23 {Ok_m, Ok_f, Ok_a} = Ok, 24 ok = apply (Ok_m, Ok_f, Ok_a), 25 {Nok_m, Nok_f, Nok_a} = Nok, 26 Error = (catch apply (Nok_m, Nok_f, Nok_a)), 27 {'EXIT', {{badmatch, nok}, _}} = Error 28 end, 29 filtering (File_name, eg_test, Test). 30 31 filtering_fixtured_tests_returns_list_of_fixture_fun_tuples () -> 32 File_name = "../fix/eg_test_fix.erl", 33 Test = fun ([{Module, Fixture, [Tests]}]) -> 34 [ok] = Module: Fixture (Tests) 35 end, 36 filtering (File_name, eg_test_fix, Test). 37 38 filtering_understands_mixed_export_and_fixtured_tests () -> 39 File_name = "../fix/eg_test_fix_nofix.erl", 40 Test = fun ([{Module, Fixture, [With]}, Without]) -> 41 {Wo_m, Wo_f, Wo_a} = Without, 42 {'EXIT', {Reason, _}} = (catch apply (Wo_m, Wo_f, Wo_a)), 43 {badmatch, without_fixture_ok} = Reason, 44 [ok] = Module: Fixture (With) 45 end, 46 filtering (File_name, eg_test_fix_nofix, Test). 47 48 filtering (File_name, Module, Test) -> 49 Binary = modules: to_binary (File_name), 50 false = code: is_loaded (Module), 51 {Module, Tests} = tests: filter_by_attribute (Binary), 52 try 53 {module, Module} = code: load_binary (Module, File_name, Binary), 54 Test (Tests) 55 after 56 code: purge (Module), 57 code: delete (Module) 58 end. 18 filtering_tests_returns_list_of_tests_from_unloaded_binary () -> 19 File = "../fix/eg_test.erl", 20 Binary = modules: to_binary (File), 21 false = code: is_loaded (eg_test), 22 {eg_test, [ok, nok]} = tests: filter_by_attribute (Binary), 23 false = code: is_loaded (eg_test).
Note: See TracChangeset
for help on using the changeset viewer.
