commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TheRealHaui <...@git.apache.org>
Subject [GitHub] commons-text pull request #60: additional-tests
Date Tue, 01 Aug 2017 13:40:31 GMT
Github user TheRealHaui commented on a diff in the pull request:

    https://github.com/apache/commons-text/pull/60#discussion_r130609309
  
    --- Diff: src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java ---
    @@ -592,4 +593,43 @@ public void testUnscapeXSI() {
             assertEquals("", unescapeXSI("\\"));
         }
     
    +    @Test
    +    public void testUnescapeEcmaScript() {
    +        assertNull("Should be null.", StringEscapeUtils.unescapeEcmaScript(null));
    +        assertEquals("8lvc1u+6B#-I", StringEscapeUtils.unescapeEcmaScript("8lvc1u+6B#-I"));
    +        assertEquals("<script src=\"build/main.bundle.js\"></script>",
    +                StringEscapeUtils.unescapeEcmaScript("<script src=\"build/main.bundle.js\"></script>")
    +        );
    +        assertEquals("<script src=\"build/main.bundle.js\"></script>>",
    +                StringEscapeUtils.unescapeEcmaScript("<script src=\"build/main.bundle.js\"></script>>")
    +        );
    +    }
    +
    +    @Test
    +    public void testEscapeHtmlFour() {
    +        assertNull("Should be null.", StringEscapeUtils.escapeHtml3(null));
    +        assertEquals("a", StringEscapeUtils.escapeHtml3("a"));
    +        assertEquals("&lt;b&gt;a", StringEscapeUtils.escapeHtml3("<b>a"));
    +    }
    +
    +    @Test
    +    public void testUnescapeJson() {
    +
    +        String jsonString = "{\"age\":100,\"name\":\"kyong.com\n\",\"messages\":[\"msg
1\",\"msg 2\",\"msg 3\"]}";
    +
    +        assertEquals("", StringEscapeUtils.unescapeJson(""));
    +        assertEquals(" ", StringEscapeUtils.unescapeJson(" "));
    +        assertEquals("a:b", StringEscapeUtils.unescapeJson("a:b"));
    +        assertEquals(jsonString, StringEscapeUtils.unescapeJson(jsonString));
    +    }
    +
    +    @Ignore("Bug found.")
    +    @Test
    +    public void testUnescapeJsonFoundBug() {
    --- End diff --
    
    Done.
    See https://issues.apache.org/jira/browse/TEXT-100.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message