diff options
author | Neil <nyamatongwe@gmail.com> | 2021-07-17 10:00:55 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-07-17 10:00:55 +1000 |
commit | 046b280114d11ff24b179dbe4df44127e80d39b5 (patch) | |
tree | deff08977ef7aec630c1a16bd894e11c9c109aea /test/unit/testDocument.cxx | |
parent | 39be73514c317e7d672e0a09862571e64f8979da (diff) | |
download | scintilla-mirror-046b280114d11ff24b179dbe4df44127e80d39b5.tar.gz |
Extract word edge detection to prepare for fixing bug.
This change does not affect behaviour.
Diffstat (limited to 'test/unit/testDocument.cxx')
-rw-r--r-- | test/unit/testDocument.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/testDocument.cxx b/test/unit/testDocument.cxx index 97db6d9a2..0f8e399fa 100644 --- a/test/unit/testDocument.cxx +++ b/test/unit/testDocument.cxx @@ -455,3 +455,26 @@ TEST_CASE("Document") { } } + +TEST_CASE("Words") { + + SECTION("WordsInText") { + const DocPlus doc(" abc ", 0); + REQUIRE(doc.document.IsWordAt(1, 4)); + REQUIRE(!doc.document.IsWordAt(0, 1)); + REQUIRE(!doc.document.IsWordAt(1, 2)); + const DocPlus docPunct(" [!] ", 0); + REQUIRE(docPunct.document.IsWordAt(1, 4)); + REQUIRE(!docPunct.document.IsWordAt(0, 1)); + REQUIRE(!docPunct.document.IsWordAt(1, 2)); + const DocPlus docMixed(" -ab ", 0); // '-' is punctuation, 'ab' is word + REQUIRE(docMixed.document.IsWordAt(2, 4)); + REQUIRE(docMixed.document.IsWordAt(1, 4)); + REQUIRE(docMixed.document.IsWordAt(1, 2)); + REQUIRE(!docMixed.document.IsWordAt(1, 3)); // 3 is between a and b so not word edge + // Scintilla's word definition just examines the ends + const DocPlus docOverSpace(" a b ", 0); + REQUIRE(docOverSpace.document.IsWordAt(1, 4)); + } + +} |