diff --git a/.gitignore b/.gitignore index e03a67d..a6c53c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -tests/*.got +tests/**/*.got /target diff --git a/runtests.sh b/runtests.sh index 06a00a1..982d97a 100755 --- a/runtests.sh +++ b/runtests.sh @@ -17,7 +17,7 @@ echo "building" cargo build $flags || die "build failed" echo "testing" -find "$tests" -type f -name '*.npp' | while read f; do +find "$tests" -type f -name '*.npp' -not -name "*test_import_*" | while read f; do result="$(cargo run $flags -- "$f")" echo "$result" > "$f.got" diff --git a/tests/modules.npp b/tests/modules.npp new file mode 100644 index 0000000..e202c61 --- /dev/null +++ b/tests/modules.npp @@ -0,0 +1,6 @@ +import "modules/test_import_directory.npp" +import test_import_local + +println(test_import_local.foo) +println(test_import_local.bar) +println(test_import_local.baz) diff --git a/tests/modules.npp.expect b/tests/modules.npp.expect new file mode 100644 index 0000000..b8de9d0 --- /dev/null +++ b/tests/modules.npp.expect @@ -0,0 +1,5 @@ +importing test_import_directory +importing test_import_local +1 +2 +3 diff --git a/tests/modules/test_import_directory.npp b/tests/modules/test_import_directory.npp new file mode 100644 index 0000000..e8d9b90 --- /dev/null +++ b/tests/modules/test_import_directory.npp @@ -0,0 +1 @@ +println("importing test_import_directory") diff --git a/tests/test_import_local.npp b/tests/test_import_local.npp new file mode 100644 index 0000000..9240add --- /dev/null +++ b/tests/test_import_local.npp @@ -0,0 +1,5 @@ +println("importing test_import_local") + +foo = 1 +bar = 2 +baz = 3