Created
March 1, 2019 14:34
-
-
Save foursixnine/5461d59877ae86d0ef8977df1b82758e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Test::More; | |
use Carp qw/carp/; | |
use feature 'say'; | |
sub get_var { | |
my ($return_this) = @_; | |
## no critic | |
return undef if $return_this eq 'Blah'; | |
return $return_this; | |
} | |
my @strings = ( | |
"Startup finished in 17.409s (kernel) + 23.946s (initrd) + 39.733s (userspace) = 21.090s", | |
"Startup finished in 17.409s (kernel) + 23.946s (initrd) + 39.733s (userspace) = 1 min 21.090s", | |
"Startup finished in 1 min 17.409s (kernel) + 23.946s (initrd) + 39.733s (userspace) = 1 min 21.090s", | |
"Startup finished in 17.409s (kernel) + 23.946s (initrd) + 39.733s (userspace) = 1 min 21.090s", | |
); | |
my $re = qr/((\d+? min)? \d+\.?\d+s)/; | |
for my $line (@strings){ | |
ok( $line =~ /$re/g, qq($line . matches $re )); | |
} | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment