mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-08 12:38:39 +00:00
Fix delimiter error message (#2186)
* Fix delimiter error message Avoid "circular structure" error message by avoiding JSON.stringify on a parse structure when getting an invalid delimiter type (e.g. ordgroup). Instead, report type of delimiter when it's invalid. Fixes #2184. * Fix and add tests
This commit is contained in:
@@ -250,14 +250,24 @@ describe("functions.js:", function() {
|
||||
describe("delimiter functions", function() {
|
||||
it("reject invalid opening delimiters", function() {
|
||||
expect`\bigl 1 + 2 \bigr`.toFailWithParseError(
|
||||
"Invalid delimiter: '1' after '\\bigl' at position 7:" +
|
||||
"Invalid delimiter '1' after '\\bigl' at position 7:" +
|
||||
" \\bigl 1̲ + 2 \\bigr");
|
||||
});
|
||||
it("reject invalid closing delimiters", function() {
|
||||
expect`\bigl(1+2\bigr=3`.toFailWithParseError(
|
||||
"Invalid delimiter: '=' after '\\bigr' at position 15:" +
|
||||
"Invalid delimiter '=' after '\\bigr' at position 15:" +
|
||||
" \\bigl(1+2\\bigr=̲3");
|
||||
});
|
||||
it("reject group opening delimiters", function() {
|
||||
expect`\bigl{(}1+2\bigr)3`.toFailWithParseError(
|
||||
"Invalid delimiter type 'ordgroup' at position 6:" +
|
||||
" \\bigl{̲(̲}̲1+2\\bigr)3");
|
||||
});
|
||||
it("reject group closing delimiters", function() {
|
||||
expect`\bigl(1+2\bigr{)}3`.toFailWithParseError(
|
||||
"Invalid delimiter type 'ordgroup' at position 15:" +
|
||||
" \\bigl(1+2\\bigr{̲)̲}̲3");
|
||||
});
|
||||
});
|
||||
|
||||
describe("\\begin and \\end", function() {
|
||||
|
Reference in New Issue
Block a user