diff options
author | Miran <narimiran@users.noreply.github.com> | 2018-10-14 17:08:42 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-10-14 17:08:42 +0200 |
commit | a30ba8cc370736b8b737292a8c2b46adadc6f8be (patch) | |
tree | ccded85b9aec0f61daa8f39b8d8cc8e344e9388d /tests/macros/tgentemplates.nim | |
parent | 8955470644972e2d1f2b029650c04505ebacca23 (diff) | |
download | Nim-a30ba8cc370736b8b737292a8c2b46adadc6f8be.tar.gz |
merge macros tests (#9367)
Diffstat (limited to 'tests/macros/tgentemplates.nim')
-rw-r--r-- | tests/macros/tgentemplates.nim | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/tests/macros/tgentemplates.nim b/tests/macros/tgentemplates.nim deleted file mode 100644 index 301d58c6a..000000000 --- a/tests/macros/tgentemplates.nim +++ /dev/null @@ -1,35 +0,0 @@ -# bug #1140 - -import parseutils, macros - -proc parse_until_symbol(node: NimNode, value: string, index: var int): bool {.compiletime.} = - var splitValue: string - var read = value.parseUntil(splitValue, '$', index) - - # when false: - if false: - var identifier: string - read = value.parseWhile(identifier, {}, index) - node.add newCall("add", ident("result"), newCall("$", ident(identifier))) - - if splitValue.len > 0: - node.insert node.len, newCall("add", ident("result"), newStrLitNode(splitValue)) - -proc parse_template(node: NimNode, value: string) {.compiletime.} = - var index = 0 - while index < value.len and - parse_until_symbol(node, value, index): discard - -macro tmpli*(body: untyped): typed = - result = newStmtList() - result.add parseExpr("result = \"\"") - result.parse_template body[1].strVal - - -proc actual: string = tmpli html""" - <p>Test!</p> - """ - -proc another: string = tmpli html""" - <p>what</p> - """ |