|
@@ -97,7 +97,9 @@ class ServerTests extends TestCase {
|
|
var args = ["-main", "BrokenSyntax.hx", "--interp", "--no-output"];
|
|
var args = ["-main", "BrokenSyntax.hx", "--interp", "--no-output"];
|
|
runHaxe(args);
|
|
runHaxe(args);
|
|
assertErrorMessage("Expected }");
|
|
assertErrorMessage("Expected }");
|
|
- runHaxe(args.concat(["--display", "Empty.hx@0@diagnostics"]));
|
|
|
|
|
|
+ runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Empty.hx")}, res -> {
|
|
|
|
+ Assert.equals(0, res.length);
|
|
|
|
+ });
|
|
runHaxe(args);
|
|
runHaxe(args);
|
|
assertErrorMessage("Expected }");
|
|
assertErrorMessage("Expected }");
|
|
}
|
|
}
|
|
@@ -143,6 +145,53 @@ class ServerTests extends TestCase {
|
|
assertSuccess();
|
|
assertSuccess();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function testDiagnosticsFileContents() {
|
|
|
|
+ vfs.putContent("Main.hx", getTemplate("issues/Issue9134/Main.hx"));
|
|
|
|
+ vfs.putContent("Other.hx", getTemplate("issues/Issue9134/Other.hx"));
|
|
|
|
+ var args = ["-main", "Main", "Other"];
|
|
|
|
+
|
|
|
|
+ runHaxeJsonCb(args, DisplayMethods.Diagnostics, {fileContents: [
|
|
|
|
+ {file: new FsPath("Other.hx")},
|
|
|
|
+ {file: new FsPath("Main.hx")},
|
|
|
|
+ ]}, res -> {
|
|
|
|
+ Assert.equals(1, res.length);
|
|
|
|
+ Assert.equals(1, res[0].diagnostics.length);
|
|
|
|
+ var arg = res[0].diagnostics[0].args;
|
|
|
|
+ Assert.equals("Unused variable", (cast arg).description);
|
|
|
|
+ Assert.stringContains("Main.hx", res[0].file.toString());
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Main.hx")});
|
|
|
|
+ runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Other.hx")});
|
|
|
|
+
|
|
|
|
+ runHaxeJsonCb(args, DisplayMethods.Diagnostics, {fileContents: [
|
|
|
|
+ {file: new FsPath("Main.hx"), contents: getTemplate("issues/Issue9134/Main2.hx")},
|
|
|
|
+ {file: new FsPath("Other.hx"), contents: getTemplate("issues/Issue9134/Other2.hx")}
|
|
|
|
+ ]}, res -> {
|
|
|
|
+ Assert.equals(1, res.length);
|
|
|
|
+ Assert.equals(1, res[0].diagnostics.length);
|
|
|
|
+ var arg = res[0].diagnostics[0].args;
|
|
|
|
+ Assert.equals("Unused variable", (cast arg).description);
|
|
|
|
+ Assert.stringContains("Other.hx", res[0].file.toString());
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Main.hx")});
|
|
|
|
+ runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Other.hx")});
|
|
|
|
+
|
|
|
|
+ runHaxeJsonCb(args, DisplayMethods.Diagnostics, {fileContents: [
|
|
|
|
+ {file: new FsPath("Main.hx"), contents: getTemplate("issues/Issue9134/Main.hx")},
|
|
|
|
+ {file: new FsPath("Other.hx"), contents: getTemplate("issues/Issue9134/Other2.hx")}
|
|
|
|
+ ]}, res -> {
|
|
|
|
+ Assert.equals(2, res.length);
|
|
|
|
+
|
|
|
|
+ for (i in 0...2) {
|
|
|
|
+ Assert.equals(1, res[i].diagnostics.length);
|
|
|
|
+ var arg = res[i].diagnostics[0].args;
|
|
|
|
+ Assert.equals("Unused variable", (cast arg).description);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
function testDiagnosticsRecache() {
|
|
function testDiagnosticsRecache() {
|
|
vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
|
|
vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
|
|
var args = ["--main", "HelloWorld", "--interp"];
|
|
var args = ["--main", "HelloWorld", "--interp"];
|
|
@@ -152,7 +201,9 @@ class ServerTests extends TestCase {
|
|
runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("HelloWorld.hx")});
|
|
runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("HelloWorld.hx")});
|
|
runHaxe(args);
|
|
runHaxe(args);
|
|
assertSkipping("HelloWorld", Tainted("server/invalidate"));
|
|
assertSkipping("HelloWorld", Tainted("server/invalidate"));
|
|
- runHaxe(args.concat(["--display", "HelloWorld.hx@0@diagnostics"]));
|
|
|
|
|
|
+ runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("HelloWorld.hx")}, res -> {
|
|
|
|
+ Assert.equals(0, res.length);
|
|
|
|
+ });
|
|
runHaxe(args);
|
|
runHaxe(args);
|
|
assertReuse("HelloWorld");
|
|
assertReuse("HelloWorld");
|
|
}
|
|
}
|
|
@@ -160,7 +211,9 @@ class ServerTests extends TestCase {
|
|
function testDiagnosticsRecache2() {
|
|
function testDiagnosticsRecache2() {
|
|
vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
|
|
vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
|
|
var args = ["--main", "HelloWorld", "--interp"];
|
|
var args = ["--main", "HelloWorld", "--interp"];
|
|
- runHaxe(args.concat(["--display", "HelloWorld.hx@0@diagnostics"]));
|
|
|
|
|
|
+ runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("HelloWorld.hx")}, res -> {
|
|
|
|
+ Assert.equals(0, res.length);
|
|
|
|
+ });
|
|
runHaxe(args);
|
|
runHaxe(args);
|
|
assertReuse("HelloWorld");
|
|
assertReuse("HelloWorld");
|
|
}
|
|
}
|
|
@@ -172,7 +225,9 @@ class ServerTests extends TestCase {
|
|
runHaxe(args);
|
|
runHaxe(args);
|
|
assertReuse("HelloWorld");
|
|
assertReuse("HelloWorld");
|
|
runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("HelloWorld.hx")});
|
|
runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("HelloWorld.hx")});
|
|
- runHaxe(args.concat(["--display", "HelloWorld.hx@0@diagnostics"]));
|
|
|
|
|
|
+ runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("HelloWorld.hx")}, res -> {
|
|
|
|
+ Assert.equals(0, res.length);
|
|
|
|
+ });
|
|
runHaxe(args.concat(["--display", "HelloWorld.hx@0@hover"]));
|
|
runHaxe(args.concat(["--display", "HelloWorld.hx@0@hover"]));
|
|
assertReuse("HelloWorld");
|
|
assertReuse("HelloWorld");
|
|
}
|
|
}
|