1 IN: classes.tuple.parser.tests
2 USING: accessors classes.tuple.parser lexer words classes
3 sequences math kernel slots tools.test parser compiler.units ;
7 [ t ] [ test-1 "slot-names" word-prop empty? ] unit-test
9 TUPLE: test-2 < test-1 ;
11 [ t ] [ test-2 "slot-names" word-prop empty? ] unit-test
12 [ test-1 ] [ test-2 superclass ] unit-test
16 [ { "a" } ] [ test-3 "slot-names" word-prop ] unit-test
18 [ object ] [ "a" test-3 "slots" word-prop slot-named class>> ] unit-test
20 TUPLE: test-4 < test-3 b ;
22 [ { "b" } ] [ test-4 "slot-names" word-prop ] unit-test
24 TUPLE: test-5 { a integer } ;
26 [ { { "a" integer } } ] [ test-5 "slot-names" word-prop ] unit-test
28 TUPLE: test-6 < test-5 { b integer } ;
30 [ integer ] [ "b" test-6 "slots" word-prop slot-named class>> ] unit-test
32 [ { { "b" integer } } ] [ test-6 "slot-names" word-prop ] unit-test
34 TUPLE: test-7 { b integer initial: 3 } ;
36 [ 3 ] [ "b" test-7 "slots" word-prop slot-named initial>> ] unit-test
38 TUPLE: test-8 { b integer read-only } ;
40 [ t ] [ "b" test-8 "slots" word-prop slot-named read-only>> ] unit-test
42 [ "IN: classes.tuple.parser.tests TUPLE: foo < test-1 < ;" eval ]
43 [ error>> invalid-slot-name? ]
46 [ "IN: classes.tuple.parser.tests TUPLE: foo :" eval ]
47 [ error>> invalid-slot-name? ]
50 [ "IN: classes.tuple.parser.tests TUPLE: foo" eval ]
51 [ error>> unexpected-eof? ]
54 [ "IN: classes.tuple.parser.tests USE: alien TUPLE: foo { slot alien } ;" eval ]
55 [ error>> no-initial-value? ]
58 [ "IN: classes.tuple.parser.tests USE: arrays TUPLE: foo { slot array initial: 5 } ;" eval ]
59 [ error>> bad-initial-value? ]
64 { test-1 test-2 test-3 test-4 test-5 test-6 test-7 test-8 }
65 [ dup class? [ forget-class ] [ drop ] if ] each
66 ] with-compilation-unit