factor/basis/compiler/tests/folding.factor

29 lines
708 B
Factor
Raw Normal View History

2009-09-20 23:42:40 -04:00
USING: eval tools.test compiler.units vocabs words
2008-08-31 10:22:36 -04:00
kernel classes.mixin arrays ;
2009-04-26 01:51:47 -04:00
IN: compiler.tests.folding
2008-08-31 10:22:36 -04:00
! Calls to generic words were not folded away.
[ ] [ [ "compiler.tests.redefine11" forget-vocab ] with-compilation-unit ] unit-test
[ ] [
2009-09-20 23:42:40 -04:00
"USING: math arrays ;
2008-08-31 10:22:36 -04:00
IN: compiler.tests.folding
GENERIC: foldable-generic ( a -- b ) foldable
2009-09-20 23:42:40 -04:00
M: integer foldable-generic f <array> ;"
eval( -- )
2008-08-31 10:22:36 -04:00
] unit-test
[ ] [
2009-09-20 23:42:40 -04:00
"USING: math arrays ;
2008-08-31 10:22:36 -04:00
IN: compiler.tests.folding
2009-09-20 23:42:40 -04:00
: fold-test ( -- x ) 10 foldable-generic ;"
eval( -- )
2008-08-31 10:22:36 -04:00
] unit-test
[ t ] [
"fold-test" "compiler.tests.folding" lookup execute
"fold-test" "compiler.tests.folding" lookup execute
eq?
] unit-test