提交 3de775b0 编写于 作者: lizhongyi_'s avatar lizhongyi_

调整部分测试例

上级 05d1943d
......@@ -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', () => {
......
......@@ -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>('{"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', () => {
......
......@@ -27,6 +27,7 @@ export function testUTSJSONObject() : Result {
})
test('setvalue-after-get', () => {
// #ifdef APP-ANDROID
let obj = {
"cars":[
{
......@@ -40,7 +41,7 @@ export function testUTSJSONObject() : Result {
cars![0].set("value",20)
let firstCar = obj.getJSON("cars[0]")
expect(firstCar!['value']).toEqual(20);
// #endif
})
test('assign-withtype', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册