Add CPDF_SimpleParser edge case tests
Increase test coverage by adding tests for edge cases with delimiters.
Change-Id: If49e25b1a0b1f91ca6c6b3a1a7a2d68986241ec0
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/123332
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Andy Phan <andyphan@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
index ff2eaeb..08abf54 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
@@ -23,6 +23,9 @@
// Mixed whitespaces and comments.
STR_IN_OUT_CASE(" \t \0%try()%haha\n %another line \aa", ""),
// Name.
+ STR_IN_OUT_CASE("/", ""),
+ STR_IN_OUT_CASE("/99", ""),
+ STR_IN_OUT_CASE("/99}", "/99"),
STR_IN_OUT_CASE(" /Tester ", "/Tester"),
// String.
STR_IN_OUT_CASE("\t(nice day)!\n ", "(nice day)"),
@@ -31,12 +34,17 @@
// String with escaped chars.
STR_IN_OUT_CASE("\t(It is a \\(long\\) day!)hi\n ",
"(It is a \\(long\\) day!)"),
+ // Angle brackets.
+ STR_IN_OUT_CASE("<", "<"),
+ STR_IN_OUT_CASE(">", ">"),
// Hex string.
STR_IN_OUT_CASE(" \n<4545acdfedertt>abc ", "<4545acdfedertt>"),
STR_IN_OUT_CASE(" \n<4545a<ed>ertt>abc ", "<4545a<ed>"),
// Dictionary.
STR_IN_OUT_CASE("<</oc 234 /color 2 3 R>>", "<<"),
STR_IN_OUT_CASE("\t\t<< /abc>>", "<<"),
+ // Parentheses.
+ STR_IN_OUT_CASE("(\\", "(\\"),
// Handling ending delimiters.
STR_IN_OUT_CASE("> little bear", ">"),
STR_IN_OUT_CASE(") another bear", ")"),