diff --git a/Makefile.am b/Makefile.am
index 489f581..a41f959 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -291,6 +291,13 @@ exec_fd_leak_checker_LDADD = libtest-helpers.la
EXTRA_DIST += tests/scanner-test.sh \
protocol/tests.xml \
+ tests/data/bad-identifier-arg.xml \
+ tests/data/bad-identifier-entry.xml \
+ tests/data/bad-identifier-enum.xml \
+ tests/data/bad-identifier-event.xml \
+ tests/data/bad-identifier-interface.xml \
+ tests/data/bad-identifier-protocol.xml \
+ tests/data/bad-identifier-request.xml \
tests/data/example.xml \
tests/data/example-client.h \
tests/data/example-server.h \
diff --git a/tests/data/bad-identifier-arg.xml b/tests/data/bad-identifier-arg.xml
new file mode 100644
index 0000000..ac2a6b7
--- /dev/null
+++ b/tests/data/bad-identifier-arg.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/data/bad-identifier-entry.xml b/tests/data/bad-identifier-entry.xml
new file mode 100644
index 0000000..6ea2fae
--- /dev/null
+++ b/tests/data/bad-identifier-entry.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/data/bad-identifier-enum.xml b/tests/data/bad-identifier-enum.xml
new file mode 100644
index 0000000..3225384
--- /dev/null
+++ b/tests/data/bad-identifier-enum.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/data/bad-identifier-event.xml b/tests/data/bad-identifier-event.xml
new file mode 100644
index 0000000..9708e3b
--- /dev/null
+++ b/tests/data/bad-identifier-event.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/tests/data/bad-identifier-interface.xml b/tests/data/bad-identifier-interface.xml
new file mode 100644
index 0000000..17404c5
--- /dev/null
+++ b/tests/data/bad-identifier-interface.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/tests/data/bad-identifier-protocol.xml b/tests/data/bad-identifier-protocol.xml
new file mode 100644
index 0000000..7a17204
--- /dev/null
+++ b/tests/data/bad-identifier-protocol.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/tests/data/bad-identifier-request.xml b/tests/data/bad-identifier-request.xml
new file mode 100644
index 0000000..a68c8aa
--- /dev/null
+++ b/tests/data/bad-identifier-request.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/scanner-test.sh b/tests/scanner-test.sh
index ff25089..35ba047 100755
--- a/tests/scanner-test.sh
+++ b/tests/scanner-test.sh
@@ -36,6 +36,20 @@ generate_and_compare() {
fail "$2 -> $3"
}
+verify_error() {
+ echo
+ echo "Checking that reading $1 gives an error on line $3"
+
+ [ -f "$TEST_DATA_DIR/$1" ] || hard_fail "$1 not present"
+
+ # Confirm failure error code
+ "$WAYLAND_SCANNER" server-header < "$TEST_DATA_DIR/$1" >/dev/null 2>"$TEST_OUTPUT_DIR/$2" && \
+ fail "$1 return code check"
+
+ # Verify that an error is produced at the correct line
+ grep -q ":$3: error:" "$TEST_OUTPUT_DIR/$2" && echo "$1 PASS" || fail "$1 line number check"
+}
+
generate_and_compare "code" "example.xml" "example-code.c"
generate_and_compare "client-header" "example.xml" "example-client.h"
generate_and_compare "server-header" "example.xml" "example-server.h"
@@ -52,4 +66,13 @@ generate_and_compare "-c server-header" "small.xml" "small-server-core.h"
generate_and_compare "code" "small.xml" "small-code.c"
generate_and_compare "public-code" "small.xml" "small-code.c"
generate_and_compare "private-code" "small.xml" "small-private-code.c"
+
+verify_error "bad-identifier-arg.xml" "bad-identifier-arg.log" 7
+verify_error "bad-identifier-entry.xml" "bad-identifier-entry.log" 8
+verify_error "bad-identifier-enum.xml" "bad-identifier-enum.log" 6
+verify_error "bad-identifier-event.xml" "bad-identifier-event.log" 6
+verify_error "bad-identifier-interface.xml" "bad-identifier-interface.log" 3
+verify_error "bad-identifier-protocol.xml" "bad-identifier-protocol.log" 2
+verify_error "bad-identifier-request.xml" "bad-identifier-request.log" 6
+
exit $RETCODE