String concatenation restricted to + and += signs

This commit is contained in:
2023-02-05 15:15:32 +00:00
parent 7ea249f723
commit 41d274177a
3 changed files with 13 additions and 2 deletions

View File

@@ -28,4 +28,15 @@ a %= 8;
assert a == 4, "%= failed";
//strings as special cases
var s = "foo";
assert s + "bar" == "foobar", "string addition failed";
assert s == "foo", "string addition failed (was too sticky)";
s += "bar";
assert s == "foobar", "string addition failed (wasn't sticky enough)";
print "All good";