This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/7.0.x by this push: new 27385c5 Speed up unit tests. 27385c5 is described below commit 27385c5e30a37deabe24d431b168f296042b8f5e Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Mar 31 20:33:05 2020 +0100 Speed up unit tests. Only run TestCharsetUtil#testIsAcsiiSupersetAll() if a new Charset is detected. Add a basic test for key charsets --- java/org/apache/tomcat/util/buf/CharsetCache.java | 2 ++ test/org/apache/tomcat/util/buf/TestCharsetUtil.java | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/java/org/apache/tomcat/util/buf/CharsetCache.java b/java/org/apache/tomcat/util/buf/CharsetCache.java index 49acca2..d41c92f 100644 --- a/java/org/apache/tomcat/util/buf/CharsetCache.java +++ b/java/org/apache/tomcat/util/buf/CharsetCache.java @@ -152,6 +152,8 @@ public class CharsetCache { "ibm858", "x-ibm29626c", // Added from HPE JVM 1.8.0.17-hp-ux "cp1051", "cp1386", "cshproman8", "hp-roman8", "ibm-1051", "r8", "roman8", "roman9" + // If you add and entry to this list, ensure you run + // TestCharsetUtil#testIsAcsiiSupersetAll() }; private static final Charset DUMMY_CHARSET = new DummyCharset("Dummy", null); diff --git a/test/org/apache/tomcat/util/buf/TestCharsetUtil.java b/test/org/apache/tomcat/util/buf/TestCharsetUtil.java index 08f8a55..10cc116 100644 --- a/test/org/apache/tomcat/util/buf/TestCharsetUtil.java +++ b/test/org/apache/tomcat/util/buf/TestCharsetUtil.java @@ -28,10 +28,24 @@ import org.junit.Test; public class TestCharsetUtil { /* + * Check the standard character sets return the expected values + */ + @Test + public void testIsAsciiSupersetStandardCharsets() { + Assert.assertTrue(CharsetUtil.isAsciiSuperset(Charset.forName("ASCII"))); + Assert.assertTrue(CharsetUtil.isAsciiSuperset(Charset.forName("ISO-8859-1"))); + Assert.assertTrue(CharsetUtil.isAsciiSuperset(Charset.forName("UTF-8"))); + } + + + /* * More comprehensive test that checks that, part from where the encoding * overlaps with ASCII, no valid ASCII bytes are used. + * + * This is relatively slow. + * Only need to run this when we detect a new Charset. */ - @Test + //@Test public void testIsAcsiiSupersetAll() { for (Charset charset : Charset.availableCharsets().values()) { System.out.println("Testing: " + charset.name()); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org