Add some tests for modules
* .gitignore now ignores *.got for *anything* under the tests/ directory * runtests.sh ignores files in the tests/ directory that have the string "test_import_" in them, so they are not run as tests themselves * Add a couple of basic module functionality tests Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,2 @@
|
|||||||
tests/*.got
|
tests/**/*.got
|
||||||
/target
|
/target
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ echo "building"
|
|||||||
cargo build $flags || die "build failed"
|
cargo build $flags || die "build failed"
|
||||||
|
|
||||||
echo "testing"
|
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")"
|
result="$(cargo run $flags -- "$f")"
|
||||||
|
|
||||||
echo "$result" > "$f.got"
|
echo "$result" > "$f.got"
|
||||||
|
|||||||
6
tests/modules.npp
Normal file
6
tests/modules.npp
Normal file
@@ -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)
|
||||||
5
tests/modules.npp.expect
Normal file
5
tests/modules.npp.expect
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
importing test_import_directory
|
||||||
|
importing test_import_local
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
1
tests/modules/test_import_directory.npp
Normal file
1
tests/modules/test_import_directory.npp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
println("importing test_import_directory")
|
||||||
5
tests/test_import_local.npp
Normal file
5
tests/test_import_local.npp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
println("importing test_import_local")
|
||||||
|
|
||||||
|
foo = 1
|
||||||
|
bar = 2
|
||||||
|
baz = 3
|
||||||
Reference in New Issue
Block a user