Changeset 83
- Timestamp:
- 08/03/09 04:32:08 (3 years ago)
- File:
-
- 1 edited
-
trunk/src/tests_test.erl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tests_test.erl
r82 r83 1 %%% Copyright (c) 2008Dominic Williams, Nicolas Charpentier1 %%% Copyright (c) Dominic Williams, Nicolas Charpentier 2 2 %%% All rights reserved. 3 3 %%% See file COPYING. … … 14 14 15 15 non_tests_returns_empty_list () -> 16 Binary = modules: to_binary ("../fix/eg_code.erl"), 17 {_, eg_code, []} = tests: filter_by_attribute (Binary). 16 Tree = [{file, "my_code.erl", 17 ["-module (my_code).", 18 "-export ([ok/0]).", 19 "ok () ->", 20 "ok."]}], 21 Fun = fun non_tests_returns_empty_list/2, 22 ok = fixtures: use_tree (Tree, Fun). 23 24 non_tests_returns_empty_list (Dir, [{file, Name, _}]) -> 25 Path = filename: join (Dir, Name), 26 Binary = modules: to_binary (Path), 27 {_, my_code, []} = tests: filter_by_attribute (Binary), 28 ok. 18 29 19 30 test_exports_returns_list_of_tests_from_unloaded_binary () -> 20 File = "../fix/eg_test.erl", 21 Binary = modules: to_binary (File), 22 false = code: is_loaded (eg_test), 23 {_, eg_test, [ok, nok]} = tests: filter_by_attribute (Binary), 24 false = code: is_loaded (eg_test). 31 Tree = [{file, "my_tests.erl", 32 ["-module (my_tests).", 33 "-test (exports).", 34 "-export ([ok/0, nok/0]).", 35 "ok () ->", 36 " ok = list_to_existing_atom (\"ok\").", 37 "nok () ->", 38 " ok = list_to_existing_atom (\"nok\")."]}], 39 Fun = fun test_exports_returns_list_of_tests_from_unloaded_binary/2, 40 ok = fixtures: use_tree (Tree, Fun). 41 42 test_exports_returns_list_of_tests_from_unloaded_binary (Dir, [{_, Name, _}]) -> 43 Path = filename: join (Dir, Name), 44 Binary = modules: to_binary (Path), 45 false = code: is_loaded (my_tests), 46 {_, my_tests, [ok, nok]} = tests: filter_by_attribute (Binary), 47 false = code: is_loaded (my_tests), 48 ok. 25 49 26 50 test_non_exports_also () -> 27 File = "../fix/eg_test_not_exports.erl", 28 Binary = modules: to_binary (File), 29 false = code: is_loaded (eg_test_not_exports), 30 {_, eg_test_not_exports, [ok]} = tests: filter_by_attribute (Binary), 31 false = code: is_loaded (eg_test_not_exports). 51 Tree = [{file, "my_test_not_exports.erl", 52 ["-module (my_test_not_exports).", 53 "-test (ok).", 54 "-export ([ok/0, nok/0]).", 55 "", 56 "ok () ->", 57 " ok = list_to_existing_atom (\"ok\").", 58 "", 59 "nok () ->", 60 " ok = list_to_existing_atom (\"nok\")."]}], 61 Fun = fun test_non_exports_also/2, 62 ok = fixtures: use_tree (Tree, Fun). 63 64 test_non_exports_also (Dir, [{file, Name, _}]) -> 65 Path = filename: join (Dir, Name), 66 Binary = modules: to_binary (Path), 67 false = code: is_loaded (my_test_not_exports), 68 {_, my_test_not_exports, [ok]} = tests: filter_by_attribute (Binary), 69 false = code: is_loaded (my_test_not_exports), 70 ok.
Note: See TracChangeset
for help on using the changeset viewer.
