Add Locale.warn() and Locale.throw(), add tests for them, and use them in several TeX packages.#1482
Open
dpvc wants to merge 1 commit into
Open
Add Locale.warn() and Locale.throw(), add tests for them, and use them in several TeX packages.#1482dpvc wants to merge 1 commit into
dpvc wants to merge 1 commit into
Conversation
…m in several TeX packages. Move test trap functions into separate src file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the
Locale.warn()function and renamesLocale.error()asLocale.throw(), and uses these in the TeX packages that I mentioned in the finalize-tex branch. It updates the tests to cover these, and moves some output-trapping functions from thetestsuite/src/setupTex.tsfile to a newtraps.tsfile. The reason for this is thatsetupTeX.tsloadsnode-main, which does two two things that affect theLocalepackage: because it is component-based, it meansLocale.isComponentgets set, which we don't want (that changes the location whereLocalelooks for the localization files), second, it alters themathjax.asyncLoadwhich ends up causing different error messages. I could have gotten around these issues, but it seemed reasonable to separate out the non-tex-based output trapping functions fromsetupTex.tsin any case, and that avoids the problem.The change to
package.jsis to allow access to the newtrap.tsfile via#helpers/trap.js. Theindex.jsfile is modified to export the traps from the new file rather thansetupTex.js. The needed traps are loaded intosetupTex.tsrather than being defined there. I also fixed some JSDoc@returnsthat changed after adding theLocale.setLocale()calls (in an earlier PR).Some tests in
Tex.test.tsare adjusted to accommodate the use ofLocale.warn()and the removal of thewarn()methods that we discussed in our meeting. TheLocale.test.tsfile is implified to use thetrapOutputandtrapAsyncOutput()functions from the newtraps.tsfile, rather that chaining theconsole.errorandconsole.warnfunctions by hand, and a new section to testLocale.warn()is added.The usage of
consoleandthrow new Errorin several TeX packages are changes toLocale.warn()andLocale.throw()and theirwarn()methods removed, and the needed messages are added to the localization files.