factor/extra/io/monitors/monitors-tests.factor

35 lines
970 B
Factor
Raw Normal View History

2008-04-09 20:47:10 -04:00
IN: io.monitors.tests
USING: io.monitors tools.test io.files system sequences
continuations namespaces concurrency.count-downs kernel io
2008-04-09 20:54:48 -04:00
threads calendar prettyprint ;
2008-04-09 20:47:10 -04:00
os { winnt macosx linux } member? [
[ "monitor-test" temp-file delete-tree ] ignore-errors
2008-04-09 20:54:48 -04:00
[ ] [ "monitor-test/xyz" temp-file make-directories ] unit-test
2008-04-09 20:47:10 -04:00
[ ] [ "monitor-test" temp-file t <monitor> "m" set ] unit-test
2008-04-09 20:54:48 -04:00
[ ] [ 1 <count-down> "b" set ] unit-test
2008-04-09 20:47:10 -04:00
[ ] [ 1 <count-down> "c" set ] unit-test
[ ] [
[
2008-04-09 20:54:48 -04:00
"b" get count-down
2008-04-09 20:47:10 -04:00
[
"m" get next-change drop
2008-04-09 20:54:48 -04:00
dup print flush right-trim-separators
"xyz" tail? not
2008-04-09 20:47:10 -04:00
] [ ] [ ] while
"c" get count-down
] "Monitor test thread" spawn drop
] unit-test
2008-04-09 20:54:48 -04:00
[ ] [ "b" get await ] unit-test
[ ] [ "monitor-test/xyz/test.txt" temp-file touch-file ] unit-test
2008-04-09 20:47:10 -04:00
[ ] [ "c" get 30 seconds await-timeout ] unit-test
] when