本文整理汇总了TypeScript中assert类的典型用法代码示例。如果您正苦于以下问题:TypeScript assert类的具体用法?TypeScript assert怎么用?TypeScript assert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了assert类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: assert
promises.push(delayer.trigger(factory).then(() => { assert.equal(result, 1); assert(!delayer.isTriggered()); }));
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:1,代码来源:async.test.ts
示例2: assert
import * as tls from "tls";
import * as http from "http";
import * as net from "net";
import * as tty from "tty";
import * as dgram from "dgram";
import * as querystring from "querystring";
import * as path from "path";
import * as readline from "readline";
import * as childProcess from "child_process";
import * as cluster from "cluster";
import * as os from "os";
import * as vm from "vm";
// Specifically test buffer module regression.
import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer";
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
assert.equal(3, "3", "uses == comparator");
assert.notStrictEqual(2, "2", "uses === comparator");
assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses === comparator");
assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT");
assert.doesNotThrow(() => {
const b = false;
if (b) { throw "a hammer at your face"; }
}, undefined, "What the...*crunch*");
开发者ID:Akylas,项目名称:DefinitelyTyped,代码行数:31,代码来源:node-tests.ts
示例3: it
it("Initializes with specified files", function () {
const speak = new BSTVirtualAlexa("http://localhost:9000",
"test/resources/interactionModel/models/en-US.json");
speak.start();
assert(true, "Start processed without exceptions");
});
开发者ID:bespoken,项目名称:bst,代码行数:6,代码来源:bst-virtual-alexa-test.ts
示例4: setTimeout
setTimeout(() => {
assert(!debuglet.activeBreakpointMap.test);
debuglet.stop();
scope.done();
done();
}, 1100);
开发者ID:GoogleCloudPlatform,项目名称:cloud-debug-nodejs,代码行数:6,代码来源:test-debuglet.ts
示例5: assert
next: (location: Location) => {
assert(location.pathname);
done();
},
开发者ID:ntilwalli,项目名称:cyclejs,代码行数:4,代码来源:common.ts
示例6: function
var testGetSetPixels = function (color : number, sourceAlpha: boolean, destAlpha: boolean) {
var bitmapData = new BitmapData (TEST_WIDTH, TEST_HEIGHT, sourceAlpha, color);
var pixels = bitmapData.getPixels (bitmapData.rect);
assert.equal (pixels.length, TEST_WIDTH * TEST_HEIGHT * 4);
var expectedColor = color;
if (sourceAlpha) {
// TODO: Native behavior is different than the flash target here.
// The flash target premultiplies RGB by the alpha value.
// If the native behavior is changed, this test needs to be
// updated.
if ((expectedColor & 0xFF000000) == 0) {
expectedColor = 0;
}
} else {
// Surfaces that don't support alpha return FF for the alpha value, so
// set our expected alpha to FF no matter what the initial value was
expectedColor |= 0xFF000000;
}
var i : number;
var pixel : number;
pixels.position = 0;
for (i = 0; i < TEST_WIDTH * TEST_HEIGHT; i++) {
pixel = pixels.readInt();
assert (Math.abs (((expectedColor >> 24) & 0xFF) - ((pixel >> 24) & 0xFF)) <= 1);
assert (Math.abs (((expectedColor >> 16) & 0xFF) - ((pixel >> 16) & 0xFF)) <= 1);
assert (Math.abs (((expectedColor >> 8) & 0xFF) - ((pixel >> 8) & 0xFF)) <= 1);
assert (Math.abs (((expectedColor) & 0xFF) - ((pixel) & 0xFF)) <= 1);
}
// Now run the same test again to make sure the source
// did not get changed by reading the first time.
pixels = bitmapData.getPixels (bitmapData.rect);
assert.equal (pixels.length, TEST_WIDTH * TEST_HEIGHT * 4);
pixels.position = 0;
for (i = 0; i < TEST_WIDTH * TEST_HEIGHT; i++) {
pixel = pixels.readInt();
assert (Math.abs (((expectedColor >> 24) & 0xFF) - ((pixel >> 24) & 0xFF)) <= 1);
assert (Math.abs (((expectedColor >> 16) & 0xFF) - ((pixel >> 16) & 0xFF)) <= 1);
assert (Math.abs (((expectedColor >> 8) & 0xFF) - ((pixel >> 8) & 0xFF)) <= 1);
assert (Math.abs (((expectedColor) & 0xFF) - ((pixel) & 0xFF)) <= 1);
}
bitmapData = new BitmapData (TEST_WIDTH, TEST_HEIGHT, destAlpha);
pixels.position = 0;
bitmapData.setPixels (bitmapData.rect, pixels);
var pixel:number = bitmapData.getPixel32 (1, 1);
if (!destAlpha) {
expectedColor |= 0xFF000000;
}
assert (Math.abs (((expectedColor >> 24) & 0xFF) - ((pixel >> 24) & 0xFF)) <= 1);
assert (Math.abs (((expectedColor >> 16) & 0xFF) - ((pixel >> 16) & 0xFF)) <= 1);
assert (Math.abs (((expectedColor >> 8) & 0xFF) - ((pixel >> 8) & 0xFF)) <= 1);
assert (Math.abs (((expectedColor) & 0xFF) - ((pixel) & 0xFF)) <= 1);
}
开发者ID:openfl,项目名称:openfl,代码行数:66,代码来源:BitmapDataTest.ts
示例7: function
stats.record("", AccessType.REQUEST_DROPPED, function (error: Error) {
assert(!error);
done();
});
开发者ID:bespoken,项目名称:bst,代码行数:4,代码来源:statistics-test.ts
示例8: it
it("#isRuleModule", function() {
assert(isRuleModule(FixerRule));
assert(isRuleModule(LinterRule));
assert(!isRuleModule(FixerOnlyRule));
assert(!isRuleModule(SimpleModule));
});
开发者ID:textlint,项目名称:textlint,代码行数:6,代码来源:rule-creator-helper-test.ts
示例9: testContentType
async function testContentType(drive: APIEndpoint) {
nock(Utils.baseUrl).post('/drive/v2/files/a/comments').reply(200);
const res =
await drive.comments.insert({fileId: 'a', resource: {content: 'hello '}});
assert(res.request.headers['content-type'].indexOf('application/json') === 0);
}
开发者ID:dmytrobanasko,项目名称:google-api-nodejs-client,代码行数:6,代码来源:test.transporters.ts
示例10: assert
walker.readStdout(cmd1, 'utf8', /*isRipgrep=*/false, (err1, stdout1) => {
assert.equal(err1, null);
assert(outputContains(stdout1, file0), stdout1);
assert(!outputContains(stdout1, file1), stdout1);
done();
});
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:6,代码来源:search.test.ts
注:本文中的assert类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论