diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-07-17 20:33:42 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-07-17 20:33:42 +0200 |
commit | 0cbfd67522f97a37d707fd4eec3ca59b0b5e0d74 (patch) | |
tree | b64478e31c49e1f16a0b00bf8ba63f7fead2934c /tests/macros | |
parent | 6a9b082b535c48b07c5713b33d0d0a3a784f7c73 (diff) | |
download | Nim-0cbfd67522f97a37d707fd4eec3ca59b0b5e0d74.tar.gz |
make typesafeprintf test green
Diffstat (limited to 'tests/macros')
-rw-r--r-- | tests/macros/typesafeprintf.nim | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/macros/typesafeprintf.nim b/tests/macros/typesafeprintf.nim index 2f4622f3e..daf213bd3 100644 --- a/tests/macros/typesafeprintf.nim +++ b/tests/macros/typesafeprintf.nim @@ -9,7 +9,7 @@ proc printfImpl(formatstr: cstring) {.importc: "printf", varargs.} iterator tokenize(format: string): char = var i = 0 - while true: + while i < format.len: case format[i] of '%': case format[i+1] @@ -42,7 +42,8 @@ macro printf(formatString: string{lit}, args: varargs[typed]): untyped = $expectedType & ", actual type: " & $actualType # keep the original callsite, but use cprintf instead - result = callsite() - result[0] = bindSym"printfImpl" + result = newCall(bindSym"printfImpl") + result.add formatString + for a in args: result.add a printf("test %d\n", 10) |