use of com.intellij.testFramework.exceptionCases.AssertionErrorCase in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoFindUsageTest method testLoadSdkUsagesForSdkDeclarations.
public void testLoadSdkUsagesForSdkDeclarations() throws Throwable {
myFixture.configureByText("bar.go", "package foo; import `io`; type ReaderWrapper interface{io.Rea<caret>der}");
failOnFileLoading();
assertException(new AssertionErrorCase() {
@Override
public void tryClosure() {
try {
assertSize(5, myFixture.findUsages(myFixture.getElementAtCaret()));
} catch (AssertionError e) {
String message = e.getMessage();
assertTrue(message.contains("Access to tree elements not allowed in tests"));
assertTrue(message.contains("io.go"));
throw e;
}
}
});
}
use of com.intellij.testFramework.exceptionCases.AssertionErrorCase in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoFindUsageTest method testLoadImportedDirectory.
public void testLoadImportedDirectory() throws Throwable {
myFixture.addFileToProject("bar/bar.go", "package bar; import `foo`; func _() { println(CONST_NAME) }");
PsiFile declarationFile = myFixture.addFileToProject("foo/foo.go", "package foo; const CON<caret>ST_NAME = 1;");
myFixture.configureFromExistingVirtualFile(declarationFile.getVirtualFile());
failOnFileLoading();
assertException(new AssertionErrorCase() {
@Override
public void tryClosure() {
try {
assertSize(1, myFixture.findUsages(myFixture.getElementAtCaret()));
} catch (AssertionError e) {
String message = e.getMessage();
assertTrue(message.contains("Access to tree elements not allowed in tests"));
assertTrue(message.contains("bar.go"));
throw e;
}
}
});
}
use of com.intellij.testFramework.exceptionCases.AssertionErrorCase in project intellij-community by JetBrains.
the class TestSuiteStackTest method testPopEmptySuite_DebugMode.
public void testPopEmptySuite_DebugMode() throws Throwable {
// enable debug mode
enableDebugMode();
assertException(new AssertionErrorCase() {
@Override
public void tryClosure() {
myTestSuiteStack.popSuite("some suite");
}
});
}
use of com.intellij.testFramework.exceptionCases.AssertionErrorCase in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoPackageClauseStubTest method testParsingPsi.
public void testParsingPsi() throws Throwable {
GoFile file = (GoFile) myFixture.addFileToProject("bar/bar.go", "package bar; import `foo`; func _() { println(CONST_NAME) }");
failOnFileLoading();
GoPackageClause packageClause = file.getPackage();
assertNotNull(packageClause);
assertException(new AssertionErrorCase() {
@Override
public void tryClosure() {
try {
packageClause.getIdentifier();
} catch (AssertionError e) {
String message = e.getMessage();
assertTrue(message.contains("Access to tree elements not allowed in tests"));
assertTrue(message.contains("bar.go"));
throw e;
}
}
});
}
use of com.intellij.testFramework.exceptionCases.AssertionErrorCase in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoFindUsageTest method testLoadTestDirectoryFromTestFile.
public void testLoadTestDirectoryFromTestFile() throws Throwable {
myFixture.addFileToProject("foo/bar_test.go", "package foo_test; import `foo`; func _() { println(CONST_NAME) }");
PsiFile declarationFile = myFixture.addFileToProject("foo/foo_test.go", "package foo; const CON<caret>ST_NAME = 1;");
myFixture.configureFromExistingVirtualFile(declarationFile.getVirtualFile());
failOnFileLoading();
assertException(new AssertionErrorCase() {
@Override
public void tryClosure() {
try {
myFixture.findUsages(myFixture.getElementAtCaret());
} catch (AssertionError e) {
String message = e.getMessage();
assertTrue(message.contains("Access to tree elements not allowed in tests"));
assertTrue(message.contains("bar_test.go"));
throw e;
}
}
});
}
Aggregations