Fix interactor

db4
Slava Pestov 2008-04-10 21:49:08 -05:00
parent 48a16b542d
commit a1b050fd88
2 changed files with 27 additions and 2 deletions

View File

@ -1,4 +1,27 @@
IN: ui.tools.interactor.tests
USING: ui.tools.interactor tools.test ;
USING: ui.tools.interactor ui.gadgets.panes namespaces
ui.gadgets.editors concurrency.promises threads listener
tools.test kernel calendar ;
\ <interactor> must-infer
[ ] [ <pane> <pane-stream> <interactor> "interactor" set ] unit-test
[ ] [ "[ 1 2 3" "interactor" get set-editor-string ] unit-test
[ ] [ <promise> "promise" set ] unit-test
[
"interactor" get stream-read-quot "promise" get fulfill
] "Interactor test" spawn drop
! This should not throw an exception
[ ] [ "interactor" get evaluate-input ] unit-test
[ ] [ [ "interactor" get interactor-busy? ] [ yield ] [ ] while ] unit-test
[ ] [ "[ 1 2 3 ]" "interactor" get set-editor-string ] unit-test
[ ] [ "interactor" get evaluate-input ] unit-test
[ [ [ 1 2 3 ] ] ] [ "promise" get 5 seconds ?promise-timeout ] unit-test

View File

@ -138,7 +138,9 @@ M: interactor stream-read-partial
drop parse-lines-interactive
] [
2nip
dup delegate unexpected-eof? [ drop f ] when
dup parse-error? [
dup error>> unexpected-eof? [ drop f ] when
] when
] recover ;
: handle-interactive ( lines interactor -- quot/f ? )