提交 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
...@@ -12,6 +12,7 @@ import { testMath } from './Math.uts' ...@@ -12,6 +12,7 @@ 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 不支持
...@@ -30,6 +31,7 @@ export function runTests() : UTSJSONObject { ...@@ -30,6 +31,7 @@ export function runTests() : UTSJSONObject {
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,
...@@ -46,5 +48,6 @@ export function runTests() : UTSJSONObject { ...@@ -46,5 +48,6 @@ export function runTests() : UTSJSONObject {
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.
先完成此消息的编辑!
想要评论请 注册