From b1150d8e86abf4f81f319a5437ebf78e73c05af2 Mon Sep 17 00:00:00 2001 From: Alexander Shaduri Date: Tue, 16 Mar 2021 18:10:35 +0400 Subject: [PATCH] Implemented app_pcre_get_options() tests. --- src/applib/tests/test_app_pcrecpp.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/applib/tests/test_app_pcrecpp.cpp b/src/applib/tests/test_app_pcrecpp.cpp index 8aa9df8..89ab8f7 100644 --- a/src/applib/tests/test_app_pcrecpp.cpp +++ b/src/applib/tests/test_app_pcrecpp.cpp @@ -16,8 +16,33 @@ Copyright: TEST_CASE("AppPcreCpp", "[app][pcrecpp]") { - REQUIRE(app_pcre_get_options("i").caseless() == true); + // Default flags + CHECK(app_pcre_get_options("").all_options() == 0x00500000); // PCRE_NEWLINE_ANYCRLF + REQUIRE(app_pcre_get_options("i").caseless() == true); + REQUIRE(app_pcre_get_options("m").multiline() == true); + REQUIRE(app_pcre_get_options("s").dotall() == true); + REQUIRE(app_pcre_get_options("E").dollar_endonly() == true); + REQUIRE(app_pcre_get_options("X").extra() == true); + REQUIRE(app_pcre_get_options("x").extended() == true); + REQUIRE(app_pcre_get_options("8").utf8() == true); + REQUIRE(app_pcre_get_options("U").ungreedy() == true); + REQUIRE(app_pcre_get_options("N").no_auto_capture() == true); + + // Multiple flags + REQUIRE(app_pcre_get_options("imX").caseless() == true); + REQUIRE(app_pcre_get_options("imX").multiline() == true); + REQUIRE(app_pcre_get_options("imX").dotall() == false); + REQUIRE(app_pcre_get_options("imX").dollar_endonly() == false); + REQUIRE(app_pcre_get_options("imX").extra() == true); + REQUIRE(app_pcre_get_options("imX").extended() == false); + REQUIRE(app_pcre_get_options("imX").utf8() == false); + REQUIRE(app_pcre_get_options("imX").ungreedy() == false); + REQUIRE(app_pcre_get_options("imX").no_auto_capture() == false); + + // Invalid flags + CHECK(app_pcre_get_options("Z").all_options() == 0x00500000); // PCRE_NEWLINE_ANYCRLF + REQUIRE(app_pcre_get_options("Zi").caseless() == true); }