diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-09-30 22:34:54 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-09-30 22:34:54 +0200 |
commit | e8eb496e6fda1e076d59fc01118af411e488bf34 (patch) | |
tree | 290a8d5092c34646e094ba691c15f9fee2ec8fe8 /tests/js | |
parent | ddc131cf07972decc206e033b2dd85a42eb1c98d (diff) | |
download | Nim-e8eb496e6fda1e076d59fc01118af411e488bf34.tar.gz |
make tests green again
Diffstat (limited to 'tests/js')
-rw-r--r-- | tests/js/tclosures.nim | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/js/tclosures.nim b/tests/js/tclosures.nim index 0ec4f4743..67243c937 100644 --- a/tests/js/tclosures.nim +++ b/tests/js/tclosures.nim @@ -23,29 +23,29 @@ asm """ """ proc consoleprint (str:cstring): void {.importc: "print", noDecl.} -proc print* (a: varargs[string, `$`]) = consoleprint "$1: $2" % [consolePrefix, join (a, " ")] +proc print* (a: varargs[string, `$`]) = consoleprint "$1: $2" % [consolePrefix, join(a, " ")] type CallbackProc {.importc.} = proc () : cstring proc regCallback (fn:CallbackProc) {.importc.} proc runCallbacks ():cstring {.importc.} -proc `*` (s:string, n:Natural) : string = s.repeat (n) +proc `*` (s:string, n:Natural) : string = s.repeat(n) proc outer (i:Natural) : (string, int) = - let c = $char (random (93) + 33) - let n = random (40) + let c = $char(random(93) + 33) + let n = random(40) let s = c * n - proc inner () : cstring = ("[$1]" % $n) & s & " <--" - regCallback (inner) + proc inner(): cstring = ("[$1]" % $n) & s & " <--" + regCallback(inner) return (s, n) var expected = "\n" for i in 1 .. 10: - let (s, n) = outer (i) + let (s, n) = outer(i) expected &= ("($1)[$2]" % [$i, $n]) & s & " <--" expected &= "\n" -let results = runCallbacks () +let results = runCallbacks() doAssert(expected == results) |