use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_5_d.
public void test_5_d() throws Exception {
SerializeWriter out = new SerializeWriter();
out.config(SerializerFeature.UseSingleQuotes, true);
out.writeString(null);
Assert.assertEquals("null", out.toString());
}
use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_8_s.
public void test_8_s() throws Exception {
SerializeWriter out = new SerializeWriter();
out.config(SerializerFeature.UseSingleQuotes, true);
out.writeString("\na\nb\nc\nd\"'");
Assert.assertEquals("'\\na\\nb\\nc\\nd\"\\''", out.toString());
}
use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_13.
public void test_13() throws Exception {
SerializeWriter out = new SerializeWriter(4);
out.config(SerializerFeature.UseSingleQuotes, true);
out.writeString("1'");
Assert.assertEquals("'1\\''", out.toString());
}
use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_9_d.
public void test_9_d() throws Exception {
SerializeWriter out = new SerializeWriter(1);
out.writeFieldName("\na\nb\nc\nd\"'e");
Assert.assertEquals("\"\\na\\nb\\nc\\nd\\\"'e\":", out.toString());
}
use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_12_d.
public void test_12_d() throws Exception {
SerializeWriter out = new SerializeWriter(1);
out.writeString("123\na\nb\nc\nd\"'e", ':');
Assert.assertEquals("\"123\\na\\nb\\nc\\nd\\\"'e\":", out.toString());
}
Aggregations