19 lines
536 B
C++
19 lines
536 B
C++
#include "Lexer.h"
|
|
|
|
#include "TestFramework.h"
|
|
#include "TestUtils.h"
|
|
|
|
#include <iostream>
|
|
|
|
TEST_CASE(TestLexer_MatchPattern, "[compiler]")
|
|
{
|
|
std::string input = "[I'm inside the tag](I'm inside the brackets), followed by more text.";
|
|
std::string pattern = "[@](@)";
|
|
|
|
std::vector<std::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");
|
|
}
|