Skip to content

Commit

Permalink
chore(core,common): updates for CLDR v46 data
Browse files Browse the repository at this point in the history
- can't test from both at the same time, so pick one, ja_Latn, to test from 45
  • Loading branch information
srl295 committed Sep 13, 2024
1 parent 5c48d6c commit 03366a1
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 12 deletions.
4 changes: 2 additions & 2 deletions common/web/types/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ builder_parse "$@"
function compile_schemas() {
# We need the schema files at runtime and bundled, so always copy it for all actions except `clean`
local schemas=(
"$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/45/ldml-keyboard3.schema.json"
"$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/45/ldml-keyboardtest3.schema.json"
"$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/46/ldml-keyboard3.schema.json"
"$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/46/ldml-keyboardtest3.schema.json"
"$KEYMAN_ROOT/common/schemas/kvks/kvks.schema.json"
"$KEYMAN_ROOT/common/schemas/kpj/kpj.schema.json"
"$KEYMAN_ROOT/common/schemas/kpj-9.0/kpj-9.0.schema.json"
Expand Down
48 changes: 39 additions & 9 deletions core/tests/unit/ldml/keyboards/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@

# keyboards in resources/standards-data/ldml-keyboards/45/3.0/
# tests in resources/standards-data/ldml-keyboards/45/test/
tests_from_cldr = [
tests_from_cldr_45 = [
'ja-Latn',
# 'pt-t-k0-abnt2',
# 'fr-t-k0-test',
# 'pcm',
# 'bn',
]

tests_from_cldr_46 = [
# 'ja-Latn',
'pt-t-k0-abnt2',
'fr-t-k0-test',
'pcm',
Expand Down Expand Up @@ -52,14 +60,18 @@ tests = tests_without_testdata
tests += tests_with_testdata
tests_needing_copy = tests # not including cldr

tests += tests_from_cldr
tests += tests_from_cldr_46
tests += tests_from_cldr_45

# Setup kmc

kmc_root = meson.global_source_root() / '../developer/src/kmc'
ldml_root = meson.global_source_root() / '../resources/standards-data/ldml-keyboards/45'
ldml_data = join_paths(ldml_root, '3.0')
ldml_testdata = join_paths(ldml_root, 'test')
ldml_root_45 = meson.global_source_root() / '../resources/standards-data/ldml-keyboards/45'
ldml_data_45 = join_paths(ldml_root_45, '3.0')
ldml_testdata_45 = join_paths(ldml_root_45, 'test')
ldml_root_46 = meson.global_source_root() / '../resources/standards-data/ldml-keyboards/46'
ldml_data_46 = join_paths(ldml_root_46, '3.0')
ldml_testdata_46 = join_paths(ldml_root_46, 'test')
kmc_cmd = [node, '--enable-source-maps', kmc_root]

# Build all keyboards in output folder
Expand Down Expand Up @@ -87,20 +99,38 @@ foreach kbd : tests_with_testdata
endforeach


foreach kbd : tests_from_cldr
foreach kbd : tests_from_cldr_45
configure_file(
copy: true,
input: ldml_data_45 / kbd + '.xml',
output: kbd + '.xml'
)
configure_file(
command: kmc_cmd + ['build', '@INPUT@', '--out-file', '@OUTPUT@'],
input: join_paths(ldml_data_45, kbd + '.xml'),
output: kbd + '.kmx',
)
configure_file(
command: kmc_cmd + ['build', 'ldml-test-data', '@INPUT@', '--out-file', '@OUTPUT@'],
input: join_paths(ldml_testdata_45, kbd + '-test.xml'),
output: kbd + '-test.json',
)
endforeach

foreach kbd : tests_from_cldr_46
configure_file(
copy: true,
input: ldml_data / kbd + '.xml',
input: ldml_data_46 / kbd + '.xml',
output: kbd + '.xml'
)
configure_file(
command: kmc_cmd + ['build', '@INPUT@', '--out-file', '@OUTPUT@'],
input: join_paths(ldml_data, kbd + '.xml'),
input: join_paths(ldml_data_46, kbd + '.xml'),
output: kbd + '.kmx',
)
configure_file(
command: kmc_cmd + ['build', 'ldml-test-data', '@INPUT@', '--out-file', '@OUTPUT@'],
input: join_paths(ldml_testdata, kbd + '-test.xml'),
input: join_paths(ldml_testdata_46, kbd + '-test.xml'),
output: kbd + '-test.json',
)
endforeach
13 changes: 13 additions & 0 deletions core/tests/unit/ldml/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,19 @@ foreach kbd : tests
test(kbd, ldml, args: [kbd_src, kbd_obj], suite: 'ldml-keyboards')
endforeach

foreach kbd : tests_from_cldr_45
kbd_src = test_path / kbd + '.xml'
kbd_obj = test_path / kbd + '.kmx'
test(kbd, ldml, args: [kbd_src, kbd_obj], suite: 'ldml-keyboards')
endforeach

foreach kbd : tests_from_cldr_46
kbd_src = test_path / kbd + '.xml'
kbd_obj = test_path / kbd + '.kmx'
test(kbd, ldml, args: [kbd_src, kbd_obj], suite: 'ldml-keyboards')
endforeach


# Run tests on all invalid keyboards (`invalid_tests` defined in invalid-keyboards/meson.build)

foreach kbd : invalid_tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('ldml keyboard xml reader tests', function () {
instancePath: '/keyboard3/conformsTo',
keyword: 'enum',
message: `must be equal to one of the allowed values`,
params: 'allowedValues="45"',
params: 'allowedValues="45,46"',
})],
},
{
Expand Down

0 comments on commit 03366a1

Please sign in to comment.