Skip to content

Commit 48dfeb8

Browse files
committed
fix(#887): unit tests, uncommented tests after fix
1 parent 1ae43bd commit 48dfeb8

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/test/java/org/json/junit/XMLTest.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,7 @@ public void testXmlEscapeToJson(){
294294
"<euro>A &#8364;33</euro>"+
295295
"<euroX>A &#x20ac;22&#x20AC;</euroX>"+
296296
"<unknown>some text &copy;</unknown>"+
297-
// TODO: Looks like a strictMode regression where embedded single quotes are not handled correctly
298-
// Should be fixed.
299-
// "<known>&#x0022; &quot; &amp; &apos; &lt; &gt;</known>"+
300-
"<known>&#x0022; &quot; &amp; &lt; &gt;</known>"+
297+
"<known>&#x0022; &quot; &amp; &apos; &lt; &gt;</known>"+
301298
"<high>&#x1D122; &#x10165;</high>" +
302299
"</root>";
303300
String expectedStr =
@@ -306,10 +303,7 @@ public void testXmlEscapeToJson(){
306303
"\"euro\":\"A €33\"," +
307304
"\"euroX\":\"A €22€\"," +
308305
"\"unknown\":\"some text &copy;\"," +
309-
// TODO: Looks like a strictMode regression where embedded single quotes are not handled correctly
310-
// Should be fixed.
311-
// "\"known\":\"\\\" \\\" & ' < >\"," +
312-
"\"known\":\"\\\" \\\" & < >\"," +
306+
"\"known\":\"\\\" \\\" & ' < >\"," +
313307
"\"high\":\"𝄢 𐅥\""+
314308
"}}";
315309

@@ -323,12 +317,9 @@ public void testXmlEscapeToJson(){
323317
*/
324318
@Test
325319
public void testJsonToXmlEscape(){
326-
// TODO: Looks like a strictMode regression where embedded single quotes are not handled correctly
327-
// Should be fixed.
328320
final String jsonSrc = "{\"amount\":\"10,00 €\","
329321
+ "\"description\":\"Ação Válida\u0085\","
330-
// + "\"xmlEntities\":\"\\\" ' & < >\""
331-
+ "\"xmlEntities\":\"\\\" & < >\""
322+
+ "\"xmlEntities\":\"\\\" ' & < >\""
332323
+ "}";
333324
JSONObject json = new JSONObject(jsonSrc);
334325
String xml = XML.toString(json);
@@ -342,8 +333,7 @@ public void testJsonToXmlEscape(){
342333
assertTrue("Escaping á failed. Not found in XML output.", xml.contains("á"));
343334
// test XML Entities converted
344335
assertTrue("Escaping \" failed. Not found in XML output.", xml.contains("&quot;"));
345-
// TODO: restore when the regression is fixed
346-
// assertTrue("Escaping ' failed. Not found in XML output.", xml.contains("&apos;"));
336+
assertTrue("Escaping ' failed. Not found in XML output.", xml.contains("&apos;"));
347337
assertTrue("Escaping & failed. Not found in XML output.", xml.contains("&amp;"));
348338
assertTrue("Escaping < failed. Not found in XML output.", xml.contains("&lt;"));
349339
assertTrue("Escaping > failed. Not found in XML output.", xml.contains("&gt;"));

0 commit comments

Comments
 (0)