Skip to content

Translator tester: Be more vigilant against empty test cases.#22

Open
zoe-translates wants to merge 1 commit into
zotero:masterfrom
zoe-translates:prune-empty-test-cases-when-parsing-code
Open

Translator tester: Be more vigilant against empty test cases.#22
zoe-translates wants to merge 1 commit into
zotero:masterfrom
zoe-translates:prune-empty-test-cases-when-parsing-code

Conversation

@zoe-translates
Copy link
Copy Markdown

The test cases in a translator script may be empty, not just with an empty array for var testCases, but in the sense of completely missing.

In that case, don't pass invalid JSON (all whitespaces or empty string) to JSON.parse(), and use an empty array instead.

This fixes an annoying SyntaxError in the console while loading the file Ovid.js in the translators repository. That translator should be fixed, too.

The test cases in a translator script may be empty, not just with an
empty array for `var testCases`, but in the sense of completely missing.

In that case, don't pass invalid JSON (all whitespaces or empty string)
to `JSON.parse()`, and use an empty array instead.

This fixes an annoying `SyntaxError` in the console while loading the
file `Ovid.js` in the translators repository. That translator should be
fixed, too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant