<commit_before>package mobi.hsz.idea.gitignore.completion;

import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
import mobi.hsz.idea.gitignore.file.GitignoreFileType;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;

public class CompletionTest extends LightPlatformCodeInsightFixtureTestCase {
    public void testSimple() {
        myFixture.getTempDirFixture().createFile("fileName.txt");
        doTest("fileN<caret>", "fileName.txt<caret>");
    }

    public void testCurrentDirectoryAlias() throws IOException {
        myFixture.getTempDirFixture().createFile("fileName.txt");
        doTest("./fileN<caret>", "./fileName.txt<caret>");
    }

    public void testNestedDirectory() throws IOException {
        myFixture.getTempDirFixture().findOrCreateDir("dir").createChildData(this, "fileName.txt");
        doTest("dir/fileN<caret>", "dir/fileName.txt<caret>");
    }

    public void testInHiddenDirectory() throws IOException {
        myFixture.getTempDirFixture().findOrCreateDir(".hidden").createChildData(this, "fileName.txt");
        doTest(".hidden/fileN<caret>", ".hidden/fileName.txt<caret>");
    }

    private void doTest(@NotNull String beforeText, @NotNull String afterText) {
        myFixture.configureByText(GitignoreFileType.INSTANCE, beforeText);
        myFixture.completeBasic();
        myFixture.checkResult(afterText);
    }
}
<commit_msg>Test completion with glob<commit_after>package mobi.hsz.idea.gitignore.completion;

import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
import mobi.hsz.idea.gitignore.file.GitignoreFileType;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;

public class CompletionTest extends LightPlatformCodeInsightFixtureTestCase {
    public void testSimple() {
        myFixture.getTempDirFixture().createFile("fileName.txt");
        doTest("fileN<caret>", "fileName.txt<caret>");
    }

    public void testCurrentDirectoryAlias() throws IOException {
        myFixture.getTempDirFixture().createFile("fileName.txt");
        doTest("./fileN<caret>", "./fileName.txt<caret>");
    }

    public void testNestedDirectory() throws IOException {
        myFixture.getTempDirFixture().findOrCreateDir("dir").createChildData(this, "fileName.txt");
        doTest("dir/fileN<caret>", "dir/fileName.txt<caret>");
    }

    public void testInHiddenDirectory() throws IOException {
        myFixture.getTempDirFixture().findOrCreateDir(".hidden").createChildData(this, "fileName.txt");
        doTest(".hidden/fileN<caret>", ".hidden/fileName.txt<caret>");
    }
        
    public void testInGlobDirectory() throws IOException {
        myFixture.getTempDirFixture().findOrCreateDir("glob1").createChildData(this, "fileName1.txt");
        myFixture.getTempDirFixture().findOrCreateDir("glob2").createChildData(this, "fileName2.txt");
        doTestVariants("*/fileN<caret>", "fileName1.txt", "fileName2.txt");
    }

    private void doTest(@NotNull String beforeText, @NotNull String afterText) {
        myFixture.configureByText(GitignoreFileType.INSTANCE, beforeText);
        myFixture.completeBasic();
        myFixture.checkResult(afterText);
    }
    
    private void doTestVariants(@NotNull String beforeText, String... variants) {
        myFixture.configureByText(GitignoreFileType.INSTANCE, beforeText);
        myFixture.completeBasic();
        assertContainsElements(myFixture.getLookupElementStrings(), variants);
    }
}

{'fraction_non_alphanumeric': 0.12507122507122506, 'fraction_numerical': 0.0017094017094017094, 'mean_word_length': 4.468847352024922, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5136736', 'n_tokens_mistral': 1025, 'n_tokens_neox': 1023, 'n_words': 145}