]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/tests/redefine9.factor
Rename and add sorting words
[factor.git] / basis / compiler / tests / redefine9.factor
1 USING: eval tools.test compiler.units vocabs words
2 kernel generic.math ;
3 IN: compiler.tests.redefine9
4
5 ! Mixin redefinition did not recompile all necessary words.
6
7 { } [ [ "compiler.tests.redefine9" forget-vocab ] with-compilation-unit ] unit-test
8
9 { } [
10     "USING: kernel math math.order sorting ;
11     IN: compiler.tests.redefine9
12     MIXIN: my-mixin
13     INSTANCE: fixnum my-mixin
14     GENERIC: my-generic ( a -- b )
15     ! We add the bogus quotation here to hinder inlining
16     ! since otherwise we cannot trigger this bug.
17     M: my-mixin my-generic 1 + [ sort ] drop ;"
18     eval( -- )
19 ] unit-test
20
21 { } [
22     "USE: math
23     IN: compiler.tests.redefine9
24     TUPLE: my-tuple ;
25     INSTANCE: my-tuple my-mixin"
26     eval( -- )
27 ] unit-test
28
29 [
30     "my-tuple" "compiler.tests.redefine9" lookup-word boa
31     "my-generic" "compiler.tests.redefine9" lookup-word
32     execute
33 ] [ no-math-method? ] must-fail-with