stuff-from-scratch/test/compiler/TestLexer.cpp
2023-12-21 09:18:44 +00:00

19 lines
516 B
C++

#include "Lexer.h"
#include "TestFramework.h"
#include "TestUtils.h"
#include <iostream>
TEST_CASE(TestLexer_MatchPattern, "[compiler]")
{
String input = "[I'm inside the tag](I'm inside the brackets), followed by more text.";
String pattern = "[@](@)";
Vector<String> hits;
const auto matched = Lexer::matchPattern(pattern, input, '@', hits);
REQUIRE(matched);
REQUIRE(hits.size() == 2);
REQUIRE(hits[0] == "I'm inside the tag");
REQUIRE(hits[1] == "I'm inside the brackets");
}