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


TypeScript assert.default方法代碼示例

本文整理匯總了TypeScript中assert.default方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript assert.default方法的具體用法?TypeScript assert.default怎麽用?TypeScript assert.default使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在assert的用法示例。


在下文中一共展示了assert.default方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: RegExp

	test('areFunctions', () => {
		assert(!types.areFunctions());
		assert(!types.areFunctions(null));
		assert(!types.areFunctions('foo'));
		assert(!types.areFunctions(5));
		assert(!types.areFunctions(true));
		assert(!types.areFunctions([]));
		assert(!types.areFunctions([1, 2, '3']));
		assert(!types.areFunctions({}));
		assert(!types.areFunctions({ foo: 'bar' }));
		assert(!types.areFunctions(/test/));
		assert(!types.areFunctions(new RegExp('')));
		assert(!types.areFunctions(new Date()));
		assert(!types.areFunctions(assert, ''));

		assert(types.areFunctions(assert));
		assert(types.areFunctions(assert, assert));
		assert(types.areFunctions(function foo() { /**/ }));
	});
開發者ID:gaoxiaojun,項目名稱:vscode,代碼行數:19,代碼來源:types.test.ts

示例2: function

	test('CamelCaseFilter - #19256', function () {
		assert(matchesCamelCase('Debug Console', 'Open: Debug Console'));
		assert(matchesCamelCase('Debug console', 'Open: Debug Console'));
		assert(matchesCamelCase('debug console', 'Open: Debug Console'));
	});
開發者ID:diarmaidm,項目名稱:vscode,代碼行數:5,代碼來源:filters.test.ts

示例3: Name

	test('Validate File Name (For Create)', function () {
		const d = new Date().getTime();
		const s = createStat('/path/to/stat', 'sName', true, true, 8096, d);
		const sChild = createStat('/path/to/stat/alles.klar', 'alles.klar', true, true, 8096, d);
		s.addChild(sChild);

		assert(validateFileName(s, null) !== null);
		assert(validateFileName(s, '') !== null);
		assert(validateFileName(s, '  ') !== null);
		assert(validateFileName(s, 'Read Me') === null, 'name containing space');

		if (isWindows) {
			assert(validateFileName(s, 'foo:bar') !== null);
			assert(validateFileName(s, 'foo*bar') !== null);
			assert(validateFileName(s, 'foo?bar') !== null);
			assert(validateFileName(s, 'foo<bar') !== null);
			assert(validateFileName(s, 'foo>bar') !== null);
			assert(validateFileName(s, 'foo|bar') !== null);
		}
		assert(validateFileName(s, 'alles.klar') !== null);

		assert(validateFileName(s, '.foo') === null);
		assert(validateFileName(s, 'foo.bar') === null);
		assert(validateFileName(s, 'foo') === null);
	});
開發者ID:AllureFer,項目名稱:vscode,代碼行數:25,代碼來源:explorerModel.test.ts

示例4: Event

	test('File Change Event (with stats)', function () {
		let d = new Date().toUTCString();
		let s1 = new FileStat(toResource('/path/to/sName'), false, false, 'sName', 8096 /* Size */, d);
		let s2 = new FileStat(toResource('/path/to/sName'), false, false, 'sName', 16000 /* Size */, d);
		let s3 = new FileStat(toResource('/path/to/sNameMoved'), false, false, 'sNameMoved', 8096 /* Size */, d);

		// Got Added
		let event = new LocalFileChangeEvent(null, s1);
		assert(event.gotAdded());
		assert(!event.gotDeleted());
		assert(!event.gotUpdated());
		assert(!event.gotMoved());

		// Got Removed
		event = new LocalFileChangeEvent(s1, null);
		assert(!event.gotAdded());
		assert(event.gotDeleted());
		assert(!event.gotUpdated());
		assert(!event.gotMoved());

		// Got Moved
		event = new LocalFileChangeEvent(s3, s1);
		assert(!event.gotAdded());
		assert(!event.gotDeleted());
		assert(!event.gotUpdated());
		assert(event.gotMoved());

		// Got Updated
		event = new LocalFileChangeEvent(s2, s1);
		assert(!event.gotAdded());
		assert(!event.gotDeleted());
		assert(event.gotUpdated());
		assert(!event.gotMoved());

		// No Change
		event = new LocalFileChangeEvent(s1, s1);
		assert(!event.gotAdded());
		assert(!event.gotDeleted());
		assert(!event.gotUpdated());
		assert(!event.gotMoved());
	});
開發者ID:13572293130,項目名稱:vscode,代碼行數:41,代碼來源:viewModel.test.ts

示例5: function

 IntentSchema.fromFile("test/alexa/resources/IntentSchemaNonExistent.json", function (schema: IntentSchema, error?: string) {
     assert(error.indexOf("not found") !== -1);
     done();
 });
開發者ID:bespoken,項目名稱:bst,代碼行數:4,代碼來源:intent-schema-test.ts

示例6: assert

 .catch(error => {
     assert(error.code === "ERR_ASSERTION" || error.name === "AssertionError");
 });
開發者ID:textlint,項目名稱:textlint,代碼行數:3,代碼來源:textlint-tester-invalid-test.ts

示例7: function

 this.spoken = function (utterance: string, callback: any) {
     assert(sessionRemoved);
     done();
 };
開發者ID:bespoken,項目名稱:bst,代碼行數:4,代碼來源:bst-utter-test.ts

示例8: finished

  TestMeta,
  TestReporter,
  TestResult
} from '../src';

const reporter: TestReporter = {
  finished(_: TestResult[]): void {
    // ...
  },

  started(_: Test[]): void {
    // ...
  },

  testFinished(result: TestResult): void {
    if (typeof result.error !== 'undefined') {
      const e: Error = result.error;
      assert(e);
    }
  },

  testStarted(test: Test): void {
    const fn: TestFn = test.fn;
    const meta: TestMeta = test.meta;
    assert(fn);
    assert(meta);
  }
}

assert(reporter);
開發者ID:bouzuya,項目名稱:beater-reporter,代碼行數:30,代碼來源:index.ts

示例9: assert

					(message) => assert(this.validator(input).indexOf(message) > -1,
						`Expected error of ${JSON.stringify(this.settings)} on \`${input}\` to contain ${message}. Got ${this.validator(input)}.`)
開發者ID:DonJayamanne,項目名稱:vscode,代碼行數:2,代碼來源:preferencesModel.test.ts

示例10:

	test('removeClass', () => {

		let element = document.createElement('div');
		element.className = 'foobar boo far';

		dom.removeClass(element, 'boo');
		assert(dom.hasClass(element, 'far'));
		assert(!dom.hasClass(element, 'boo'));
		assert(dom.hasClass(element, 'foobar'));
		assert.equal(element.className, 'foobar far');

		element = document.createElement('div');
		element.className = 'foobar boo far';

		dom.removeClass(element, 'far');
		assert(!dom.hasClass(element, 'far'));
		assert(dom.hasClass(element, 'boo'));
		assert(dom.hasClass(element, 'foobar'));
		assert.equal(element.className, 'foobar boo');

		dom.removeClass(element, 'boo');
		assert(!dom.hasClass(element, 'far'));
		assert(!dom.hasClass(element, 'boo'));
		assert(dom.hasClass(element, 'foobar'));
		assert.equal(element.className, 'foobar');

		dom.removeClass(element, 'foobar');
		assert(!dom.hasClass(element, 'far'));
		assert(!dom.hasClass(element, 'boo'));
		assert(!dom.hasClass(element, 'foobar'));
		assert.equal(element.className, '');
	});
開發者ID:AllureFer,項目名稱:vscode,代碼行數:32,代碼來源:dom.test.ts


注:本文中的assert.default方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。