From 79c4374a1f2ccd92842112ccf50a27b313b7e26a Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sat, 23 Nov 2024 13:41:02 +1100 Subject: [PATCH] Make sure this test works without scope braces too --- .../test_keyword_if_then_else.toy | 1 - .../test_keyword_if_then_else_no_braces.toy | 46 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/integrations/test_keyword_if_then_else_no_braces.toy diff --git a/tests/integrations/test_keyword_if_then_else.toy b/tests/integrations/test_keyword_if_then_else.toy index 5934f8d..9fe8d5e 100644 --- a/tests/integrations/test_keyword_if_then_else.toy +++ b/tests/integrations/test_keyword_if_then_else.toy @@ -1,4 +1,3 @@ - //literals if (true) { print "Success 1"; diff --git a/tests/integrations/test_keyword_if_then_else_no_braces.toy b/tests/integrations/test_keyword_if_then_else_no_braces.toy new file mode 100644 index 0000000..9aeeb42 --- /dev/null +++ b/tests/integrations/test_keyword_if_then_else_no_braces.toy @@ -0,0 +1,46 @@ +//literals +if (true) + print "Success 1"; +else + print "Failure 1"; + +//false literals +if (false) + print "Failure 2"; +else + print "Success 2"; + +//conditionals +if (1 < 2) + print "Success 3"; +if (1 > 2) + print "Failure 3"; + +//variables +var a = 42; + +if (a) + print "Success 4"; +else + print "Failure 4"; + +if (a == 42) + print "Success 5"; +else + print "Failure 5"; + +//concatenated strings +if ("foo" .. "bar" == "foobar") + print "Success 6"; +else + print "Failure 6"; + +if ("foobar" == "foo" .. "bar") + print "Success 7"; +else + print "Failure 7"; + +if ("fizz" .. "le" == "fi" .. "zzle") + print "Success 8"; +else + print "Failure 8";