public void testIssue453() { myFixture.configureByFiles("defmodule.ex"); myFixture.complete(CompletionType.BASIC); List<String> strings = myFixture.getLookupElementStrings(); assertNotNull("Completion not shown", strings); assertEquals("Wrong number of completions", 0, strings.size()); }
private void doTestVariantsInner(@NotNull CompletionType type, int count, CheckType checkType, String... variants) { myFixture.complete(type, count); List<String> stringList = myFixture.getLookupElementStrings(); assertNotNull("\nPossibly the single variant has been completed.\nFile after:\n" + myFixture.getFile().getText(), stringList); Collection<String> varList = ContainerUtil.newArrayList(variants); if (checkType == CheckType.ORDERED_EQUALS) { UsefulTestCase.assertOrderedEquals(stringList, variants); } else if (checkType == CheckType.EQUALS) { UsefulTestCase.assertSameElements(stringList, variants); } else if (checkType == CheckType.INCLUDES) { varList.removeAll(stringList); assertTrue("Missing variants: " + varList, varList.isEmpty()); } else if (checkType == CheckType.EXCLUDES) { varList.retainAll(stringList); assertTrue("Unexpected variants: " + varList, varList.isEmpty()); } }
private void doCompletionTest(@NotNull String source, int invocationCount, long expectation) { VirtualFile go = installTestData("go"); if (go == null) return; myFixture.configureByText(GoFileType.INSTANCE, source); PlatformTestUtil.startPerformanceTest(getTestName(true), (int)expectation, () -> myFixture.complete(CompletionType.BASIC, invocationCount)).cpuBound().usesAllCPUCores().assertTiming(); }
public void testPrivateFunction() { myFixture.configureByFiles("private_function_usage.ex", "private_function_declaration.ex"); myFixture.complete(CompletionType.BASIC, 1); List<String> strings = myFixture.getLookupElementStrings(); assertNotNull("Completion lookup not shown", strings); assertCompletion("private_function1", strings); assertCompletion("private_function2", strings); assertEquals("Wrong number of completions", 2, strings.size()); }
public void testPublicFunction() { myFixture.configureByFiles("public_function_usage.ex", "public_function_declaration.ex"); myFixture.complete(CompletionType.BASIC, 1); List<String> strings = myFixture.getLookupElementStrings(); assertNotNull("Completion lookup not shown", strings); assertCompletion("public_function1", strings); assertCompletion("public_function2", strings); assertEquals("Wrong number of completions", 2, strings.size()); }
public void testPrivateMacroFunction() { myFixture.configureByFiles("private_macro_usage.ex", "private_macro_declaration.ex"); myFixture.complete(CompletionType.BASIC, 1); List<String> strings = myFixture.getLookupElementStrings(); assertNotNull("Completion lookup not shown", strings); assertCompletion("private_macro1", strings); assertCompletion("private_macro2", strings); assertEquals("Wrong number of completions", 2, strings.size()); }
public void testPublicMacroFunction() { myFixture.configureByFiles("public_macro_usage.ex", "public_macro_declaration.ex"); myFixture.complete(CompletionType.BASIC, 1); List<String> strings = myFixture.getLookupElementStrings(); assertNotNull("Completion lookup not shown", strings); assertCompletion("public_macro1", strings); assertCompletion("public_macro2", strings); assertEquals("Wrong number of completions", 2, strings.size()); }
public void testMixesWithNestedModules() { myFixture.configureByFiles("mixed_usage.ex", "mixed_declaration.ex"); myFixture.complete(CompletionType.BASIC, 1); List<String> strings = myFixture.getLookupElementStrings(); assertNotNull("Completion lookup not shown", strings); assertCompletion("public_macro", strings); assertCompletion("private_macro", strings); assertCompletion("public_function", strings); assertCompletion("private_function", strings); assertCompletion("MixedDeclaration.Nested", strings); assertCompletion("Prefix.MixedDeclaration.Nested", strings); assertEquals("Wrong number of completions", 6, strings.size()); }
public void testCompletion() { myFixture.configureByFiles("completion.ex", "suffix.ex", "nested.ex"); myFixture.complete(CompletionType.BASIC, 1); List<String> strings = myFixture.getLookupElementStrings(); assertNull("Completion lookup shown", strings); PsiElement autoInsertedLeafElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset() - 1); assertNotNull(autoInsertedLeafElement); assertInstanceOf(autoInsertedLeafElement, LeafPsiElement.class); PsiElement autoInsertedCompositeElement = autoInsertedLeafElement.getParent(); assertInstanceOf(autoInsertedCompositeElement, ElixirAlias.class); assertEquals(autoInsertedCompositeElement.getText(), "Nested"); }
public void complete(@NotNull final String testFileNoExt, @NotNull final Format fileKind) { myCodeInsightFixture.configureByFile(fileKind.getFileNameWithExtension(testFileNoExt)); myCodeInsightFixture.complete(CompletionType.BASIC, 2); if (LookupManager.getActiveLookup(myCodeInsightFixture.getEditor()) != null) { myCodeInsightFixture.type('\n'); } }
public static void doVariantsTestInner(CodeInsightTestFixture fixture, CompletionType type, CheckType checkType, String... variants) { fixture.complete(type, 1); List<String> stringList = fixture.getLookupElementStrings(); assertNotNull(stringList); Collection<String> varList = ContainerUtil.newArrayList(variants); if (checkType == EQUALS) { UsefulTestCase.assertSameElements(stringList, variants); } else if (checkType == INCLUDES) { varList.removeAll(stringList); assertTrue("Missing: " + varList + " in " + stringList, varList.isEmpty()); } else if (checkType == EXCLUDES) { varList.retainAll(stringList); assertTrue("Unexpected: " + varList + " in " + stringList, varList.isEmpty()); } }