tests to verify correct serialization and deserialization of = char.

This commit is contained in:
Inderjeet Singh 2008-11-25 17:53:12 +00:00
parent 0c98c2f8d1
commit 1e7f3ebe7a

View File

@ -109,4 +109,26 @@ public class StringTest extends TestCase {
String actual = gson.fromJson(json, String.class);
assertEquals(value, actual);
}
/**
* Created in response to http://groups.google.com/group/google-gson/browse_thread/thread/2431d4a3d0d6cb23
*/
public void testAssignmentCharSerialization() {
String value = "abc=";
String json = gson.toJson(value);
assertEquals("\"abc\\u003d\"", json);
}
/**
* Created in response to http://groups.google.com/group/google-gson/browse_thread/thread/2431d4a3d0d6cb23
*/
public void testAssignmentCharDeserialization() {
String json = "\"abc=\"";
String value = gson.fromJson(json, String.class);
assertEquals("abc=", value);
json = "'abc\u003d'";
value = gson.fromJson(json, String.class);
assertEquals("abc=", value);
}
}