test.mshk 758 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env tengo
  2. // This is a test of custom extension for issue #286 and PR #350.
  3. // Which allows the tengo library to use custom extension names for the
  4. // source files.
  5. //
  6. // This test should pass if the interpreter's tengo.Compiler.SetImportExt()
  7. // was set as `c.SetImportExt(".tengo", ".mshk")`.
  8. os := import("os")
  9. uno := import("uno") // it will search uno.tengo and uno.mshk
  10. fmt := import("fmt")
  11. text := import("text")
  12. expected := ["test", "uno", "dos", "tres", "quatro", "cinco"]
  13. expected = text.join(expected, " ")
  14. if v := uno.fn("test"); v != expected {
  15. fmt.printf("relative import test error:\n\texpected: %v\n\tgot : %v\n",
  16. expected, v)
  17. os.exit(1)
  18. }
  19. args := text.join(os.args(), " ")
  20. fmt.println("ok\t", args)