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

增加 typeof null 测试示例

上级 b867420c
...@@ -80,6 +80,8 @@ export function testKeyWord() : Result { ...@@ -80,6 +80,8 @@ export function testKeyWord() : Result {
}) })
test('typeof', () => { test('typeof', () => {
expect(typeof (null)).toEqual('object')
expect(typeof null).toEqual('object')
let new1 = new User() let new1 = new User()
expect(typeof (new1)).toEqual('object') expect(typeof (new1)).toEqual('object')
//expect(typeof null).toEqual('object') //expect(typeof null).toEqual('object')
......
...@@ -93,20 +93,20 @@ export function testUTSJSONObject() : Result { ...@@ -93,20 +93,20 @@ export function testUTSJSONObject() : Result {
expect(data5!.toJSONString()).toEqual('{"data4":{"data":{"num":1,"num2":2.369,"str":"test"},"name":"张三"}}') expect(data5!.toJSONString()).toEqual('{"data4":{"data":{"num":1,"num2":2.369,"str":"test"},"name":"张三"}}')
class TestData6 implements IJsonStringify{ // class TestData6 implements IJsonStringify{
toJSON():any|null{ // toJSON():any|null{
return JSON.parse("22") // return JSON.parse("22")
} // }
} // }
let testData6 = TestData6() // let testData6 = TestData6()
let data6 = { // let data6 = {
data:testData6, // data:testData6,
array:[1,"22",false], // array:[1,"22",false],
name:"data6" // name:"data6"
} // }
expect(data6!.toJSONString()).toEqual('{"data":22.0,"array":[1,"22",false],"name":"data6"}') // expect(data6!.toJSONString()).toEqual('{"data":22.0,"array":[1,"22",false],"name":"data6"}')
console.log(data6.toJSONString()) // console.log(data6.toJSONString())
// #endif // #endif
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册