You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2017/07/05 15:34:22 UTC

[03/12] commons-compress git commit: Test that ebcidic encoding is supported (making sure "%Uxxxx" replacement strings don't use ascii encodings)

Test that ebcidic encoding is supported (making sure "%Uxxxx" replacement strings don't use ascii encodings)

Signed-off-by: Simon Spero <se...@gmail.com>

(cherry picked from commit f1ec715)
Signed-off-by: Simon Spero <se...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/b745af39
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/b745af39
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/b745af39

Branch: refs/heads/master
Commit: b745af3975a0bb3acddbc59ef85860d08221a010
Parents: 11fcc89
Author: Simon Spero <se...@gmail.com>
Authored: Sun Jun 18 19:27:42 2017 -0400
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Jul 5 16:30:00 2017 +0200

----------------------------------------------------------------------
 .../compress/archivers/zip/ZipEncodingTest.java      | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/b745af39/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
index ce0934f..34a9cb8 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
@@ -27,7 +27,6 @@ import static org.junit.Assert.assertTrue;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
-import org.apache.commons.compress.utils.CharsetNames;
 import org.hamcrest.core.IsInstanceOf;
 import org.junit.Assert;
 import org.junit.Test;
@@ -78,6 +77,13 @@ public class ZipEncodingTest {
     }
 
 
+    @Test
+    public void testEbcidic() throws IOException {
+
+        doSimpleEncodingTest("IBM1047", null);
+    }
+
+
     private void doSimpleEncodingsTest(int n) throws IOException {
 
         doSimpleEncodingTest("Cp" + n, null);
@@ -178,11 +184,10 @@ public class ZipEncodingTest {
         assertEquals(testBytes, encoded);
 
         assertFalse(enc.canEncode(UNENC_STRING));
-        assertEquals("%U2016".getBytes(CharsetNames.US_ASCII), enc.encode(UNENC_STRING));
+        assertEquals("%U2016".getBytes(name), enc.encode(UNENC_STRING));
         assertFalse(enc.canEncode(BAD_STRING));
-        byte[] expected = BAD_STRING_ENC.getBytes(CharsetNames.US_ASCII);
-        ByteBuffer actual = enc.encode(BAD_STRING);
-        assertEquals(expected, actual);
+        assertEquals(BAD_STRING_ENC.getBytes(name), enc.encode(BAD_STRING));
+        assertEquals(BAD_STRING_ENC.getBytes(name), enc.encode(BAD_STRING));
     }
 
 }