factor/basis/compiler/tests/folding.factor

31 lines
732 B
Factor
Raw Normal View History

2008-08-31 10:22:36 -04:00
USING: eval tools.test compiler.units vocabs multiline words
kernel classes.mixin arrays ;
IN: compiler.tests
! Calls to generic words were not folded away.
[ ] [ [ "compiler.tests.redefine11" forget-vocab ] with-compilation-unit ] unit-test
[ ] [
<"
USING: math arrays ;
IN: compiler.tests.folding
GENERIC: foldable-generic ( a -- b ) foldable
M: integer foldable-generic f <array> ;
2009-04-17 13:46:04 -04:00
"> (( -- )) eval
2008-08-31 10:22:36 -04:00
] unit-test
[ ] [
<"
USING: math arrays ;
IN: compiler.tests.folding
: fold-test ( -- x ) 10 foldable-generic ;
2009-04-17 13:46:04 -04:00
"> (( -- )) 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