]> gitweb.factorcode.org Git - factor.git/blob - basis/alien/parser/parser-tests.factor
alien.parser: fix unit tests
[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 parser ;
4 IN: alien.parser.tests
5
6 TYPEDEF: char char2
7
8 SYMBOL: not-c-type
9
10 [
11     "alien.parser.tests" use-vocab
12     "alien.c-types" use-vocab
13
14     [ int ] [ "int" parse-c-type ] unit-test
15     [ { int 5 } ] [ "int[5]" parse-c-type ] unit-test
16     [ { int 5 10 11 } ] [ "int[5][10][11]" parse-c-type ] unit-test
17     [ void* ] [ "int*" parse-c-type ] unit-test
18     [ void* ] [ "int**" parse-c-type ] unit-test
19     [ void* ] [ "int***" parse-c-type ] unit-test
20     [ void* ] [ "int****" parse-c-type ] unit-test
21     [ char* ] [ "char*" parse-c-type ] unit-test
22     [ void* ] [ "char**" parse-c-type ] unit-test
23     [ void* ] [ "char***" parse-c-type ] unit-test
24     [ void* ] [ "char****" parse-c-type ] unit-test
25     [ char2 ] [ "char2" parse-c-type ] unit-test
26     [ char* ] [ "char2*" parse-c-type ] unit-test
27
28     [ "not-c-type" parse-c-type ] [ no-c-type? ] must-fail-with
29     [ "not-word" parse-c-type ] [ error>> no-word-error? ] must-fail-with
30
31 ] with-file-vocabs