本文整理汇总了TypeScript中chai.assert.doesNotThrow方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.doesNotThrow方法的具体用法?TypeScript assert.doesNotThrow怎么用?TypeScript assert.doesNotThrow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.doesNotThrow方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: XmlDtd
+ " default newline", () => {
assert.throws(
() => new XmlDtd(undefined, true, {
name: "abc",
sysId: "abc" + String.fromCharCode(0x0001) + "def"
}));
assert.doesNotThrow(
() => new XmlDtd(undefined, false, {
name: "abc",
sysId: "abc" + String.fromCharCode(0x0001) + "def"
}));
assert.throws(
() => new XmlDtd(undefined, true, {
name: "abc",
sysId: "'\""
}));
assert.doesNotThrow(
() => new XmlDtd(undefined, false, {
name: "abc",
sysId: "'\""
}));
assert.throws(
() => new XmlDtd(undefined, true, {
name: "abc",
sysId: "abc'abc\"abc"
}));
assert.doesNotThrow(
() => new XmlDtd(undefined, false, {
name: "abc",
sysId: "abc'abc\"abc"
}));
});
示例2: XmlAttributeText
+ " chars", () => {
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlAttributeText(
undefined, true, {
charData: "abc" + String.fromCharCode(0x0001)
+ "def",
replaceInvalidCharsInCharData: true
}
).toString(),
"abc\uFFFDdef");
}
);
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlAttributeText(
undefined, false, {
charData: "abc" + String.fromCharCode(0x0001)
+ "def",
replaceInvalidCharsInCharData: true
}
).toString(),
"abc\uFFFDdef");
}
);
});
示例3: it
it("can create a pen", () => {
const pen = test.context.createPen("", { translate: [0, 0], rotate: 0 });
assert.isFunction(pen.write);
assert.doesNotThrow(pen.write);
if (pen.destroy != null) {
assert.isFunction(pen.destroy);
assert.doesNotThrow(pen.destroy);
}
});
示例4: it
it('Should register multiple entities', () => {
let manager = getManager().registerEntities([ Address, Tracker ]);
assert.doesNotThrow(() => {
return manager.getEntity('Address');
}, 'No entity found for "Address".');
assert.doesNotThrow(() => {
return manager.getEntity('Tracker');
}, 'No entity found for "Tracker".');
});
示例5: XmlDecl
+ " not allowed in attribute; default quotes", () => {
assert.throws(
() => new XmlDecl(undefined, true, {
version: "1"
}));
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlDecl(undefined, false, {
version: "1"
}).toString(),
"<?xml version='1'?>");
});
assert.throws(
() => new XmlDecl(undefined, true, {
version: "1."
}));
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlDecl(undefined, false, {
version: "1."
}).toString(),
"<?xml version='1.'?>");
});
assert.throws(
() => new XmlDecl(undefined, true, {
version: "1.2a"
}));
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlDecl(undefined, false, {
version: "1.2a"
}).toString(),
"<?xml version='1.2a'?>");
});
assert.throws(
() => new XmlDecl(undefined, true, {
version: "2.0"
}));
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlDecl(undefined, false, {
version: "2.0"
}).toString(),
"<?xml version='2.0'?>");
});
});
示例6: XmlCdata
+ " chars", () => {
assert.throws(
() => new XmlCdata(undefined, true, {
charData: "]]>"
}));
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlCdata(undefined, false, {
charData: "]]>"
}).toString(),
"<![CDATA[]]>]]>");
});
assert.throws(
() => new XmlCdata(undefined, true, {
charData: "abc]]>123"
}));
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlCdata(undefined, false, {
charData: "abc]]>123"
}).toString(),
"<![CDATA[abc]]>123]]>");
});
assert.throws(
() => new XmlCdata(undefined, true, {
charData: "]]>abc123"
}));
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlCdata(undefined, false, {
charData: "]]>abc123"
}).toString(),
"<![CDATA[]]>abc123]]>");
});
assert.throws(
() => new XmlCdata(undefined, true, {
charData: "abc123]]>"
}));
assert.doesNotThrow(
() => {
assert.strictEqual(
new XmlCdata(undefined, false, {
charData: "abc123]]>"
}).toString(),
"<![CDATA[abc123]]>]]>");
});
});
示例7: it
it("should return an instance of JsonSchemaGenerator", () => {
const program = TJS.getProgramFromFiles([resolve(BASE + "comments/main.ts")]);
const generator = TJS.buildGenerator(program);
assert.instanceOf(generator, TJS.JsonSchemaGenerator);
if (generator !== null) {
assert.doesNotThrow(() => generator.getSchemaForSymbol("MyObject"));
assert.doesNotThrow(() => generator.getSchemaForSymbol("Vector3D"));
const symbols = generator.getUserSymbols();
assert(symbols.indexOf("MyObject") > -1);
assert(symbols.indexOf("Vector3D") > -1);
}
});
示例8: it
it("put doesn't throw", () => {
assert.doesNotThrow(() => {
child.put(new Blob(['a']));
child.put(new Uint8Array(10));
child.put(new ArrayBuffer(10));
});
});
示例9: it
it("resolves custom rule directories as relative paths", () => {
let rule: RuleConstructor | undefined;
assert.doesNotThrow(() => {
rule = findRule("always-fail", "test/files/custom-rules");
});
assert.isDefined(rule);
});
示例10: XmlDocument
+ " default indentation; default newline", () => {
assert.throws(() => {
const node = new XmlDocument({});
node.decl({});
node.dtd({name: "abc"});
node.comment({charData: "def"});
node.procInst({target: "ghi"});
node.comment({charData: "jkl"});
node.procInst({target: "mno"});
node.toString();
});
assert.doesNotThrow(() => {
const node = new XmlDocument({validation: false});
node.decl({});
node.dtd({name: "abc"});
node.comment({charData: "def"});
node.procInst({target: "ghi"});
node.comment({charData: "jkl"});
node.procInst({target: "mno"});
assert.strictEqual(
node.toString(),
"<?xml version='1.0'?>\n<!DOCTYPE abc>\n"
+ "<!--def-->\n<?ghi?>\n<!--jkl-->\n<?mno?>");
});
});