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

增加关键字测试用例

上级 d5a44872
......@@ -74,10 +74,10 @@
"uniStatistics": {
"enable": false
},
"vueVersion": "3"
// "uni-app-x" : {
// "uvue" : {
// "flex-direction" : "cloum"
// }
// }
"vueVersion": "3",
"uni-app-x" : {
"uvue" : {
"flex-direction" : "cloum"
}
}
}
\ No newline at end of file
import { describe, test, expect, Result } from './tests.uts'
class User{
name:string = "";
age:number = 0
}
export function testKeyWord(): Result {
return describe("Error", () => {
test('new', () => {
let new1 = new User()
expect(JSON.stringify(new1)).toEqual('{"age":0,"name":""}')
new1.age = 10
new1.name = "job"
expect(JSON.stringify(new1)).toEqual('{"age":10,"name":"job"}')
})
test('typeof', () => {
let new1 = new User()
expect(typeof(new1)).toEqual('object')
expect(typeof(123456.789)).toEqual('number')
expect(typeof("hello world")).toEqual('string')
})
test('instanceof', () => {
let user1 = new User()
let instanceRet1 = user1 instanceof User
expect(instanceRet1).toEqual(true)
let instanceRet2 = user1 instanceof String
expect(instanceRet2).toEqual(false)
})
})
}
......@@ -19,6 +19,9 @@ export function testSet(): Result {
set1.forEach((item)=>{
expect(set1.has(item)).toEqual(true);
})
console.log(set1)
let set2 = set1.add(66);
console.log(set2)
})
test('clear', () => {
const set1 = new Set<any>();
......
......@@ -2,6 +2,7 @@ import { testArray } from './Array.uts'
import { testDate } from './Date.uts'
import { testString } from './String.uts'
import { testError } from './Error.uts'
import { testKeyWord } from './KeyWord.uts'
import { testJSON } from './JSON.uts'
import { testNumber } from './Number.uts'
import { testMap } from './Map.uts'
......@@ -27,7 +28,8 @@ export function runTests() : UTSJSONObject {
const SetRes = testSet();
const OperatorsRes = testOperators();
const MathRes = testMath();
const RegExpRes = testRegExp();
const RegExpRes = testRegExp();
const KeyWordRes = testKeyWord();
// #ifdef APP-ANDROID
// const ReactiveArrayRes = testReactiveArray();
// const ReactiveMapRes = testReactiveMap();
......@@ -51,5 +53,6 @@ export function runTests() : UTSJSONObject {
Operators: OperatorsRes,
Math: MathRes,
RegExp: RegExpRes,
KeyWord:KeyWordRes
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册