Commit graph

518 commits

Author SHA1 Message Date
Marc Durdin
54f586f51b chore(developer): update tests to match 2025-09-19 09:29:00 +02:00
Marc Durdin
1892142c6d fix(developer): remove incorrect offset for compiler error line
Fixes: #13903
2025-09-19 09:28:59 +02:00
Marc Durdin
fdd219a481 chore(developer): remove mozhi_malayalam.kmx from baseline fixtures
This is required because it includes rules with nul and other output.
2025-03-18 12:16:40 +07:00
Marc Durdin
5683b370fe fix(developer): add validation of nul usage in output part of rule
If `nul` is used in the output part of a rule, then text or
text-emitting statements cannot also be included in the output of that
rule. This was not enforced in earlier versions of Keyman.

Adds a unit test for the enhanced validation.

Fixes: #13455
Relates-to: keymanapp/keyboards#3379
2025-03-18 09:54:06 +07:00
Marc Durdin
03001bd971 chore(common): add unit test for nul and context() in context part of rule
The compiler and Core appear to be working correctly in this situation;
this test verifies Core's behaviour.

Fixes: #13299
2025-03-04 11:22:35 +01:00
Marc Durdin
2b9b8eb419 chore(core): add unit tests to validate nul with index and context
Add 4 test keyboards to validate `nul` and `if` used in conjunction with
`index` and `context` and corresponding references in core unit tests.

Add a script to rebuild baseline keyboards using a copy of kmcomp.exe
16.0.138; this is setup and tested only on Windows (YMMV on WINE, etc).

Add the 4 additional baseline test keyboards to kmcmplib unit tests for
build consistency between kmcomp 16 and kmcmplib 18 (all pass).

Note: two of the new Core tests currently fail. This is expected, see
issue #13304.

Fixes: #13303
2025-02-21 13:06:29 +07:00
Marc Durdin
5d16d083bd chore(developer): update unit test error checks 2025-02-21 11:10:53 +07:00
Marc Durdin
4a797d0e5a fix(developer): verify context(n) offsets are valid in kmcmplib
Add validity checks to kmcmplib to verify that offsets provided to
`context(n)` are in range for the context, and do not point to
non-character elements (`nul` and `if`) in the context string.

Fixes: #13301
Fixes: #13302
Relates-to: #13299
Relates-to: #13276
2025-02-21 09:58:26 +07:00
Eberhard Beilharz
e069c3ad2a
chore(core): remove meson warnings for wasm builds
Replace deprecated function calls. Also add `strip` command to wasm
build defaults.
2024-12-12 19:48:13 +01:00
Marc Durdin
9a01ac166d chore(core): Merge branch 'master' into fix/core/12619-disable-assertions-vcwin-release-build 2024-12-01 16:17:21 +07:00
Eberhard Beilharz
66404f9503
chore(developer): rename test files
This change rename the test files for Developer according to the
discussion at the Keyman conference in November 2024.
2024-11-28 14:32:09 +01:00
Marc Durdin
d71cb56ca7 fix(core): rename assert() to test_assert() in unit tests
Had a real yak shave this morning with disabling assertions in release
builds in our C/C++ code. It turns out that our unit tests use
`assert()` which we intended to use from `test_assert.h`, but in some
cases `cassert` or `assert.h` had been #included after `test_assert.h`,
overriding our special `assert()` macro. The chain of includes is
somewhat hard to puzzle out -- it's often buried several levels deep.
This meant that a release build would drop all test assertions, meaning
most tests passed, unsurprisingly, as there were no assertions left to
fail ... but some tests failed with crashes because we optimized out
important lines such as `assert(some_important_function())`.

I was quite unhappy with this fragility, so I have opted to rename
`assert()` to `test_assert()` in all of our home-grown C/C++ unit tests,
which further highlighted unit tests which were only using the C/C++
`assert()` and not ours, so then had to figure out which unit test
executables needed to have `test_assert` added, and then ... then ...
discovered a bug in `test_color.h`, where we were #including
`io.h`/`unistd.h` inside a `namespace console_color {}` block, which
just happened to be the first ref to those beautiful headers, and thus
(because `#pragma once`) meant that useful little functions like
`access()` were no longer accessible to us in the global namespace.

I have also audited Every Single Call to `assert()` to verify that we do
not do Important Work inside the parentheses, and, apart from those
offending unit tests, now resolved with `test_assert()`, it looks like
all is good.

I would like to present one very well-shaved yak in this commit.

Fixes: #12619
2024-11-28 09:46:01 +07:00
Dr Mark C. Sinclair
f641b3cc08 chore(developer): remove unnecessary assignment to sFlag block variable 2024-11-27 01:27:59 +00:00
Dr Mark C. Sinclair
5adb76b357 chore(developer): removed comments referencing ERROR_XXXInVirtualKeySection from gtest-compiler-test.cpp 2024-11-26 04:04:13 +00:00
Dr Mark C. Sinclair
f9f16167c1 chore(developer): made case 11 a block and moved sFlag, finished and wsRequired inside it 2024-11-26 03:59:59 +00:00
Dr Mark C. Sinclair
f51bb9602b chore(developer): removed ERROR_XXXInVirtualKeySection from Compiler.cpp and kmn_compiler_errors.h 2024-11-26 03:46:58 +00:00
Dr Mark C. Sinclair
6dbd9cfab4 chore(developer): Merge branch 'master' into test/developer/kmcmplib-compiler-unit-tests-5 2024-11-26 03:19:16 +00:00
Dr Mark C. Sinclair
a33037b4df fix(developer): add basic_kbdcherp and basic_kbdolch to list of excluded keyboards 2024-11-13 16:54:59 +00:00
Marc Durdin
18532724fc
Merge branch 'master' into fix/developer/12307-correct-whitespace-handling-in-virtual-keys-and-remove-partially-implemented-virtual-key-series 2024-11-13 04:25:02 +01:00
Dr Mark C. Sinclair
e661d7c329 chore(developer): Merge branch 'master' into fix/developer/12307-correct-whitespace-handling-in-virtual-keys 2024-11-07 11:19:43 +00:00
Marc Durdin
1c39a0e38f chore: fix PR number in comment 2024-11-07 06:03:04 +07:00
Marc Durdin
0df0287cb3 chore(developer): remove setlocale again, add exclusions for fv_statimcets, fv_nuucaanul 2024-11-06 13:56:41 +07:00
Marc Durdin
3a359b580a chore(developer): include clocale for CompilerInterfaces, for setlocale call 2024-11-06 13:43:08 +07:00
Marc Durdin
4e2f83ad50 chore(developer): skip anii and sil_kmhmu in full test
anii.kmn and sil_kmhmu.kmn both have mismatching case in filename
references for icons. For now, we will disable tests for these two
keyboards, so that tests pass on Linux (which has case-sensitive
filesystem).

Note: the filename case was already addressed in the keyboards repo, so
when we realign to a more recent commit for the test fixtures, we should
be able to include these tests again.

Relates-to: #12623
2024-11-06 13:41:31 +07:00
Marc Durdin
411cd06df7 fix(developer): use C.UTF-8 locale to for consistent cross-platform whitespace management
On mac arch build, kmcmplib is failing to trim U+2002, unlike all other
platforms. Using UTF-8 locale should treat the ISO 30112 POSIX space
characters, which includes U+2002, as whitespace.
2024-11-06 13:34:28 +07:00
Marc Durdin
3c680e3334 fix(developer): normalize path separators in unit tests in kmcmplib
While kmc did this already in its callbacks, the unit test callbacks
did not, which meant that some keyboard tests failed on Linux and macOS.

Relates-to: #12623
2024-11-06 12:57:55 +07:00
Marc Durdin
d88f16e153 chore(developer): include build-utils-ci.inc.sh in kmcmplib 2024-11-06 11:09:14 +07:00
Marc Durdin
f4bd99f935 fix(developer): reconnect --full-test in kmcmplib build and enable for CI
The --full-test parameter in kmcmplib build.sh has not been working.
This PR reconnects the parameter and also enables it by default for CI
test builds (not release builds).

Fixes: #12623
2024-11-06 10:59:29 +07:00
Marc Durdin
393a15e2f2 chore(developer): skip masaram_gondi in kmcmplib full test
masaram_gondi.kmx fixture is built from a known-bad source, which is
caught in kmcmplib 18.0.

This failure is because the keyboard source had non-BMP characters in
the key part of the rule on line 215, which has been picked up by the
18.0 compiler in #11806:

```
$keymanonly: if(opt1 = 'gondi') any(Vyanjana)"𑵄" + any(Vyanjana)	>	index(Vyanjana,2) U+11D45
```

The trick here is that the compiled fixture
developer/src/kmcmplib/tests/fixtures/keyboards-repo/masaram_gondi.kmx
is based on a [broken version of the keyboard
source](965ef1941f/release/m/masaram_gondi/source/masaram_gondi.kmn)
in the keyboards repo ([fixed
version](06cfd2d186/release/m/masaram_gondi/source/masaram_gondi.kmn)),
and updating to the fixed version will also trigger updates to a bunch
of other keyboards. I think the simplest resolution is probably to skip
masaram_gondi for 18.0.

Relates-to: #12623
Relates-to: #11806
2024-11-06 09:49:39 +07:00
Marc Durdin
baf08c77e6 fix(developer): correct regression from #12107
Fixes a regression arising from #12107 in debug store strings.

Relates-to: #12623
Relates-to: #12107
2024-11-06 09:48:00 +07:00
Dr Mark C. Sinclair
036ce049af chore(developer): update comments to remover TODO where virtual key section cannot be reached 2024-11-04 10:28:53 +00:00
Dr Mark C. Sinclair
ed42594b1a fix(developer): minor layout changes 2024-11-01 12:10:39 +00:00
Dr Mark C. Sinclair
94019b92b5 fix(developer): add wsRequired flag to check for whitespace between modifiers and modifier(s) and key 2024-11-01 11:43:16 +00:00
Dr Mark C. Sinclair
72a27464f5 fix(developer): refactor virtual key whitespace loop and improve layout 2024-11-01 10:48:49 +00:00
Dr Mark C. Sinclair
86a6bf617b fix(developer): remove redundant virtual key series while loop 2024-11-01 10:40:58 +00:00
Dr Mark C. Sinclair
d1bd4ec651 fix(developer): remove virtual key series 2024-11-01 10:28:13 +00:00
Dr Mark C. Sinclair
8ac4267ce3 chore(developer): added commented-out unit test for multiple grouped virtual keys (see #12307) 2024-10-29 14:13:36 +00:00
Dr Mark C. Sinclair
feb7c51f8f chore(developer): four additional test cases with spaces around the names of custom virtual keys 2024-10-29 13:20:20 +00:00
Dr Mark C. Sinclair
2da8f7b17b chore(developer): add two test cases for VKeyMayBeVCKey when FMnemonicLayout is set 2024-10-29 13:13:49 +00:00
Dr Mark C. Sinclair
c36f093a91 chore(developer): some clarification of comments on test cases for custom name virtual keys 2024-10-24 12:40:21 +01:00
Dr Mark C. Sinclair
4b30cc9f3f chore(developer): added virtual key names to initVKDictionary() 2024-10-24 12:29:02 +01:00
Dr Mark C. Sinclair
6ec4a47214 chore(developer): three test cases for custom virtual key names 2024-10-21 12:30:08 +01:00
Dr Mark C. Sinclair
e54762e1eb chore(developer): add two test cases for long virtual key names 2024-10-21 11:55:41 +01:00
Dr Mark C. Sinclair
b3635680a6 chore(developer): correct extern variable initialisation (kmcmp::FMnemonicLayout) 2024-10-21 10:48:36 +01:00
Dr Mark C. Sinclair
592ffbd807 chore(developer): add six additional test cases (virtual char key), plus three commented-out test cases for issue #12307 2024-10-14 16:03:11 +01:00
Dr Mark C. Sinclair
24377acfc9 chore(developer): add ten virtual key test cases (virtual char key) 2024-10-14 11:58:37 +01:00
Dr Mark C. Sinclair
8d9ec89a3d chore(developer): add test cases for chiral modifiers version bump 2024-10-10 12:36:45 +01:00
Dr Mark C. Sinclair
5b7ccc9f05 chore(developer): check for mixed modifiers on virtual keys 2024-10-10 11:20:35 +01:00
Dr Mark C. Sinclair
2f7096a810 chore(developer): add ten test cases on virtual key qualifiers 2024-10-10 10:47:18 +01:00
Dr Mark C. Sinclair
d269edb20c chore(developer): add initial three test cases to GetXStringImpl_type_osb test, plus initVKDictionary() 2024-10-07 16:25:42 +01:00