aboutsummaryrefslogtreecommitdiff
path: root/opt/tests/uninclude.sh
diff options
context:
space:
mode:
Diffstat (limited to 'opt/tests/uninclude.sh')
-rwxr-xr-xopt/tests/uninclude.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/opt/tests/uninclude.sh b/opt/tests/uninclude.sh
new file mode 100755
index 0000000..bb11f05
--- /dev/null
+++ b/opt/tests/uninclude.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+git restore opt/resources/
+
+# shellcheck disable=2086
+find opt/resources/ -name '*.c' |
+ sh ~/.usr/bin/uninclude -E '^#include ' -- cc $CFLAGS
+
+find opt/resources/ -name '*.c' | while read -r file; do
+ if ! cmp -s "$file" "$file".expected; then
+ cat <<-EOF
+ The unincluded file is different from expected.
+
+ See with:
+ $ diff -U5 $file.expected $file
+ EOF
+ exit 1
+ else
+ git restore "$file"
+ fi
+done
+
+rm -f a.out