Skip to content

Commit

Permalink
[tests] misc tests: ignore position changes for std modules
Browse files Browse the repository at this point in the history
Closes #11539
  • Loading branch information
kLabz committed Feb 3, 2024
1 parent 48b5189 commit 2cecaff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/misc/src/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ class Main {
.filter(s -> 0 != s.indexOf('Picked up JAVA_TOOL_OPTIONS:'))
.join('\n');

content = hideStdPositions(content);
expected = hideStdPositions(expected);

if (StringTools.startsWith(content, '{"jsonrpc":')) {
try {
content = haxe.Json.stringify(haxe.Json.parse(content).result.result);
Expand Down Expand Up @@ -178,6 +181,15 @@ class Main {
return true;
}

static function hideStdPositions(content:String):String {
var std = Path.removeTrailingSlashes(getStd());
var regex = new EReg(std + '([a-z/]+\\.hx):[0-9]+:( characters? [0-9]+(-[0-9]+)( :)?)', 'i');

return content.split("\n")
.map(line -> regex.replace(line, "$1:???:"))
.join("\n");
}

static macro function getStd() {
var std = Compiler.getConfiguration().stdPath;
return macro $v{std.shift()};
Expand Down

0 comments on commit 2cecaff

Please sign in to comment.