scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 1679b6d153d6617c2049bc3bb79a4e5854fcb1cb
parent 7b5e51fae035c6e8c2ca62be07ba3a31e38a4593
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 12 Jan 2017 12:02:55 +0100

[test] Import error tests from Andrew Chambers

Diffstat:
Atests/error/0001-sanity.c | 9+++++++++
Atests/error/0002-missinginclude.c | 1+
Atests/error/0003-junkinclude.c | 6++++++
Atests/error/0004-macroredef.c | 8++++++++
Atests/error/0005-fmacro.c | 7+++++++
Atests/error/0006-endif.c | 7+++++++
Atests/error/0007-unmatchedcppif.c | 7+++++++
Atests/error/0008-unmatchedcppelse.c | 8++++++++
Atests/error/0009-unmatchedcppelif.c | 7+++++++
Atests/error/0010-extraelif.c | 12++++++++++++
Atests/error/0011-extraelse.c | 12++++++++++++
Atests/error/0012-ifnoexpr.c | 7+++++++
Atests/error/0013-macro.c | 8++++++++
Atests/error/0014-macro.c | 8++++++++
Atests/error/0015-macro.c | 6++++++
Atests/error/0016-arrayinitsize.c | 5+++++
Atests/error/0017-duplicatefunc.c | 13+++++++++++++
Atests/error/0018-voidparam.c | 12++++++++++++
Atests/error/README | 2++
19 files changed, 145 insertions(+), 0 deletions(-)

diff --git a/tests/error/0001-sanity.c b/tests/error/0001-sanity.c @@ -0,0 +1,9 @@ +/* +PATTERN: undefined symbol FOO +*/ + +int main() +{ + return FOO; +} + diff --git a/tests/error/0002-missinginclude.c b/tests/error/0002-missinginclude.c @@ -0,0 +1 @@ +#include "MISSING.h" diff --git a/tests/error/0003-junkinclude.c b/tests/error/0003-junkinclude.c @@ -0,0 +1,6 @@ +/* +PATTERN: bar +PATTERN: junk +*/ + +#include "0003-junkinclude.c" bar diff --git a/tests/error/0004-macroredef.c b/tests/error/0004-macroredef.c @@ -0,0 +1,8 @@ +/* +PATTERN: redefinition +PATTERN: 7 +*/ + +#define X 1 +#define X 2 + diff --git a/tests/error/0005-fmacro.c b/tests/error/0005-fmacro.c @@ -0,0 +1,7 @@ + +/* +PATTERN: expected +*/ + +#define X( + diff --git a/tests/error/0006-endif.c b/tests/error/0006-endif.c @@ -0,0 +1,7 @@ + +/* +PATTERN: endif +*/ + +#endif + diff --git a/tests/error/0007-unmatchedcppif.c b/tests/error/0007-unmatchedcppif.c @@ -0,0 +1,7 @@ +/* +PATTERN: endif +*/ + +#ifdef FOO + + diff --git a/tests/error/0008-unmatchedcppelse.c b/tests/error/0008-unmatchedcppelse.c @@ -0,0 +1,8 @@ + +/* +PATTERN: else +*/ + +#else + + diff --git a/tests/error/0009-unmatchedcppelif.c b/tests/error/0009-unmatchedcppelif.c @@ -0,0 +1,7 @@ + +/* +PATTERN: elif +*/ + +#elif 1 + diff --git a/tests/error/0010-extraelif.c b/tests/error/0010-extraelif.c @@ -0,0 +1,12 @@ + +/* +PATTERN: elif +*/ + +#if 1 + +#else + +#elif 0 + +#endif diff --git a/tests/error/0011-extraelse.c b/tests/error/0011-extraelse.c @@ -0,0 +1,12 @@ + +/* +PATTERN: else +*/ + +#if 1 + +#else + +#else + +#endif diff --git a/tests/error/0012-ifnoexpr.c b/tests/error/0012-ifnoexpr.c @@ -0,0 +1,7 @@ +/* +PATTERN: expression +*/ + +#if +#endif + diff --git a/tests/error/0013-macro.c b/tests/error/0013-macro.c @@ -0,0 +1,8 @@ +/* +PATTERN: macro +*/ + +#define X(A, ...) 0 + +X() + diff --git a/tests/error/0014-macro.c b/tests/error/0014-macro.c @@ -0,0 +1,8 @@ +/* +PATTERN: macro +*/ + +#define X() 0 + +X(A) + diff --git a/tests/error/0015-macro.c b/tests/error/0015-macro.c @@ -0,0 +1,6 @@ +/* +PATTERN: macro argument +*/ + +#define X(A, A) 0 + diff --git a/tests/error/0016-arrayinitsize.c b/tests/error/0016-arrayinitsize.c @@ -0,0 +1,5 @@ +/* +PATTERN: incorrect +*/ + +int x[2] = {1, 2, 3}; diff --git a/tests/error/0017-duplicatefunc.c b/tests/error/0017-duplicatefunc.c @@ -0,0 +1,13 @@ + +int +main() +{ + return 0; +} + +int +main() +{ + return 0; +} + diff --git a/tests/error/0018-voidparam.c b/tests/error/0018-voidparam.c @@ -0,0 +1,12 @@ + +int +foo(void, int x) +{ + return 0; +} + +int +main() +{ + return foo(); +} diff --git a/tests/error/README b/tests/error/README @@ -0,0 +1,2 @@ +These tests are taken from https://github.com/andrewchambers/qc. +All the credits for this test suite are for Andrew Chambers.