questionable/tests/testScope.nim
Mark Spanbroek d079162675 Use scope instead of block
To avoid influencing `break` statements.
2022-10-24 13:02:55 +02:00

18 lines
296 B
Nim

import ../questionable/private/scope
import std/unittest
suite "Scope":
test "introduces variable scope":
var x = 1
scope:
var x: string
x = "some string"
check x == "some string"
check x == 1
test "returns value":
let x = scope:
3
check x == 3