Search in sources :

Example 61 with IErlProject

use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.

the class ContentAssistTest method includeCompletionTest.

// http://www.assembla.com/spaces/erlide/tickets/947
// completion of include and include_lib
@Test
public void includeCompletionTest() throws Exception {
    ErlideTestUtils.initProjects();
    final String name1 = "testproject1";
    final IErlProject project = ErlideTestUtils.createErlProject(name1);
    try {
        ErlideTestUtils.createInclude(project, "a.hrl", "-define(A, a).\n");
        // check that quotes are added if needed
        completionTest(project, "a.erl", "-include().\n", 9, Lists.newArrayList("\"a.hrl\""), false);
        // check that completion works in strings
        completionTest(project, "b.erl", "-include(\"\").\n", 10, Lists.newArrayList("a.hrl"), true);
    } finally {
        ErlideTestUtils.deleteProjects();
    }
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) Test(org.junit.Test)

Example 62 with IErlProject

use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.

the class ContentAssistTest method moduleCompletion2Test.

@Test
public void moduleCompletion2Test() throws Exception {
    ErlideTestUtils.initProjects();
    final String name1 = "testproject1";
    final IErlProject project = ErlideTestUtils.createErlProject(name1);
    try {
        completionTest(project, "a.erl", "'CosEventChannelAdmin_A", 23, Lists.newArrayList("'CosEventChannelAdmin_AlreadyConnected':"), false);
    } finally {
        ErlideTestUtils.deleteProjects();
    }
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) Test(org.junit.Test)

Example 63 with IErlProject

use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.

the class ContentAssistTest method recordCompletionSingleQuoteTest.

@Test
public void recordCompletionSingleQuoteTest() throws Exception {
    ErlideTestUtils.initProjects();
    final String name1 = "testproject1";
    final IErlProject project = ErlideTestUtils.createErlProject(name1);
    try {
        final String initialText = "-record('AA', {a, b}).\n-record('B', {a, b}).\n" + "-record(ab, {a, b}).\nf() ->\n#'A";
        final int len = initialText.length();
        completionTest(project, "a1.erl", initialText, len - 2, Lists.newArrayList("'AA'", "'B'", "ab"), false);
        completionTest(project, "a2.erl", initialText, len - 1, Lists.newArrayList("'AA'", "'B'"), false);
        completionTest(project, "a3.erl", initialText, len, Lists.newArrayList("'AA'"), false);
    } finally {
        ErlideTestUtils.deleteProjects();
    }
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 64 with IErlProject

use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.

the class ContentAssistTest method caseInsensitiveProposalsTest.

@Test
public void caseInsensitiveProposalsTest() throws Exception {
    ErlideTestUtils.initProjects();
    final String name1 = "testproject1";
    final IErlProject project = ErlideTestUtils.createErlProject(name1);
    try {
        final String initialText1 = "-define(abc,abc).\n-define(aBc, aBc).\nf()->?ab";
        completionTest(project, "w.erl", initialText1, initialText1.length() - 1, Lists.newArrayList("aBc", "abc"), false);
        final String initialText2 = "-define(abc,abc).\n-define(aBc, aBc).\nf()->?aB";
        completionTest(project, "w2.erl", initialText2, initialText2.length(), Lists.newArrayList("aBc", "abc"), false);
    } finally {
        ErlideTestUtils.deleteProjects();
    }
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) Test(org.junit.Test)

Example 65 with IErlProject

use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.

the class ContentAssistTest method moduleCompletionTest.

@Test
public void moduleCompletionTest() throws Exception {
    ErlideTestUtils.initProjects();
    final String name1 = "testproject1";
    final IErlProject project = ErlideTestUtils.createErlProject(name1);
    try {
        final String initialText = "application_";
        completionTest(project, "z.erl", initialText, initialText.length(), Lists.newArrayList("application_controller:", "application_master:", "application_starter:"), false);
    } finally {
        ErlideTestUtils.deleteProjects();
    }
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) Test(org.junit.Test)

Aggregations

IErlProject (org.erlide.engine.model.root.IErlProject)123 IErlModule (org.erlide.engine.model.root.IErlModule)57 Test (org.junit.Test)47 IPath (org.eclipse.core.runtime.IPath)30 IProject (org.eclipse.core.resources.IProject)29 ErlProject (org.erlide.engine.internal.model.root.ErlProject)25 File (java.io.File)19 Path (org.eclipse.core.runtime.Path)16 CoreException (org.eclipse.core.runtime.CoreException)13 ErlModelException (org.erlide.engine.model.ErlModelException)13 IErlElementLocator (org.erlide.engine.model.root.IErlElementLocator)13 IErlModel (org.erlide.engine.model.root.IErlModel)13 ArrayList (java.util.ArrayList)11 IErlElement (org.erlide.engine.model.IErlElement)10 IFile (org.eclipse.core.resources.IFile)9 IResource (org.eclipse.core.resources.IResource)9 HashSet (java.util.HashSet)7 IProjectDescription (org.eclipse.core.resources.IProjectDescription)7 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)6 IErlPreprocessorDef (org.erlide.engine.model.erlang.IErlPreprocessorDef)6