Skip to content

Commit 5efc81b

Browse files
zufuliunyamatongwe
authored andcommitted
#344 Allow testing only a single lexer by set directory to sub-folder in examples folder.
1 parent 77c0860 commit 5efc81b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

doc/LexillaHistory.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,10 @@ <h3>
605605
Released 10 November 2025.
606606
</li>
607607
<li>
608+
Test a single lexer by specifying as command line argument to TestLexers.
609+
<a href="https://github.com/ScintillaOrg/lexilla/pull/344">Pull request #344</a>.
610+
</li>
611+
<li>
608612
Lexer added for escape sequences "escseq".
609613
<a href="https://github.com/ScintillaOrg/lexilla/pull/336">Pull request #336</a>.
610614
</li>

test/TestLexers.cxx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,14 +950,19 @@ bool AccessLexilla(std::filesystem::path basePath) {
950950
}
951951

952952
bool success = true;
953+
size_t count = 0;
953954
for (auto &p : std::filesystem::recursive_directory_iterator(basePath)) {
954955
if (p.is_directory()) {
955956
//std::cout << p.path().string() << '\n';
957+
++count;
956958
if (!TestDirectory(p, basePath)) {
957959
success = false;
958960
}
959961
}
960962
}
963+
if (count == 0) {
964+
success = TestDirectory(basePath, basePath);
965+
}
961966
return success;
962967
}
963968

@@ -1006,7 +1011,15 @@ int main(int argc, char **argv) {
10061011
std::filesystem::path examplesDirectory = baseDirectory / "test" / "examples";
10071012
for (int i = 1; i < argc; i++) {
10081013
if (argv[i][0] != '-') {
1009-
examplesDirectory = argv[i];
1014+
std::filesystem::path path = argv[i];
1015+
if (std::filesystem::is_directory(path)) {
1016+
examplesDirectory = path;
1017+
} else {
1018+
path = examplesDirectory / path;
1019+
if (std::filesystem::is_directory(path)) {
1020+
examplesDirectory = path;
1021+
}
1022+
}
10101023
}
10111024
}
10121025
success = AccessLexilla(examplesDirectory);

0 commit comments

Comments
 (0)