From f2f4b28c2bc7cf8502a748394886b333089cc20d Mon Sep 17 00:00:00 2001 From: duqingquan Date: Sat, 12 Aug 2023 16:37:07 +0800 Subject: [PATCH] add json test case --- uni_modules/uts-tests/utssdk/JSON.uts | 7 +++++++ uni_modules/uts-tests/utssdk/KeyWord.uts | 3 +++ 2 files changed, 10 insertions(+) diff --git a/uni_modules/uts-tests/utssdk/JSON.uts b/uni_modules/uts-tests/utssdk/JSON.uts index 84a2e00..7265e6d 100644 --- a/uni_modules/uts-tests/utssdk/JSON.uts +++ b/uni_modules/uts-tests/utssdk/JSON.uts @@ -101,8 +101,15 @@ export function testJSON() : Result { expect(JSON.stringify({ x: 5, y: 6 })).toEqual(`{"x":5,"y":6}`); expect(JSON.stringify([3, 'false', false])).toEqual(`[3,"false",false]`); expect(JSON.stringify({})).toEqual('{}'); + expect(JSON.stringify(1002)).toEqual('1002'); + expect(JSON.stringify(1002.202)).toEqual('1002.202'); + expect(JSON.stringify(null)).toEqual('null'); + expect(JSON.stringify(100/0.0)).toEqual('null'); expect(JSON.stringify(true)).toEqual('true'); + expect(JSON.stringify(false)).toEqual('false'); expect(JSON.stringify('foo')).toEqual('"foo"'); + expect(JSON.stringify(Math.PI)).toEqual('3.141592653589793'); + expect(JSON.stringify(Math.E)).toEqual('2.718281828459045'); }) }) } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/KeyWord.uts b/uni_modules/uts-tests/utssdk/KeyWord.uts index aa9aaba..aeea449 100644 --- a/uni_modules/uts-tests/utssdk/KeyWord.uts +++ b/uni_modules/uts-tests/utssdk/KeyWord.uts @@ -20,6 +20,9 @@ export function testKeyWord(): Result { expect(typeof(new1)).toEqual('object') expect(typeof(123456.789)).toEqual('number') expect(typeof("hello world")).toEqual('string') + console.log(typeof([1,2,3])) + let arr1 = new Array() + console.log(arr1) }) -- GitLab