]> git.gsnw.org Git - fping.git/commitdiff
Small code coverage improvements
authorDavid Schweikert <david@schweikert.ch>
Wed, 24 Dec 2025 07:06:32 +0000 (08:06 +0100)
committerDavid Schweikert <david@schweikert.ch>
Fri, 26 Dec 2025 17:00:20 +0000 (18:00 +0100)
ci/test-01-basics.pl

index e54bc225dc1b1dc14f4ac7b62fdc3e19a79ca536..33419501ef3592e238a295479970aab80027a5c8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-use Test::Command tests => 15;
+use Test::Command tests => 21;
 use Test::More;
 
 # ping 127.0.0.1
@@ -53,3 +53,27 @@ SKIP: {
     $cmd->stdout_is_eq("");
     $cmd->stderr_like(qr{host\.name\.invalid: .+\n});
 }
+
+# Mixed arguments to exercise optparse permutation
+{
+    my $cmd = Test::Command->new(cmd => "fping 127.0.0.1 -c 1");
+    $cmd->exit_is_num(0);
+    $cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 64 bytes});
+    $cmd->stderr_like(qr{\s*127\.0\.0\.1\s+:\sxmt/rcv/%loss = 1/1/0%, min/avg/max});
+}
+
+# fping6 symlink compatibility
+SKIP: {
+    if($ENV{SKIP_IPV6}) {
+        skip 'Skip IPv6 tests', 3;
+    }
+
+    symlink "fping", "src/fping6" or die "Failed to create symlink: $!";
+
+    my $cmd = Test::Command->new(cmd => "./src/fping6 ::1 -c 1");
+    $cmd->exit_is_num(0);
+    $cmd->stdout_like(qr{::1 : \[0\], 64 bytes});
+    $cmd->stderr_like(qr{^\s*::1 : xmt/rcv/%loss = 1/1/0%, min/avg/max = .*$});
+
+    unlink "src/fping6";
+}