aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test_include_guards.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_include_guards.sh')
-rw-r--r--tests/test_include_guards.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_include_guards.sh b/tests/test_include_guards.sh
new file mode 100644
index 0000000..87c44a9
--- /dev/null
+++ b/tests/test_include_guards.sh
@@ -0,0 +1,26 @@
+cat <<'EOF' > expected
+42
+EOF
+
+cat <<'EOF' > header.h
+#ifndef HEADER_H
+#define HEADER_H
+
+int f() { return 42; }
+
+#endif
+EOF
+
+test_diff <<'EOF'
+#include "header.h"
+#include "header.h"
+#include "header.h"
+
+int printf();
+
+int main() {
+ printf("%d\n", HEADER_H HEADER_H HEADER_H f() HEADER_H HEADER_H HEADER_H);
+ return 0;
+}
+EOF
+