]> gitweb.factorcode.org Git - factor.git/blob - core/slots/slots-tests.factor
Builtinn types now use new slot accessors; tuple slot type declaration work in progress
[factor.git] / core / slots / slots-tests.factor
1 IN: slots.tests
2 USING: math accessors slots strings generic.standard kernel tools.test ;
3
4 TUPLE: r/w-test foo ;
5
6 TUPLE: r/o-test { "foo" read-only: t } ;
7
8 [ r/o-test new 123 >>foo ] [ no-method? ] must-fail-with
9
10 TUPLE: decl-test { "foo" integer } ;
11
12 [ decl-test new 1.0 >>foo ] [ bad-slot-value? ] must-fail-with
13
14 TUPLE: hello length ;
15
16 [ 3 ] [ "xyz" length>> ] unit-test
17
18 [ "xyz" 4 >>length ] [ no-method? ] must-fail-with