mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-08 04:28:41 +00:00
fix: remove local macros upon parse error (#3114)
Close all groups after parse, in particular in case of parse error, completing `Namespace`'s simulation of local definitions. Fixes #3122 Co-authored-by: ylemkimon <y@ylem.kim>
This commit is contained in:
@@ -3440,6 +3440,12 @@ describe("A macro expander", function() {
|
||||
expect(macros["\\foo"]).toBeFalsy();
|
||||
});
|
||||
|
||||
it("\\def doesn't change settings.macros on error", () => {
|
||||
const macros = {};
|
||||
expect`\def\foo{c^}\foo`.not.toParse(new Settings({macros}));
|
||||
expect(macros["\\foo"]).toBeFalsy();
|
||||
});
|
||||
|
||||
it("\\def changes settings.macros with globalGroup", () => {
|
||||
const macros = {};
|
||||
expect`\gdef\foo{1}`.toParse(new Settings({macros, globalGroup: true}));
|
||||
|
Reference in New Issue
Block a user