Skip to content

Commit

Permalink
chore(developer): correct ERROR_ExtendedStringTooLong test following fix
Browse files Browse the repository at this point in the history
  • Loading branch information
markcsinclair committed Apr 22, 2024
1 parent 5ec3589 commit 92fb9cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ group(main) using keys
c
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 0x101B - 0x0020 + 1 = 0x0FFD --> 4092 words, + 4 = 4096 = too long
c See #11136 for calculation adjustment TODO
c so we need 0x101B - 0x0020 + 1 = 0x0FFC --> 4092 words, + 4 = 4096 = too long

store(x) U+0020 .. U+101B

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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 0x101D - 0x0020 + 1 = 0x0FFE --> 4094 words
c + 1, for 'a' in the rule below = 4095, which triggers the buffer boundary check.
c Noting that this is conservative and losing 2 possible chars, but not fixing
c Noting that this is conservative and losing 1 possible char, but not fixing
c in compiler.cpp at this time.

store(x) U+0020 .. U+101D
Expand Down
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 @@ -103,9 +103,9 @@ describe('KmnCompilerMessages', function () {

// ERROR_ExtendedStringTooLong

it('should generate ERROR_ExtendedStringTooLong if an extended string is too long (more than GLOBAL_BUFSIZE elements)', async function() {
it('should generate ERROR_ExtendedStringTooLong if an extended string is too long and would overflow the buffer', async function() {
await testForMessage(this, ['invalid-keyboards', 'error_extended_string_too_long.kmn'], KmnCompilerMessages.ERROR_ExtendedStringTooLong);
// callbacks.printMessages();
assert.equal(callbacks.messages[0].message, "Extended string is too long character offset: 9");
});

// ERROR_VirtualKeyExpansionTooLong
Expand Down

0 comments on commit 92fb9cd

Please sign in to comment.