Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-03-22 21:48:22 -0500
committerpelder2006-03-22 21:48:22 -0500
commit3e7e12643751f1c62d814eb4a3017e0c9dc16212 (patch)
tree08b542a685b773eea10f9732046103705532da2d /tests/org.eclipse.jet.tests
parenteda319e7e116d647fa944d5d4de14917dcf9ccec (diff)
downloadorg.eclipse.jet-3e7e12643751f1c62d814eb4a3017e0c9dc16212.tar.gz
org.eclipse.jet-3e7e12643751f1c62d814eb4a3017e0c9dc16212.tar.xz
org.eclipse.jet-3e7e12643751f1c62d814eb4a3017e0c9dc16212.zip
Implement a subset of the APIs needed for 131192.
Diffstat (limited to 'tests/org.eclipse.jet.tests')
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java16
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/runtime/AllTests.java1
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/runtime/TestBundleDescriptions.java38
3 files changed, 55 insertions, 0 deletions
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java
index 6f60af4..79f3ad8 100644
--- a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java
@@ -24,6 +24,7 @@ import org.eclipse.jet.compiler.XMLBodyElement;
import org.eclipse.jet.compiler.XMLBodyElementEnd;
import org.eclipse.jet.compiler.XMLEmptyElement;
import org.eclipse.jet.internal.compiler.templates.JET2JavaGenerator;
+import org.eclipse.jet.taglib.TagLibraryReference;
import org.eclipse.jet.tests.FileUtils;
public class TestJET2Parser extends TestCase {
@@ -213,6 +214,21 @@ public class TestJET2Parser extends TestCase {
}
+ public void testCompilationUnit_getTagLibraryReferences() throws Exception {
+ String urlString = "platform:/plugin/org.eclipse.jet.tests/data/taglibs.jet";
+
+ InputStream is = getFileContentsAsStream(urlString);
+
+ JET2CompilationUnit cu = new JET2CompilationUnit();
+ cu.parse(is, "UTF-8");
+
+ final TagLibraryReference[] tlRefs = cu.getTagLibraryReferences();
+ assertNotNull(tlRefs);
+ assertEquals(1, tlRefs.length);
+ assertEquals("test", tlRefs[0].getPrefix());
+ assertEquals("org.eclipse.jet.tests.TestLibrary", tlRefs[0].getTagLibraryId());
+ }
+
public void testCodeGen() throws Exception {
// HACK: Disabling this test on Unix/Linux/Mac until uniform treatment of
// line separators in generated code is handled.
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/runtime/AllTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/runtime/AllTests.java
index 0debdf6..d2e7fe9 100644
--- a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/runtime/AllTests.java
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/runtime/AllTests.java
@@ -9,6 +9,7 @@ public class AllTests {
TestSuite suite = new TestSuite(
"Test for org.eclipse.jet.tests.runtime");
//$JUnit-BEGIN$
+ suite.addTestSuite(TestBundleDescriptions.class);
suite.addTestSuite(TestBundleLoading.class);
//$JUnit-END$
return suite;
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/runtime/TestBundleDescriptions.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/runtime/TestBundleDescriptions.java
new file mode 100644
index 0000000..25b77d1
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/runtime/TestBundleDescriptions.java
@@ -0,0 +1,38 @@
+package org.eclipse.jet.tests.runtime;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jet.JET2Platform;
+import org.eclipse.jet.taglib.TagLibraryReference;
+import org.eclipse.jet.transform.IJETBundleDescriptor;
+
+public class TestBundleDescriptions extends TestCase {
+
+ public void testGetProjectDescription()
+ {
+ final IStatus result = JET2Platform.execute("org.eclipse.jet.transforms.newproject",
+ "<newProjectModel><project name=\"foo.bar\"/></newProjectModel>",
+ new NullProgressMonitor());
+
+ assertTrue(result.isOK());
+
+ final IJETBundleDescriptor desc = JET2Platform.getProjectDescription("foo.bar");
+ assertNotNull(desc);
+ assertEquals("foo.bar", desc.getId());
+ assertEquals("foo.bar", desc.getName());
+ final TagLibraryReference[] tlRefs = desc.getTagLibraryReferences();
+ assertNotNull(tlRefs);
+ assertEquals(4, tlRefs.length);
+ assertEquals("c", tlRefs[0].getPrefix());
+ assertEquals("f", tlRefs[1].getPrefix());
+ assertEquals("ws", tlRefs[2].getPrefix());
+ assertEquals("java", tlRefs[3].getPrefix());
+ assertEquals("org.eclipse.jet.controlTags", tlRefs[0].getTagLibraryId());
+ assertEquals("org.eclipse.jet.formatTags", tlRefs[1].getTagLibraryId());
+ assertEquals("org.eclipse.jet.workspaceTags", tlRefs[2].getTagLibraryId());
+ assertEquals("org.eclipse.jet.javaTags", tlRefs[3].getTagLibraryId());
+ }
+
+}

Back to the top