4846cf5243
* chore: add tests for custom extension * feat: cusom source extension #286 * fix: path to test directory * add getter + change setter name for file extension * add tests of source file extension validation * fix: add validation for file extension names * fix: property importExt -> importFileExt * fix: redundant check (no resetting) * fix: failing test wich did not follow the new spec * chore: add detailed description of the test * chore: fix doc comment to be descriptive * docs: add note about customizing the file extension
23 lines
758 B
Text
23 lines
758 B
Text
#!/usr/bin/env tengo
|
|
// This is a test of custom extension for issue #286 and PR #350.
|
|
// Which allows the tengo library to use custom extension names for the
|
|
// source files.
|
|
//
|
|
// This test should pass if the interpreter's tengo.Compiler.SetImportExt()
|
|
// was set as `c.SetImportExt(".tengo", ".mshk")`.
|
|
|
|
os := import("os")
|
|
uno := import("uno") // it will search uno.tengo and uno.mshk
|
|
fmt := import("fmt")
|
|
text := import("text")
|
|
|
|
expected := ["test", "uno", "dos", "tres", "quatro", "cinco"]
|
|
expected = text.join(expected, " ")
|
|
if v := uno.fn("test"); v != expected {
|
|
fmt.printf("relative import test error:\n\texpected: %v\n\tgot : %v\n",
|
|
expected, v)
|
|
os.exit(1)
|
|
}
|
|
|
|
args := text.join(os.args(), " ")
|
|
fmt.println("ok\t", args)
|