From b5666047a521a98a5bbed016b654720d0286744e Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Fri, 8 Nov 2024 21:28:56 -0600 Subject: [PATCH] Rearrange tests so they make sense --- .../google/gwt/core/ext/util/UtilSuite.java | 30 ------------------ .../gwt/{core/ext => dev}/util/UtilTest.java | 17 ++++++++-- .../SourceLevelTest.java} | 31 ++++--------------- 3 files changed, 20 insertions(+), 58 deletions(-) delete mode 100644 dev/core/test/com/google/gwt/core/ext/util/UtilSuite.java rename dev/core/test/com/google/gwt/{core/ext => dev}/util/UtilTest.java (88%) rename dev/core/test/com/google/gwt/dev/util/{UtilityTest.java => arg/SourceLevelTest.java} (67%) diff --git a/dev/core/test/com/google/gwt/core/ext/util/UtilSuite.java b/dev/core/test/com/google/gwt/core/ext/util/UtilSuite.java deleted file mode 100644 index b6a8c7495fc..00000000000 --- a/dev/core/test/com/google/gwt/core/ext/util/UtilSuite.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2009 Google Inc. - * - * Licensed 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 com.google.gwt.core.ext.util; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Test suite for {@link Util} - */ -public class UtilSuite { - public static Test suite() { - TestSuite suite = new TestSuite("Test suite for Util"); - suite.addTestSuite(UtilTest.class); - return suite; - } -} diff --git a/dev/core/test/com/google/gwt/core/ext/util/UtilTest.java b/dev/core/test/com/google/gwt/dev/util/UtilTest.java similarity index 88% rename from dev/core/test/com/google/gwt/core/ext/util/UtilTest.java rename to dev/core/test/com/google/gwt/dev/util/UtilTest.java index 229a3814397..3de5fc70a13 100644 --- a/dev/core/test/com/google/gwt/core/ext/util/UtilTest.java +++ b/dev/core/test/com/google/gwt/dev/util/UtilTest.java @@ -13,9 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.core.ext.util; - -import com.google.gwt.dev.util.Util; +package com.google.gwt.dev.util; import junit.framework.TestCase; @@ -23,6 +21,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; +import java.net.URL; /** * Tests for some com.google.gwt.dev.util.Util methods. @@ -104,4 +103,16 @@ public void testWriteUtf8() { fail("Got IOException"); } } + + /** Tests that URLAsChars correctly processes unicode. */ + public void testUnicode() { + URL r = this.getClass().getResource("unicodeTest.txt"); + assertNotNull(r); + + char[] x = Util.readURLAsChars(r); + assertEquals(2,x.length); + char a = '\u4F60'; + assertEquals(x[0],a); + assertEquals(x[1],'\u597D'); + } } diff --git a/dev/core/test/com/google/gwt/dev/util/UtilityTest.java b/dev/core/test/com/google/gwt/dev/util/arg/SourceLevelTest.java similarity index 67% rename from dev/core/test/com/google/gwt/dev/util/UtilityTest.java rename to dev/core/test/com/google/gwt/dev/util/arg/SourceLevelTest.java index 9f19aa3d5a5..d13c62ddd73 100644 --- a/dev/core/test/com/google/gwt/dev/util/UtilityTest.java +++ b/dev/core/test/com/google/gwt/dev/util/arg/SourceLevelTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2007 Google Inc. + * Copyright 2024 GWT Project Authors * * Licensed 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 @@ -13,30 +13,11 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.dev.util; - -import com.google.gwt.dev.util.arg.SourceLevel; +package com.google.gwt.dev.util.arg; import junit.framework.TestCase; -import java.net.URL; - -/** Pure junit test of Utility functionality*/ -public class UtilityTest extends TestCase { - - /** Tests that URLAsChars correctly processes unicode*/ - public void testUnicode() { - URL r = this.getClass().getResource("unicodeTest.txt"); - assertNotNull(r); - - char[] x = Util.readURLAsChars(r); - assertEquals(2,x.length); - char a = '\u4F60'; - assertEquals(x[0],a); - assertEquals(x[1],'\u597D'); - } - - +public class SourceLevelTest extends TestCase { public void testVersionNumberComparisons() { assertTrue(SourceLevel.versionCompare("1.4.3.22", "1.04.3.22") == 0); assertTrue(SourceLevel.versionCompare("1.4.3.22.1", "1.4.3.22") > 0); @@ -49,13 +30,13 @@ public void testVersionNumberComparisons() { try { SourceLevel.versionCompare("1.4.3.22.1.dodo", "1.4.3.22.1"); - fail("Should have trown a IllegalArgumentException"); + fail("Should have thrown a IllegalArgumentException"); } catch (IllegalArgumentException e) { } try { SourceLevel.versionCompare("1.4.3.22.1", "1.4.3.22.1.dodo"); - fail("Should have trown a IllegalArgumentException"); + fail("Should have thrown a IllegalArgumentException"); } catch (IllegalArgumentException e) { } } -} +} \ No newline at end of file