factor/basis/compiler/tests/redefine3.factor

36 lines
1.3 KiB
Factor
Raw Normal View History

2008-06-30 04:57:00 -04:00
USING: accessors compiler compiler.units tools.test math parser
kernel sequences sequences.private classes.mixin generic
definitions arrays words assocs eval grouping ;
IN: compiler.tests.redefine3
2008-06-11 03:58:38 -04:00
GENERIC: sheeple ( obj -- x )
2009-08-18 04:49:05 -04:00
M: object sheeple drop "sheeple" ; inline
2008-06-11 03:58:38 -04:00
MIXIN: empty-mixin
2009-08-18 04:49:05 -04:00
M: empty-mixin sheeple drop "wake up" ; inline
2008-06-11 03:58:38 -04:00
: sheeple-test ( -- string ) { } sheeple ;
: compiled-use? ( key word -- ? )
"definition-dependencies" word-prop member-eq? ;
2008-06-11 03:58:38 -04:00
[ "sheeple" ] [ sheeple-test ] unit-test
[ t ] [ \ sheeple-test optimized? ] unit-test
[ t ] [ object \ sheeple method \ sheeple-test compiled-use? ] unit-test
[ f ] [ empty-mixin \ sheeple method \ sheeple-test compiled-use? ] unit-test
2008-06-11 03:58:38 -04:00
2009-04-26 03:23:33 -04:00
[ ] [ "IN: compiler.tests.redefine3 USE: arrays INSTANCE: array empty-mixin" eval( -- ) ] unit-test
2008-06-11 03:58:38 -04:00
[ "wake up" ] [ sheeple-test ] unit-test
[ f ] [ object \ sheeple method \ sheeple-test compiled-use? ] unit-test
[ t ] [ empty-mixin \ sheeple method \ sheeple-test compiled-use? ] unit-test
2008-06-11 03:58:38 -04:00
[ ] [ [ array empty-mixin remove-mixin-instance ] with-compilation-unit ] unit-test
[ "sheeple" ] [ sheeple-test ] unit-test
[ t ] [ \ sheeple-test optimized? ] unit-test
[ t ] [ object \ sheeple method \ sheeple-test compiled-use? ] unit-test
[ f ] [ empty-mixin \ sheeple method \ sheeple-test compiled-use? ] unit-test