You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2017/11/29 16:18:08 UTC
[04/21] ant git commit: Normalise tabulation and line breaks
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java b/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
index 524a187..11491e3 100644
--- a/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
@@ -1,295 +1,295 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class VectorSetTest {
-
- private static final Object O = new Object();
- private VectorSet v = new VectorSet();
-
- @Test
- public void testAdd() {
- assertTrue(v.add(O));
- assertFalse(v.add(O));
- assertEquals(1, v.size());
- }
-
- @Test
- public void testAdd2() {
- v.add(0, O);
- v.add(1, O);
- assertEquals(1, v.size());
- }
-
- @Test
- public void testAddElement() {
- v.addElement(O);
- v.addElement(O);
- assertEquals(1, v.size());
- }
-
- @Test
- public void testAddAll() {
- assertTrue(v.addAll(Arrays.asList(new Object[] {O, O})));
- assertEquals(1, v.size());
- }
-
- @Test
- public void testAddAll2() {
- assertTrue(v.addAll(0, Arrays.asList(new Object[] {O, O})));
- assertEquals(1, v.size());
- }
-
- @Test
- public void testClear() {
- v.add(O);
- v.clear();
- assertEquals(0, v.size());
- }
-
- @Test
- public void testClone() {
- v.add(O);
- Object o = v.clone();
- assertTrue(o instanceof VectorSet);
- VectorSet vs = (VectorSet) o;
- assertEquals(1, vs.size());
- assertTrue(vs.contains(O));
- }
-
- @Test
- public void testContains() {
- assertFalse(v.contains(O));
- v.add(O);
- assertTrue(v.contains(O));
- assertFalse(v.contains(null));
- }
-
- @Test
- public void testContainsAll() {
- assertFalse(v.containsAll(Arrays.asList(new Object[] {O, O})));
- v.add(O);
- assertTrue(v.containsAll(Arrays.asList(new Object[] {O, O})));
- assertFalse(v.containsAll(Arrays.asList(new Object[] {O, null})));
- }
-
- @Test
- public void testInsertElementAt() {
- v.insertElementAt(O, 0);
- v.insertElementAt(O, 1);
- assertEquals(1, v.size());
- }
-
- @Test
- public void testRemoveIndex() {
- v.add(O);
- assertSame(O, v.remove(0));
- assertEquals(0, v.size());
- try {
- v.remove(0);
- fail("expected an AIOBE");
- } catch (ArrayIndexOutOfBoundsException e) {
- //TODO assert exception values
- // expected
- }
- }
-
- @Test
- public void testRemoveObject() {
- v.add(O);
- assertTrue(v.remove(O));
- assertEquals(0, v.size());
- assertFalse(v.remove(O));
- }
-
- @Test
- public void testRemoveAtEndWhenSizeEqualsCapacity() {
- v = new VectorSet(3, 1);
- Object a = new Object();
- v.add(a);
- Object b = new Object();
- v.add(b);
- v.add(O);
- assertEquals(3, v.size());
- assertEquals(3, v.capacity());
- assertTrue(v.remove(O));
- assertEquals(2, v.size());
- assertFalse(v.remove(O));
- assertSame(a, v.elementAt(0));
- assertSame(b, v.elementAt(1));
- }
-
- @Test
- public void testRemoveAtFrontWhenSizeEqualsCapacity() {
- v = new VectorSet(3, 1);
- v.add(O);
- Object a = new Object();
- v.add(a);
- Object b = new Object();
- v.add(b);
- assertEquals(3, v.size());
- assertEquals(3, v.capacity());
- assertTrue(v.remove(O));
- assertEquals(2, v.size());
- assertFalse(v.remove(O));
- assertSame(a, v.elementAt(0));
- assertSame(b, v.elementAt(1));
- }
-
- @Test
- public void testRemoveInMiddleWhenSizeEqualsCapacity() {
- v = new VectorSet(3, 1);
- Object a = new Object();
- v.add(a);
- v.add(O);
- Object b = new Object();
- v.add(b);
- assertEquals(3, v.size());
- assertEquals(3, v.capacity());
- assertTrue(v.remove(O));
- assertEquals(2, v.size());
- assertFalse(v.remove(O));
- assertSame(a, v.elementAt(0));
- assertSame(b, v.elementAt(1));
- }
-
- @Test
- public void testRemoveAll() {
- v.add(O);
- assertTrue(v.removeAll(Arrays.asList(new Object[] {O, O})));
- assertEquals(0, v.size());
- assertFalse(v.removeAll(Arrays.asList(new Object[] {O, O})));
- }
-
- @Test
- public void testRemoveAllElements() {
- v.add(O);
- v.removeAllElements();
- assertEquals(0, v.size());
- }
-
- @Test
- public void testRemoveElement() {
- v.add(O);
- assertTrue(v.removeElement(O));
- assertEquals(0, v.size());
- assertFalse(v.removeElement(O));
- }
-
- @Test
- public void testRemoveElementAt() {
- v.add(O);
- v.removeElementAt(0);
- assertEquals(0, v.size());
- try {
- v.removeElementAt(0);
- fail("expected an AIOBE");
- } catch (ArrayIndexOutOfBoundsException e) {
- //TODO assert exception values
- // expected
- }
- }
-
- @Test
- public void testRemoveRange() {
- Object a = new Object();
- Object b = new Object();
- Object c = new Object();
- v.addAll(Arrays.asList(new Object[] {O, a, b, c}));
- v.removeRange(1, 3);
- assertEquals(2, v.size());
- assertTrue(v.contains(O));
- assertTrue(v.contains(c));
- }
-
- @Test
- public void testRetainAll() {
- Object a = new Object();
- Object b = new Object();
- Object c = new Object();
- v.addAll(Arrays.asList(new Object[] {O, a, b, c}));
- assertEquals(0, v.indexOf(O));
- assertTrue(v.retainAll(Arrays.asList(new Object[] {c, O})));
- assertEquals(2, v.size());
- assertTrue(v.contains(O));
- assertTrue(v.contains(c));
- assertEquals(0, v.indexOf(O));
- }
-
- @Test
- public void testRetainAllReturnValueAndEmptiness() {
- v.add(1);
- v.add(2);
- v.add(3);
- assertTrue(v.retainAll(Arrays.asList(1, 2)));
- assertEquals(2, v.size());
- assertFalse(v.retainAll(Arrays.asList(1, 2)));
- assertEquals(2, v.size());
- assertTrue(v.retainAll(Arrays.asList(4, 5)));
- assertEquals(0, v.size());
- assertFalse(v.retainAll(Arrays.asList(4, 5)));
- }
-
- @Test
- public void testSet() {
- v.add(O);
- Object a = new Object();
- assertSame(O, v.set(0, a));
- assertSame(a, v.get(0));
- assertEquals(1, v.size());
- }
-
- @Test
- public void testSetElementAt() {
- v.add(O);
- Object a = new Object();
- v.setElementAt(a, 0);
- assertSame(a, v.get(0));
- assertEquals(1, v.size());
- }
-
- @Test
- public void testRetainAllSpeed() {
- int size = 50000;
- for (int i = 0; i < size; i++) {
- v.add(i);
- v.add(i);
- }
- assertEquals(size, v.size());
- ArrayList<Integer> list = new ArrayList<Integer>();
- for (int i = size - 4; i < 2 * size; i++) {
- list.add(i);
- v.add(i);
- }
- assertTrue(v.retainAll(list));
- assertEquals(v.toString(), size + 4, v.size());
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public class VectorSetTest {
+
+ private static final Object O = new Object();
+ private VectorSet v = new VectorSet();
+
+ @Test
+ public void testAdd() {
+ assertTrue(v.add(O));
+ assertFalse(v.add(O));
+ assertEquals(1, v.size());
+ }
+
+ @Test
+ public void testAdd2() {
+ v.add(0, O);
+ v.add(1, O);
+ assertEquals(1, v.size());
+ }
+
+ @Test
+ public void testAddElement() {
+ v.addElement(O);
+ v.addElement(O);
+ assertEquals(1, v.size());
+ }
+
+ @Test
+ public void testAddAll() {
+ assertTrue(v.addAll(Arrays.asList(new Object[] {O, O})));
+ assertEquals(1, v.size());
+ }
+
+ @Test
+ public void testAddAll2() {
+ assertTrue(v.addAll(0, Arrays.asList(new Object[] {O, O})));
+ assertEquals(1, v.size());
+ }
+
+ @Test
+ public void testClear() {
+ v.add(O);
+ v.clear();
+ assertEquals(0, v.size());
+ }
+
+ @Test
+ public void testClone() {
+ v.add(O);
+ Object o = v.clone();
+ assertTrue(o instanceof VectorSet);
+ VectorSet vs = (VectorSet) o;
+ assertEquals(1, vs.size());
+ assertTrue(vs.contains(O));
+ }
+
+ @Test
+ public void testContains() {
+ assertFalse(v.contains(O));
+ v.add(O);
+ assertTrue(v.contains(O));
+ assertFalse(v.contains(null));
+ }
+
+ @Test
+ public void testContainsAll() {
+ assertFalse(v.containsAll(Arrays.asList(new Object[] {O, O})));
+ v.add(O);
+ assertTrue(v.containsAll(Arrays.asList(new Object[] {O, O})));
+ assertFalse(v.containsAll(Arrays.asList(new Object[] {O, null})));
+ }
+
+ @Test
+ public void testInsertElementAt() {
+ v.insertElementAt(O, 0);
+ v.insertElementAt(O, 1);
+ assertEquals(1, v.size());
+ }
+
+ @Test
+ public void testRemoveIndex() {
+ v.add(O);
+ assertSame(O, v.remove(0));
+ assertEquals(0, v.size());
+ try {
+ v.remove(0);
+ fail("expected an AIOBE");
+ } catch (ArrayIndexOutOfBoundsException e) {
+ //TODO assert exception values
+ // expected
+ }
+ }
+
+ @Test
+ public void testRemoveObject() {
+ v.add(O);
+ assertTrue(v.remove(O));
+ assertEquals(0, v.size());
+ assertFalse(v.remove(O));
+ }
+
+ @Test
+ public void testRemoveAtEndWhenSizeEqualsCapacity() {
+ v = new VectorSet(3, 1);
+ Object a = new Object();
+ v.add(a);
+ Object b = new Object();
+ v.add(b);
+ v.add(O);
+ assertEquals(3, v.size());
+ assertEquals(3, v.capacity());
+ assertTrue(v.remove(O));
+ assertEquals(2, v.size());
+ assertFalse(v.remove(O));
+ assertSame(a, v.elementAt(0));
+ assertSame(b, v.elementAt(1));
+ }
+
+ @Test
+ public void testRemoveAtFrontWhenSizeEqualsCapacity() {
+ v = new VectorSet(3, 1);
+ v.add(O);
+ Object a = new Object();
+ v.add(a);
+ Object b = new Object();
+ v.add(b);
+ assertEquals(3, v.size());
+ assertEquals(3, v.capacity());
+ assertTrue(v.remove(O));
+ assertEquals(2, v.size());
+ assertFalse(v.remove(O));
+ assertSame(a, v.elementAt(0));
+ assertSame(b, v.elementAt(1));
+ }
+
+ @Test
+ public void testRemoveInMiddleWhenSizeEqualsCapacity() {
+ v = new VectorSet(3, 1);
+ Object a = new Object();
+ v.add(a);
+ v.add(O);
+ Object b = new Object();
+ v.add(b);
+ assertEquals(3, v.size());
+ assertEquals(3, v.capacity());
+ assertTrue(v.remove(O));
+ assertEquals(2, v.size());
+ assertFalse(v.remove(O));
+ assertSame(a, v.elementAt(0));
+ assertSame(b, v.elementAt(1));
+ }
+
+ @Test
+ public void testRemoveAll() {
+ v.add(O);
+ assertTrue(v.removeAll(Arrays.asList(new Object[] {O, O})));
+ assertEquals(0, v.size());
+ assertFalse(v.removeAll(Arrays.asList(new Object[] {O, O})));
+ }
+
+ @Test
+ public void testRemoveAllElements() {
+ v.add(O);
+ v.removeAllElements();
+ assertEquals(0, v.size());
+ }
+
+ @Test
+ public void testRemoveElement() {
+ v.add(O);
+ assertTrue(v.removeElement(O));
+ assertEquals(0, v.size());
+ assertFalse(v.removeElement(O));
+ }
+
+ @Test
+ public void testRemoveElementAt() {
+ v.add(O);
+ v.removeElementAt(0);
+ assertEquals(0, v.size());
+ try {
+ v.removeElementAt(0);
+ fail("expected an AIOBE");
+ } catch (ArrayIndexOutOfBoundsException e) {
+ //TODO assert exception values
+ // expected
+ }
+ }
+
+ @Test
+ public void testRemoveRange() {
+ Object a = new Object();
+ Object b = new Object();
+ Object c = new Object();
+ v.addAll(Arrays.asList(new Object[] {O, a, b, c}));
+ v.removeRange(1, 3);
+ assertEquals(2, v.size());
+ assertTrue(v.contains(O));
+ assertTrue(v.contains(c));
+ }
+
+ @Test
+ public void testRetainAll() {
+ Object a = new Object();
+ Object b = new Object();
+ Object c = new Object();
+ v.addAll(Arrays.asList(new Object[] {O, a, b, c}));
+ assertEquals(0, v.indexOf(O));
+ assertTrue(v.retainAll(Arrays.asList(new Object[] {c, O})));
+ assertEquals(2, v.size());
+ assertTrue(v.contains(O));
+ assertTrue(v.contains(c));
+ assertEquals(0, v.indexOf(O));
+ }
+
+ @Test
+ public void testRetainAllReturnValueAndEmptiness() {
+ v.add(1);
+ v.add(2);
+ v.add(3);
+ assertTrue(v.retainAll(Arrays.asList(1, 2)));
+ assertEquals(2, v.size());
+ assertFalse(v.retainAll(Arrays.asList(1, 2)));
+ assertEquals(2, v.size());
+ assertTrue(v.retainAll(Arrays.asList(4, 5)));
+ assertEquals(0, v.size());
+ assertFalse(v.retainAll(Arrays.asList(4, 5)));
+ }
+
+ @Test
+ public void testSet() {
+ v.add(O);
+ Object a = new Object();
+ assertSame(O, v.set(0, a));
+ assertSame(a, v.get(0));
+ assertEquals(1, v.size());
+ }
+
+ @Test
+ public void testSetElementAt() {
+ v.add(O);
+ Object a = new Object();
+ v.setElementAt(a, 0);
+ assertSame(a, v.get(0));
+ assertEquals(1, v.size());
+ }
+
+ @Test
+ public void testRetainAllSpeed() {
+ int size = 50000;
+ for (int i = 0; i < size; i++) {
+ v.add(i);
+ v.add(i);
+ }
+ assertEquals(size, v.size());
+ ArrayList<Integer> list = new ArrayList<Integer>();
+ for (int i = size - 4; i < 2 * size; i++) {
+ list.add(i);
+ v.add(i);
+ }
+ assertTrue(v.retainAll(list));
+ assertEquals(v.toString(), size + 4, v.size());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java b/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
index 72c42b3..0ac938f 100644
--- a/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
@@ -1,91 +1,91 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class XMLFragmentTest {
-
- @Rule
- public BuildFileRule buildRule = new BuildFileRule();
-
- @Before
- public void setUp() {
- buildRule.configureProject("src/etc/testcases/types/xmlfragment.xml");
- }
-
- @Test
- public void testNestedText() {
- XMLFragment x = (XMLFragment) buildRule.getProject().getReference("nested-text");
- assertNotNull(x);
- Node n = x.getFragment();
- assertTrue("No attributes", !n.hasAttributes());
- NodeList nl = n.getChildNodes();
- assertEquals(1, nl.getLength());
- assertEquals(Node.TEXT_NODE, nl.item(0).getNodeType());
- assertEquals("foo", nl.item(0).getNodeValue());
- }
-
- @Test
- public void testNestedChildren() {
- XMLFragment x =
- (XMLFragment) buildRule.getProject().getReference("with-children");
- assertNotNull(x);
- Node n = x.getFragment();
- assertTrue("No attributes", !n.hasAttributes());
- NodeList nl = n.getChildNodes();
- assertEquals(3, nl.getLength());
-
- assertEquals(Node.ELEMENT_NODE, nl.item(0).getNodeType());
- Element child1 = (Element) nl.item(0);
- assertEquals("child1", child1.getTagName());
- assertTrue(!child1.hasAttributes());
- NodeList nl2 = child1.getChildNodes();
- assertEquals(1, nl2.getLength());
- assertEquals(Node.TEXT_NODE, nl2.item(0).getNodeType());
- assertEquals("foo", nl2.item(0).getNodeValue());
-
- assertEquals(Node.ELEMENT_NODE, nl.item(1).getNodeType());
- Element child2 = (Element) nl.item(1);
- assertEquals("child2", child2.getTagName());
- assertTrue(child2.hasAttributes());
- nl2 = child2.getChildNodes();
- assertEquals(0, nl2.getLength());
- assertEquals("bar", child2.getAttribute("foo"));
-
- assertEquals(Node.ELEMENT_NODE, nl.item(2).getNodeType());
- Element child3 = (Element) nl.item(2);
- assertEquals("child3", child3.getTagName());
- assertTrue(!child3.hasAttributes());
- nl2 = child3.getChildNodes();
- assertEquals(1, nl2.getLength());
- assertEquals(Node.ELEMENT_NODE, nl2.item(0).getNodeType());
- assertEquals("child4", ((Element) nl2.item(0)).getTagName());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class XMLFragmentTest {
+
+ @Rule
+ public BuildFileRule buildRule = new BuildFileRule();
+
+ @Before
+ public void setUp() {
+ buildRule.configureProject("src/etc/testcases/types/xmlfragment.xml");
+ }
+
+ @Test
+ public void testNestedText() {
+ XMLFragment x = (XMLFragment) buildRule.getProject().getReference("nested-text");
+ assertNotNull(x);
+ Node n = x.getFragment();
+ assertTrue("No attributes", !n.hasAttributes());
+ NodeList nl = n.getChildNodes();
+ assertEquals(1, nl.getLength());
+ assertEquals(Node.TEXT_NODE, nl.item(0).getNodeType());
+ assertEquals("foo", nl.item(0).getNodeValue());
+ }
+
+ @Test
+ public void testNestedChildren() {
+ XMLFragment x =
+ (XMLFragment) buildRule.getProject().getReference("with-children");
+ assertNotNull(x);
+ Node n = x.getFragment();
+ assertTrue("No attributes", !n.hasAttributes());
+ NodeList nl = n.getChildNodes();
+ assertEquals(3, nl.getLength());
+
+ assertEquals(Node.ELEMENT_NODE, nl.item(0).getNodeType());
+ Element child1 = (Element) nl.item(0);
+ assertEquals("child1", child1.getTagName());
+ assertTrue(!child1.hasAttributes());
+ NodeList nl2 = child1.getChildNodes();
+ assertEquals(1, nl2.getLength());
+ assertEquals(Node.TEXT_NODE, nl2.item(0).getNodeType());
+ assertEquals("foo", nl2.item(0).getNodeValue());
+
+ assertEquals(Node.ELEMENT_NODE, nl.item(1).getNodeType());
+ Element child2 = (Element) nl.item(1);
+ assertEquals("child2", child2.getTagName());
+ assertTrue(child2.hasAttributes());
+ nl2 = child2.getChildNodes();
+ assertEquals(0, nl2.getLength());
+ assertEquals("bar", child2.getAttribute("foo"));
+
+ assertEquals(Node.ELEMENT_NODE, nl.item(2).getNodeType());
+ Element child3 = (Element) nl.item(2);
+ assertEquals("child3", child3.getTagName());
+ assertTrue(!child3.hasAttributes());
+ nl2 = child3.getChildNodes();
+ assertEquals(1, nl2.getLength());
+ assertEquals(Node.ELEMENT_NODE, nl2.item(0).getNodeType());
+ assertEquals("child4", ((Element) nl2.item(0)).getTagName());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java b/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
index 3377d73..df2d43b 100644
--- a/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
@@ -1,64 +1,64 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.facade;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @since Ant 1.5
- */
-public class FacadeTaskHelperTest {
-
- @Test
- public void testPrecedenceRules() {
- FacadeTaskHelper fth = new FacadeTaskHelper("foo");
- assertEquals("foo", fth.getImplementation());
-
- fth.setMagicValue("bar");
- assertEquals("bar", fth.getImplementation());
-
- fth = new FacadeTaskHelper("foo", "bar");
- assertEquals("bar", fth.getImplementation());
-
- fth = new FacadeTaskHelper("foo", null);
- assertEquals("foo", fth.getImplementation());
-
- fth = new FacadeTaskHelper("foo");
- fth.setMagicValue("bar");
- fth.setImplementation("baz");
- assertEquals("baz", fth.getImplementation());
- }
-
- @Test
- public void testHasBeenSet() {
- FacadeTaskHelper fth = new FacadeTaskHelper("foo");
- assertTrue("nothing set", !fth.hasBeenSet());
- fth.setMagicValue(null);
- assertTrue("magic has not been set", !fth.hasBeenSet());
- fth.setMagicValue("foo");
- assertTrue("magic has been set", fth.hasBeenSet());
- fth.setMagicValue(null);
- assertTrue(!fth.hasBeenSet());
- fth.setImplementation("baz");
- assertTrue("set explicitly", fth.hasBeenSet());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.facade;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @since Ant 1.5
+ */
+public class FacadeTaskHelperTest {
+
+ @Test
+ public void testPrecedenceRules() {
+ FacadeTaskHelper fth = new FacadeTaskHelper("foo");
+ assertEquals("foo", fth.getImplementation());
+
+ fth.setMagicValue("bar");
+ assertEquals("bar", fth.getImplementation());
+
+ fth = new FacadeTaskHelper("foo", "bar");
+ assertEquals("bar", fth.getImplementation());
+
+ fth = new FacadeTaskHelper("foo", null);
+ assertEquals("foo", fth.getImplementation());
+
+ fth = new FacadeTaskHelper("foo");
+ fth.setMagicValue("bar");
+ fth.setImplementation("baz");
+ assertEquals("baz", fth.getImplementation());
+ }
+
+ @Test
+ public void testHasBeenSet() {
+ FacadeTaskHelper fth = new FacadeTaskHelper("foo");
+ assertTrue("nothing set", !fth.hasBeenSet());
+ fth.setMagicValue(null);
+ assertTrue("magic has not been set", !fth.hasBeenSet());
+ fth.setMagicValue("foo");
+ assertTrue("magic has been set", fth.hasBeenSet());
+ fth.setMagicValue(null);
+ assertTrue(!fth.hasBeenSet());
+ fth.setImplementation("baz");
+ assertTrue("set explicitly", fth.hasBeenSet());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java b/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
index 7a678bc..a1b97d1 100644
--- a/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
@@ -1,59 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.facade;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * @since Ant 1.5
- */
-public class ImplementationSpecificArgumentTest {
-
- @Test
- public void testDependsOnImplementation() {
- ImplementationSpecificArgument ia =
- new ImplementationSpecificArgument();
- ia.setLine("A B");
- String[] parts = ia.getParts();
- assertNotNull(parts);
- assertEquals(2, parts.length);
- assertEquals("A", parts[0]);
- assertEquals("B", parts[1]);
-
- parts = ia.getParts(null);
- assertNotNull(parts);
- assertEquals(2, parts.length);
- assertEquals("A", parts[0]);
- assertEquals("B", parts[1]);
-
- ia.setImplementation("foo");
- parts = ia.getParts(null);
- assertNotNull(parts);
- assertEquals(0, parts.length);
-
- parts = ia.getParts("foo");
- assertNotNull(parts);
- assertEquals(2, parts.length);
- assertEquals("A", parts[0]);
- assertEquals("B", parts[1]);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.facade;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * @since Ant 1.5
+ */
+public class ImplementationSpecificArgumentTest {
+
+ @Test
+ public void testDependsOnImplementation() {
+ ImplementationSpecificArgument ia =
+ new ImplementationSpecificArgument();
+ ia.setLine("A B");
+ String[] parts = ia.getParts();
+ assertNotNull(parts);
+ assertEquals(2, parts.length);
+ assertEquals("A", parts[0]);
+ assertEquals("B", parts[1]);
+
+ parts = ia.getParts(null);
+ assertNotNull(parts);
+ assertEquals(2, parts.length);
+ assertEquals("A", parts[0]);
+ assertEquals("B", parts[1]);
+
+ ia.setImplementation("foo");
+ parts = ia.getParts(null);
+ assertNotNull(parts);
+ assertEquals(0, parts.length);
+
+ parts = ia.getParts("foo");
+ assertNotNull(parts);
+ assertEquals(2, parts.length);
+ assertEquals("A", parts[0]);
+ assertEquals("B", parts[1]);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
index 073cf86..d1405f4 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
@@ -1,35 +1,35 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.regexp;
-
-/**
- * Tests for the jakarta-oro implementation of the RegexpMatcher interface.
- *
- */
-public class JakartaOroMatcherTest extends RegexpMatcherTest {
-
- public RegexpMatcher getImplementation() {
- return new JakartaOroMatcher();
- }
-
- public JakartaOroMatcherTest(String name) {
- super(name);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.regexp;
+
+/**
+ * Tests for the jakarta-oro implementation of the RegexpMatcher interface.
+ *
+ */
+public class JakartaOroMatcherTest extends RegexpMatcherTest {
+
+ public RegexpMatcher getImplementation() {
+ return new JakartaOroMatcher();
+ }
+
+ public JakartaOroMatcherTest(String name) {
+ super(name);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
index 340e602..e869c62 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
@@ -1,35 +1,35 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.regexp;
-
-/**
- * Tests for the jakarta-oro implementation of the Regexp interface.
- *
- */
-public class JakartaOroRegexpTest extends RegexpTest {
-
- public Regexp getRegexpImplementation() {
- return new JakartaOroRegexp();
- }
-
- public JakartaOroRegexpTest(String name) {
- super(name);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.regexp;
+
+/**
+ * Tests for the jakarta-oro implementation of the Regexp interface.
+ *
+ */
+public class JakartaOroRegexpTest extends RegexpTest {
+
+ public Regexp getRegexpImplementation() {
+ return new JakartaOroRegexp();
+ }
+
+ public JakartaOroRegexpTest(String name) {
+ super(name);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
index 0b1bb55..3340b59 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
@@ -1,63 +1,63 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.regexp;
-
-import java.io.IOException;
-
-import junit.framework.AssertionFailedError;
-
-/**
- * Tests for the jakarta-regexp implementation of the RegexpMatcher interface.
- *
- */
-public class JakartaRegexpMatcherTest extends RegexpMatcherTest {
-
- public RegexpMatcher getImplementation() {
- return new JakartaRegexpMatcher();
- }
-
- public JakartaRegexpMatcherTest(String name) {
- super(name);
- }
-
- public void testWindowsLineSeparator2() throws IOException {
- try {
- super.testWindowsLineSeparator2();
- fail("Should trigger when this bug is fixed. {@since 1.2}");
- } catch (AssertionFailedError e) {
- }
- }
-
- /**
- * Fails for the same reason as "default" mode in doEndTest2.
- */
- public void testUnixLineSeparator() throws IOException {
- try {
- super.testUnixLineSeparator();
- fail("Should trigger once this bug is fixed. {@since 1.2}");
- } catch (AssertionFailedError e) {
- }
- }
-
-
- /**
- * Fails for "default" mode.
- */
- protected void doEndTest2(String text) {}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.regexp;
+
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for the jakarta-regexp implementation of the RegexpMatcher interface.
+ *
+ */
+public class JakartaRegexpMatcherTest extends RegexpMatcherTest {
+
+ public RegexpMatcher getImplementation() {
+ return new JakartaRegexpMatcher();
+ }
+
+ public JakartaRegexpMatcherTest(String name) {
+ super(name);
+ }
+
+ public void testWindowsLineSeparator2() throws IOException {
+ try {
+ super.testWindowsLineSeparator2();
+ fail("Should trigger when this bug is fixed. {@since 1.2}");
+ } catch (AssertionFailedError e) {
+ }
+ }
+
+ /**
+ * Fails for the same reason as "default" mode in doEndTest2.
+ */
+ public void testUnixLineSeparator() throws IOException {
+ try {
+ super.testUnixLineSeparator();
+ fail("Should trigger once this bug is fixed. {@since 1.2}");
+ } catch (AssertionFailedError e) {
+ }
+ }
+
+
+ /**
+ * Fails for "default" mode.
+ */
+ protected void doEndTest2(String text) {}
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
index ea2b963..078fbb1 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
@@ -1,62 +1,62 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.regexp;
-
-import java.io.IOException;
-
-import junit.framework.AssertionFailedError;
-
-/**
- * Tests for the jakarta-regexp implementation of the Regexp interface.
- *
- */
-public class JakartaRegexpRegexpTest extends RegexpTest {
-
- public Regexp getRegexpImplementation() {
- return new JakartaRegexpRegexp();
- }
-
- public JakartaRegexpRegexpTest(String name) {
- super(name);
- }
-
- public void testWindowsLineSeparator2() throws IOException {
- try {
- super.testWindowsLineSeparator2();
- fail("Should trigger when this bug is fixed. {@since 1.2}");
- } catch (AssertionFailedError e){
- }
- }
-
- /**
- * Fails for the same reason as "default" mode in doEndTest2.
- */
- public void testUnixLineSeparator() throws IOException {
- try {
- super.testUnixLineSeparator();
- fail("Should trigger once this bug is fixed. {@since 1.2}");
- } catch (AssertionFailedError e){
- }
- }
-
- /**
- * Fails for "default" mode.
- */
- protected void doEndTest2(String text) {}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.regexp;
+
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for the jakarta-regexp implementation of the Regexp interface.
+ *
+ */
+public class JakartaRegexpRegexpTest extends RegexpTest {
+
+ public Regexp getRegexpImplementation() {
+ return new JakartaRegexpRegexp();
+ }
+
+ public JakartaRegexpRegexpTest(String name) {
+ super(name);
+ }
+
+ public void testWindowsLineSeparator2() throws IOException {
+ try {
+ super.testWindowsLineSeparator2();
+ fail("Should trigger when this bug is fixed. {@since 1.2}");
+ } catch (AssertionFailedError e){
+ }
+ }
+
+ /**
+ * Fails for the same reason as "default" mode in doEndTest2.
+ */
+ public void testUnixLineSeparator() throws IOException {
+ try {
+ super.testUnixLineSeparator();
+ fail("Should trigger once this bug is fixed. {@since 1.2}");
+ } catch (AssertionFailedError e){
+ }
+ }
+
+ /**
+ * Fails for "default" mode.
+ */
+ protected void doEndTest2(String text) {}
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
index fdb3e7d..c042e71 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
@@ -1,70 +1,70 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.regexp;
-
-import java.io.IOException;
-
-import junit.framework.AssertionFailedError;
-
-/**
- * Tests for the JDK 1.4 implementation of the RegexpMatcher interface.
- *
- */
-public class Jdk14RegexpMatcherTest extends RegexpMatcherTest {
-
- public RegexpMatcher getImplementation() {
- return new Jdk14RegexpMatcher();
- }
-
- public Jdk14RegexpMatcherTest(String name) {
- super(name);
- }
-
- public void testParagraphCharacter() throws IOException {
- try {
- super.testParagraphCharacter();
- fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
- }
- }
-
- public void testLineSeparatorCharacter() throws IOException {
- try {
- super.testLineSeparatorCharacter();
- fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
- }
- }
-
- public void testStandaloneCR() throws IOException {
- try {
- super.testStandaloneCR();
- fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
- }
- }
-
- public void testWindowsLineSeparator() throws IOException {
- try {
- super.testWindowsLineSeparator();
- fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.regexp;
+
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for the JDK 1.4 implementation of the RegexpMatcher interface.
+ *
+ */
+public class Jdk14RegexpMatcherTest extends RegexpMatcherTest {
+
+ public RegexpMatcher getImplementation() {
+ return new Jdk14RegexpMatcher();
+ }
+
+ public Jdk14RegexpMatcherTest(String name) {
+ super(name);
+ }
+
+ public void testParagraphCharacter() throws IOException {
+ try {
+ super.testParagraphCharacter();
+ fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+ } catch (AssertionFailedError e){
+ }
+ }
+
+ public void testLineSeparatorCharacter() throws IOException {
+ try {
+ super.testLineSeparatorCharacter();
+ fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+ } catch (AssertionFailedError e){
+ }
+ }
+
+ public void testStandaloneCR() throws IOException {
+ try {
+ super.testStandaloneCR();
+ fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+ } catch (AssertionFailedError e){
+ }
+ }
+
+ public void testWindowsLineSeparator() throws IOException {
+ try {
+ super.testWindowsLineSeparator();
+ fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+ } catch (AssertionFailedError e){
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
index 7843adc..2b60406 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.regexp;
-
-import java.io.IOException;
-
-import junit.framework.AssertionFailedError;
-
-/**
- * Tests for the JDK 1.4 implementation of the Regexp interface.
- *
- */
-public class Jdk14RegexpRegexpTest extends RegexpTest {
-
- public Regexp getRegexpImplementation() {
- return new Jdk14RegexpRegexp();
- }
-
- public Jdk14RegexpRegexpTest(String name) {
- super(name);
- }
-
- public void testParagraphCharacter() throws IOException {
- try {
- super.testParagraphCharacter();
- fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
- }
- }
-
- public void testLineSeparatorCharacter() throws IOException {
- try {
- super.testLineSeparatorCharacter();
- fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
- }
- }
-
- public void testStandaloneCR() throws IOException {
- try {
- super.testStandaloneCR();
- fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
- }
- }
-
- public void testWindowsLineSeparator() throws IOException {
- try {
- super.testWindowsLineSeparator();
- fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.regexp;
+
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for the JDK 1.4 implementation of the Regexp interface.
+ *
+ */
+public class Jdk14RegexpRegexpTest extends RegexpTest {
+
+ public Regexp getRegexpImplementation() {
+ return new Jdk14RegexpRegexp();
+ }
+
+ public Jdk14RegexpRegexpTest(String name) {
+ super(name);
+ }
+
+ public void testParagraphCharacter() throws IOException {
+ try {
+ super.testParagraphCharacter();
+ fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+ } catch (AssertionFailedError e){
+ }
+ }
+
+ public void testLineSeparatorCharacter() throws IOException {
+ try {
+ super.testLineSeparatorCharacter();
+ fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+ } catch (AssertionFailedError e){
+ }
+ }
+
+ public void testStandaloneCR() throws IOException {
+ try {
+ super.testStandaloneCR();
+ fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+ } catch (AssertionFailedError e){
+ }
+ }
+
+ public void testWindowsLineSeparator() throws IOException {
+ try {
+ super.testWindowsLineSeparator();
+ fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+ } catch (AssertionFailedError e){
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
index 559e4f0..0950827 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
@@ -1,204 +1,204 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.regexp;
-
-import java.io.IOException;
-import java.util.Vector;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for all implementations of the RegexpMatcher interface.
- *
- */
-public abstract class RegexpMatcherTest extends TestCase {
-
- public final static String UNIX_LINE = "\n";
-
- private RegexpMatcher reg;
-
- public abstract RegexpMatcher getImplementation();
-
- protected final RegexpMatcher getReg() {return reg;}
-
- public RegexpMatcherTest(String name) {
- super(name);
- }
-
- public void setUp() {
- reg = getImplementation();
- }
-
- public void testMatches() {
- reg.setPattern("aaaa");
- assertTrue("aaaa should match itself", reg.matches("aaaa"));
- assertTrue("aaaa should match xaaaa", reg.matches("xaaaa"));
- assertTrue("aaaa shouldn\'t match xaaa", !reg.matches("xaaa"));
- reg.setPattern("^aaaa");
- assertTrue("^aaaa shouldn\'t match xaaaa", !reg.matches("xaaaa"));
- assertTrue("^aaaa should match aaaax", reg.matches("aaaax"));
- reg.setPattern("aaaa$");
- assertTrue("aaaa$ shouldn\'t match aaaax", !reg.matches("aaaax"));
- assertTrue("aaaa$ should match xaaaa", reg.matches("xaaaa"));
- reg.setPattern("[0-9]+");
- assertTrue("[0-9]+ should match 123", reg.matches("123"));
- assertTrue("[0-9]+ should match 1", reg.matches("1"));
- assertTrue("[0-9]+ shouldn\'t match \'\'", !reg.matches(""));
- assertTrue("[0-9]+ shouldn\'t match a", !reg.matches("a"));
- reg.setPattern("[0-9]*");
- assertTrue("[0-9]* should match 123", reg.matches("123"));
- assertTrue("[0-9]* should match 1", reg.matches("1"));
- assertTrue("[0-9]* should match \'\'", reg.matches(""));
- assertTrue("[0-9]* should match a", reg.matches("a"));
- reg.setPattern("([0-9]+)=\\1");
- assertTrue("([0-9]+)=\\1 should match 1=1", reg.matches("1=1"));
- assertTrue("([0-9]+)=\\1 shouldn\'t match 1=2", !reg.matches("1=2"));
- }
-
- public void testGroups() {
- reg.setPattern("aaaa");
- Vector v = reg.getGroups("xaaaa");
- assertEquals("No parens -> no extra groups", 1, v.size());
- assertEquals("Trivial match with no parens", "aaaa",
- (String) v.elementAt(0));
-
- reg.setPattern("(aaaa)");
- v = reg.getGroups("xaaaa");
- assertEquals("Trivial match with single paren", 2, v.size());
- assertEquals("Trivial match with single paren, full match", "aaaa",
- (String) v.elementAt(0));
- assertEquals("Trivial match with single paren, matched paren", "aaaa",
- (String) v.elementAt(0));
-
- reg.setPattern("(a+)b(b+)");
- v = reg.getGroups("xaabb");
- assertEquals(3, v.size());
- assertEquals("aabb", (String) v.elementAt(0));
- assertEquals("aa", (String) v.elementAt(1));
- assertEquals("b", (String) v.elementAt(2));
- }
-
- public void testBugzillaReport14619() {
- reg.setPattern("^(.*)/src/((.*/)*)([a-zA-Z0-9_\\.]+)\\.java$");
- Vector v = reg.getGroups("de/tom/src/Google.java");
- assertEquals(5, v.size());
- assertEquals("de/tom", v.elementAt(1));
- assertEquals("", v.elementAt(2));
- assertEquals("", v.elementAt(3));
- assertEquals("Google", v.elementAt(4));
- }
-
- public void testCaseInsensitiveMatch() {
- reg.setPattern("aaaa");
- assertTrue("aaaa doesn't match AAaa", !reg.matches("AAaa"));
- assertTrue("aaaa matches AAaa ignoring case",
- reg.matches("AAaa", RegexpMatcher.MATCH_CASE_INSENSITIVE));
- }
-
-
-// make sure there are no issues concerning line separator interpretation
-// a line separator for regex (perl) is always a unix line (ie \n)
-
- public void testParagraphCharacter() throws IOException {
- reg.setPattern("end of text$");
- assertTrue("paragraph character", !reg.matches("end of text\u2029"));
- }
-
- public void testLineSeparatorCharacter() throws IOException {
- reg.setPattern("end of text$");
- assertTrue("line-separator character", !reg.matches("end of text\u2028"));
- }
-
- public void testNextLineCharacter() throws IOException {
- reg.setPattern("end of text$");
- assertTrue("next-line character", !reg.matches("end of text\u0085"));
- }
-
- public void testStandaloneCR() throws IOException {
- reg.setPattern("end of text$");
- assertTrue("standalone CR", !reg.matches("end of text\r"));
- }
-
- public void testWindowsLineSeparator() throws IOException {
- reg.setPattern("end of text$");
- assertTrue("Windows line separator", !reg.matches("end of text\r\n"));
- }
-
- public void testWindowsLineSeparator2() throws IOException {
- reg.setPattern("end of text\r$");
- assertTrue("Windows line separator", reg.matches("end of text\r\n"));
- }
-
- public void testUnixLineSeparator() throws IOException {
- reg.setPattern("end of text$");
- assertTrue("Unix line separator", reg.matches("end of text\n"));
- }
-
-
- public void testMultiVersusSingleLine() throws IOException {
- StringBuffer buf = new StringBuffer();
- buf.append("Line1").append(UNIX_LINE);
- buf.append("starttest Line2").append(UNIX_LINE);
- buf.append("Line3 endtest").append(UNIX_LINE);
- buf.append("Line4").append(UNIX_LINE);
- String text = buf.toString();
-
- doStartTest1(text);
- doStartTest2(text);
- doEndTest1(text);
- doEndTest2(text);
- }
-
- protected void doStartTest1(String text) {
- reg.setPattern("^starttest");
- assertTrue("^starttest in default mode", !reg.matches(text));
- assertTrue("^starttest in single line mode",
- !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
- assertTrue("^starttest in multi line mode",
- reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
- }
-
- protected void doStartTest2(String text) {
- reg.setPattern("^Line1");
- assertTrue("^Line1 in default mode", reg.matches(text));
- assertTrue("^Line1 in single line mode",
- reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
- assertTrue("^Line1 in multi line mode",
- reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
- }
-
- protected void doEndTest1(String text) {
- reg.setPattern("endtest$");
- assertTrue("endtest$ in default mode", !reg.matches(text));
- assertTrue("endtest$ in single line mode",
- !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
- assertTrue("endtest$ in multi line mode",
- reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
- }
-
- protected void doEndTest2(String text) {
- reg.setPattern("Line4$");
- assertTrue("Line4$ in default mode", reg.matches(text));
- assertTrue("Line4$ in single line mode",
- reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
- assertTrue("Line4$ in multi line mode",
- reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.regexp;
+
+import java.io.IOException;
+import java.util.Vector;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for all implementations of the RegexpMatcher interface.
+ *
+ */
+public abstract class RegexpMatcherTest extends TestCase {
+
+ public final static String UNIX_LINE = "\n";
+
+ private RegexpMatcher reg;
+
+ public abstract RegexpMatcher getImplementation();
+
+ protected final RegexpMatcher getReg() {return reg;}
+
+ public RegexpMatcherTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ reg = getImplementation();
+ }
+
+ public void testMatches() {
+ reg.setPattern("aaaa");
+ assertTrue("aaaa should match itself", reg.matches("aaaa"));
+ assertTrue("aaaa should match xaaaa", reg.matches("xaaaa"));
+ assertTrue("aaaa shouldn\'t match xaaa", !reg.matches("xaaa"));
+ reg.setPattern("^aaaa");
+ assertTrue("^aaaa shouldn\'t match xaaaa", !reg.matches("xaaaa"));
+ assertTrue("^aaaa should match aaaax", reg.matches("aaaax"));
+ reg.setPattern("aaaa$");
+ assertTrue("aaaa$ shouldn\'t match aaaax", !reg.matches("aaaax"));
+ assertTrue("aaaa$ should match xaaaa", reg.matches("xaaaa"));
+ reg.setPattern("[0-9]+");
+ assertTrue("[0-9]+ should match 123", reg.matches("123"));
+ assertTrue("[0-9]+ should match 1", reg.matches("1"));
+ assertTrue("[0-9]+ shouldn\'t match \'\'", !reg.matches(""));
+ assertTrue("[0-9]+ shouldn\'t match a", !reg.matches("a"));
+ reg.setPattern("[0-9]*");
+ assertTrue("[0-9]* should match 123", reg.matches("123"));
+ assertTrue("[0-9]* should match 1", reg.matches("1"));
+ assertTrue("[0-9]* should match \'\'", reg.matches(""));
+ assertTrue("[0-9]* should match a", reg.matches("a"));
+ reg.setPattern("([0-9]+)=\\1");
+ assertTrue("([0-9]+)=\\1 should match 1=1", reg.matches("1=1"));
+ assertTrue("([0-9]+)=\\1 shouldn\'t match 1=2", !reg.matches("1=2"));
+ }
+
+ public void testGroups() {
+ reg.setPattern("aaaa");
+ Vector v = reg.getGroups("xaaaa");
+ assertEquals("No parens -> no extra groups", 1, v.size());
+ assertEquals("Trivial match with no parens", "aaaa",
+ (String) v.elementAt(0));
+
+ reg.setPattern("(aaaa)");
+ v = reg.getGroups("xaaaa");
+ assertEquals("Trivial match with single paren", 2, v.size());
+ assertEquals("Trivial match with single paren, full match", "aaaa",
+ (String) v.elementAt(0));
+ assertEquals("Trivial match with single paren, matched paren", "aaaa",
+ (String) v.elementAt(0));
+
+ reg.setPattern("(a+)b(b+)");
+ v = reg.getGroups("xaabb");
+ assertEquals(3, v.size());
+ assertEquals("aabb", (String) v.elementAt(0));
+ assertEquals("aa", (String) v.elementAt(1));
+ assertEquals("b", (String) v.elementAt(2));
+ }
+
+ public void testBugzillaReport14619() {
+ reg.setPattern("^(.*)/src/((.*/)*)([a-zA-Z0-9_\\.]+)\\.java$");
+ Vector v = reg.getGroups("de/tom/src/Google.java");
+ assertEquals(5, v.size());
+ assertEquals("de/tom", v.elementAt(1));
+ assertEquals("", v.elementAt(2));
+ assertEquals("", v.elementAt(3));
+ assertEquals("Google", v.elementAt(4));
+ }
+
+ public void testCaseInsensitiveMatch() {
+ reg.setPattern("aaaa");
+ assertTrue("aaaa doesn't match AAaa", !reg.matches("AAaa"));
+ assertTrue("aaaa matches AAaa ignoring case",
+ reg.matches("AAaa", RegexpMatcher.MATCH_CASE_INSENSITIVE));
+ }
+
+
+// make sure there are no issues concerning line separator interpretation
+// a line separator for regex (perl) is always a unix line (ie \n)
+
+ public void testParagraphCharacter() throws IOException {
+ reg.setPattern("end of text$");
+ assertTrue("paragraph character", !reg.matches("end of text\u2029"));
+ }
+
+ public void testLineSeparatorCharacter() throws IOException {
+ reg.setPattern("end of text$");
+ assertTrue("line-separator character", !reg.matches("end of text\u2028"));
+ }
+
+ public void testNextLineCharacter() throws IOException {
+ reg.setPattern("end of text$");
+ assertTrue("next-line character", !reg.matches("end of text\u0085"));
+ }
+
+ public void testStandaloneCR() throws IOException {
+ reg.setPattern("end of text$");
+ assertTrue("standalone CR", !reg.matches("end of text\r"));
+ }
+
+ public void testWindowsLineSeparator() throws IOException {
+ reg.setPattern("end of text$");
+ assertTrue("Windows line separator", !reg.matches("end of text\r\n"));
+ }
+
+ public void testWindowsLineSeparator2() throws IOException {
+ reg.setPattern("end of text\r$");
+ assertTrue("Windows line separator", reg.matches("end of text\r\n"));
+ }
+
+ public void testUnixLineSeparator() throws IOException {
+ reg.setPattern("end of text$");
+ assertTrue("Unix line separator", reg.matches("end of text\n"));
+ }
+
+
+ public void testMultiVersusSingleLine() throws IOException {
+ StringBuffer buf = new StringBuffer();
+ buf.append("Line1").append(UNIX_LINE);
+ buf.append("starttest Line2").append(UNIX_LINE);
+ buf.append("Line3 endtest").append(UNIX_LINE);
+ buf.append("Line4").append(UNIX_LINE);
+ String text = buf.toString();
+
+ doStartTest1(text);
+ doStartTest2(text);
+ doEndTest1(text);
+ doEndTest2(text);
+ }
+
+ protected void doStartTest1(String text) {
+ reg.setPattern("^starttest");
+ assertTrue("^starttest in default mode", !reg.matches(text));
+ assertTrue("^starttest in single line mode",
+ !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
+ assertTrue("^starttest in multi line mode",
+ reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
+ }
+
+ protected void doStartTest2(String text) {
+ reg.setPattern("^Line1");
+ assertTrue("^Line1 in default mode", reg.matches(text));
+ assertTrue("^Line1 in single line mode",
+ reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
+ assertTrue("^Line1 in multi line mode",
+ reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
+ }
+
+ protected void doEndTest1(String text) {
+ reg.setPattern("endtest$");
+ assertTrue("endtest$ in default mode", !reg.matches(text));
+ assertTrue("endtest$ in single line mode",
+ !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
+ assertTrue("endtest$ in multi line mode",
+ reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
+ }
+
+ protected void doEndTest2(String text) {
+ reg.setPattern("Line4$");
+ assertTrue("Line4$ in default mode", reg.matches(text));
+ assertTrue("Line4$ in single line mode",
+ reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
+ assertTrue("Line4$ in multi line mode",
+ reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
index b083bfa..5cfe8c9 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
@@ -1,63 +1,63 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.util.regexp;
-
-/**
- * Tests for all implementations of the Regexp interface.
- *
- */
-public abstract class RegexpTest extends RegexpMatcherTest {
-
- private static final String test = "abcdefg-abcdefg";
- private static final String pattern = "ab([^d]*)d([^f]*)f";
-
- public RegexpTest(String name) {
- super(name);
- }
-
- public final RegexpMatcher getImplementation() {
- return getRegexpImplementation();
- }
-
- public abstract Regexp getRegexpImplementation();
-
- public void testSubstitution() {
- Regexp reg = (Regexp) getReg();
- reg.setPattern(pattern);
- assertTrue(reg.matches(test));
- assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
- Regexp.MATCH_DEFAULT));
- }
-
- public void testReplaceFirstSubstitution() {
- Regexp reg = (Regexp) getReg();
- reg.setPattern(pattern);
- assertTrue(reg.matches(test));
- assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
- Regexp.REPLACE_FIRST));
- }
-
- public void testReplaceAllSubstitution() {
- Regexp reg = (Regexp) getReg();
- reg.setPattern(pattern);
- assertTrue(reg.matches(test));
- assertEquals("abedcfg-abedcfg", reg.substitute(test, "ab\\2d\\1f",
- Regexp.REPLACE_ALL));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.util.regexp;
+
+/**
+ * Tests for all implementations of the Regexp interface.
+ *
+ */
+public abstract class RegexpTest extends RegexpMatcherTest {
+
+ private static final String test = "abcdefg-abcdefg";
+ private static final String pattern = "ab([^d]*)d([^f]*)f";
+
+ public RegexpTest(String name) {
+ super(name);
+ }
+
+ public final RegexpMatcher getImplementation() {
+ return getRegexpImplementation();
+ }
+
+ public abstract Regexp getRegexpImplementation();
+
+ public void testSubstitution() {
+ Regexp reg = (Regexp) getReg();
+ reg.setPattern(pattern);
+ assertTrue(reg.matches(test));
+ assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
+ Regexp.MATCH_DEFAULT));
+ }
+
+ public void testReplaceFirstSubstitution() {
+ Regexp reg = (Regexp) getReg();
+ reg.setPattern(pattern);
+ assertTrue(reg.matches(test));
+ assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
+ Regexp.REPLACE_FIRST));
+ }
+
+ public void testReplaceAllSubstitution() {
+ Regexp reg = (Regexp) getReg();
+ reg.setPattern(pattern);
+ assertTrue(reg.matches(test));
+ assertEquals("abedcfg-abedcfg", reg.substitute(test, "ab\\2d\\1f",
+ Regexp.REPLACE_ALL));
+ }
+}