本文整理汇总了TypeScript中assert.throws函数的典型用法代码示例。如果您正苦于以下问题:TypeScript throws函数的具体用法?TypeScript throws怎么用?TypeScript throws使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了throws函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should not accept a selector to an unknown element as input', function() {
assert.throws(function() {
makeDOMDriver('#nonsenseIdToNothing');
}, /Cannot render into unknown element/);
});
开发者ID:joeldentici,项目名称:cyclejs,代码行数:5,代码来源:dom-driver.ts
示例2: test
test('throws if bad ++opt name', () => {
assert.throws(() => commandParsers.write('++foo=foo'));
});
开发者ID:arussellk,项目名称:Vim,代码行数:3,代码来源:subparser.test.ts
示例3: it
it('does not load invalid YAML', () => assert.throws(() => load('petstore-invalid.yaml')));
开发者ID:carlansley,项目名称:swagger2,代码行数:1,代码来源:document.spec.ts
示例4: ReflectDecorateThrowsIfDecoratorsArgumentNotArrayForFunctionOverload
export function ReflectDecorateThrowsIfDecoratorsArgumentNotArrayForFunctionOverload() {
let target = function() { };
assert.throws(() => Reflect.decorate(undefined, target, undefined, undefined), TypeError);
}
开发者ID:1600,项目名称:Angular2Playground,代码行数:4,代码来源:reflect-decorate.ts
示例5: test
test('register command - no handler', function () {
assert.throws(() => CommandsRegistry.registerCommand('foo', null));
});
开发者ID:GYGit,项目名称:vscode,代码行数:3,代码来源:commands.test.ts
示例6: it
it("does not infinite loop on incomplete JSX", () => {
throws(() => transform("const x = <", {transforms: ["jsx"]}));
});
开发者ID:alangpierce,项目名称:sucrase,代码行数:3,代码来源:jsx-test.ts
示例7: ReflectDecorateThrowsIfTargetArgumentNotObjectForPropertyOverload
export function ReflectDecorateThrowsIfTargetArgumentNotObjectForPropertyOverload() {
let decorators: (ClassDecorator | MethodDecorator | PropertyDecorator)[] = [];
let target = 1;
let name = "name";
assert.throws(() => Reflect.decorate(decorators, target, name, undefined), TypeError);
}
开发者ID:1600,项目名称:Angular2Playground,代码行数:6,代码来源:reflect-decorate.ts
示例8: it
it('should throw if second argument is not an object', function() {
assert.throws(() => {
(run as any)(() => {}, 'not an object');
}, /Second argument given to Cycle must be an object with driver functions/i);
});
开发者ID:joeldentici,项目名称:cyclejs,代码行数:5,代码来源:index.ts
示例9: test
test("try to read lines that don't exist", () => {
assert.equal(vscode.window.activeTextEditor.document.lineCount, 1);
assert.throws(() => TextEditor.readLineAt(1), RangeError);
assert.throws(() => TextEditor.readLineAt(2), RangeError);
});
开发者ID:RendleLabs,项目名称:Vim,代码行数:5,代码来源:textEditor.test.ts
注:本文中的assert.throws函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论