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
This change adds the mocha-teamcity-reporter which outputs the running
tests in a special format that TeamCity can interpret. This allows TC
to show which tests run as well as the number of tests run.
Also refactor some of the build scripts to use functions.
Note that we had to explicitly add `--check-coverage=false` (which is the
default) to get successful builds when we run on TC.
Many of the types had very generic names (e.g. `Configuration`), and as
the types are now exported from `@keymanapp/common-types`, this was
unhelpful.
For units with many references, I used TypeScript's import-equals to
reduce the change impact. For units with only a few references, I added
the `LexicalModelTypes.` prefix to the references in source.
(Best reference I could find for import-equals: b722fa4e49)
Fixes: #12516
If a .kps file had an `<Info>` element without a URL attribute, it
would not map correctly in all circumstances. This change ensures that
the kps-file-reader is responsible for normalizing the layout of these
elements on read.
The package subfile description field is never really used in the
end-user apps. As it is meaningless metadata, we'll make it fully
optional, and start to remove all references in the designers and
compilers.
TODO: For packages targeting Keyman 18.0+, we should consider removing
the description field altogether from the subfiles.