diff options
| -rw-r--r-- | test/unit/makefile | 1 | ||||
| -rw-r--r-- | test/unit/test.mak | 1 | ||||
| -rw-r--r-- | test/unit/testWordList.cxx | 32 | 
3 files changed, 34 insertions, 0 deletions
diff --git a/test/unit/makefile b/test/unit/makefile index 683391100..f95aab581 100644 --- a/test/unit/makefile +++ b/test/unit/makefile @@ -47,6 +47,7 @@ CXXFLAGS += -Wall -Wextra  TESTSRC=test*.cxx  # Files being tested from scintilla/src directory  TESTEDSRC=\ + ../../lexlib/WordList.cxx \   ../../src/CellBuffer.cxx \   ../../src/CharClassify.cxx \   ../../src/ContractionState.cxx \ diff --git a/test/unit/test.mak b/test/unit/test.mak index 934b0aa12..d79aff8b3 100644 --- a/test/unit/test.mak +++ b/test/unit/test.mak @@ -12,6 +12,7 @@ CXXFLAGS = /EHsc /wd 4805 $(INCLUDEDIRS)  TESTSRC=test*.cxx  # Files being tested from scintilla/src directory  TESTEDSRC=\ + ../../lexlib/WordList.cxx \   ../../src/CellBuffer.cxx \   ../../src/CharClassify.cxx \   ../../src/ContractionState.cxx \ diff --git a/test/unit/testWordList.cxx b/test/unit/testWordList.cxx new file mode 100644 index 000000000..a4ccf4d6a --- /dev/null +++ b/test/unit/testWordList.cxx @@ -0,0 +1,32 @@ +// Unit Tests for Scintilla internal data structures + +#include <string.h> + +#include "WordList.h" + +#include "catch.hpp" + +// Test WordList. + +TEST_CASE("WordList") { + +	WordList wl; + +	SECTION("IsEmptyInitially") { +		REQUIRE(0 == wl.Length()); +		REQUIRE(!wl.InList("struct")); +	} + +	SECTION("InList") { +		wl.Set("else struct"); +		REQUIRE(2 == wl.Length()); +		REQUIRE(wl.InList("struct")); +		REQUIRE(!wl.InList("class")); +	} + +	SECTION("WordAt") { +		wl.Set("else struct"); +		REQUIRE(0 == strcmp(wl.WordAt(0), "else")); +	} + +}  | 
