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

add json test case

上级 3561ff13
...@@ -101,8 +101,15 @@ export function testJSON() : Result { ...@@ -101,8 +101,15 @@ export function testJSON() : Result {
expect(JSON.stringify({ x: 5, y: 6 })).toEqual(`{"x":5,"y":6}`); 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([3, 'false', false])).toEqual(`[3,"false",false]`);
expect(JSON.stringify({})).toEqual('{}'); 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(true)).toEqual('true');
expect(JSON.stringify(false)).toEqual('false');
expect(JSON.stringify('foo')).toEqual('"foo"'); 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
...@@ -20,6 +20,9 @@ export function testKeyWord(): Result { ...@@ -20,6 +20,9 @@ export function testKeyWord(): Result {
expect(typeof(new1)).toEqual('object') expect(typeof(new1)).toEqual('object')
expect(typeof(123456.789)).toEqual('number') expect(typeof(123456.789)).toEqual('number')
expect(typeof("hello world")).toEqual('string') expect(typeof("hello world")).toEqual('string')
console.log(typeof([1,2,3]))
let arr1 = new Array<any>()
console.log(arr1)
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册