aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-01-21 15:03:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-01-21 15:03:26 +0200
commit67382c15f7e9176dea44c3da7f7013759c88ce33 (patch)
tree5ff4fe1436792a01d4a8576f1e0efa3ce2ff9c20 /tests
parent41f091f46b47c20dc1571db5d56a1eaade25cb1e (diff)
Add support for ==, != in eval context
Diffstat (limited to 'tests')
-rw-r--r--tests/eval/buildfile30
-rw-r--r--tests/eval/test.out16
-rw-r--r--tests/if-else/buildfile17
-rw-r--r--tests/if-else/test.out3
4 files changed, 66 insertions, 0 deletions
diff --git a/tests/eval/buildfile b/tests/eval/buildfile
index cf315b6..06fb5fb 100644
--- a/tests/eval/buildfile
+++ b/tests/eval/buildfile
@@ -12,3 +12,33 @@ print ((foo) (bar))
print (foo\
bar)
+
+# !=, == vs !, = recognition
+#
+print (=)
+print (!)
+print (= foo)
+print (foo!)
+
+# !=, == evaluation
+#
+
+# print ( == bar)
+# print (foo == )
+
+print (foo == bar)
+print (foo == foo)
+print (foo != bar)
+print (foo != foo)
+
+print (foo == (foo))
+print ((foo bar) == foo bar)
+print (foo != foo bar)
+print ("" == '')
+
+print ((foo != bar) baz)
+print "foo equals bar is (foo == bar)"
+
+foo = foo
+print ($foo == foo)
+print (bar != $foo)
diff --git a/tests/eval/test.out b/tests/eval/test.out
index 5885c7d..599f928 100644
--- a/tests/eval/test.out
+++ b/tests/eval/test.out
@@ -2,3 +2,19 @@
foobar
foo bar
foobar
+=
+!
+= foo
+foo!
+false
+true
+true
+false
+true
+true
+true
+true
+true baz
+foo equals bar is false
+true
+true
diff --git a/tests/if-else/buildfile b/tests/if-else/buildfile
index 30da40f..2b87b8c 100644
--- a/tests/if-else/buildfile
+++ b/tests/if-else/buildfile
@@ -106,6 +106,23 @@ if! $f
./:
+# With eval context.
+#
+if (foo == foo)
+{
+ print 1
+}
+
+if(foo != bar)
+{
+ print 1
+}
+
+if!(foo == bar)
+{
+ print 1
+}
+
# EOF test.
#
if true
diff --git a/tests/if-else/test.out b/tests/if-else/test.out
index bb08505..4dff9ef 100644
--- a/tests/if-else/test.out
+++ b/tests/if-else/test.out
@@ -7,3 +7,6 @@
1
1
1
+1
+1
+1