diff options
Diffstat (limited to 'tests/js')
-rw-r--r-- | tests/js/tcodegendeclproc.nim | 11 | ||||
-rw-r--r-- | tests/js/tcodegendeclvar.nim | 10 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/js/tcodegendeclproc.nim b/tests/js/tcodegendeclproc.nim new file mode 100644 index 000000000..3acf0bc13 --- /dev/null +++ b/tests/js/tcodegendeclproc.nim @@ -0,0 +1,11 @@ +discard """ + output: ''' +-1 +8 +''' + ccodecheck: "'console.log(-1); function fac_' \\d+ '(n_' \\d+ ')'" +""" +proc fac(n: int): int {.codegenDecl: "console.log(-1); function $2($3)".} = + return n + +echo fac(8) diff --git a/tests/js/tcodegendeclvar.nim b/tests/js/tcodegendeclvar.nim new file mode 100644 index 000000000..645443ef7 --- /dev/null +++ b/tests/js/tcodegendeclvar.nim @@ -0,0 +1,10 @@ +discard """ + output: ''' +-1 +2 +''' + ccodecheck: "'console.log(-1); var v_' \\d+ ' = [2]'" +""" + +var v {.codegenDecl: "console.log(-1); var $2".} = 2 +echo v |