Changeset 75
- Timestamp:
- 07/16/09 03:49:56 (3 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
-
directory_watcher.erl (modified) (1 diff)
-
directory_watcher_test.erl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/directory_watcher.erl
r60 r75 124 124 report_lost (Fun, X), 125 125 compare (Fun, Xs, []); 126 compare (Fun, [X], [Y]) -> 127 report_lost (Fun, X), 128 {File, _} = Y, 129 report_found (Fun, File), 130 done; 126 131 compare (_, [], []) -> 127 132 done. -
trunk/src/directory_watcher_test.erl
r60 r75 16 16 -export ([change_from_file_to_directory/0]). 17 17 -export ([change_from_file_to_directory_when_recursive/0]). 18 -export ([remove_and_add_in_same_check/0]). 18 19 19 20 tests_from_empty () -> … … 67 68 F = fun change_from_directory_to_file_when_recursive/2, 68 69 ok = fixtures: use_tree (tree (), F). 69 70 71 remove_and_add_in_same_check () -> 72 F = fun remove_and_add_in_same_check/2, 73 ok = fixtures: use_tree ([{file, "foo", "foo"}], F). 74 70 75 tree () -> 71 76 Subsub = {directory, "subsubdir", … … 255 260 ok. 256 261 262 remove_and_add_in_same_check (Root, _) -> 263 Watcher = spawn_link (directory_watcher, init_recursive, [Root, send_me ()]), 264 receive_all (), 265 [Foo, Bar] = [filename: join (Root, X) || X <- ["foo", "bar"]], 266 ok = file: delete (Foo), 267 ok = file: write_file (Bar, list_to_binary ("bar")), 268 Watcher ! check, 269 [{{file, ""}, Foo, lost}, 270 {{file, ""}, Bar, found}] = receive_all (), 271 ok. 272 273 257 274 send_me () -> 258 275 Self = self (),
Note: See TracChangeset
for help on using the changeset viewer.
