Search in sources :

Example 1 with AdditionalInfoFileStub

use of com.python.pydev.analysis.additionalinfo.AdditionalInfoFileStub in project Pydev by fabioz.

the class SearchIndexQueryTest method testSearchQuery.

public void testSearchQuery() throws Exception {
    PySearchIndexQuery query = new PySearchIndexQuery("my");
    String text = "rara\nmy\nnomyno\nmy";
    IDocument doc = new Document(text);
    IFile f = new AdditionalInfoFileStub("stub") {

        @Override
        public long getModificationStamp() {
            return 0;
        }
    };
    AbstractTextSearchResult searchResult = new PySearchResult(null);
    query.createMatches(doc, text, query.createStringMatcher(), f, searchResult, new ModulesKey("my", null));
    assertEquals(2, searchResult.getMatchCount());
}
Also used : IFile(org.eclipse.core.resources.IFile) AdditionalInfoFileStub(com.python.pydev.analysis.additionalinfo.AdditionalInfoFileStub) ModulesKey(org.python.pydev.core.ModulesKey) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) IDocument(org.eclipse.jface.text.IDocument) AbstractTextSearchResult(org.eclipse.search.ui.text.AbstractTextSearchResult)

Example 2 with AdditionalInfoFileStub

use of com.python.pydev.analysis.additionalinfo.AdditionalInfoFileStub in project Pydev by fabioz.

the class SearchIndexQueryTest method testSearchQuery2.

public void testSearchQuery2() throws Exception {
    PySearchIndexQuery query = new PySearchIndexQuery("*my");
    String text = "rara\nmy\nnomyno\nmy";
    IDocument doc = new Document(text);
    IFile f = new AdditionalInfoFileStub("stub") {

        @Override
        public long getModificationStamp() {
            return 0;
        }
    };
    AbstractTextSearchResult searchResult = new PySearchResult(null);
    query.createMatches(doc, text, query.createStringMatcher(), f, searchResult, new ModulesKey("my", null));
    assertEquals(2, searchResult.getMatchCount());
}
Also used : IFile(org.eclipse.core.resources.IFile) AdditionalInfoFileStub(com.python.pydev.analysis.additionalinfo.AdditionalInfoFileStub) ModulesKey(org.python.pydev.core.ModulesKey) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) IDocument(org.eclipse.jface.text.IDocument) AbstractTextSearchResult(org.eclipse.search.ui.text.AbstractTextSearchResult)

Example 3 with AdditionalInfoFileStub

use of com.python.pydev.analysis.additionalinfo.AdditionalInfoFileStub in project Pydev by fabioz.

the class SearchIndexQueryTest method testSearchQuery3.

public void testSearchQuery3() throws Exception {
    PySearchIndexQuery query = new PySearchIndexQuery("*my*");
    String text = "rara\nmy\nnomyno\nmy";
    IDocument doc = new Document(text);
    IFile f = new AdditionalInfoFileStub("stub") {

        @Override
        public long getModificationStamp() {
            return 0;
        }
    };
    AbstractTextSearchResult searchResult = new PySearchResult(null);
    query.createMatches(doc, text, query.createStringMatcher(), f, searchResult, new ModulesKey("my", null));
    assertEquals(3, searchResult.getMatchCount());
}
Also used : IFile(org.eclipse.core.resources.IFile) AdditionalInfoFileStub(com.python.pydev.analysis.additionalinfo.AdditionalInfoFileStub) ModulesKey(org.python.pydev.core.ModulesKey) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) IDocument(org.eclipse.jface.text.IDocument) AbstractTextSearchResult(org.eclipse.search.ui.text.AbstractTextSearchResult)

Aggregations

AdditionalInfoFileStub (com.python.pydev.analysis.additionalinfo.AdditionalInfoFileStub)3 IFile (org.eclipse.core.resources.IFile)3 Document (org.eclipse.jface.text.Document)3 IDocument (org.eclipse.jface.text.IDocument)3 AbstractTextSearchResult (org.eclipse.search.ui.text.AbstractTextSearchResult)3 ModulesKey (org.python.pydev.core.ModulesKey)3