]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/tools/annotations/annotations-tests.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / tools / annotations / annotations-tests.factor
index 1e1eccb8b592dbe1d24c74361b394ca67225c86b..c21e9e0c60ea9b90244de909042d0c0b79054af4 100644 (file)
@@ -1,8 +1,8 @@
-USING: tools.test tools.annotations math parser eval
-io.streams.string kernel ;
+USING: tools.test tools.annotations tools.time math parser eval
+io.streams.string kernel strings ;
 IN: tools.annotations.tests
 
-: foo ;
+: foo ( -- ) ;
 \ foo watch
 
 [ ] [ foo ] unit-test
@@ -10,7 +10,7 @@ IN: tools.annotations.tests
 ! erg's bug
 GENERIC: some-generic ( a -- b )
 
-M: integer some-generic 1+ ;
+M: integer some-generic 1 + ;
 
 [ 4 ] [ 3 some-generic ] unit-test
 
@@ -18,7 +18,7 @@ M: integer some-generic 1+ ;
 
 [ 4 ] [ 3 some-generic ] unit-test
 
-[ ] [ "IN: tools.annotations.tests USE: math M: integer some-generic 1- ;" eval ] unit-test
+[ ] [ "IN: tools.annotations.tests USE: math M: integer some-generic 1 - ;" eval( -- ) ] unit-test
 
 [ 2 ] [ 3 some-generic ] unit-test
 
@@ -33,8 +33,30 @@ M: object another-generic ;
 
 \ another-generic watch
 
-[ ] [ "IN: tools.annotations.tests GENERIC: another-generic ( a -- b )" eval ] unit-test
+[ ] [ "IN: tools.annotations.tests GENERIC: another-generic ( a -- b )" eval( -- ) ] unit-test
 
 [ ] [ \ another-generic reset ] unit-test
 
 [ "" ] [ [ 3 another-generic drop ] with-string-writer ] unit-test
+
+! reset should do the right thing for generic words
+[ ] [ \ another-generic watch ] unit-test
+
+GENERIC: blah-generic ( a -- b )
+
+M: string blah-generic ;
+
+[ ] [ M\ string blah-generic watch ] unit-test
+
+[ "hi" ] [ "hi" blah-generic ] unit-test
+
+! See how well watch interacts with optimizations.
+GENERIC: my-generic ( a -- b )
+M: object my-generic ;
+
+\ my-generic watch
+
+: some-code ( -- )
+    f my-generic drop ;
+
+[ ] [ some-code ] unit-test