aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorZufu Liu <unknown>2019-09-30 12:15:31 +1000
committerZufu Liu <unknown>2019-09-30 12:15:31 +1000
commit632bf5eb1f2825ac1c7f4c9850462ad1fe68990d (patch)
treeb1cf3d120610339493691d2f77514ece5b2132d3 /test
parent44b175314f0b875e6d3fa0664ad2c0133e4542f9 (diff)
downloadscintilla-mirror-632bf5eb1f2825ac1c7f4c9850462ad1fe68990d.tar.gz
Backport: Feature [feature-requests:#1305] Optimize setting up keyword lists in lexers.
Avoids splitting and sorting the input twice. Backport of changeset 7697:f0848608c92c.
Diffstat (limited to 'test')
-rw-r--r--test/unit/testWordList.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/testWordList.cxx b/test/unit/testWordList.cxx
index 4d7805d1e..3970d37d4 100644
--- a/test/unit/testWordList.cxx
+++ b/test/unit/testWordList.cxx
@@ -26,6 +26,21 @@ TEST_CASE("WordList") {
REQUIRE(!wl.InList("class"));
}
+ SECTION("Set") {
+ // Check whether Set returns whether it has changed correctly
+ const bool changed = wl.Set("else struct");
+ REQUIRE(changed);
+ // Changing to same thing
+ const bool changed2 = wl.Set("else struct");
+ REQUIRE(!changed2);
+ // Changed order shouldn't be seen as a change
+ const bool changed3 = wl.Set("struct else");
+ REQUIRE(!changed3);
+ // Removing word is a change
+ const bool changed4 = wl.Set("struct");
+ REQUIRE(changed4);
+ }
+
SECTION("WordAt") {
wl.Set("else struct");
REQUIRE(0 == strcmp(wl.WordAt(0), "else"));