Skip to content

Commit

Permalink
chore(developer): correct ERROR_VirtualKeyExpansionTooLong test follo…
Browse files Browse the repository at this point in the history
…wing fix #11137
  • Loading branch information
markcsinclair committed Apr 22, 2024
1 parent 92fb9cd commit 5fcf92d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ group(main) using keys

c maximum store length is 4096 UTF-16 code units, including U+0000 terminator
c #define GLOBAL_BUFSIZE 4096 // compfile.h
c so we need 0x101E - 0x0020 + 1 = 0x0FFF --> 4095 words
c each vk is 5 words long UC_SENTINEL CODE_EXTENDED shift key CODE_EXTENDEDEND (some long history here!)
c we start filling the buffer with 4066 words and then the remaining 30 bytes = 6 VKs A-F
c See #11136 for calculation adjustment TODO
c so we need 0x101D - 0x0020 + 1 = 0x0FFE --> 4094 words
c each VK is 5 words long UC_SENTINEL CODE_EXTENDED shift key CODE_EXTENDEDEND (some long history here!)
c we start filling the buffer with 4064 words (0x0FFF - 0x0020 + 1) and then the remaining 30 bytes = 6 VKs A-F

store(x) U+0020 .. U+1000 [K_A] .. [K_F]
store(x) U+0020 .. U+0FFF [K_A] .. [K_F]

any(x) + 'x' > 'x' context
4 changes: 2 additions & 2 deletions developer/src/kmc-kmn/test/test-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ describe('KmnCompilerMessages', function () {

// ERROR_VirtualKeyExpansionTooLong

it('should generate ERROR_VirtualKeyExpansionTooLong if a virtual key expansion is too long (more than GLOBAL_BUFSIZE elements)', async function() {
it('should generate ERROR_VirtualKeyExpansionTooLong if a virtual key expansion is too long and would overflow the buffer', async function() {
await testForMessage(this, ['invalid-keyboards', 'error_virtual_key_expansion_too_long.kmn'], KmnCompilerMessages.ERROR_VirtualKeyExpansionTooLong);
// callbacks.printMessages();
assert.equal(callbacks.messages[0].message, "Virtual key expansion is too large");
});

// ERROR_CharacterRangeTooLong
Expand Down

0 comments on commit 5fcf92d

Please sign in to comment.