]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/tests/redefine3.factor
Make M\ throw an error upon lookup failure. Change method -> ?lookup-method, lookup...
[factor.git] / basis / compiler / tests / redefine3.factor
1 USING: accessors compiler compiler.units tools.test math parser
2 kernel sequences sequences.private classes.mixin generic
3 definitions arrays words assocs eval grouping ;
4 IN: compiler.tests.redefine3
5
6 GENERIC: sheeple ( obj -- x )
7
8 M: object sheeple drop "sheeple" ; inline
9
10 MIXIN: empty-mixin
11
12 M: empty-mixin sheeple drop "wake up" ; inline
13
14 : sheeple-test ( -- string ) { } sheeple ;
15
16 : compiled-use? ( key word -- ? )
17     "definition-dependencies" word-prop member-eq? ;
18
19 [ "sheeple" ] [ sheeple-test ] unit-test
20 [ t ] [ \ sheeple-test optimized? ] unit-test
21 [ t ] [ object \ sheeple lookup-method \ sheeple-test compiled-use? ] unit-test
22 [ f ] [ empty-mixin \ sheeple lookup-method \ sheeple-test compiled-use? ] unit-test
23
24 [ ] [ "IN: compiler.tests.redefine3 USE: arrays INSTANCE: array empty-mixin" eval( -- ) ] unit-test
25
26 [ "wake up" ] [ sheeple-test ] unit-test
27 [ f ] [ object \ sheeple lookup-method \ sheeple-test compiled-use? ] unit-test
28 [ t ] [ empty-mixin \ sheeple lookup-method \ sheeple-test compiled-use? ] unit-test
29
30 [ ] [ [ array empty-mixin remove-mixin-instance ] with-compilation-unit ] unit-test
31
32 [ "sheeple" ] [ sheeple-test ] unit-test
33 [ t ] [ \ sheeple-test optimized? ] unit-test
34 [ t ] [ object \ sheeple lookup-method \ sheeple-test compiled-use? ] unit-test
35 [ f ] [ empty-mixin \ sheeple lookup-method \ sheeple-test compiled-use? ] unit-test