@@ -0,0 +1,3383 @@
+package mobi.hsz.idea.gitignore.resolving;%0A%0Aimport com.intellij.openapi.vfs.VfsUtilCore;%0Aimport com.intellij.openapi.vfs.VirtualFile;%0Aimport com.intellij.psi.PsiElement;%0Aimport com.intellij.psi.PsiFileSystemItem;%0Aimport com.intellij.psi.PsiPolyVariantReference;%0Aimport com.intellij.psi.ResolveResult;%0Aimport com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;%0Aimport com.intellij.util.Function;%0Aimport com.intellij.util.containers.ContainerUtil;%0Aimport mobi.hsz.idea.gitignore.file.GitignoreFileType;%0Aimport org.jetbrains.annotations.NotNull;%0A%0Aimport java.io.IOException;%0Aimport java.util.List;%0A%0Apublic class ResolvingTest extends LightPlatformCodeInsightFixtureTestCase %7B%0A    public void testSimple() %7B%0A        myFixture.getTempDirFixture().createFile(%22fileName.txt%22);%0A        doTest(%22fileNa%3Ccaret%3Eme.txt%22, %22fileName.txt%22);%0A    %7D%0A%0A    public void testNestedDirectory() throws IOException %7B%0A        myFixture.getTempDirFixture().findOrCreateDir(%22dir%22).createChildData(this, %22fileName.txt%22);%0A        doTest(%22dir/file%3Ccaret%3EName.txt%22, %22dir/fileName.txt%22);%0A    %7D%0A%0A    public void testInHiddenDirectory() throws IOException %7B%0A        myFixture.getTempDirFixture().findOrCreateDir(%22.hidden%22).createChildData(this, %22fileName.txt%22);%0A        doTest(%22.hidden/file%3Ccaret%3EName.txt%22, %22.hidden/fileName.txt%22);%0A    %7D%0A%0A    public void testGlob() throws IOException %7B%0A        VirtualFile dir = myFixture.getTempDirFixture().findOrCreateDir(%22glob%22);%0A        dir.createChildData(this, %22fileName1.txt%22);%0A        dir.createChildData(this, %22fileName2.txt%22);%0A        doTest(%22glob/*%3Ccaret%3E.txt%22, %22glob/fileName1.txt%22, %22glob/fileName2.txt%22);%0A    %7D%0A%0A    public void testGlobInParent() throws IOException %7B%0A        myFixture.getTempDirFixture().findOrCreateDir(%22glob1%22).createChildData(this, %22fileName.txt%22);%0A        myFixture.getTempDirFixture().findOrCreateDir(%22glob2%22).createChildData(this, %22fileName.txt%22);%0A        doTest(%22*/file%3Ccaret%3EName.txt%22, %22glob1/fileName.txt%22, %22glob2/fileName.txt%22);%0A    %7D%0A%0A    public void testInvalidRegex() throws IOException %7B%0A        myFixture.getTempDirFixture().findOrCreateDir(%22glob%22).createChildData(this, %22fileName1.txt%22);%0A        doTest(%22glob/fileN(%3Ccaret%3E.txt%22);%0A    %7D%0A%0A    private void doTest(@NotNull String beforeText, String... expectedResolve) %7B%0A        myFixture.configureByText(GitignoreFileType.INSTANCE, beforeText);%0A        PsiPolyVariantReference reference = ((PsiPolyVariantReference) myFixture.getReferenceAtCaretPosition());%0A        assertNotNull(reference);%0A%0A        final VirtualFile rootFile = myFixture.getFile().getContainingDirectory().getVirtualFile();%0A        ResolveResult%5B%5D resolveResults = reference.multiResolve(true);%0A        List%3CString%3E actualResolve = ContainerUtil.map(resolveResults, new Function%3CResolveResult, String%3E() %7B%0A            @Override%0A            public String fun(ResolveResult resolveResult) %7B%0A                PsiElement resolveResultElement = resolveResult.getElement();%0A                assertNotNull(resolveResultElement);%0A                assertInstanceOf(resolveResultElement, PsiFileSystemItem.class);%0A                PsiFileSystemItem fileSystemItem = (PsiFileSystemItem) resolveResultElement;%0A                return VfsUtilCore.getRelativePath(fileSystemItem.getVirtualFile(), rootFile, '/');%0A            %7D%0A        %7D);%0A%0A        assertContainsElements(actualResolve, expectedResolve);%0A    %7D%0A%0A%7D%0A

Add resolving tests