Error.uts 511 字节
Newer Older
Y
yurj26 已提交
1 2 3 4 5 6 7 8
import { describe, test, expect, Result } from './tests.uts'

export function testError(): Result {
    return describe("Error", () => {
        test('message', () => {
            try {
              throw new Error('Whoops!')
            } catch (e) {
9
              expect((e as Error).message).toEqual("Whoops!");
Y
yurj26 已提交
10 11 12 13 14 15 16 17
            }
        })
        // test('name', () => {
        //     const e = new Error("Malformed input"); // e.name is 'Error'
        //     e.name = "ParseError";
        // })
    })
}