]> gitweb.factorcode.org Git - factor.git/blob - basis/alien/parser/parser-tests.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / basis / alien / parser / parser-tests.factor
1 ! (c)2009 Joe Groff bsd license
2 USING: accessors alien.c-types alien.parser alien.syntax
3 tools.test vocabs.parser ;
4 IN: alien.parser.tests
5
6 TYPEDEF: char char2
7
8 [ int ] [ "int" parse-c-type ] unit-test
9 [ { int 5 } ] [ "int[5]" parse-c-type ] unit-test
10 [ { int 5 10 11 } ] [ "int[5][10][11]" parse-c-type ] unit-test
11 [ void* ] [ "int*" parse-c-type ] unit-test
12 [ void* ] [ "int**" parse-c-type ] unit-test
13 [ void* ] [ "int***" parse-c-type ] unit-test
14 [ void* ] [ "int****" parse-c-type ] unit-test
15 [ char* ] [ "char*" parse-c-type ] unit-test
16 [ void* ] [ "char**" parse-c-type ] unit-test
17 [ void* ] [ "char***" parse-c-type ] unit-test
18 [ void* ] [ "char****" parse-c-type ] unit-test
19 [ char2 ] [ "char2" parse-c-type ] unit-test
20 [ char* ] [ "char2*" parse-c-type ] unit-test
21
22 SYMBOL: not-c-type
23
24 [ "not-c-type" parse-c-type ] [ no-c-type? ] must-fail-with
25 ! uncomment this when string C type parsing goes away
26 ! [ "not-word" parse-c-type ] [ error>> no-word-error? ] must-fail-with
27