Hello community,
here is the log from the commit of package perl-Test-Base for openSUSE:Factory checked in at 2018-04-26 13:34:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Test-Base (Old)
and /work/SRC/openSUSE:Factory/.perl-Test-Base.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-Base"
Thu Apr 26 13:34:09 2018 rev:26 rq:599319 version:0.89
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Test-Base/perl-Test-Base.changes 2015-04-25 21:14:49.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Test-Base.new/perl-Test-Base.changes 2018-04-26 13:34:11.180534558 +0200
@@ -1,0 +2,9 @@
+Fri Apr 20 06:02:38 UTC 2018 - coolo@suse.com
+
+- updated to 0.89
+ see /usr/share/doc/packages/perl-Test-Base/Changes
+
+ 0.89 Thu Apr 19 08:54:04 PDT 2018
+ - Apply PR/19 and PR/21 from @perlpunk++
+
+-------------------------------------------------------------------
Old:
----
Test-Base-0.88.tar.gz
New:
----
Test-Base-0.89.tar.gz
cpanspec.yml
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Test-Base.spec ++++++
--- /var/tmp/diff_new_pack.ZeBz5H/_old 2018-04-26 13:34:11.720514773 +0200
+++ /var/tmp/diff_new_pack.ZeBz5H/_new 2018-04-26 13:34:11.720514773 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Test-Base
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,22 +17,25 @@
Name: perl-Test-Base
-Version: 0.88
+Version: 0.89
Release: 0
%define cpan_name Test-Base
-Summary: A Data Driven Testing Framework
-License: Artistic-1.0 or GPL-1.0+
+Summary: Data Driven Testing Framework
+License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Test-Base/
-Source: http://www.cpan.org/authors/id/I/IN/INGY/%{cpan_name}-%{version}.tar.gz
+Source0: https://cpan.metacpan.org/authors/id/I/IN/INGY/%{cpan_name}-%{version}.tar.gz
+Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Algorithm::Diff) >= 1.15
BuildRequires: perl(Spiffy) >= 0.40
+BuildRequires: perl(Test::More) >= 0.88
BuildRequires: perl(Text::Diff) >= 0.35
Requires: perl(Spiffy) >= 0.40
+Requires: perl(Test::More) >= 0.88
Recommends: perl(Test::Deep)
%{perl_requires}
@@ -85,6 +88,7 @@
%files -f %{name}.files
%defattr(-,root,root,755)
-%doc Changes CONTRIBUTING LICENSE README
+%doc Changes CONTRIBUTING README
+%license LICENSE
%changelog
++++++ Test-Base-0.88.tar.gz -> Test-Base-0.89.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/CONTRIBUTING new/Test-Base-0.89/CONTRIBUTING
--- old/Test-Base-0.88/CONTRIBUTING 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/CONTRIBUTING 2018-04-19 17:54:27.000000000 +0200
@@ -9,7 +9,7 @@
GitHub
------
-The code for this Project is hosted at GitHub. The repository is:
+The code for this Project is hosted at GitHub. The URL is:
https://github.com/ingydotnet/test-base-pm
@@ -36,7 +36,7 @@
This Project uses Zilla::Dist to prepare it for publishing to CPAN. Read:
- https://metacpan.org/pod/distribution/Zilla-Dist/lib/Zilla/Dist/Contributing...
+ https://metacpan.org/pod/Zilla::Dist::Contributing
for up-to-date instructions on what contributors like yourself need to know to
use it.
@@ -51,5 +51,10 @@
Join the channel. Join the team!
- Thanks in advance, Ingy döt Net
+ Thanks in advance,
+
+
+
+
+# This file generated by Zilla-Dist-0.0.196
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/Changes new/Test-Base-0.89/Changes
--- old/Test-Base-0.88/Changes 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/Changes 2018-04-19 17:54:27.000000000 +0200
@@ -1,3 +1,6 @@
+0.89 Thu Apr 19 08:54:04 PDT 2018
+ - Apply PR/19 and PR/21 from @perlpunk++
+
0.88 Sun Aug 24 08:09:16 PDT 2014
- Remove a debugging line.
@@ -304,4 +307,3 @@
0.10 Wed Apr 20 18:05:42 PDT 2005
- Initial version of Test::Chunks
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/LICENSE new/Test-Base-0.89/LICENSE
--- old/Test-Base-0.88/LICENSE 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/LICENSE 2018-04-19 17:54:27.000000000 +0200
@@ -1,4 +1,4 @@
-This software is copyright (c) 2014 by Ingy döt Net.
+This software is copyright (c) 2018 by Ingy döt Net.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@
--- The GNU General Public License, Version 1, February 1989 ---
-This software is Copyright (c) 2014 by Ingy döt Net.
+This software is Copyright (c) 2018 by Ingy döt Net.
This is free software, licensed under:
@@ -22,7 +22,7 @@
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -272,7 +272,7 @@
--- The Artistic License 1.0 ---
-This software is Copyright (c) 2014 by Ingy döt Net.
+This software is Copyright (c) 2018 by Ingy döt Net.
This is free software, licensed under:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/MANIFEST new/Test-Base-0.89/MANIFEST
--- old/Test-Base-0.88/MANIFEST 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/MANIFEST 2018-04-19 17:54:27.000000000 +0200
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.019.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.010.
CONTRIBUTING
Changes
LICENSE
@@ -22,6 +22,7 @@
t/append.t
t/arguments.t
t/array.t
+t/author-pod-syntax.t
t/autoload.t
t/base64.t
t/blocks-scalar.t
@@ -85,7 +86,6 @@
t/quick_test.t
t/read_file.t
t/regexp.t
-t/release-pod-syntax.t
t/repeated-filters.t
t/require.t
t/reserved_names.t
@@ -124,6 +124,7 @@
t/unchomp.t
t/undef.t
t/use-test-more.t
+t/use.t
t/write_file.t
t/xxx.t
t/yaml.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/META.json new/Test-Base-0.89/META.json
--- old/Test-Base-0.88/META.json 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/META.json 2018-04-19 17:54:27.000000000 +0200
@@ -1,30 +1,30 @@
{
"abstract" : "A Data Driven Testing Framework",
"author" : [
- "Ingy döt Net "
+ "Ingy d\u00f6t Net "
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.132830",
+ "generated_by" : "Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150005",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Test-Base",
"no_index" : {
"directory" : [
+ "example",
"inc",
"t",
- "xt",
- "example"
+ "xt"
]
},
"prereqs" : {
"configure" : {
"requires" : {
- "ExtUtils::MakeMaker" : "6.30"
+ "ExtUtils::MakeMaker" : "0"
}
},
"develop" : {
@@ -38,7 +38,9 @@
},
"requires" : {
"Filter::Util::Call" : "0",
+ "Scalar::Util" : "1.07",
"Spiffy" : "0.40",
+ "Test::More" : "0.88",
"perl" : "v5.8.1"
}
},
@@ -62,6 +64,7 @@
"web" : "https://github.com/ingydotnet/test-base-pm"
}
},
- "version" : "0.88"
+ "version" : "0.89",
+ "x_serialization_backend" : "Cpanel::JSON::XS version 3.0211"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/META.yml new/Test-Base-0.89/META.yml
--- old/Test-Base-0.88/META.yml 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/META.yml 2018-04-19 17:54:27.000000000 +0200
@@ -7,9 +7,9 @@
ExtUtils::MakeMaker: '6.52'
Text::Diff: '0.35'
configure_requires:
- ExtUtils::MakeMaker: '6.30'
+ ExtUtils::MakeMaker: '0'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.132830'
+generated_by: 'Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150005'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -17,18 +17,21 @@
name: Test-Base
no_index:
directory:
+ - example
- inc
- t
- xt
- - example
recommends:
Test::Deep: '0'
requires:
Filter::Util::Call: '0'
+ Scalar::Util: '1.07'
Spiffy: '0.40'
+ Test::More: '0.88'
perl: v5.8.1
resources:
bugtracker: https://github.com/ingydotnet/test-base-pm/issues
homepage: https://github.com/ingydotnet/test-base-pm
repository: https://github.com/ingydotnet/test-base-pm.git
-version: '0.88'
+version: '0.89'
+x_serialization_backend: 'YAML::Tiny version 1.69'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/Makefile.PL new/Test-Base-0.89/Makefile.PL
--- old/Test-Base-0.88/Makefile.PL 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/Makefile.PL 2018-04-19 17:54:27.000000000 +0200
@@ -1,34 +1,33 @@
-
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.019.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.010.
use strict;
use warnings;
use 5.008001;
-use ExtUtils::MakeMaker 6.30;
-
-
+use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "A Data Driven Testing Framework",
"AUTHOR" => "Ingy d\x{f6}t Net ",
"CONFIGURE_REQUIRES" => {
- "ExtUtils::MakeMaker" => "6.30"
+ "ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "Test-Base",
- "EXE_FILES" => [],
"LICENSE" => "perl",
+ "MIN_PERL_VERSION" => "5.008001",
"NAME" => "Test::Base",
"PREREQ_PM" => {
"Filter::Util::Call" => 0,
- "Spiffy" => "0.40"
+ "Scalar::Util" => "1.07",
+ "Spiffy" => "0.40",
+ "Test::More" => "0.88"
},
"TEST_REQUIRES" => {
"Algorithm::Diff" => "1.15",
"ExtUtils::MakeMaker" => "6.52",
"Text::Diff" => "0.35"
},
- "VERSION" => "0.88",
+ "VERSION" => "0.89",
"test" => {
"TESTS" => "t/*.t"
}
@@ -39,7 +38,9 @@
"Algorithm::Diff" => "1.15",
"ExtUtils::MakeMaker" => "6.52",
"Filter::Util::Call" => 0,
+ "Scalar::Util" => "1.07",
"Spiffy" => "0.40",
+ "Test::More" => "0.88",
"Text::Diff" => "0.35"
);
@@ -54,6 +55,3 @@
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
-
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/README new/Test-Base-0.89/README
--- old/Test-Base-0.88/README 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/README 2018-04-19 17:54:27.000000000 +0200
@@ -1,18 +1,20 @@
NAME
+
Test::Base - A Data Driven Testing Framework
SYNOPSIS
+
A new test module:
# lib/MyProject/Test.pm
package MyProject::Test;
use Test::Base -Base;
-
+
use MyProject;
-
+
package MyProject::Test::Filter;
use Test::Base::Filter -base;
-
+
sub my_filter {
return MyProject->do_something(shift);
}
@@ -21,17 +23,17 @@
# t/sample.t
use MyProject::Test;
-
+
plan tests => 1 * blocks;
-
+
run_is input => 'expected';
-
+
sub local_filter {
s/my/your/;
}
-
+
__END__
-
+
=== Test one (the name of the test)
--- input my_filter local_filter
my
@@ -40,7 +42,7 @@
--- expected
expected
output
-
+
=== Test two
This is an optional description
of this particular test.
@@ -53,29 +55,31 @@
output
DESCRIPTION
+
Testing is usually the ugly part of Perl module authoring. Perl gives
you a standard way to run tests with Test::Harness, and basic testing
primitives with Test::More. After that you are pretty much on your own
- to develop a testing framework and philosophy. Test::More encourages you
- to make your own framework by subclassing Test::Builder, but that is not
- trivial.
+ to develop a testing framework and philosophy. Test::More encourages
+ you to make your own framework by subclassing Test::Builder, but that
+ is not trivial.
Test::Base gives you a way to write your own test framework base class
- that *is* trivial. In fact it is as simple as two lines:
+ that is trivial. In fact it is as simple as two lines:
package MyTestFramework;
use Test::Base -Base;
- A module called "MyTestFramework.pm" containing those two lines, will
+ A module called MyTestFramework.pm containing those two lines, will
give all the power of Test::More and all the power of Test::Base to
every test file that uses it. As you build up the capabilities of
- "MyTestFramework", your tests will have all of that power as well.
+ MyTestFramework, your tests will have all of that power as well.
- "MyTestFramework" becomes a place for you to put all of your reusable
- testing bits. As you write tests, you will see patterns and duplication,
- and you can "upstream" them into "MyTestFramework". Of course, you don't
- have to subclass Test::Base at all. You can use it directly in many
- applications, including everywhere you would use Test::More.
+ MyTestFramework becomes a place for you to put all of your reusable
+ testing bits. As you write tests, you will see patterns and
+ duplication, and you can "upstream" them into MyTestFramework. Of
+ course, you don't have to subclass Test::Base at all. You can use it
+ directly in many applications, including everywhere you would use
+ Test::More.
Test::Base concentrates on offering reusable data driven patterns, so
that you can write tests with a minimum of code. At the heart of all
@@ -86,227 +90,249 @@
time focusing on that rather than your code scaffolding.
EXPORTED FUNCTIONS
+
Test::Base extends Test::More and exports all of its functions. So you
can basically write your tests the same as Test::More. Test::Base also
exports many functions of its own:
- "is(actual, expected, [test-name])"
- This is the equivalent of Test::More's "is" function with one
- interesting twist. If your actual and expected results differ and
- the output is multi- line, this function will show you a unified
- diff format of output. Consider the benefit when looking for the one
- character that is different in hundreds of lines of output!
-
- Diff output requires the optional "Text::Diff" CPAN module. If you
- don't have this module, the "is()" function will simply give you
- normal Test::More output. To disable diffing altogether, set the
- "TEST_SHOW_NO_DIFFS" environment variable (or
- $ENV{TEST_SHOW_NO_DIFFS}) to a true value. You can also call the
- "no_diff" function as a shortcut.
-
- "blocks( [data-section-name] )"
- The most important function is "blocks". In list context it returns
- a list of "Test::Base::Block" objects that are generated from the
- test specification in the "DATA" section of your test file. In
- scalar context it returns the number of objects. This is useful to
- calculate your Test::More plan.
-
- Each Test::Base::Block object has methods that correspond to the
- names of that object's data sections. There is also a "name" and a
- "description" method for accessing those parts of the block if they
- were specified.
-
- The "blocks" function can take an optional single argument, that
- indicates to only return the blocks that contain a particular named
- data section. Otherwise "blocks" returns all blocks.
-
- my @all_of_my_blocks = blocks;
-
- my @just_the_foo_blocks = blocks('foo');
-
- "next_block()"
- You can use the next_block function to iterate over all the blocks.
-
- while (my $block = next_block) {
- ...
- }
-
- It returns undef after all blocks have been iterated over. It can
- then be called again to reiterate.
-
- "first_block()"
- Returns the first block or undef if there are none. It resets the
- iterator to the "next_block" function.
-
- "run(&subroutine)"
- There are many ways to write your tests. You can reference each
- block individually or you can loop over all the blocks and perform a
- common operation. The "run" function does the looping for you, so
- all you need to do is pass it a code block to execute for each
- block.
-
- The "run" function takes a subroutine as an argument, and calls the
- sub one time for each block in the specification. It passes the
- current block object to the subroutine.
-
- run {
- my $block = shift;
- is(process($block->foo), $block->bar, $block->name);
- };
-
- "run_is([data_name1, data_name2])"
- Many times you simply want to see if two data sections are
- equivalent in every block, probably after having been run through
- one or more filters. With the "run_is" function, you can just pass
- the names of any two data sections that exist in every block, and it
- will loop over every block comparing the two sections.
-
- run_is 'foo', 'bar';
-
- If no data sections are given "run_is" will try to detect them
- automatically.
-
- NOTE: Test::Base will silently ignore any blocks that don't contain
- both sections.
-
- "is_deep($data1, $data2, $test_name)"
- Like Test::More's "is_deeply" but uses the more correct Test::Deep
- module.
-
- "run_is_deeply([data_name1, data_name2])"
- Like "run_is_deeply" but uses "is_deep" which uses the more correct
- Test::Deep.
-
- "run_is_deeply([data_name1, data_name2])"
- Like "run_is" but uses "is_deeply" for complex data structure
- comparison.
-
- "run_is_deeply([data_name1, data_name2])"
- Like "run_is_deeply" but uses "is_deep" which uses the more correct
- Test::Deep.
-
- "run_like([data_name, regexp | data_name]);"
- The "run_like" function is similar to "run_is" except the second
- argument is a regular expression. The regexp can either be a "qr{}"
- object or a data section that has been filtered into a regular
- expression.
-
- run_like 'foo', qr{ [qw(chomp lines)],
- yyy => ['yaml'],
- zzz => 'eval',
- };
-
- If a filters list has only one element, the array ref is optional.
-
- "filters_delay( [1 | 0] );"
- By default Test::Base::Block objects are have all their filters run
- ahead of time. There are testing situations in which it is
- advantageous to delay the filtering. Calling this function with no
- arguments or a true value, causes the filtering to be delayed.
-
- use Test::Base;
- filters_delay;
- plan tests => 1 * blocks;
- for my $block (blocks) {
- ...
- $block->run_filters;
- ok($block->is_filtered);
- ...
- }
-
- In the code above, the filters are called manually, using the
- "run_filters" method of Test::Base::Block. In functions like
- "run_is", where the tests are run automatically, filtering is
- delayed until right before the test.
-
- "filter_arguments()"
- Return the arguments after the equals sign on a filter.
-
- sub my_filter {
- my $args = filter_arguments;
- # is($args, 'whazzup');
- ...
- }
-
- __DATA__
- === A test
- --- data my_filter=whazzup
-
- "tie_output()"
- You can capture STDOUT and STDERR for operations with this function:
-
- my $out = '';
- tie_output(*STDOUT, $out);
- print "Hey!\n";
- print "Che!\n";
- untie *STDOUT;
- is($out, "Hey!\nChe!\n");
-
- "no_diff()"
- Turn off diff support for is() in a test file.
-
- "default_object()"
- Returns the default Test::Base object. This is useful if you feel
- the need to do an OO operation in otherwise functional test code.
- See OO below.
-
- "WWW() XXX() YYY() ZZZ()"
- These debugging functions are exported from the Spiffy.pm module.
- See Spiffy for more info.
-
- "croak() carp() cluck() confess()"
- You can use the functions from the Carp module without needing to
- import them. Test::Base does it for you by default.
+ is(actual, expected, [test-name])
+
+ This is the equivalent of Test::More's is function with one
+ interesting twist. If your actual and expected results differ and the
+ output is multi- line, this function will show you a unified diff
+ format of output. Consider the benefit when looking for the one
+ character that is different in hundreds of lines of output!
+
+ Diff output requires the optional Text::Diff CPAN module. If you
+ don't have this module, the is() function will simply give you normal
+ Test::More output. To disable diffing altogether, set the
+ TEST_SHOW_NO_DIFFS environment variable (or $ENV{TEST_SHOW_NO_DIFFS})
+ to a true value. You can also call the no_diff function as a
+ shortcut.
+
+ blocks( [data-section-name] )
+
+ The most important function is blocks. In list context it returns a
+ list of Test::Base::Block objects that are generated from the test
+ specification in the DATA section of your test file. In scalar
+ context it returns the number of objects. This is useful to calculate
+ your Test::More plan.
+
+ Each Test::Base::Block object has methods that correspond to the
+ names of that object's data sections. There is also a name and a
+ description method for accessing those parts of the block if they
+ were specified.
+
+ The blocks function can take an optional single argument, that
+ indicates to only return the blocks that contain a particular named
+ data section. Otherwise blocks returns all blocks.
+
+ my @all_of_my_blocks = blocks;
+
+ my @just_the_foo_blocks = blocks('foo');
+
+ next_block()
+
+ You can use the next_block function to iterate over all the blocks.
+
+ while (my $block = next_block) {
+ ...
+ }
+
+ It returns undef after all blocks have been iterated over. It can
+ then be called again to reiterate.
+
+ first_block()
+
+ Returns the first block or undef if there are none. It resets the
+ iterator to the next_block function.
+
+ run(&subroutine)
+
+ There are many ways to write your tests. You can reference each block
+ individually or you can loop over all the blocks and perform a common
+ operation. The run function does the looping for you, so all you need
+ to do is pass it a code block to execute for each block.
+
+ The run function takes a subroutine as an argument, and calls the sub
+ one time for each block in the specification. It passes the current
+ block object to the subroutine.
+
+ run {
+ my $block = shift;
+ is(process($block->foo), $block->bar, $block->name);
+ };
+
+ run_is([data_name1, data_name2])
+
+ Many times you simply want to see if two data sections are equivalent
+ in every block, probably after having been run through one or more
+ filters. With the run_is function, you can just pass the names of any
+ two data sections that exist in every block, and it will loop over
+ every block comparing the two sections.
+
+ run_is 'foo', 'bar';
+
+ If no data sections are given run_is will try to detect them
+ automatically.
+
+ NOTE: Test::Base will silently ignore any blocks that don't contain
+ both sections.
+
+ is_deep($data1, $data2, $test_name)
+
+ Like Test::More's is_deeply but uses the more correct Test::Deep
+ module.
+
+ run_is_deeply([data_name1, data_name2])
+
+ Like run_is_deeply but uses is_deep which uses the more correct
+ Test::Deep.
+
+ run_is_deeply([data_name1, data_name2])
+
+ Like run_is but uses is_deeply for complex data structure comparison.
+
+ run_is_deeply([data_name1, data_name2])
+
+ Like run_is_deeply but uses is_deep which uses the more correct
+ Test::Deep.
+
+ run_like([data_name, regexp | data_name]);
+
+ The run_like function is similar to run_is except the second argument
+ is a regular expression. The regexp can either be a qr{} object or a
+ data section that has been filtered into a regular expression.
+
+ run_like 'foo', qr{ [qw(chomp lines)],
+ yyy => ['yaml'],
+ zzz => 'eval',
+ };
+
+ If a filters list has only one element, the array ref is optional.
+
+ filters_delay( [1 | 0] );
+
+ By default Test::Base::Block objects are have all their filters run
+ ahead of time. There are testing situations in which it is
+ advantageous to delay the filtering. Calling this function with no
+ arguments or a true value, causes the filtering to be delayed.
+
+ use Test::Base;
+ filters_delay;
+ plan tests => 1 * blocks;
+ for my $block (blocks) {
+ ...
+ $block->run_filters;
+ ok($block->is_filtered);
+ ...
+ }
+
+ In the code above, the filters are called manually, using the
+ run_filters method of Test::Base::Block. In functions like run_is,
+ where the tests are run automatically, filtering is delayed until
+ right before the test.
+
+ filter_arguments()
+
+ Return the arguments after the equals sign on a filter.
+
+ sub my_filter {
+ my $args = filter_arguments;
+ # is($args, 'whazzup');
+ ...
+ }
+
+ __DATA__
+ === A test
+ --- data my_filter=whazzup
+
+ tie_output()
+
+ You can capture STDOUT and STDERR for operations with this function:
+
+ my $out = '';
+ tie_output(*STDOUT, $out);
+ print "Hey!\n";
+ print "Che!\n";
+ untie *STDOUT;
+ is($out, "Hey!\nChe!\n");
+
+ no_diff()
+
+ Turn off diff support for is() in a test file.
+
+ default_object()
+
+ Returns the default Test::Base object. This is useful if you feel the
+ need to do an OO operation in otherwise functional test code. See OO
+ below.
+
+ WWW() XXX() YYY() ZZZ()
+
+ These debugging functions are exported from the Spiffy.pm module. See
+ Spiffy for more info.
+
+ croak() carp() cluck() confess()
+
+ You can use the functions from the Carp module without needing to
+ import them. Test::Base does it for you by default.
TEST SPECIFICATION
- Test::Base allows you to specify your test data in an external file, the
- DATA section of your program or from a scalar variable containing all
- the text input.
-
- A *test specification* is a series of text lines. Each test (or block)
- is separated by a line containing the block delimiter and an optional
- test "name". Each block is further subdivided into named sections with a
- line containing the data delimiter and the data section name. A
- "description" of the test can go on lines after the block delimiter but
- before the first data section.
+
+ Test::Base allows you to specify your test data in an external file,
+ the DATA section of your program or from a scalar variable containing
+ all the text input.
+
+ A test specification is a series of text lines. Each test (or block) is
+ separated by a line containing the block delimiter and an optional test
+ name. Each block is further subdivided into named sections with a line
+ containing the data delimiter and the data section name. A description
+ of the test can go on lines after the block delimiter but before the
+ first data section.
Here is the basic layout of a specification:
@@ -318,7 +344,7 @@
<test data lines>
--- <data section name n> <filter-1> <filter-2> <filter-n>
<test data lines>
-
+
===
<optional block description lines>
--- <filter-1> <filter-2> <filter-n>
@@ -331,44 +357,44 @@
Here is a code example:
use Test::Base;
-
+
delimiters qw(### :::);
-
+
# test code here
-
+
__END__
-
+
### Test One
We want to see if foo and bar
are really the same...
::: foo
a foo line
another foo line
-
+
::: bar
a bar line
another bar line
-
+
### Test Two
-
+
::: foo
some foo line
some other foo line
-
+
::: bar
some bar line
some other bar line
-
+
::: baz
some baz line
some other baz line
This example specifies two blocks. They both have foo and bar data
sections. The second block has a baz component. The block delimiter is
- "###" and the data delimiter is ":::".
+ ### and the data delimiter is :::.
- The default block delimiter is "===" and the default data delimiter is
- "--- ".
+ The default block delimiter is === and the default data delimiter is
+ --- .
There are some special data section names used for control purposes:
@@ -385,72 +411,76 @@
Because ONLY is very useful for debugging and sometimes you forgot to
remove the ONLY flag before committing to the VCS or uploading to CPAN,
- Test::Base by default gives you a diag message saying *I found ONLY ...
- maybe you're debugging?*. If you don't like it, use "no_diag_on_only".
+ Test::Base by default gives you a diag message saying I found ONLY ...
+ maybe you're debugging?. If you don't like it, use no_diag_on_only.
A block with a LAST section makes that block the last one in the
specification. All following blocks will be ignored.
FILTERS
- The real power in writing tests with Test::Base comes from its filtering
- capabilities. Test::Base comes with an ever growing set of useful
- generic filters than you can sequence and apply to various test blocks.
- That means you can specify the block serialization in the most readable
- format you can find, and let the filters translate it into what you
- really need for a test. It is easy to write your own filters as well.
+
+ The real power in writing tests with Test::Base comes from its
+ filtering capabilities. Test::Base comes with an ever growing set of
+ useful generic filters than you can sequence and apply to various test
+ blocks. That means you can specify the block serialization in the most
+ readable format you can find, and let the filters translate it into
+ what you really need for a test. It is easy to write your own filters
+ as well.
Test::Base allows you to specify a list of filters to each data section
- of each block. The default filters are "norm" and "trim". These filters
- will be applied (in order) to the data after it has been parsed from the
- specification and before it is set into its Test::Base::Block object.
-
- You can add to the default filter list with the "filters" function. You
- can specify additional filters to a specific block by listing them after
- the section name on a data section delimiter line.
+ of each block. The default filters are norm and trim. These filters
+ will be applied (in order) to the data after it has been parsed from
+ the specification and before it is set into its Test::Base::Block
+ object.
+
+ You can add to the default filter list with the filters function. You
+ can specify additional filters to a specific block by listing them
+ after the section name on a data section delimiter line.
Example:
use Test::Base;
-
+
filters qw(foo bar);
filters { perl => 'strict' };
-
+
sub upper { uc(shift) }
-
+
__END__
-
+
=== Test one
--- foo trim chomp upper
...
-
+
--- bar -norm
...
-
+
--- perl eval dumper
my @foo = map {
- $_;
} 1..10;
\ @foo;
- Putting a "-" before a filter on a delimiter line, disables that filter.
+ Putting a - before a filter on a delimiter line, disables that filter.
+
+ Scalar vs List
- Scalar vs List
- Each filter can take either a scalar or a list as input, and will return
- either a scalar or a list. Since filters are chained together, it is
- important to learn which filters expect which kind of input and return
- which kind of output.
+ Each filter can take either a scalar or a list as input, and will
+ return either a scalar or a list. Since filters are chained together,
+ it is important to learn which filters expect which kind of input and
+ return which kind of output.
For example, consider the following filter list:
norm trim lines chomp array dumper eval
- The data always starts out as a single scalar string. "norm" takes a
- scalar and returns a scalar. "trim" takes a list and returns a list, but
- a scalar is a valid list. "lines" takes a scalar and returns a list.
- "chomp" takes a list and returns a list. "array" takes a list and
- returns a scalar (an anonymous array reference containing the list
- elements). "dumper" takes a list and returns a scalar. "eval" takes a
- scalar and creates a list.
+ The data always starts out as a single scalar string. norm takes a
+ scalar and returns a scalar. trim takes a list and returns a list, but
+ a scalar is a valid list. lines takes a scalar and returns a list.
+ chomp takes a list and returns a list. array takes a list and returns a
+ scalar (an anonymous array reference containing the list elements).
+ dumper takes a list and returns a scalar. eval takes a scalar and
+ creates a list.
A list of exactly one element works fine as input to a filter requiring
a scalar, but any other list will cause an exception. A scalar in list
@@ -460,28 +490,30 @@
in list context, and the first element of the list in scalar context.
This is usually "the right thing", but be aware.
- The Stock Filters
+ The Stock Filters
+
Test::Base comes with large set of stock filters. They are in the
- "Test::Base::Filter" module. See Test::Base::Filter for a listing and
+ Test::Base::Filter module. See Test::Base::Filter for a listing and
description of these filters.
- Rolling Your Own Filters
+ Rolling Your Own Filters
+
Creating filter extensions is very simple. You can either write a
- *function* in the "main" namespace, or a *method* in the
- "Test::Base::Filter" namespace or a subclass of it. In either case the
- text and any extra arguments are passed in and you return whatever you
- want the new value to be.
+ function in the main namespace, or a method in the Test::Base::Filter
+ namespace or a subclass of it. In either case the text and any extra
+ arguments are passed in and you return whatever you want the new value
+ to be.
Here is a self explanatory example:
use Test::Base;
-
+
filters 'foo', 'bar=xyz';
-
+
sub foo {
transform(shift);
}
-
+
sub Test::Base::Filter::bar {
my $self = shift; # The Test::Base::Filter object
my $data = shift;
@@ -492,12 +524,12 @@
}
If you use the method interface for a filter, you can access the block
- internals by calling the "block" method on the filter object.
+ internals by calling the block method on the filter object.
- Normally you'll probably just use the functional interface, although all
- the builtin filters are methods.
+ Normally you'll probably just use the functional interface, although
+ all the builtin filters are methods.
- Note that filters defined in the "main" namespace can look like:
+ Note that filters defined in the main namespace can look like:
sub filter9 {
s/foo/bar/;
@@ -510,58 +542,68 @@
the simplistic $_ munging.
OO
+
Test::Base has a nice functional interface for simple usage. Under the
hood everything is object oriented. A default Test::Base object is
created and all the functions are really just method calls on it.
- This means if you need to get fancy, you can use all the object oriented
- stuff too. Just create new Test::Base objects and use the functions as
- methods.
+ This means if you need to get fancy, you can use all the object
+ oriented stuff too. Just create new Test::Base objects and use the
+ functions as methods.
use Test::Base;
my $blocks1 = Test::Base->new;
my $blocks2 = Test::Base->new;
-
+
$blocks1->delimiters(qw(!!! @@@))->spec_file('test1.txt');
$blocks2->delimiters(qw(### $$$))->spec_string($test_data);
-
+
plan tests => $blocks1->blocks + $blocks2->blocks;
-
+
# ... etc
-THE "TEST::BASE::BLOCK" CLASS
+THE TEST::BASE::BLOCK CLASS
+
In Test::Base, blocks are exposed as Test::Base::Block objects. This
section lists the methods that can be called on a Test::Base::Block
- object. Of course, each data section name is also available as a method.
+ object. Of course, each data section name is also available as a
+ method.
+
+ name()
+
+ This is the optional short description of a block, that is specified
+ on the block separator line.
+
+ description()
+
+ This is an optional long description of the block. It is the text
+ taken from between the block separator and the first data section.
+
+ seq_num()
+
+ Returns a sequence number for this block. Sequence numbers begin with
+ 1.
+
+ blocks_object()
+
+ Returns the Test::Base object that owns this block.
+
+ run_filters()
+
+ Run the filters on the data sections of the blocks. You don't need to
+ use this method unless you also used the filters_delay function.
+
+ is_filtered()
- "name()"
- This is the optional short description of a block, that is specified
- on the block separator line.
-
- "description()"
- This is an optional long description of the block. It is the text
- taken from between the block separator and the first data section.
-
- "seq_num()"
- Returns a sequence number for this block. Sequence numbers begin
- with 1.
-
- "blocks_object()"
- Returns the Test::Base object that owns this block.
-
- "run_filters()"
- Run the filters on the data sections of the blocks. You don't need
- to use this method unless you also used the "filters_delay"
- function.
-
- "is_filtered()"
- Returns true if filters have already been run for this block.
-
- "original_values()"
- Returns a hash of the original, unfiltered values of each data
- section.
+ Returns true if filters have already been run for this block.
+
+ original_values()
+
+ Returns a hash of the original, unfiltered values of each data
+ section.
SUBCLASSING
+
One of the nicest things about Test::Base is that it is easy to
subclass. This is very important, because in your personal project, you
will likely want to extend Test::Base with your own filters and other
@@ -571,36 +613,37 @@
package MyTestStuff;
use Test::Base -Base;
-
+
our @EXPORT = qw(some_func);
-
+
sub some_func {
(my ($self), @_) = find_my_self(@_);
...
}
-
+
package MyTestStuff::Block;
use base 'Test::Base::Block';
-
+
sub desc {
$self->description(@_);
}
-
+
package MyTestStuff::Filter;
use base 'Test::Base::Filter';
-
+
sub upper {
$self->assert_scalar(@_);
uc(shift);
}
- Note that you don't have to re-Export all the functions from Test::Base.
- That happens automatically, due to the powers of Spiffy.
+ Note that you don't have to re-Export all the functions from
+ Test::Base. That happens automatically, due to the powers of Spiffy.
- The first line in "some_func" allows it to be called as either a
- function or a method in the test code.
+ The first line in some_func allows it to be called as either a function
+ or a method in the test code.
DISTRIBUTION SUPPORT
+
You might be thinking that you do not want to use Test::Base in you
modules, because it adds an installation dependency. Fear not.
Module::Install::TestBase takes care of that.
@@ -608,18 +651,19 @@
Just write a Makefile.PL that looks something like this:
use inc::Module::Install;
-
+
name 'Foo';
all_from 'lib/Foo.pm';
-
+
use_test_base;
-
+
WriteAll;
- The line with "use_test_base" will automatically bundle all the code the
+ The line with use_test_base will automatically bundle all the code the
user needs to run Test::Base based tests.
OTHER COOL FEATURES
+
Test::Base automatically adds:
use strict;
@@ -629,20 +673,23 @@
indeed.
HISTORY
+
This module started its life with the horrible and ridicule inducing
- name "Test::Chunks". It was renamed to "Test::Base" with the hope that
- it would be seen for the very useful module that it has become. If you
- are switching from "Test::Chunks" to "Test::Base", simply substitute the
- concept and usage of "chunks" to "blocks".
+ name Test::Chunks. It was renamed to Test::Base with the hope that it
+ would be seen for the very useful module that it has become. If you are
+ switching from Test::Chunks to Test::Base, simply substitute the
+ concept and usage of chunks to blocks.
AUTHOR
+
Ingy döt Net
COPYRIGHT
- Copyright 2005-2014. Ingy döt Net.
+
+ Copyright 2005-2018. Ingy döt Net.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
- See http://www.perl.com/perl/misc/Artistic.html
+ See http://www.perl.com/perl/misc/Artistic.html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/lib/Test/Base/Filter.pod new/Test-Base-0.89/lib/Test/Base/Filter.pod
--- old/Test-Base-0.88/lib/Test/Base/Filter.pod 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/lib/Test/Base/Filter.pod 2018-04-19 17:54:27.000000000 +0200
@@ -1,7 +1,7 @@
=pod
=for comment
-DO NOT EDIT. This Pod was generated by Swim.
+DO NOT EDIT. This Pod was generated by Swim v0.1.46.
See http://github.com/ingydotnet/swim-pm#readme
=encoding utf8
@@ -299,7 +299,7 @@
=head1 COPYRIGHT
-Copyright 2005-2014. Ingy döt Net. All rights reserved.
+Copyright 2005-2018. Ingy döt Net. All rights reserved.
This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/lib/Test/Base.pm new/Test-Base-0.89/lib/Test/Base.pm
--- old/Test-Base-0.88/lib/Test/Base.pm 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/lib/Test/Base.pm 2018-04-19 17:54:27.000000000 +0200
@@ -1,5 +1,5 @@
package Test::Base;
-our $VERSION = '0.88';
+our $VERSION = '0.89';
use Spiffy -Base;
use Spiffy ':XXX';
@@ -286,6 +286,7 @@
my $name_error = "Can't determine section names";
sub _section_names {
+ return unless defined $self->spec;
return @_ if @_ == 2;
my $block = $self->first_block
or croak $name_error;
@@ -307,6 +308,7 @@
sub run_compare() {
(my ($self), @_) = find_my_self(@_);
+ return unless defined $self->spec;
$self->_assert_plan;
my ($x, $y) = $self->_section_names(@_);
local $Test::Builder::Level = $Test::Builder::Level + 1;
@@ -412,6 +414,7 @@
sub _pre_eval {
my $spec = shift;
+ return unless defined $spec;
return $spec unless $spec =~
s/\A\s*<<<(.*?)>>>\s*$//sm;
my $eval_code = $1;
@@ -422,6 +425,7 @@
sub _block_list_init {
my $spec = $self->spec;
+ return [] unless defined $spec;
$spec = $self->_pre_eval($spec);
my $cd = $self->block_delim;
my @hunks = ($spec =~ /^(\Q${cd}\E.*?(?=^\Q${cd}\E|\z))/msg);
@@ -513,11 +517,11 @@
close FILE;
}
else {
- $spec = do {
- package main;
- no warnings 'once';
- <DATA>;
- };
+ require Scalar::Util;
+ my $handle = Scalar::Util::openhandle( \*main::DATA );
+ if ($handle) {
+ $spec = <$handle>;
+ }
}
return $spec;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/lib/Test/Base.pod new/Test-Base-0.89/lib/Test/Base.pod
--- old/Test-Base-0.88/lib/Test/Base.pod 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/lib/Test/Base.pod 2018-04-19 17:54:27.000000000 +0200
@@ -1,7 +1,7 @@
=pod
=for comment
-DO NOT EDIT. This Pod was generated by Swim.
+DO NOT EDIT. This Pod was generated by Swim v0.1.46.
See http://github.com/ingydotnet/swim-pm#readme
=encoding utf8
@@ -687,7 +687,7 @@
=head1 COPYRIGHT
-Copyright 2005-2014. Ingy döt Net.
+Copyright 2005-2018. Ingy döt Net.
This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/t/author-pod-syntax.t new/Test-Base-0.89/t/author-pod-syntax.t
--- old/Test-Base-0.88/t/author-pod-syntax.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Test-Base-0.89/t/author-pod-syntax.t 2018-04-19 17:54:27.000000000 +0200
@@ -0,0 +1,15 @@
+#!perl
+
+BEGIN {
+ unless ($ENV{AUTHOR_TESTING}) {
+ print qq{1..0 # SKIP these tests are for testing by the author\n};
+ exit
+ }
+}
+
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
+use strict; use warnings;
+use Test::More;
+use Test::Pod 1.41;
+
+all_pod_files_ok();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/t/release-pod-syntax.t new/Test-Base-0.89/t/release-pod-syntax.t
--- old/Test-Base-0.88/t/release-pod-syntax.t 2014-08-24 17:09:32.000000000 +0200
+++ new/Test-Base-0.89/t/release-pod-syntax.t 1970-01-01 01:00:00.000000000 +0100
@@ -1,14 +0,0 @@
-#!perl
-
-BEGIN {
- unless ($ENV{RELEASE_TESTING}) {
- require Test::More;
- Test::More::plan(skip_all => 'these tests are for release candidate testing');
- }
-}
-
-# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
-use Test::More;
-use Test::Pod 1.41;
-
-all_pod_files_ok();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Base-0.88/t/use.t new/Test-Base-0.89/t/use.t
--- old/Test-Base-0.88/t/use.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Test-Base-0.89/t/use.t 2018-04-19 17:54:27.000000000 +0200
@@ -0,0 +1,5 @@
+use Test::Base;
+
+ok(1, "Dummy test to test module load without any test spec");
+
+Test::More::done_testing();
++++++ cpanspec.yml ++++++
---
#description_paragraphs: 3
#description: |-
# override description from CPAN
#summary: override summary from CPAN
#no_testing: broken upstream
#sources:
# - source1
# - source2
#patches:
# foo.patch: -p1
# bar.patch:
#preamble: |-
# BuildRequires: gcc-c++
#post_prep: |-
# hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'`
# sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL
#post_build: |-
# rm unused.files
#post_install: |-
# sed on %{name}.files
#license: SUSE-NonFree
#skip_noarch: 1
#custom_build: |-
#./Build build flags=%{?_smp_mflags} --myflag
#custom_test: |-
#startserver && make test
#ignore_requires: Bizarre::Module