Test.hx 626 B

12345678910111213141516171819202122
  1. class Test {
  2. static function error(msg, code) {
  3. Sys.stderr().writeString(msg);
  4. Sys.exit(code);
  5. }
  6. static function main() {
  7. var proc = new sys.io.Process("haxe", [
  8. "-js", "out.js",
  9. "--macro", "Include.use()"
  10. ]);
  11. var stderr = proc.stderr.readAll().toString();
  12. var exit = proc.exitCode();
  13. if (exit != 0) {
  14. error(stderr, exit);
  15. } else {
  16. var out = sys.io.File.getContent("out.js");
  17. if (out.indexOf("THIS IS INCLUDED") == -1)
  18. error("File is NOT included\n", 1);
  19. }
  20. }
  21. }