Skip to content

Commit

Permalink
test proc module import #63
Browse files Browse the repository at this point in the history
Signed-off-by: David Krause (enthus1ast) <[email protected]>
  • Loading branch information
David Krause (enthus1ast) committed Aug 12, 2024
1 parent 7ef34bd commit aa7a0df
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/basic/procmodule/importInChild/macros.nimja
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{%- proc foo(): string = -%}foo{%- endmacro -%}

2 changes: 2 additions & 0 deletions tests/basic/procmodule/importInChild/master_template.nimja
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{%- importnimja procmodule/importInChild/macros.nimja -%}
{%- block cont -%}{%- endblock cont -%}
5 changes: 5 additions & 0 deletions tests/basic/procmodule/importInChild/template_child.nimja
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends procmodule/importInChild/master_template.nimja %}
{%- importnimja procmodule/importInChild/macros.nimja -%}
{%- block cont -%}
{{- foo() -}}
{%- endblock cont -%}
2 changes: 2 additions & 0 deletions tests/basic/procmodule/importInMaster/macros.nimja
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{%- proc foo(): string = -%}foo{%- endmacro -%}

2 changes: 2 additions & 0 deletions tests/basic/procmodule/importInMaster/master_template.nimja
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{%- importnimja procmodule/importInMaster/macros.nimja -%}
{%- block cont -%}{%- endblock cont -%}
2 changes: 2 additions & 0 deletions tests/basic/procmodule/importInMaster/template_child.nimja
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{%- extends procmodule/importInMaster/master_template.nimja -%}
{%- block cont -%}{{- foo() -}}{%- endblock cont -%}
1 change: 1 addition & 0 deletions tests/basic/procmodule/master_template.nimja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% block cont %}{% endblock cont %}
Binary file added tests/basic/test_procmodule
Binary file not shown.
18 changes: 18 additions & 0 deletions tests/basic/test_procmodule.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
discard """
joinable: false
"""
import ../../src/nimja
import unittest
import strutils

test "import proc module in master":
proc tchild(): string =
compileTemplateFile("procmodule/importInMaster/template_child.nimja", baseDir = getScriptDir())
check "foo" == tchild()

test "import proc module in child":
proc tchild(): string =
compileTemplateFile("procmodule/importInChild/template_child.nimja", baseDir = getScriptDir())
check "foo" == tchild()


0 comments on commit aa7a0df

Please sign in to comment.