Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9e30513

Browse filesBrowse files
committed
Add integration tests for any-character symbol.
1 parent 774e9f5 commit 9e30513
Copy full SHA for 9e30513

File tree

Expand file treeCollapse file tree

1 file changed

+28
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+28
-0
lines changed

‎tests/test-grammar-integration.cpp

Copy file name to clipboardExpand all lines: tests/test-grammar-integration.cpp
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,33 @@ static void test_complex_grammar() {
205205
);
206206
}
207207

208+
static void test_special_chars() {
209+
// A collection of tests to exercise special characters such as "."
210+
test_grammar(
211+
"special characters",
212+
// Grammar
213+
R"""(
214+
root ::= ... "abc" ...
215+
)""",
216+
// Passing strings
217+
{
218+
"abcabcabc",
219+
"aaaabcccc",
220+
// NOTE: Also ensures that multi-byte characters still count as a single character
221+
"🔵🟠✅abc❌🟠🔵"
222+
},
223+
// Failing strings
224+
{
225+
"aaabcccc",
226+
"aaaaabcccc",
227+
"aaaabccc",
228+
"aaaabccccc",
229+
"🔵🟠✅❌abc❌✅🟠🔵"
230+
"🔵🟠abc🟠🔵"
231+
}
232+
);
233+
}
234+
208235
static void test_quantifiers() {
209236
// A collection of tests to exercise * + and ? quantifiers
210237

@@ -369,6 +396,7 @@ int main() {
369396
fprintf(stdout, "Running grammar integration tests...\n");
370397
test_simple_grammar();
371398
test_complex_grammar();
399+
test_special_chars();
372400
test_quantifiers();
373401
test_failure_missing_root();
374402
test_failure_missing_reference();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.