@Override protected void tearDown() throws Exception { myProjectDir = null; super.tearDown(); }
private void doHighlightingTest(long expectation) { PlatformTestUtil.startPerformanceTest(getTestName(true), (int)expectation, () -> myFixture.testHighlighting(true, false, false, getTestName(true) + ".go")).cpuBound().usesAllCPUCores().assertTiming(); }
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(); }
private void doInspectionTest(@NotNull InspectionProfileEntry tool, long expected) { VirtualFile sourceDir = installTestData("docker"); if (sourceDir == null) return; //noinspection ConstantConditions AnalysisScope scope = new AnalysisScope(getPsiManager().findDirectory(sourceDir)); scope.invalidate(); InspectionManagerEx inspectionManager = (InspectionManagerEx)InspectionManager.getInstance(getProject()); InspectionToolWrapper wrapper = InspectionToolRegistrar.wrapTool(tool); GlobalInspectionContextForTests globalContext = CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, getProject(), inspectionManager, wrapper); PlatformTestUtil.startPerformanceTest(getTestName(true), (int)expected, () -> InspectionTestUtil.runTool(wrapper, scope, globalContext)).cpuBound().usesAllCPUCores().assertTiming(); InspectionTestUtil.compareToolResults(globalContext, wrapper, false, new File(getTestDataPath(), wrapper.getShortName()).getPath()); }
private void safeEdt(@NotNull ThrowableRunnable<Throwable> r) { if (runInDispatchThread()) { TestRunnerUtil.replaceIdeEventQueueSafely(); EdtTestUtil.runInEdtAndWait(r); } else { try { r.run(); } catch (Throwable t) { throw new RuntimeException(t); } } } }
@Override protected void setUp() throws Exception { super.setUp(); setProjectSdkFromEbinDirectory(); }
public void testNoDuplicates() { doTestInclude("package foo; type a struct {<caret>", "a"); List<String> stringList = myFixture.getLookupElementStrings(); assertNotNull(stringList); assertSize(1, ContainerUtil.filter(stringList, new TreePrintCondition.Include("a"))); }
@Override protected void doTest(boolean checkErrors) { super.doTest(true); if (checkErrors) { assertFalse( "PsiFile contains error elements", toParseTreeText(myFile, skipSpaces(), includeRanges()).contains("PsiErrorElement") ); } }
public void testSingletonAppEngineSdkPath() { setIsWindows(false); String sdkPath = createDir("goroot/", "goapp").getAbsolutePath(); PlatformTestUtil.assertPathsEqual(sdkPath + "/goapp", executable(sdkPath + "/goroot")); }
public void testQuote() { PlatformTestUtil.withEncoding(CharsetToolkit.UTF8, () -> { GoStringLiteral expr = createStringFromText("import \\\"fmt\\\""); assertNotNull(expr); assertEquals("\"fmt\"", decodeRange(expr, TextRange.create(8, 15))); }); }
@Override protected void setUp() throws Exception { super.setUp(); CoreApplicationEnvironment.registerExtensionPoint( Extensions.getRootArea(), "com.intellij.lang.braceMatcher", LanguageExtensionPoint.class); } }
@Override protected void doTest(boolean checkErrors) { super.doTest(true); if (checkErrors) { assertFalse( "PsiFile contains error elements", toParseTreeText(myFile, skipSpaces(), includeRanges()).contains("PsiErrorElement") ); } }
public void testGcloudAppEngineSdkPathWindows() { setIsWindows(true); String sdkPath = createDir("platform/google_appengine/goroot/", "bin/goapp.cmd").getAbsolutePath(); PlatformTestUtil.assertPathsEqual(sdkPath + "/bin/goapp.cmd", executable(sdkPath + "/platform/google_appengine/goroot")); }
public void testDecodeLongUnicodeCharString() { PlatformTestUtil.withEncoding(CharsetToolkit.UTF8, () -> { GoStringLiteral expr = createStringFromText("\\U00008a9e"); assertNotNull(expr); String a = decodeRange(expr, TextRange.create(1, 11)); assertEquals("語", a); }); }
public void testGcloudAppEngineSdkPath() { setIsWindows(false); String sdkPath = createDir("platform/google_appengine/goroot/", "bin/goapp").getAbsolutePath(); PlatformTestUtil.assertPathsEqual(sdkPath + "/bin/goapp", executable(sdkPath + "/platform/google_appengine/goroot")); }
public void testSingletonAppEngineSdkPathWindows() { setIsWindows(true); String sdkPath = createDir("goroot/", "goapp.bat").getAbsolutePath(); PlatformTestUtil.assertPathsEqual(sdkPath + "/goapp.bat", executable(sdkPath + "/goroot")); }
public void testRegularSdkPath() { setIsWindows(false); setIsLinux(false); PlatformTestUtil.assertPathsEqual("/path/to/sdk/bin/go", executable("/path/to/sdk")); }
public void testRegularSdkPathWindows() { setIsWindows(true); setIsLinux(false); String sdkPath = createDir("platform/google_appengine/goroot/", "bin/goapp").getAbsolutePath(); PlatformTestUtil.assertPathsEqual(sdkPath + "/bin/go.exe", executable(sdkPath)); }
public void testRegularSdkPathWithGorootName() { setIsWindows(false); setIsLinux(false); String sdkPath = createDir("goroot/").getAbsolutePath(); PlatformTestUtil.assertPathsEqual(sdkPath + "/goroot/bin/go", executable(sdkPath + "/goroot")); }