factor/basis/tools/crossref/crossref-tests.factor

50 lines
1.2 KiB
Factor
Raw Normal View History

2008-12-15 02:40:50 -05:00
USING: math kernel sequences io.files io.pathnames
tools.crossref tools.test parser namespaces source-files generic
2009-04-22 08:05:00 -04:00
definitions words accessors compiler.units ;
2008-03-01 17:00:45 -05:00
IN: tools.crossref.tests
2007-09-20 18:09:08 -04:00
2009-03-23 01:34:02 -04:00
GENERIC: foo ( a b -- c )
2007-09-20 18:09:08 -04:00
M: integer foo + ;
2009-02-15 20:53:21 -05:00
"vocab:tools/crossref/test/foo.factor" run-file
2007-09-20 18:09:08 -04:00
2008-03-05 17:24:32 -05:00
[ t ] [ integer \ foo method \ + usage member? ] unit-test
[ t ] [ \ foo usage [ pathname? ] any? ] unit-test
! Issues with forget
GENERIC: generic-forget-test-1 ( a b -- c )
M: integer generic-forget-test-1 / ;
[ t ] [
\ / usage [ word? ] filter
[ name>> "integer=>generic-forget-test-1" = ] any?
] unit-test
[ ] [
[ \ generic-forget-test-1 forget ] with-compilation-unit
] unit-test
[ f ] [
\ / usage [ word? ] filter
[ name>> "integer=>generic-forget-test-1" = ] any?
] unit-test
GENERIC: generic-forget-test-2 ( a b -- c )
M: sequence generic-forget-test-2 = ;
[ t ] [
\ = usage [ word? ] filter
[ name>> "sequence=>generic-forget-test-2" = ] any?
] unit-test
[ ] [
[ M\ sequence generic-forget-test-2 forget ] with-compilation-unit
] unit-test
[ f ] [
\ = usage [ word? ] filter
[ name>> "sequence=>generic-forget-test-2" = ] any?
] unit-test