spiegel-keyman/core/tests/unit/ldml
2026-05-07 15:20:19 +02:00
..
fixtures refactor(core): clean up unit tests 2026-04-28 12:17:44 +02:00
context_normalization.tests.cpp chore(core): address review comments on unit tests 2026-05-06 12:09:19 +02:00
kmx_plus.tests.cpp chore(core): use ASSERT_FALSE and ASSERT_TRUE where possible 2026-05-06 14:01:18 +02:00
ldml.tests.cpp chore(core): avoid emitting control chars into junit.xml 2026-04-28 15:48:49 +02:00
ldml_test_source.cpp chore(core): add cross-reference between ldml_test_source and kmx_test_source 2026-05-06 15:09:25 +02:00
ldml_test_source.hpp refactor(core): clean up unit tests 2026-04-28 12:17:44 +02:00
ldml_test_utils.cpp chore(linux): Rename namespace kbp to core 2023-10-19 10:39:55 +02:00
ldml_test_utils.hpp refactor(core): split context API from Core primary API 2024-01-17 14:44:25 +11:00
meson.build refactor(core): clean up unit tests 2026-04-28 12:17:44 +02:00
README.md refactor(core): clean up unit tests 2026-04-28 12:17:44 +02:00
transforms.tests.cpp chore(core): cleanup leaks in tests and skipped tests 2026-05-07 15:19:27 +02:00
unicode.tests.cpp refactor(core): clean up unit tests 2026-04-28 12:17:44 +02:00
write_node_versions.js fix(core): add a test to verify ICU and Unicode version 2024-05-23 09:31:15 -05:00

LDML unit tests

This directory contains unit tests that test the LDML keyboard processing and related functions.

For the fixture-based tests, the driver (ldml.tests.cpp) loads and executes the tests. Each test consist of a Keyman keyboard source file (*.xml) and the compiled KMXPlus keyboard. The source file contains rules and defines the setup, input and expected results.

Defining tests in the .xml file

Somewhere near the top of the file, an XML comment contains lines that define the setup, input and expected results.

Setup

  • description: this is just for commenting what we test here
@@description: Tests Caps Lock env set
  • capsLock: allows to set the caps lock state. The example below turns caps-lock on at the start of the test. [K_CAPS] in the keys comment allows toggling of caps lock.
@@capsLock: 1
  • context: allows to setup a string which serves as context
@@context:

Input

  • keys: defines one or more virtual keys that will be processed one after the other
@@keys: [K_1][K_CAPS][K_2][SHIFT K_3][K_4][K_CAPS][K_5][K_CAPS][K_6]

Expected Result

  • expected: the resulting string of processing the input keys. In the example below each key press is expected to output the string 'pass.'.
@@expected: pass.pass.pass.pass.pass.pass.

Running the tests

All tests can be run at once with `./core/build.sh test'.

Alternatively it's possible to run a single test with:

cd core
build/<arch>/<configuration>/tests/unit/ldml/ldml-tests 'tests/unit/ldml/fixtures/keyboards/000_test_zero.xml' 'tests/unit/ldml/fixtures/keyboards/000_test_zero.kmx'