]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/tests/redefine0.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / compiler / tests / redefine0.factor
index cdef7103ce2cfd532d839f8324ba4c12e210c402..4de6d952c8fce6156067fc8e2c929aff49314614 100644 (file)
@@ -1,5 +1,6 @@
+USING: tools.test eval compiler compiler.errors compiler.units definitions kernel math
+namespaces macros assocs ;
 IN: compiler.tests.redefine0
-USING: tools.test eval compiler compiler.errors compiler.units definitions kernel math ;
 
 ! Test ripple-up behavior
 : test-1 ( -- a ) 3 ;
@@ -61,7 +62,7 @@ M: integer test-7 + ;
 [ 1 test-7 ] [ not-compiled? ] must-fail-with
 [ 1 test-8 ] [ not-compiled? ] must-fail-with
 
-[ ] [ "IN: compiler.tests.redefine0 USING: macros kernel ; GENERIC: test-7 ( x y -- z )" eval( -- ) ] unit-test
+[ ] [ "IN: compiler.tests.redefine0 USING: macros math kernel ; GENERIC: test-7 ( x y -- z ) : test-8 ( a b -- c ) 255 bitand test-7 ;" eval( -- ) ] unit-test
 
 [ 4 ] [ 1 3 test-7 ] unit-test
 [ 4 ] [ 1 259 test-8 ] unit-test
@@ -72,3 +73,35 @@ M: integer test-7 + ;
         \ test-8 forget
     ] with-compilation-unit
 ] unit-test
+
+! Indirect dependency on an unoptimized word
+: test-9 ( -- ) ;
+<< SYMBOL: quot
+[ test-9 ] quot set-global >>
+MACRO: test-10 ( -- quot ) quot get ;
+: test-11 ( -- ) test-10 ;
+
+[ ] [ test-11 ] unit-test
+
+[ ] [ "IN: compiler.tests.redefine0 : test-9 ( -- ) 1 ;" eval( -- ) ] unit-test
+
+! test-11 should get recompiled now
+
+[ test-11 ] [ not-compiled? ] must-fail-with
+
+[ ] [ "IN: compiler.tests.redefine0 : test-9 ( -- a ) 1 ;" eval( -- ) ] unit-test
+
+[ ] [ "IN: compiler.tests.redefine0 : test-9 ( -- ) ;" eval( -- ) ] unit-test
+
+[ ] [ test-11 ] unit-test
+
+quot global delete-at
+
+[ ] [
+    [
+        \ test-9 forget
+        \ test-10 forget
+        \ test-11 forget
+        \ quot forget
+    ] with-compilation-unit
+] unit-test