diff --git a/uni_modules/uts-tests/utssdk/JSON.uts b/uni_modules/uts-tests/utssdk/JSON.uts index 3ff104a5b81c2a22a0fbe8918f7d8ad02f768126..63cc7ea74518e9972fb883da6ac9aa4a1649eab9 100644 --- a/uni_modules/uts-tests/utssdk/JSON.uts +++ b/uni_modules/uts-tests/utssdk/JSON.uts @@ -38,9 +38,9 @@ function countOccurrences(str : string, substr : string) : number { return count; } -// #ifdef APP-ANDROID + class A1 implements IJSONStringify{ - override toJSON():any|null{ + toJSON():any|null{ let jsonRet = { 'name': "zhangsan", 'age': 12, @@ -78,20 +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 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 + expect(JSON.stringify(new A5())!.length).toEqual(28) + expect(JSON.stringify(new A6())!.length).toEqual(28) + }) test('parse', () => {