From 5ec3589e07b748e5654e9ba2d067c743b156d962 Mon Sep 17 00:00:00 2001 From: "Dr Mark C. Sinclair" Date: Mon, 22 Apr 2024 15:44:34 +0100 Subject: [PATCH] chore(developer): correct ERROR_OutsTooLong test following fix #11137 --- .../fixtures/invalid-keyboards/error_outs_too_long.kmn | 7 +++---- developer/src/kmc-kmn/test/test-messages.ts | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/developer/src/kmc-kmn/test/fixtures/invalid-keyboards/error_outs_too_long.kmn b/developer/src/kmc-kmn/test/fixtures/invalid-keyboards/error_outs_too_long.kmn index 750e45d3bad..76d68b97e85 100644 --- a/developer/src/kmc-kmn/test/fixtures/invalid-keyboards/error_outs_too_long.kmn +++ b/developer/src/kmc-kmn/test/fixtures/invalid-keyboards/error_outs_too_long.kmn @@ -7,12 +7,11 @@ 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 0x101C - 0x0020 + 1 = 0x0FFD --> 4093 words -c + 1, for 'a' in the rule below = 4094, which triggers the buffer boundary check. +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 in compiler.cpp at this time. -c See #11136 for calculation adjustment TODO -store(x) U+0020 .. U+101C +store(x) U+0020 .. U+101D 'a' outs(x) + 'x' > 'x' context diff --git a/developer/src/kmc-kmn/test/test-messages.ts b/developer/src/kmc-kmn/test/test-messages.ts index d1792ffcd55..9ffe617e70d 100644 --- a/developer/src/kmc-kmn/test/test-messages.ts +++ b/developer/src/kmc-kmn/test/test-messages.ts @@ -96,9 +96,9 @@ describe('KmnCompilerMessages', function () { // ERROR_OutsTooLong - it('should generate ERROR_OutsTooLong if a store referenced in outs() is too long (more than GLOBAL_BUFSIZE elements)', async function() { + it('should generate ERROR_OutsTooLong if a store referenced in outs() is too long and would overflow the buffer', async function() { 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"); }); // ERROR_ExtendedStringTooLong