keyman icon indicating copy to clipboard operation
keyman copied to clipboard

test(developer): kmcmplib compiler unit tests 2

Open markcsinclair opened this issue 1 year ago • 2 comments

Google Test based unit tests for Compiler.cpp

Continues PR #11378

@keymanapp-test-bot skip

markcsinclair avatar Jun 03 '24 11:06 markcsinclair

User Test Results

Test specification and instructions

User tests are not required

keymanapp-test-bot[bot] avatar Jun 03 '24 11:06 keymanapp-test-bot[bot]

Hmm ... one of the commits (54d82b5) says initFileKeyboard when it should say deleteFileKeyboard ... too late to change.

markcsinclair avatar Jun 08 '24 12:06 markcsinclair

Putting this in for review as it stands, and will continue in a new PR. There are several test cases written but commented out due to issues #11814 (u16tok() bug)and #11937 (GetDelimitedString() bug), as well as a test that passes and shouldn't due to issue #11833 (a space works as well as a comma between arguments in index()). The fixes for the outstanding issues should uncomment (or reverse the outcome) of the relevant test cases here.

markcsinclair avatar Jul 08 '24 11:07 markcsinclair

LGTM outside of lines 876 - 879.

I'm not currently able to adequately parse the setup for that block to know why the test works and makes sense. It's not that I found an issue; it's more that I'm having difficulty parsing what it represents and so cannot give good feedback there. Feel free to move forward if you're not too worried about that particular test - it's one of many, and the reset seem fine and clear enough.

I have added some local variables and comments to try to clarify the CERR_OutsTooLong test case

markcsinclair avatar Jul 23 '24 19:07 markcsinclair

Re-review requested as nine test cases uncommented and passing due to having merged #11938 and #11910 into master.

markcsinclair avatar Jul 24 '24 10:07 markcsinclair

I'm admittedly not terribly clear on the cases from among the newly-uncommented nine (see ea0a2f7) that involve the special Keyman-language keyword beep in the midst of other statements, but otherwise this LGTM.

The reason the beeps are there is because the compiler renenters on that part of the statement (e.g. if you call GetXStringImpl() on u"baselayout(beep)", the call chain includes process_baselayout() on the argument beep, which ultimately calls GetXStringImpl() on beep. I selected beep as a simple command that I had already tested. In an ideal world, all of these case statements in GetXStringImpl() and the functions they call would be stubbable virtual class methods, so the unit test didn't extend beyond a single method, but what can you do!

markcsinclair avatar Jul 26 '24 10:07 markcsinclair

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

keyman-server avatar Jul 26 '24 18:07 keyman-server