]> git.draconx.ca Git - cdecl99.git/blobdiff - tests/cdecl99-c-invalid.sh
Convert invalid declaration test to Autotest.
[cdecl99.git] / tests / cdecl99-c-invalid.sh
diff --git a/tests/cdecl99-c-invalid.sh b/tests/cdecl99-c-invalid.sh
deleted file mode 100755 (executable)
index 4370e58..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/sh
-#
-# Copyright © 2012 Nick Bowler
-#
-# Check that cdecl99 rejects a variety of invalid declarations.
-#
-# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
-# This is free software: you are free to do what the fuck you want to.
-# There is NO WARRANTY, to the extent permitted by law.
-
-cdecl99=./cdecl99$EXEEXT
-scriptname=$0
-
-test_decl() {
-       cmd=$1
-       shift
-
-       if $cdecl99 -e "$cmd $*" >/dev/null 2>&1; then
-               printf '%s: %s not rejected\n' "$scriptname" "$*" 1>&2
-               return 1
-       fi
-
-       return 0
-}
-
-set -e
-test_decl explain 'int x$'
-test_decl declare 'x$ as int'
-test_decl explain 'long long long x'
-test_decl declare 'x as long long long'
-test_decl explain 'inline int x'
-test_decl declare 'x as inline int'
-# C99§6.7.3#2: Types other than opinter types derived from object or incomplete
-# types shall not be restrict-qualified.
-test_decl explain 'restrict int x'
-test_decl declare 'x as restrict int'
-test_decl explain 'int (*restrict f)(void)'
-test_decl declare 'f as restrict pointer to function (void) returning int'
-test_decl explain 'static auto int x'
-test_decl declare 'x as static auto int'
-test_decl explain 'auto x'
-test_decl declare 'x as auto'
-test_decl explain 'void x'
-test_decl declare 'x as void'
-test_decl explain 'int _Complex x'
-test_decl declare 'x as int _Complex'
-test_decl explain 'typedef int'
-test_decl type    'typedef int'
-test_decl explain 'void f(...)'
-test_decl declare 'f as function (...) returning void'
-# XXX: While these silly void-parameter declarations are "obviously" invalid, I
-# can't actually find a statement in the specification which forbids them.
-test_decl explain 'void f(void, void)'
-test_decl declare 'f as function (void, void) returning void'
-test_decl explain 'void f(void, ...)'
-test_decl declare 'f as function (void, ...) returning void'
-test_decl explain 'void f(register void)'
-test_decl declare 'f as function (register void) returning void'
-test_decl explain 'void f(const void)'
-test_decl declare 'f as function (const void) returning void'
-test_decl explain 'void f(void const)'
-test_decl declare 'f as function (void const) returning void'
-test_decl explain 'void f(const)'
-test_decl declare 'f as function (const) returning void'
-test_decl explain 'void f(typedef int x)'
-test_decl declare 'f as function (x as typedef int) returning void'
-test_decl explain 'void f(static int x)'
-test_decl declare 'f as function (x as static int) returning void'
-test_decl explain 'int f(void)[1]'
-test_decl declare 'f as function (void) returning array 1 of int'
-test_decl explain 'inline int (void)'
-test_decl type    'inline function (void) returning int'
-test_decl explain 'int f(inline int g())'
-test_decl declare 'f as function (g as inline function returning int) returning int'
-test_decl explain 'int f(void)(void)'
-test_decl declare 'f as function (void) returning function (void) returning int'
-test_decl explain 'int a[0]'
-test_decl declare 'a as array 0 of int'
-test_decl explain 'void a[1]'
-test_decl declare 'a as array 1 of void'
-test_decl explain 'int a[1](void)'
-test_decl declare 'a as array 1 of function (void) returning int'
-test_decl explain 'int a[1nan]'
-test_decl declare 'a as array 1nan of int'
-test_decl explain 'int a[99999999999999999999999999999999999999999999999999999]'
-test_decl declare 'a as array 99999999999999999999999999999999999999999999999999999 of int'
-
-test_decl explain 'int f((x))'
-test_decl explain 'int f(void), g(...)'
-test_decl explain 'int f, g((x))'
-test_decl explain 'int x, (void)'
-test_decl explain 'int [5], (void)'
-test_decl explain 'int ((int))'