aboutsummaryrefslogtreecommitdiff
path: root/tests/if-else
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-21 12:05:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-21 12:05:31 +0200
commit141693278ef900655efae53990d084058b008a90 (patch)
tree5b247e57d279a5f40e380d8ca35e871332d82712 /tests/if-else
parent4a5c11f559e72bb6f5d8c28815c57c1690408f29 (diff)
Add support for single line if-blocks
So now we can do: if true print true else print false Instead having to do: if true { print true } else { print false }
Diffstat (limited to 'tests/if-else')
-rw-r--r--tests/if-else/buildfile26
-rw-r--r--tests/if-else/test.out3
2 files changed, 27 insertions, 2 deletions
diff --git a/tests/if-else/buildfile b/tests/if-else/buildfile
index a54092d..25fabf0 100644
--- a/tests/if-else/buildfile
+++ b/tests/if-else/buildfile
@@ -104,8 +104,6 @@ if! $f
print 1
}
-./:
-
# With eval context.
#
if (foo == foo)
@@ -128,8 +126,32 @@ if ([uint64] 01 == [uint64] 1)
print 1
}
+# Single line.
+#
+
+#if true
+#} # expected if-line
+
+if true
+ print 1
+
+if false
+
+ print 0
+else
+ # Comment.
+ print 1
+
+if true
+ if false
+ print 0
+ else
+ print 1
+
# EOF test.
#
+./:
+
if true
{
print 1
diff --git a/tests/if-else/test.out b/tests/if-else/test.out
index 71c9a23..58501cb 100644
--- a/tests/if-else/test.out
+++ b/tests/if-else/test.out
@@ -11,3 +11,6 @@
1
1
1
+1
+1
+1