diff options
Diffstat (limited to 'tests/varstmt')
-rw-r--r-- | tests/varstmt/tlet.nim | 19 | ||||
-rw-r--r-- | tests/varstmt/tvardecl.nim | 19 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/varstmt/tlet.nim b/tests/varstmt/tlet.nim new file mode 100644 index 000000000..9c2d9706d --- /dev/null +++ b/tests/varstmt/tlet.nim @@ -0,0 +1,19 @@ +discard """ + output: '''Very funny, your name is name. +nameabc''' +""" + +proc main = + let name = "name" + if name == "": + echo("Poor soul, you lost your name?") + elif name == "name": + echo("Very funny, your name is name.") + else: + echo("Hi, ", name, "!") + + let (x, y) = ("abc", name) + echo y, x + +main() + diff --git a/tests/varstmt/tvardecl.nim b/tests/varstmt/tvardecl.nim new file mode 100644 index 000000000..d5ccfafb7 --- /dev/null +++ b/tests/varstmt/tvardecl.nim @@ -0,0 +1,19 @@ +discard """ + output: "44" +""" +# Test the new variable declaration syntax +import std/sequtils + +var + x = 0 + s = "Hallo" + a, b: int = 4 + +write(stdout, a) +writeLine(stdout, b) #OUT 44 + +proc p() = # bug #18104 + var x, y = newSeqWith(10, newString(3)) + discard (x, y) + +p() |