summaryrefslogtreecommitdiff
path: root/pkgtools/check-portability/files/testdata/test-eqeq
diff options
context:
space:
mode:
Diffstat (limited to 'pkgtools/check-portability/files/testdata/test-eqeq')
-rw-r--r--pkgtools/check-portability/files/testdata/test-eqeq18
1 files changed, 18 insertions, 0 deletions
diff --git a/pkgtools/check-portability/files/testdata/test-eqeq b/pkgtools/check-portability/files/testdata/test-eqeq
new file mode 100644
index 00000000000..fbfa2c618a7
--- /dev/null
+++ b/pkgtools/check-portability/files/testdata/test-eqeq
@@ -0,0 +1,18 @@
+#! /bin/sh
+#
+# This file demonstrates which patterns are detected by the check for
+# the == operator.
+
+test a = b # good
+test a == b # bad
+
+[ a = b ] # good
+[ a == b ] # bad
+
+# The check does not look at the closing bracket as that would generate
+# too many special cases.
+[ a == b -a c == d ]
+
+# This case is not found since the == operator is not at the beginning
+# of the condition. This constellation doesn't occur in practice though.
+[ a = b -a c == d ]