]> gitweb.factorcode.org Git - factor.git/blob - 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
1 USING: tools.test tools.annotations tools.time math parser eval
2 io.streams.string kernel strings ;
3 IN: tools.annotations.tests
4
5 : foo ( -- ) ;
6 \ foo watch
7
8 [ ] [ foo ] unit-test
9
10 ! erg's bug
11 GENERIC: some-generic ( a -- b )
12
13 M: integer some-generic 1 + ;
14
15 [ 4 ] [ 3 some-generic ] unit-test
16
17 [ ] [ \ some-generic watch ] unit-test
18
19 [ 4 ] [ 3 some-generic ] unit-test
20
21 [ ] [ "IN: tools.annotations.tests USE: math M: integer some-generic 1 - ;" eval( -- ) ] unit-test
22
23 [ 2 ] [ 3 some-generic ] unit-test
24
25 [ ] [ \ some-generic reset ] unit-test
26
27 [ 2 ] [ 3 some-generic ] unit-test
28
29 ! slava's bug
30 GENERIC: another-generic ( a -- b )
31
32 M: object another-generic ;
33
34 \ another-generic watch
35
36 [ ] [ "IN: tools.annotations.tests GENERIC: another-generic ( a -- b )" eval( -- ) ] unit-test
37
38 [ ] [ \ another-generic reset ] unit-test
39
40 [ "" ] [ [ 3 another-generic drop ] with-string-writer ] unit-test
41
42 ! reset should do the right thing for generic words
43 [ ] [ \ another-generic watch ] unit-test
44
45 GENERIC: blah-generic ( a -- b )
46
47 M: string blah-generic ;
48
49 [ ] [ M\ string blah-generic watch ] unit-test
50
51 [ "hi" ] [ "hi" blah-generic ] unit-test
52
53 ! See how well watch interacts with optimizations.
54 GENERIC: my-generic ( a -- b )
55 M: object my-generic ;
56
57 \ my-generic watch
58
59 : some-code ( -- )
60     f my-generic drop ;
61
62 [ ] [ some-code ] unit-test