com.intellij.testFramework.TestDataFile Java Examples

The following examples show how to use com.intellij.testFramework.TestDataFile. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HaskellParserTestBase.java    From intellij-haskforce with Apache License 2.0 5 votes vote down vote up
@Override
protected void checkResult(@NonNls @TestDataFile String targetDataName,
                           final PsiFile file) throws IOException {
    doCheckResult(myFullDataPath, file, checkAllPsiRoots(),
            "expected" + File.separator + targetDataName, skipSpaces(),
            includeRanges());
}
 
Example #2
Source File: AbstractResolveTest.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
protected PsiFile addFile(@TestDataFile @NonNls String filePath) throws Exception {
    return addFile(filePath, myFile != null ? myFile.getVirtualFile().getParent() : null);
}
 
Example #3
Source File: BashTestUtils.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
@NotNull
public static String loadTestCaseFile(BashTestCase testCase, @TestDataFile String path) throws IOException {
    return FileUtil.loadFile(new File(testCase.getTestDataPath(), path.replace('/', File.separatorChar)), "UTF-8");
}
 
Example #4
Source File: OneFileAtProjectTestCase.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected String loadFile(@NonNls @TestDataFile String name) throws IOException {
  return doLoadFile(myFullDataPath, name);
}
 
Example #5
Source File: OneFileAtProjectTestCase.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected void checkResult(@TestDataFile @NonNls String targetDataName, final String text) throws IOException {
  doCheckResult(myFullDataPath, targetDataName, text);
}
 
Example #6
Source File: ParsingTestCase.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected void checkResult(@NonNls @TestDataFile String targetDataName, final PsiFile file) throws IOException {
  doCheckResult(myFullDataPath, file, checkAllPsiRoots(), targetDataName, skipSpaces(), includeRanges());
}
 
Example #7
Source File: HaskellLightPlatformCodeInsightFixtureTestCase.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
/**
 * Loads the test data file from the right place.
 */
protected String loadFile(@NonNls @TestDataFile String name) throws IOException {
    return doLoadFile(srcPath, name);
}
 
Example #8
Source File: HaskellLexerTestBase.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
/**
 * Loads the test data file from the right place.
 */
protected String loadFile(@NonNls @TestDataFile String name) throws IOException {
    return doLoadFile(srcPath, name);
}
 
Example #9
Source File: LightBashCodeInsightFixtureTestCase.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
public String loadTestDataFile(@TestDataFile String path) throws IOException {
    return BashTestUtils.loadTestCaseFile(this, path);
}
 
Example #10
Source File: AbstractBashPsiTreeTest.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
protected void assertPsiTree(@NotNull String content, @NotNull @TestDataFile String filePath) throws IOException {
    PsiFile psiFile = myFixture.configureByText(BashFileType.BASH_FILE_TYPE, content);
    BashTestUtils.assertPsiTreeByFile(this, psiFile, filePath);
}
 
Example #11
Source File: AbstractResolveTest.java    From BashSupport with Apache License 2.0 3 votes vote down vote up
protected PsiFile addFile(@TestDataFile @NonNls String filePath, @Nullable VirtualFile parentDir) throws Exception {
    final String fullPath = getTestDataPath() + filePath;

    final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/'));
    assertNotNull("file " + filePath + " not found", vFile);

    String fileText = StringUtil.convertLineSeparators(VfsUtil.loadText(vFile));

    return createFile(myModule, parentDir, vFile.getName(), fileText);
}
 
Example #12
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Returns gutter renderer at the caret position.
 * Use {@link #CARET_MARKER} to mark the element to check.
 *
 * @param filePath file path
 * @return gutter renderer at the caret position.
 */
@javax.annotation.Nullable
GutterMark findGutter(@TestDataFile @NonNls String filePath);
 
Example #13
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Launches renaming refactoring and checks the result.
 *
 * @param fileBefore original file path. Use {@link #CARET_MARKER} to mark the element to rename.
 * @param fileAfter result file to be checked against.
 * @param newName new name for the element.
 * @see #testRename(String, String)
 */
void testRename(@TestDataFile @NonNls String fileBefore,
                @TestDataFile @NonNls String fileAfter, @NonNls String newName, final String... additionalFiles);
 
Example #14
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Runs basic completion in caret position in fileBefore.
 * Checks that lookup is shown and it contains items with given lookup strings
 * @param items most probably will contain > 1 items
 */
void testCompletionVariants(@TestDataFile @NonNls String fileBefore, @NonNls String... items);
 
Example #15
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Runs basic completion in caret position in fileBefore.
 * Implies that there is only one completion variant and it was inserted automatically, and checks the result file text with fileAfter
 */
void testCompletion(@TestDataFile @NonNls String fileBefore, @TestDataFile @NonNls String fileAfter, final String... additionalFiles);
 
Example #16
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Finds the reference in position marked by {@link #CARET_MARKER}.
 * Asserts that the reference exists.
 *
 * @return founded reference
 *
 * @see #getReferenceAtCaretPosition(String...)
 */
@Nonnull
PsiReference getReferenceAtCaretPositionWithAssertion(@NonNls @TestDataFile String... filePaths);
 
Example #17
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Finds the reference in position marked by {@link #CARET_MARKER}.
 *
 * @return null if no reference found.
 *
 * @see #getReferenceAtCaretPositionWithAssertion(String...)
 */
@Nullable
PsiReference getReferenceAtCaretPosition(@TestDataFile @NonNls String... filePaths);
 
Example #18
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Runs highlighting test for the given files.
 * The same as {@link #testHighlighting(boolean, boolean, boolean, String...)} with all options set.
 *
 * @param filePaths the first file is tested only; the others are just copied along with the first.
 *
 * @return highlighting duration in milliseconds
 */
long testHighlighting(@TestDataFile @NonNls String... filePaths);
 
Example #19
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Runs highlighting test for the given files.
 * Checks for {@link #ERROR_MARKER} markers by default.
 *
 * @param checkWarnings enables {@link #WARNING_MARKER} support.
 * @param checkInfos enables {@link #INFO_MARKER} support.
 * @param checkWeakWarnings enables {@link #INFORMATION_MARKER} support.
 * @param filePaths the first file is tested only; the others are just copied along the first.
 *
 * @return highlighting duration in milliseconds.
 */
long testHighlighting(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, @TestDataFile @NonNls String... filePaths);
 
Example #20
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Compares a file in the test project with a file in the testdata directory.
 *
 * @param filePath path to file to be checked, relative to the source root of the test project.
 * @param expectedFile path to file to check against, relative to the testdata path.
 * @param ignoreTrailingWhitespaces whether trailing whitespaces should be ignored by the comparison.
 */
void checkResultByFile(@NonNls String filePath, @TestDataFile @NonNls String expectedFile, boolean ignoreTrailingWhitespaces);
 
Example #21
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Compares the contents of the in-memory editor with the specified file, optionally ignoring trailing whitespaces.
 *
 * @param expectedFile path to file to check against, relative to the testdata path.
 * @param ignoreTrailingWhitespaces whether trailing whitespaces should be ignored by the comparison.
 */
void checkResultByFile(@TestDataFile @NonNls String expectedFile, boolean ignoreTrailingWhitespaces);
 
Example #22
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Compares the contents of the in-memory editor with the specified file. The trailing whitespaces are not ignored
 * by the comparison.
 *
 * @param expectedFile path to file to check against, relative to the testdata path.
 */
void checkResultByFile(@TestDataFile @NonNls String expectedFile);
 
Example #23
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Copies multiple files from the testdata directory to the same relative paths in the test project directory
 * and opens the first of them in the in-memory editor.
 *
 * @param filePaths path to the files, relative to the testdata path.
 * @return the PSI files for the copied files.
 */
PsiFile[] configureByFiles(@TestDataFile @NonNls String... filePaths);
 
Example #24
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Copies a file from the testdata directory to the same relative path in the test project directory
 * and opens it in the in-memory editor.
 *
 * @param filePath path to the file, relative to the testdata path.
 * @return the PSI file for the copied and opened file.
 */
PsiFile configureByFile(@TestDataFile @NonNls String filePath);
 
Example #25
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Copies a file from the testdata directory to the same relative path in the test project directory.
 *
 * @return the VirtualFile for the copied file in the test project directory.
 */
VirtualFile copyFileToProject(@TestDataFile @NonNls String sourceFilePath);
 
Example #26
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Copies a file from the testdata directory to the specified path in the test project directory.
 *
 * @param sourceFilePath path to the source file, relative to the testdata path.
 * @param targetPath path to the destination, relative to the source root of the test project.
 * @return the VirtualFile for the copied file in the test project directory.
 */
VirtualFile copyFileToProject(@TestDataFile @NonNls String sourceFilePath, @NonNls String targetPath);
 
Example #27
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 votes vote down vote up
long testHighlightingAllFiles(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, @TestDataFile @NonNls String... filePaths); 
Example #28
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 votes vote down vote up
long testHighlightingAllFiles(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, @TestDataFile @NonNls VirtualFile... files); 
Example #29
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 votes vote down vote up
void testCompletion(@NonNls String[] filesBefore, @TestDataFile @NonNls String fileAfter); 
Example #30
Source File: CodeInsightTestFixture.java    From consulo with Apache License 2.0 votes vote down vote up
void testCompletionTyping(@NonNls String[] filesBefore, String toType, @TestDataFile @NonNls String fileAfter);