Skip to content

Commit

Permalink
Improve auto-complete for this case #186 : add test
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Apr 29, 2024
1 parent bd86e2c commit 576f0fd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/test/java/intellij_awk/AwkCompletionTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,21 +430,32 @@ public void testLocalVariableInAction3() {
}

public void testGlobalVariableInAction1() {
checkCompletionAuto("{ Xxx=1 } function f(){ Xx<caret> }", "{ Xxx=1 } function f(){ Xxx<caret> }");
checkCompletionAuto(
"{ Xxx=1 } function f(){ Xx<caret> }", "{ Xxx=1 } function f(){ Xxx<caret> }");
}

public void testGlobalVariableInAction2() {
checkCompletionAuto("{ Xxx=1 }\nXx<caret>", "{ Xxx=1 }\nXxx<caret>");
}

public void testGlobalVariableInAction3() {
checkCompletionAuto("/a/{ xxx=1 } /b/{ xx<caret> }", "/a/{ xxx=1 } /b/{ xxx<caret> }");
}

public void testGlobalVariableInAction4() {
checkCompletionAuto("function f(){ Xxx=1 } { Xx<caret> }", "function f(){ Xxx=1 } { Xxx<caret> }");
checkCompletionAuto(
"function f(){ Xxx=1 } { Xx<caret> }", "function f(){ Xxx=1 } { Xxx<caret> }");
}

public void testGlobalVariableInAction5_NotLocal() {
checkCompletionEmpty("function f(Xxx){ Xxx=1 } { Xx<caret> }");
}

public void testMustCompleteInsideEmptySubscript() {
checkCompletion(
Set.of("q1q2q3"), Set.of(), "BEGIN {\n a[<caret>]\n}\n\nfunction q1q2q3() {\n}");
}

private void checkFunctionArgs(String code, String fName, String expectedArgs) {
setupCode(code);
LookupElement[] variants = myFixture.completeBasic();
Expand Down

0 comments on commit 576f0fd

Please sign in to comment.