diff options
| author | Jules Aguillon | 2025-12-13 15:58:34 +0100 |
|---|---|---|
| committer | GitHub | 2025-12-13 15:58:34 +0100 |
| commit | 08ebf8fabc860fb66d586aade838483dda86b5b0 (patch) | |
| tree | 1b13c55dded53ca8f2515ff58779f442d876bf54 /test/juloo.keyboard2 | |
| parent | 0ad03c6dea515f577c195304a24fac65bae5d272 (diff) | |
| download | unexpected-keyboard-08ebf8fabc860fb66d586aade838483dda86b5b0.tar.gz unexpected-keyboard-08ebf8fabc860fb66d586aade838483dda86b5b0.zip | |
Fix parsing of escaped characters in macros (#1126)
* refactor: Better printing for KeyValue in tests
* Fix parsing of escaped characters in macros
The parsing code was bugged with custom macros like `symbol:\abc` and
`symbol:\\abc`.
Diffstat (limited to 'test/juloo.keyboard2')
| -rw-r--r-- | test/juloo.keyboard2/KeyValueParserTest.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/juloo.keyboard2/KeyValueParserTest.java b/test/juloo.keyboard2/KeyValueParserTest.java index d56b6b5..aa506e7 100644 --- a/test/juloo.keyboard2/KeyValueParserTest.java +++ b/test/juloo.keyboard2/KeyValueParserTest.java @@ -44,6 +44,12 @@ public class KeyValueParserTest KeyValue.getSpecialKeyByName("ctrl"), KeyValue.getSpecialKeyByName("backspace") }, 0)); + Utils.parse("symbol:a,'\\\\abc','abc','a\\\\bc'", KeyValue.makeMacro("symbol", new KeyValue[]{ + KeyValue.makeStringKey("a"), + KeyValue.makeStringKey("\\abc"), + KeyValue.makeStringKey("abc"), + KeyValue.makeStringKey("a\\bc") + }, 0)); Utils.expect_error("symbol:"); Utils.expect_error("unterminated_string:'"); Utils.expect_error("unterminated_string:abc,'"); @@ -57,6 +63,10 @@ public class KeyValueParserTest { Utils.parse("a:b", KeyValue.makeCharKey('b', "a", 0)); Utils.parse("symbol:abc", KeyValue.makeStringKey("abc").withSymbol("symbol")); + Utils.parse("symbol:\\abc", KeyValue.makeStringKey("abc").withSymbol("symbol")); + Utils.parse("symbol:a\\bc", KeyValue.makeStringKey("abc").withSymbol("symbol")); + Utils.parse("symbol:\\\\abc", KeyValue.makeStringKey("\\abc").withSymbol("symbol")); + Utils.parse("symbol:a\\\\bc", KeyValue.makeStringKey("a\\bc").withSymbol("symbol")); } @Test |
