Skip to content

Commit

Permalink
Rearrange tests so they make sense
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Nov 9, 2024
1 parent c2e3388 commit b566604
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 58 deletions.
30 changes: 0 additions & 30 deletions dev/core/test/com/google/gwt/core/ext/util/UtilSuite.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@
* 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;

import java.io.ByteArrayOutputStream;
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.
Expand Down Expand Up @@ -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');
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);
Expand All @@ -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) {
}
}
}
}

0 comments on commit b566604

Please sign in to comment.