Allow all Unicode symbols in nonstrict mode (#1217)

Change symbol parsing to allow all Unicode symbols when the appropriate strict setting allows it.  By default, this allows all symbols, but the user will get (probably two) warnings about them.
This commit is contained in:
Erik Demaine
2018-05-17 11:33:01 -04:00
committed by GitHub
parent 431434258d
commit 369b5a8276
3 changed files with 34 additions and 5 deletions

View File

@@ -137,6 +137,27 @@ describe("unicode", function() {
expect('ěščřžůřťďňőİı').toNotParse(strictSettings);
});
it("should not allow emoji in strict mode", function() {
expect('✌').toNotParse(strictSettings);
expect('\\text{✌}').toNotParse(strictSettings);
const settings = new Settings({
strict: (errorCode) =>
(errorCode === "unknownSymbol" ? "error" : "ignore"),
});
expect('✌').toNotParse(settings);
expect('\\text{✌}').toNotParse(settings);
});
it("should allow emoji outside strict mode", function() {
expect('✌').toWarn();
expect('\\text{✌}').toWarn();
const settings = new Settings({
strict: (errorCode) =>
(errorCode === "unknownSymbol" ? "ignore" : "error"),
});
expect('✌').toParse(settings);
expect('\\text{✌}').toParse(settings);
});
});
describe("unicodeScripts", () => {