From 0cbfd67522f97a37d707fd4eec3ca59b0b5e0d74 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Tue, 17 Jul 2018 20:33:42 +0200 Subject: [PATCH] make typesafeprintf test green --- tests/macros/typesafeprintf.nim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/macros/typesafeprintf.nim b/tests/macros/typesafeprintf.nim index 2f4622f3e1..daf213bd37 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)