Ease EXPECT_ERROR and EXPECT_WARN string matching with errors/warnings
that have more than one trailing newline.

Signed-off-by: Daniel Herzig <d.her...@proxmox.com>
---
 test/run_config2command_tests.pl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/run_config2command_tests.pl b/test/run_config2command_tests.pl
index 8c525f09..2911483e 100755
--- a/test/run_config2command_tests.pl
+++ b/test/run_config2command_tests.pl
@@ -426,7 +426,9 @@ sub diff($$) {
 
 $SIG{__WARN__} = sub {
     my $warning = shift;
-    chomp $warning;
+    while ((chomp($warning))) {
+       chomp($warning);
+    }
     if (my $warn_expect = $current_test->{expect_warning}) {
        if ($warn_expect ne $warning) {
            fail($current_test->{testname});
@@ -461,7 +463,9 @@ sub do_test($) {
            note("did NOT get any error, but expected error: $err_expect");
            return;
        }
-       chomp $err;
+       while ((chomp($err))) {
+           chomp($err);
+       }
        if ($err ne $err_expect) {
            fail("$testname");
            note("error does not match expected error: '$err' !~ 
'$err_expect'");
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to