diff --git a/uni_modules/uts-tests/utssdk/JSON.uts b/uni_modules/uts-tests/utssdk/JSON.uts index 00ebc1ed3892262c870c609830d06bfa9ae2578f..ad362a3ed0ab3038f55b3afce49c6ef6f7719ac2 100644 --- a/uni_modules/uts-tests/utssdk/JSON.uts +++ b/uni_modules/uts-tests/utssdk/JSON.uts @@ -323,8 +323,9 @@ export function testJSON() : Result { const json = `{"result":true, "count":42}`; const obj = JSON.parse(json) as UTSJSONObject; let retStr = JSON.stringify(obj) + // #ifdef APP-ANDROID expect(retStr).toEqual('{"result":true,"count":42}') - + // #endif }) test('parse Map', () => { diff --git a/uni_modules/uts-tests/utssdk/Number.uts b/uni_modules/uts-tests/utssdk/Number.uts index 5a22aa7f3e30fa4e195f1c79a46092018f128837..7c33dd79f2ec6b7f1413283b3cd9ee29682e8b77 100644 --- a/uni_modules/uts-tests/utssdk/Number.uts +++ b/uni_modules/uts-tests/utssdk/Number.uts @@ -59,14 +59,14 @@ export function testNumber() : Result { expect(isFinite(1000 / 1)).toEqual(true); expect(isFinite(910)).toEqual(true); expect(isFinite(0)).toEqual(true); - + // #ifdef APP-ANDROID let aj2 = JSON.parse('{"a":1}') as UTSJSONObject; let aNumber = aj2['a'] as UTSNumber expect(isFinite(aNumber)).toEqual(true); expect(UTSNumber.isFinite(aNumber)).toEqual(true); expect(UTSNumber.isFinite(11.00)).toEqual(true); expect(UTSNumber.isFinite(Double.POSITIVE_INFINITY)).toEqual(false); - + // #endif }) test('number-from-json-parse', () => { @@ -78,6 +78,7 @@ export function testNumber() : Result { expect(aj?.a == 1 as number).toEqual(true); expect(aj?.a == 1.0).toEqual(true); expect(aj?.a == 1.0 as number).toEqual(true); + // #ifdef APP-ANDROID expect(aj?.a === 1).toEqual(true); expect(aj?.a === 1 as number).toEqual(true); expect(aj?.a === 1.0).toEqual(true); @@ -110,6 +111,8 @@ export function testNumber() : Result { let aj2 = JSON.parse('{"a":1}'); expect(aj?.a == aj2?.a).toEqual(true); + // #endif + }) @@ -122,7 +125,7 @@ export function testNumber() : Result { test('isNaN', () => { expect(isNaN(0)).toEqual(false); - + // #ifdef APP-ANDROID let aj2 = JSON.parse('{"a":1}') as UTSJSONObject; let aNumber = aj2['a'] as UTSNumber expect(isNaN(aNumber)).toEqual(false); @@ -130,6 +133,7 @@ export function testNumber() : Result { expect(UTSNumber.isNaN(11)).toEqual(false); expect(UTSNumber.isNaN(null)).toEqual(false); expect(UTSNumber.isNaN(1 / 0)).toEqual(false); + // #endif }) test('toPrecision', () => { diff --git a/uni_modules/uts-tests/utssdk/UTSJSONObject.uts b/uni_modules/uts-tests/utssdk/UTSJSONObject.uts index cb4820e2cd6f08b8a63b7ee323121a9e8d85334c..6b38239e40155556316aa55f9a90288363c018cc 100644 --- a/uni_modules/uts-tests/utssdk/UTSJSONObject.uts +++ b/uni_modules/uts-tests/utssdk/UTSJSONObject.uts @@ -27,6 +27,7 @@ export function testUTSJSONObject() : Result { }) test('setvalue-after-get', () => { + // #ifdef APP-ANDROID let obj = { "cars":[ { @@ -35,12 +36,12 @@ export function testUTSJSONObject() : Result { } ] } - + let cars = obj.getArray("cars") cars![0].set("value",20) let firstCar = obj.getJSON("cars[0]") expect(firstCar!['value']).toEqual(20); - + // #endif }) test('assign-withtype', () => {