factor/basis/ui/tools/search/search-tests.factor

57 lines
1.3 KiB
Factor
Raw Normal View History

2008-12-15 02:40:50 -05:00
USING: assocs ui.tools.search help.topics io.pathnames io.styles
kernel namespaces sequences source-files threads
2008-09-02 02:52:22 -04:00
tools.test ui.gadgets ui.gestures vocabs accessors
vocabs.loader words tools.test.ui debugger calendar ;
2008-03-01 17:00:45 -05:00
IN: ui.tools.search.tests
2007-09-20 18:09:08 -04:00
[ f ] [
"no such word with this name exists, certainly"
f f <definition-search>
T{ key-down f { C+ } "x" } swap search-gesture
] unit-test
: assert-non-empty ( obj -- ) empty? f assert= ;
2007-11-16 01:19:13 -05:00
: update-live-search ( search -- seq )
dup [
300 milliseconds sleep
2008-09-02 02:52:22 -04:00
list>> control-value
2007-11-16 01:19:13 -05:00
] with-grafted-gadget ;
2007-09-20 18:09:08 -04:00
: test-live-search ( gadget quot -- ? )
[ update-live-search dup assert-non-empty ] dip all? ;
2007-09-20 18:09:08 -04:00
[ t ] [
"swp" all-words f <definition-search>
[ word? ] test-live-search
] unit-test
[ t ] [
"" all-words t <definition-search>
2007-11-16 01:19:13 -05:00
dup [
2008-09-02 02:52:22 -04:00
{ "set-word-prop" } over field>> set-control-value
300 milliseconds sleep
2007-11-16 01:19:13 -05:00
search-value \ set-word-prop eq?
] with-grafted-gadget
2007-09-20 18:09:08 -04:00
] unit-test
[ t ] [
"quot" <help-search>
[ link? ] test-live-search
] unit-test
[ t ] [
"factor" source-files get keys <source-file-search>
[ pathname? ] test-live-search
] unit-test
[ t ] [
"kern" <vocab-search>
[ vocab-spec? ] test-live-search
] unit-test
[ t ] [
"a" { "a" "b" "aa" } <history-search>
[ input? ] test-live-search
] unit-test