提交 488fe7ea 编写于 作者: 杜庆泉's avatar 杜庆泉

增加custom-stringify 条件编译

上级 b4a9a16b
......@@ -38,6 +38,7 @@ function countOccurrences(str : string, substr : string) : number {
return count;
}
// #ifdef APP-ANDROID
class A1 implements IJsonStringify{
override toJSON():any|null{
let jsonRet = {
......@@ -77,18 +78,20 @@ class A6 implements IJsonStringify{
return new A5()
}
}
// #endif
export function testJSON() : Result {
return describe("JSON", () => {
test('custom-stringify', () => {
// #ifdef APP-ANDROID
expect(JSON.stringify(new A1()).length).toEqual(28)
expect(JSON.stringify(new A2())).toEqual("2")
expect(JSON.stringify(new A3())).toEqual('"json"')
expect(JSON.stringify(new A4())).toEqual('null')
expect(JSON.stringify(new A5()).length).toEqual(28)
expect(JSON.stringify(new A6()).length).toEqual(28)
// #endif
})
test('parse', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册