Test::BDD::Infrastructure::Utils - class with collection of some utility functions
version 1.005
The Utils package provides human readable comparsion operators.
Returns the perl operator for $op as string.
Contains a regex to match all supported operators.
use Test::BDD::Infrastructure::Utils qw( convert_cmp_operator $CMP_OPERATOR_RE ); Then qr/the file must contain $CMP_OPERATOR_RE (\d+) lines/, sub { my $op = convert_cmp_operator( $1 ); my $count = $2; my $lines = calc_lines(); cmp_ok( $lines, $op, $count, "the file must contain $op $count lines"); }
Then the file must contain at least 10 lines
The module provides conversion of human readable byte units.
Returns the size in bytes.
1/100
1 byte
1000 byte
1000000 byte
1000000000 byte
1000000000000 byte
1024 byte
1048576 byte
1073741824 byte
1099511627776 byte
The module provides conversion of human readable intervals.
Return the interval in seconds.
A backend for retrieving configuration variables is implemented in Test::BDD::Infrastrucuture::Config.
The following short-cut methods could be used to implement configuration variables in step file definitions.
The syntax for variables is $<path> or $<scope>:<path>
If the scope is omitted the default 'c' will be used.
If the step file definition is:
Then qr/the value (\S+) must be bla/, sub { my $value = lookup_config( $1 ); ok( is_bla($value), 'value must be bla' ); }
then it could be used with variables:
Then the value $bla must be bla
Tries to lookup the configuration value for $str if $str starts with "$" otherwise the string is returned as-is.
Tries to lookup the configuration node for $str otherwise undef is returned.
Markus Benning <ich@markusbenning.de>
This software is copyright (c) 2015 by Markus Benning.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test::BDD::Infrastructure, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::BDD::Infrastructure
CPAN shell
perl -MCPAN -e shell install Test::BDD::Infrastructure
For more information on module installation, please visit the detailed CPAN module installation guide.