[ https://issues.apache.org/jira/browse/TEXT-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16108906#comment-16108906 ]
ASF GitHub Bot commented on TEXT-100: ------------------------------------- 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("<b>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. > StringEscapeUtils#UnEscapeJson doesn't recognize escape signs correctly > ----------------------------------------------------------------------- > > Key: TEXT-100 > URL: https://issues.apache.org/jira/browse/TEXT-100 > Project: Commons Text > Issue Type: Bug > Reporter: Michael Hausegger > > As shown in > org.apache.commons.text.StringEscapeUtils#testUnescapeJsonFoundBug JSON > escape signs do not get treated correctly. -- This message was sent by Atlassian JIRA (v6.4.14#64029)