notepad-plus-plus/lexilla/test/unit/testLexerSimple.cxx
Christian Grasser d8c6350918 Update to scintilla 5.5.1 & Lexilla 5.3.3
Release 5.5.1 ( https://www.scintilla.org/scintilla551.zip )

    Released 22 July 2024.
    SCI_CUTALLOWLINE added which is similar to SCI_COPYALLOWLINE but also deletes the copied text. Feature #1518.
    Can set font used for autocompletion lists with SCI_AUTOCSETSTYLE. Feature #1523.
    Increase maximum zoom set interactively to +60 points. Feature #1517.
    Fix flickering cursor after some mouse action sequences. Bug #2443.

Release 5.3.3 ( https://www.scintilla.org/lexilla533.zip )

    Released 22 July 2024.
    ASP: Control whether ASP is enabled for XML and HTML with lexer.xml.allow.asp and lexer.html.allow.asp. Issue #252.
    JavaScript: Recognize regular expressions at start or after '>' in JavaScript when lexer is cpp, hypertext, or xml. Issue #250, Bug #918.
    JavaScript: Recognize initial #! 'shebang' line as a comment in standalone files. Issue #253.
    Lua: Fix non-ASCII identifiers joined with '.' or ':'. Issue #242.
    Lua: Fix folding for multi-line SCE_LUA_LITERALSTRING and SCE_LUA_COMMENT when performed incrementally. Issue #247.
    PHP: Control whether PHP is enabled for XML and HTML with lexer.xml.allow.php and lexer.html.allow.php. Issue #252.

Close #15466
2024-07-23 13:07:50 +02:00

67 lines
1.5 KiB
C++

/** @file testLexerSimple.cxx
** Unit Tests for Lexilla internal data structures
**/
#include <cassert>
#include <string>
#include <string_view>
#include "ILexer.h"
#include "Scintilla.h"
#include "PropSetSimple.h"
#include "LexerModule.h"
#include "LexerBase.h"
#include "LexerSimple.h"
#include "catch.hpp"
using namespace Lexilla;
// Test LexerSimple.
namespace {
constexpr const char *propertyName = "lexer.tex.comment.process";
constexpr const char *propertyValue = "1";
void ColouriseDocument(Sci_PositionU, Sci_Position, int, WordList *[], Accessor &) {
// Do no styling
}
LexerModule lmSimpleExample(123456, ColouriseDocument, "simpleexample");
}
TEST_CASE("LexerSimple") {
SECTION("Identifier") {
LexerSimple lexSimple(&lmSimpleExample);
REQUIRE(lexSimple.GetIdentifier() == 123456);
}
SECTION("Identifier") {
LexerSimple lexSimple(&lmSimpleExample);
REQUIRE_THAT(lexSimple.GetName(), Catch::Matchers::Equals("simpleexample"));
}
SECTION("SetAndGet") {
LexerSimple lexSimple(&lmSimpleExample);
// New setting -> 0
const Sci_Position pos0 = lexSimple.PropertySet(propertyName, "8");
REQUIRE(pos0 == 0);
// Changed setting -> 0
const Sci_Position pos1 = lexSimple.PropertySet(propertyName, propertyValue);
REQUIRE(pos1 == 0);
// Same setting -> -1
const Sci_Position pos2 = lexSimple.PropertySet(propertyName, propertyValue);
REQUIRE(pos2 == -1);
const char *value = lexSimple.PropertyGet(propertyName);
REQUIRE_THAT(propertyValue, Catch::Matchers::Equals(value));
}
}