當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript assert.throws函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。