Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Jan 30, 2025
1 parent 4b2fb30 commit b24e5ed
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/display/src/BaseDisplayTestContext.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ using StringTools;
import Types;

class BaseDisplayTestContext {
static var haxeServer = haxeserver.HaxeServerSync.launch("haxe", []);
static var p = new sys.io.Process("haxe", ["--wait", "6566"]);
static var haxeServer = haxeserver.HaxeServerSync.connect("haxe", 6566, []);

var dir:String = ".";
var vfs:Vfs;
Expand Down
8 changes: 7 additions & 1 deletion tests/display/src/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ class Main {
report.displaySuccessResults = NeverShowSuccessResults;

var haxeServer = @:privateAccess BaseDisplayTestContext.haxeServer;

report.setHandler((report) -> {
Sys.println(report.getResults());
haxeServer.close();
@:privateAccess BaseDisplayTestContext.p.kill();
});

Vfs.removeDir('${Sys.getCwd()}/test/cases');
runner.run();
haxeServer.close();
}
}
42 changes: 41 additions & 1 deletion tests/display/src/cases/Issue5172.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ class Issue5172 extends DisplayTestCase {
}
**/
function test() @:privateAccess {
var res = ctx.callDisplay(ServerMethods.Configure, {
print: {
notCached: true,
parsed: true,
reusing: true,
skippingDep: true,
unchangedContent: true,
cachedModules: true,
arguments: true,
completion: true,
defines: true,
signature: true,
displayPosition: true,
message: true,
socketMessage: true,
uncaughtError: true,
newContext: true,
}
}).result;
trace(res);

eq("Int", type(pos(1)));
eq("Int", type(pos(2)));
eq(range(3, 1), position(pos(1)));
Expand All @@ -22,6 +43,25 @@ class Issue5172 extends DisplayTestCase {
trace(cp);
var contexts = ctx.callDisplay(ServerMethods.Contexts, null).result;
for (c in contexts) trace(c);
arrayEq([range(4, 2)], usage(pos(1)));

try {
var res = usage(pos(1));
trace(res);
print();
arrayEq([range(4, 2)], res);
} catch(e) {
trace(e);
print();
}
}

function print() {
var p = @:privateAccess BaseDisplayTestContext.p;
try {
p.kill();
trace(p.stdout.readAll());
} catch(e) {
trace(e);
}
}
}

0 comments on commit b24e5ed

Please sign in to comment.