From acf156b965a92faf4bfcf8cded7cf9effd370379 Mon Sep 17 00:00:00 2001 From: "Dr Mark C. Sinclair" Date: Wed, 27 Nov 2024 07:02:44 +0000 Subject: [PATCH 1/4] chore(common/web): add test-unicodeset-parser.ts to test UnicodeSet --- .../test-unicodeset-parser-api.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts diff --git a/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts b/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts new file mode 100644 index 00000000000..073e0d61f3d --- /dev/null +++ b/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts @@ -0,0 +1,24 @@ +import 'mocha'; +import { assert } from 'chai'; +import { UnicodeSet } from '../../src/ldml-keyboard/unicodeset-parser-api.js'; + +class MockUnicodeSet extends UnicodeSet { + constructor(public pattern: string, public ranges: number[][]) { + super(pattern, ranges); // does nothing + this.pattern = pattern; + this.ranges = ranges; + } +} + +describe('Test of Unicode-Parser-API', () => { + describe('Test UnicodeSet', () => { + it('can provide a correct ranges length', () => { + const unicodeSet = new MockUnicodeSet("[ħa-z]", [[0x41, 0x7A], [0x0127, 0x0127]]); + assert.equal(unicodeSet.length, 2); + }); + it('can provide a correct string representation', () => { + const unicodeSet = new MockUnicodeSet("[ħa-z]", [[0x41, 0x7A], [0x0127, 0x0127]]); + assert.deepEqual(unicodeSet.toString(), "[ħa-z]"); + }); + }); +}); \ No newline at end of file From a2cb00aa8118895248520af1cf25d6dffae81447 Mon Sep 17 00:00:00 2001 From: "Dr Mark C. Sinclair" Date: Thu, 28 Nov 2024 02:01:45 +0000 Subject: [PATCH 2/4] chore(common/web): add copyright banner --- .../test/ldml-keyboard/test-unicodeset-parser-api.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts b/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts index 073e0d61f3d..330e53c7c80 100644 --- a/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts +++ b/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts @@ -1,3 +1,11 @@ +/* + * Keyman is copyright (C) SIL Global. MIT License. + * + * Created by Dr Mark C. Sinclair on 2024-11-28 + * + * Test code for unicodeset-parser-api.ts + */ + import 'mocha'; import { assert } from 'chai'; import { UnicodeSet } from '../../src/ldml-keyboard/unicodeset-parser-api.js'; From 3de4f997e1234153d3db5a699e2b92cafb6c1d04 Mon Sep 17 00:00:00 2001 From: "Dr Mark C. Sinclair" Date: Fri, 29 Nov 2024 01:56:38 +0000 Subject: [PATCH 3/4] chore(common/web): remove MockUnicodeSet as unnecessary --- .../ldml-keyboard/test-unicodeset-parser-api.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts b/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts index 330e53c7c80..4f85a39cb38 100644 --- a/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts +++ b/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts @@ -1,7 +1,7 @@ /* * Keyman is copyright (C) SIL Global. MIT License. * - * Created by Dr Mark C. Sinclair on 2024-11-28 + * Created by Dr Mark C. Sinclair on 2024-11-29 * * Test code for unicodeset-parser-api.ts */ @@ -10,22 +10,14 @@ import 'mocha'; import { assert } from 'chai'; import { UnicodeSet } from '../../src/ldml-keyboard/unicodeset-parser-api.js'; -class MockUnicodeSet extends UnicodeSet { - constructor(public pattern: string, public ranges: number[][]) { - super(pattern, ranges); // does nothing - this.pattern = pattern; - this.ranges = ranges; - } -} - describe('Test of Unicode-Parser-API', () => { describe('Test UnicodeSet', () => { it('can provide a correct ranges length', () => { - const unicodeSet = new MockUnicodeSet("[ħa-z]", [[0x41, 0x7A], [0x0127, 0x0127]]); + const unicodeSet = new UnicodeSet("[ħa-z]", [[0x41, 0x7A], [0x0127, 0x0127]]); assert.equal(unicodeSet.length, 2); }); it('can provide a correct string representation', () => { - const unicodeSet = new MockUnicodeSet("[ħa-z]", [[0x41, 0x7A], [0x0127, 0x0127]]); + const unicodeSet = new UnicodeSet("[ħa-z]", [[0x41, 0x7A], [0x0127, 0x0127]]); assert.deepEqual(unicodeSet.toString(), "[ħa-z]"); }); }); From eccc7edeba33f85c5cc3c8d7663ca5a0c3d97266 Mon Sep 17 00:00:00 2001 From: "Dr Mark C. Sinclair" Date: Fri, 29 Nov 2024 03:30:08 +0000 Subject: [PATCH 4/4] chore(common/web): add blank line at end of file --- .../web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts b/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts index 4f85a39cb38..cc36e78ae28 100644 --- a/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts +++ b/common/web/types/test/ldml-keyboard/test-unicodeset-parser-api.ts @@ -21,4 +21,4 @@ describe('Test of Unicode-Parser-API', () => { assert.deepEqual(unicodeSet.toString(), "[ħa-z]"); }); }); -}); \ No newline at end of file +});