diff options
author | Cashew <52880648+cashewnuttynuts@users.noreply.github.com> | 2024-06-28 23:06:27 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-28 16:06:27 +0000 |
commit | b4e885d1f1f467152295c2a830d87704b36f4ff6 (patch) | |
tree | 87219b4477b9f86fc6791a3a36394625f8d81635 /test/fixtures | |
parent | 79dc26b6a83e4ef1643d0795d569429086ac1024 (diff) |
Korean transformation tests (#1134)
* wip
* add tests
* wip
* fix typo
* beautify test output
* fix static analysis tests
Diffstat (limited to 'test/fixtures')
-rw-r--r-- | test/fixtures/language-transformer-test.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/fixtures/language-transformer-test.js b/test/fixtures/language-transformer-test.js index 69cdc230..bf6b723c 100644 --- a/test/fixtures/language-transformer-test.js +++ b/test/fixtures/language-transformer-test.js @@ -58,12 +58,14 @@ function hasTermReasons(languageTransformer, source, expectedTerm, expectedCondi /** * @param {LanguageTransformer} languageTransformer * @param {import('test/language-transformer-test').LanguageTransformerTestCategory[]} data + * @param {(input: string) => string} [preprocess] An optional function for if the input to the transformer needs to be preprocessed. */ -export function testLanguageTransformer(languageTransformer, data) { +export function testLanguageTransformer(languageTransformer, data, preprocess) { + if (typeof preprocess === 'undefined') { preprocess = (input) => input; } describe('deinflections', () => { describe.each(data)('$category', ({valid, tests}) => { for (const {source, term, rule, reasons} of tests) { - const {has} = hasTermReasons(languageTransformer, source, term, rule, reasons); + const {has} = hasTermReasons(languageTransformer, preprocess(source), preprocess(term), rule, reasons); let message = `${source} ${valid ? 'has' : 'does not have'} term candidate ${JSON.stringify(term)}`; if (rule !== null) { message += ` with rule ${JSON.stringify(rule)}`; |