aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-01-20 07:02:46 (EST)
committersefftinge2009-01-20 07:02:46 (EST)
commit35ff8174fd27f8459cbde2de6c6ae17331f65b34 (patch)
tree65372ccac01b793e72fbecbc4595833b93060cb6
parentdf0431dd1ebf27146bfdc23be4d8c70a0693bab3 (diff)
downloadorg.eclipse.xtext-35ff8174fd27f8459cbde2de6c6ae17331f65b34.zip
org.eclipse.xtext-35ff8174fd27f8459cbde2de6c6ae17331f65b34.tar.gz
org.eclipse.xtext-35ff8174fd27f8459cbde2de6c6ae17331f65b34.tar.bz2
* suppress timestamp in generated antlr parser and lexer
* update org.eclipse.xtext.test.AutoTestSuite
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/AutoTestSuite.java2
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/ChainedIteratorTest.java47
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java97
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/MappingIteratorTest.java65
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java71
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/TuplesTest.java55
6 files changed, 0 insertions, 337 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/AutoTestSuite.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/AutoTestSuite.java
index 0dbabb2..0b13573 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/AutoTestSuite.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/AutoTestSuite.java
@@ -46,8 +46,6 @@ public class AutoTestSuite {
suite.addTestSuite(org.eclipse.xtext.resource.metamodel.TypeHierarchyHelperTests.class);
suite.addTestSuite(org.eclipse.xtext.crossrefs.CrossRefTest.class);
suite.addTestSuite(org.eclipse.xtext.crossrefs.LinkingErrorTest.class);
- suite.addTestSuite(org.eclipse.xtext.util.SimpleCacheTest.class);
- suite.addTestSuite(org.eclipse.xtext.util.FilteringIteratorTest.class);
suite.addTestSuite(org.eclipse.xtext.parser.XtextParserBugsTest.class);
suite.addTestSuite(org.eclipse.xtext.parsetree.transientvalues.TransientValuesTest.class );
suite.addTestSuite(org.eclipse.xtext.parsetree.formatter.FormatterTest.class );
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/ChainedIteratorTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/ChainedIteratorTest.java
deleted file mode 100644
index 4f8b381..0000000
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/ChainedIteratorTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.xtext.util;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-public class ChainedIteratorTest extends TestCase {
-
- public void testSimple() throws Exception {
- ChainedIterator<String> iter = new ChainedIterator<String>(new ChainedIterator<String>(iter("a","b"),iter("c")),iter("d"));
- assertEquals("abcd",concat(iter));
- }
-
- public void testSecondArgNull() throws Exception {
- ChainedIterator<String> iter = new ChainedIterator<String>(new ChainedIterator<String>(iter("a","b"),null),null);
- assertEquals("ab",concat(iter));
- }
-
- public void testFirstArgNull() throws Exception {
- try {
- new ChainedIterator<String>(null, Collections.<String>emptyList().iterator());
- fail("nullpointer exception expected");
- } catch (NullPointerException npe){
- //expected
- }
- }
-
- private String concat(Iterator<String> iter) {
- String r = "";
- while (iter.hasNext())
- r+=iter.next();
- return r;
- }
-
- private Iterator<String> iter(String ... elements) {
- return Arrays.asList(elements).iterator();
- }
-}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java
deleted file mode 100644
index 33c1dad..0000000
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.xtext.util;
-
-import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-/**
- * @author Sebastian Zarnekow - Initial contribution and API
- */
-public class FilteringIteratorTest extends TestCase implements Filter<String> {
-
- private String matchMe;
-
- private List<String> list;
-
- protected void setUp() throws Exception {
- super.setUp();
- matchMe = "matchMe";
- list = new ArrayList<String>();
- }
-
- public boolean matches(String param) {
- return param.equals(matchMe);
- }
-
- public void testEmptyList() {
- Iterator<String> iter = new FilteringIterator<String>(list, this);
- assertFalse(iter.hasNext());
- }
-
- public void testConcurrentModificationException() {
- Iterator<String> iter = new FilteringIterator<String>(list, this);
- list.add("null");
- try {
- iter.hasNext();
- fail("expected exception");
- } catch (ConcurrentModificationException ex) {
- }
- }
-
- public void testRemove() {
- list.add(matchMe);
- Iterator<String> iter = new FilteringIterator<String>(list, this);
- iter.next();
- try {
- iter.remove();
- fail("expected exception");
- } catch (UnsupportedOperationException ex) {
- }
- }
-
- public void testHasNext() {
- list.add("null");
- list.add(matchMe);
- list.add("null");
- Iterator<String> iter = new FilteringIterator<String>(list, this);
- assertTrue(iter.hasNext());
- assertTrue(iter.hasNext());
- assertEquals(matchMe, iter.next());
- assertFalse(iter.hasNext());
- }
-
- public void testNext() {
- list.add("null");
- list.add(matchMe);
- list.add("null");
- list.add(matchMe);
- Iterator<String> iter = new FilteringIterator<String>(list, this);
- assertTrue(iter.hasNext());
- assertEquals(matchMe, iter.next());
- assertTrue(iter.hasNext());
- assertEquals(matchMe, iter.next());
- assertFalse(iter.hasNext());
- }
-
- public void testNextCallsHasNext() {
- list.add("null");
- list.add(matchMe);
- list.add("null");
- list.add(matchMe);
- Iterator<String> iter = new FilteringIterator<String>(list, this);
- assertEquals(matchMe, iter.next());
- assertEquals(matchMe, iter.next());
- assertFalse(iter.hasNext());
- }
-
-}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/MappingIteratorTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/MappingIteratorTest.java
deleted file mode 100644
index bfae0f7..0000000
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/MappingIteratorTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.xtext.util;
-
-import java.util.Arrays;
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-/**
- * @author Sebastian Zarnekow - Initial contribution and API
- */
-public class MappingIteratorTest extends TestCase implements Function<String, String> {
-
- public String exec(String param) {
- return param + "->" + param;
- }
-
- public void testEmptyIter() {
- Iterator<String> iter = createMappingIterator(new String[]{});
- assertFalse(iter.hasNext());
- }
-
- public void testSingleElementIter() {
- Iterator<String> iter = createMappingIterator("a");
- assertTrue(iter.hasNext());
- assertEquals("a->a", iter.next());
- assertFalse(iter.hasNext());
- }
-
- public void testMultiElementIter() {
- Iterator<String> iter = createMappingIterator("a", "b", "c");
- assertEquals("a->a", iter.next());
- assertEquals("b->b", iter.next());
- assertEquals("c->c", iter.next());
- assertFalse(iter.hasNext());
- }
-
- public void testNullIter() {
- try {
- new MappingIterator<String, String>(null, this);
- fail("NPE expected");
- } catch(NullPointerException e) {
- // expected
- }
- }
-
- public void testNullFunction() {
- try {
- new MappingIterator<String, String>(createMappingIterator("a"), null);
- } catch(NullPointerException e) {
- // expected
- }
- }
-
- private Iterator<String> createMappingIterator(String ...strings) {
- return new MappingIterator<String, String>(Arrays.asList(strings).iterator(), this);
- }
-
-}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java
deleted file mode 100644
index bbaa495..0000000
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.xtext.util;
-
-import junit.framework.TestCase;
-
-/**
- * @author Sebastian Zarnekow - Initial contribution and API
- */
-public class SimpleCacheTest extends TestCase implements Function<String, String>{
-
- private SimpleCache<String, String> cache;
-
- private String expectedParam;
-
- private int callCount;
-
- protected void setUp() throws Exception {
- this.cache = new SimpleCache<String, String>(this);
- expectedParam = null;
- callCount = 0;
- }
-
- public String exec(String param) {
- assertEquals(expectedParam, param);
- callCount++;
- return param + param;
- }
-
- public void testInitial() {
- assertEquals(0, cache.getSize());
- }
-
- public void testGet() {
- expectedParam = new String("param"); // is not interned
- String cached = cache.get(expectedParam);
- assertEquals("paramparam", cached);
- assertEquals(1, callCount);
- assertEquals(1, cache.getSize());
- assertSame(cached, cache.get(new String(expectedParam)));
- assertEquals(1, callCount);
- assertEquals(1, cache.getSize());
- }
-
- public void testDiscard() {
- String first = new String("first"); // is not interned
- expectedParam = first;
- cache.get(expectedParam);
- String second = new String("second"); // is not interned
- expectedParam = second;
- cache.get(expectedParam);
- assertEquals(2, cache.getSize());
- cache.discard(expectedParam);
- assertEquals(1, cache.getSize());
- assertFalse(cache.hasCachedValue(expectedParam));
- }
-
- public void testClear() {
- expectedParam = new String("param"); // is not interned
- cache.get(expectedParam);
- assertEquals(1, cache.getSize());
- cache.clear();
- assertEquals(0, cache.getSize());
- }
-
-}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/TuplesTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/TuplesTest.java
deleted file mode 100644
index 3892304..0000000
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/TuplesTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.xtext.util;
-
-import java.util.HashSet;
-
-import junit.framework.TestCase;
-
-public class TuplesTest extends TestCase {
-
- public void testPair() throws Exception {
- Pair<String, String> p1 = Tuples.create("foo", "bar");
- Pair<String, String> p2 = Tuples.create("foo", null);
- Pair<String, String> p3 = Tuples.create(null, "bar");
- Pair<String, String> p4 = Tuples.create("bar", "foo");
- Pair<String, String> p5 = Tuples.create(null,null);
-
- assertEquals(p1, Tuples.create("foo", "bar"));
- assertFalse(p1.equals(p2));
- assertFalse(p1.equals(p3));
- assertFalse(p1.equals(p4));
- assertFalse(p1.equals(p5));
- assertFalse(p1.equals(null));
-
- HashSet<Pair<String, String>> set = new HashSet<Pair<String,String>>();
- set.add(Tuples.create("foo", (String) null));
- assertFalse(set.add(Tuples.create("foo", (String) null)));
- assertTrue(set.add(Tuples.create((String) null,(String) null)));
- }
-
- public void testTriple() throws Exception {
- assertFalse(Tuples.create("foo", "bar", "stuff").equals(Tuples.create("foo", "bar")));
- assertFalse(Tuples.create("foo", "bar").equals(Tuples.create("foo", "bar", "stuff")));
-
- Triple<String, String, String> p1 = Tuples.create("foo", "bar","honk");
- Triple<String, String, String> p2 = Tuples.create("foo", null,"honk");
- Triple<String, String, String> p3 = Tuples.create(null, "bar","honk");
- Triple<String, String, String> p6 = Tuples.create("foo", "bar",null);
- Triple<String, String, String> p4 = Tuples.create("bar", "foo","honk");
- Triple<String, String, String> p5 = Tuples.create(null,null,null);
-
- assertEquals(p1, Tuples.create("foo", "bar","honk"));
- assertFalse(p1.equals(p2));
- assertFalse(p1.equals(p3));
- assertFalse(p1.equals(p4));
- assertFalse(p1.equals(p5));
- assertFalse(p1.equals(p6));
- assertFalse(p1.equals(null));
-
- HashSet<Triple<String, String,String>> set = new HashSet<Triple<String,String,String>>();
- set.add(Tuples.create("foo", (String) null,"bar"));
- assertFalse(set.add(Tuples.create("foo", (String) null,"bar")));
- assertTrue(set.add(Tuples.create((String) null,(String) null,"bar")));
- assertTrue(set.add(Tuples.create((String) null,(String) null, (String)null)));
- assertFalse(set.add(Tuples.create((String) null,(String) null, (String)null)));
- }
-}