Skip to content

Commit

Permalink
[tests] check for range too for HaxeFoundation#7282
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz authored and 0b1kn00b committed Jan 25, 2024
1 parent 74d8783 commit d7ee533
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions tests/server/src/cases/issues/Issue7282.hx
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package cases.issues;

import haxe.display.Diagnostic;

class Issue7282 extends TestCase {
function test(_) {
vfs.putContent("Main.hx", getTemplate("issues/Issue7282/Main.hx"));
var content = getTemplate("issues/Issue7282/Main.hx");
var transform = Markers.parse(content);

vfs.putContent("Main.hx", transform.source);
var args = ["-main", "Main"];
runHaxe(args);
assertSuccess();
runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Main.hx")}, res -> {
Assert.equals("Unused variable", (cast res[0].diagnostics[0].args).description);
var arg:ReplacableCode = res[0].diagnostics[0].args;
Assert.equals("Unused variable", arg.description);
Assert.same(transform.range(1,2), res[0].diagnostics[0].range);
Assert.same(transform.range(1,2), arg.range);
});
}
}
2 changes: 1 addition & 1 deletion tests/server/test/templates/issues/Issue7282/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import haxe.ds.Option;
class Main {
public static function main() {
switch ((null:Option<Int>)) {
case Some(value):
case Some({-1-}value{-2-}):
case None:
}
}
Expand Down

0 comments on commit d7ee533

Please sign in to comment.