ding-libs/INI-Fix-detection-of-error-messages.patch

48 lines
1.7 KiB
Diff

From 72c19bd018b107ecf5a80963b433e9922f7243fd Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Wed, 3 Jan 2018 18:03:44 +0100
Subject: [PATCH 01/11] INI: Fix detection of error messages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
libc on BSD returns different error messages.
Reviewed-by: Michal Židek <mzidek@redhat.com>
---
ini/ini_validators_ut_check.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ini/ini_validators_ut_check.c b/ini/ini_validators_ut_check.c
index fa7105a..9ecde75 100644
--- a/ini/ini_validators_ut_check.c
+++ b/ini/ini_validators_ut_check.c
@@ -607,6 +607,12 @@ START_TEST(test_ini_allowed_options_wrong_regex)
"[rule/options_for_foo]: Cannot compile regular expression "
"from option 'section_re'. "
"Error: 'Unmatched [ or [^'");
+ if (ret != 0) {
+ ret = strcmp(errmsg,
+ "[rule/options_for_foo]: Cannot compile regular expression "
+ "from option 'section_re'. "
+ "Error: 'brackets ([ ]) not balanced'");
+ }
fail_unless(ret == 0, "Got msg: [%s]", errmsg);
ini_errobj_next(errobj);
@@ -1028,6 +1034,11 @@ START_TEST(test_ini_allowed_sections_wrong_regex)
ret = strcmp(errmsg,
"[rule/section_list]: Validator failed to use regex "
"[^foo\\(*$]:[Unmatched ( or \\(]");
+ if (ret !=0) {
+ ret = strcmp(errmsg,
+ "[rule/section_list]: Validator failed to use regex "
+ "[^foo\\(*$]:[parentheses not balanced]");
+ }
fail_unless(ret == 0, "Got msg: [%s]", errmsg);
ini_errobj_next(errobj);
--
2.9.5