Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(developer) kmn compiler messages unit tests #11284

Merged
merged 10 commits into from
May 21, 2024

Conversation

markcsinclair
Copy link
Contributor

@markcsinclair markcsinclair commented Apr 22, 2024

Review and extend the unit test coverage of the kmn compiler messages.

Currently failing tests, see #11136 and #11137

@keymanapp-test-bot skip

@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Apr 22, 2024

User Test Results

Test specification and instructions

User tests are not required

@keymanapp-test-bot keymanapp-test-bot bot added this to the B17S6 milestone Apr 22, 2024
@markcsinclair markcsinclair marked this pull request as draft April 22, 2024 10:47
@mcdurdin mcdurdin changed the base branch from beta to master April 25, 2024 06:22
@darcywong00 darcywong00 modified the milestones: B17S6, A18S1 Apr 28, 2024
@darcywong00 darcywong00 modified the milestones: A18S1, A18S2 May 11, 2024
@markcsinclair markcsinclair marked this pull request as ready for review May 13, 2024 15:58
@markcsinclair
Copy link
Contributor Author

As I am working on the kmcmplib C++ testing at present, the limited changes here should be reviewed and merged. The changes are essentially those to get tests impacted by an earlier fix (see #11136 and #11137) working again. I am not fully confident of the changes, as I am still growing in my understanding of the kmcmplib library - I will thus have to lean heavily on Marc's reviewing here.

await testForMessage(this, ['invalid-keyboards', 'error_outs_too_long.kmn'], KmnCompilerMessages.ERROR_OutsTooLong);
// callbacks.printMessages();
assert.equal(callbacks.messages[0].message, "Store cannot be inserted with outs() as it makes the extended string too long character offset: 5");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we really want to test the message content because adjusting the text of a message should probably not be affecting unit tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, but I limited myself to just correcting the four failing tests. Six other pre-existing tests check the error message, only two do not, so for consistency I replaced commented out code to just print the message with assertions for the four tests I touched. Options include (i) simply removing the assertions on the messages on the four corrected tests, accepting the inconsistency; (ii) removing the assertions on messages from all existing tests as well as the four I corrected; (iii) looking to find a way (not sure how difficult this would be as I am not yet fully familiar with the interaction of the TS wrapper and kmcmplib) to read the messages from kmcmplib and assert these in the TS ... not really necessary in a unit test though ... operating more at the functional level; (iv) look to mock some aspect of the interaction so there is no dependency on the actual message text in kmcmplib.

Given effort vs. return, I am thinking (ii); what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think (ii) makes sense, yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@markcsinclair markcsinclair merged commit c55484f into master May 21, 2024
3 checks passed
@markcsinclair markcsinclair deleted the test/developer/kmn-compiler-messages-unit-tests branch May 21, 2024 08:11
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.40-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants