Test.hx 471 B

12345678910111213141516171819
  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", ["-dce", "full", "-x", "Main.hx"]);
  8. var stderr = proc.stderr.readAll().toString();
  9. var exit = proc.exitCode();
  10. if (exit != 0) {
  11. error(stderr, exit);
  12. } else {
  13. var stdout = proc.stdout.readAll().toString();
  14. if (stdout.indexOf("aaa") == -1)
  15. error("toString NOT kept\n", 1);
  16. }
  17. }
  18. }