提交 e078ef0c 编写于 作者: 雪洛's avatar 雪洛

test: 增加对象字面量转type实例测试例

上级 2fae914a
import { describe, test, expect, Result } from './tests.uts'
export function testType() : Result {
return describe("Type", () => {
test("Object literal to type instance", () => {
type Person = {
age: number
}
const a: Person = {
age: 1
}
const b = {
age: 2
} as Person
expect(a instanceof Person).toEqual(true);
expect(b instanceof Person).toEqual(true);
})
})
}
\ No newline at end of file
...@@ -10,8 +10,9 @@ import { testSet } from './Set.uts' ...@@ -10,8 +10,9 @@ import { testSet } from './Set.uts'
import { testOperators } from './Operators.uts' import { testOperators } from './Operators.uts'
import { testMath } from './Math.uts' import { testMath } from './Math.uts'
import { testRegExp } from './RegExp.uts' import { testRegExp } from './RegExp.uts'
import { testForLoop } from './ForLoop.uts' import { testForLoop } from './ForLoop.uts'
import { testGlobal } from './Global.uts' import { testGlobal } from './Global.uts'
import { testType } from './Type.uts'
export { Result } from './tests.uts' export { Result } from './tests.uts'
// Promise、Proxy、Reflect、Weakmap、WeakSet 不支持 // Promise、Proxy、Reflect、Weakmap、WeakSet 不支持
...@@ -28,8 +29,9 @@ export function runTests() : UTSJSONObject { ...@@ -28,8 +29,9 @@ export function runTests() : UTSJSONObject {
const MathRes = testMath(); const MathRes = testMath();
const RegExpRes = testRegExp(); const RegExpRes = testRegExp();
const KeyWordRes = testKeyWord(); const KeyWordRes = testKeyWord();
const ForLoopRes = testForLoop(); const ForLoopRes = testForLoop();
const GlobalRes = testGlobal(); const GlobalRes = testGlobal();
const TypeRes = testType();
return { return {
Array: ArrayRes, Array: ArrayRes,
...@@ -44,7 +46,8 @@ export function runTests() : UTSJSONObject { ...@@ -44,7 +46,8 @@ export function runTests() : UTSJSONObject {
Math: MathRes, Math: MathRes,
RegExp: RegExpRes, RegExp: RegExpRes,
KeyWord: KeyWordRes, KeyWord: KeyWordRes,
ForLoop: ForLoopRes, ForLoop: ForLoopRes,
Global: GlobalRes, Global: GlobalRes,
Type: TypeRes
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册