Add \message, \errmessage, and \show for debugging (#2135)

* Add \message, \errmessage, and \show for debugging

* Remove unnecessary parentheses

* add tests for \message and \errmessage
This commit is contained in:
ylemkimon
2019-12-02 08:24:47 +09:00
committed by Kevin Barabash
parent e5333ad04d
commit 0d8830af30
2 changed files with 43 additions and 0 deletions

View File

@@ -3732,3 +3732,23 @@ describe("Extending katex by new fonts and symbols", function() {
expect(katex.renderToString("۹۹^{۱۱}")).toMatchSnapshot();
});
});
describe("debugging macros", () => {
describe("message", () => {
it("should print the argument using console.log", () => {
jest.spyOn(console, "log");
expect`\message{Hello, world}`.toParse();
// eslint-disable-next-line no-console
expect(console.log.mock.calls[0][0]).toEqual("Hello, world");
});
});
describe("errmessage", () => {
it("should print the argument using console.error", () => {
jest.spyOn(console, "error");
expect`\errmessage{Hello, world}`.toParse();
// eslint-disable-next-line no-console
expect(console.error.mock.calls[0][0]).toEqual("Hello, world");
});
});
});