Skip to content

Commit

Permalink
[tests] Add test for 11695
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Jul 3, 2024
1 parent 7d9cad3 commit ac735ed
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/server/src/cases/issues/Issue11695.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package cases.issues;

class Issue11695 extends TestCase {
function test(_) {
vfs.putContent("Main.hx", getTemplate("issues/Issue11695/Main.hx"));
vfs.putContent("Macro.hx", getTemplate("issues/Issue11695/Macro1.hx"));
var args = ["-main", "Main", "--interp"];
runHaxe(args);
assertHasPrint("Macro.hx:1: before");

// Note: this is needed because modification time is currently checked with second precision
Sys.sleep(1);

vfs.putContent("Macro.hx", getTemplate("issues/Issue11695/Macro2.hx"));
runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Macro.hx")}, res -> {
Assert.equals(0, res.length);
});

runHaxe(args);
assertHasPrint("Macro.hx:1: after");
}

function testLegacyDiagnostics(_) {
vfs.putContent("Main.hx", getTemplate("issues/Issue11695/Main.hx"));
vfs.putContent("Macro.hx", getTemplate("issues/Issue11695/Macro1.hx"));
var args = ["-main", "Main", "--interp"];
runHaxe(args);
assertHasPrint("Macro.hx:1: before");

// Note: this is needed because modification time is currently checked with second precision
Sys.sleep(1);

vfs.putContent("Macro.hx", getTemplate("issues/Issue11695/Macro2.hx"));
runHaxe(args.concat(["--display", "Macro.hx@0@diagnostics"]));

runHaxe(args);
assertHasPrint("Macro.hx:1: after");
}
}
1 change: 1 addition & 0 deletions tests/server/test/templates/issues/Issue11695/Macro1.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
macro function test() return macro trace("before");
1 change: 1 addition & 0 deletions tests/server/test/templates/issues/Issue11695/Macro2.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
macro function test() return macro trace("after");
3 changes: 3 additions & 0 deletions tests/server/test/templates/issues/Issue11695/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function main() {
Macro.test();
}

0 comments on commit ac735ed

Please sign in to comment.