Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37480274
en ru br
ALT Linux repositórios
S:0.13-alt1

Group :: Desenvolvimento/Perl
RPM: perl-Text-TestBase

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

pax_global_header00006660000000000000000000000064122273072360014516gustar00rootroot0000000000000052 comment=857e98e57a7dd050672164e305939a8f1114b3c6
perl-Text-TestBase-0.12/000075500000000000000000000000001222730723600150325ustar00rootroot00000000000000perl-Text-TestBase-0.12/Build.PL000064400000000000000000000034671222730723600163400ustar00rootroot00000000000000# =========================================================================
# THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA.
# DO NOT EDIT DIRECTLY.
# =========================================================================

use 5.008_001;

use strict;
use warnings;
use utf8;

use Module::Build;
use File::Basename;
use File::Spec;
use CPAN::Meta;
use CPAN::Meta::Prereqs;

my %args = (
license => 'perl',
dynamic_config => 0,

configure_requires => {
'Module::Build' => 0.38,
},

name => 'Text-TestBase',
module_name => 'Text::TestBase',
allow_pureperl => 0,

script_files => [glob('script/*'), glob('bin/*')],
c_source => [qw()],

test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
recursive_test_files => 1,
);
if (-d 'share') {
$args{share_dir} = 'share';
}

my $builder = Module::Build->subclass(
class => 'MyBuilder',
code => q{
sub ACTION_distmeta {
die "Do not run distmeta. Install Minilla and `minil install` instead.\n";
}
sub ACTION_installdeps {
die "Do not run installdeps. Run `cpanm --installdeps .` instead.\n";
}
}
)->new(%args);
$builder->create_build_script();

my $mbmeta = CPAN::Meta->load_file('MYMETA.json');
my $meta = CPAN::Meta->load_file('META.json');
my $prereqs_hash = CPAN::Meta::Prereqs->new(
$meta->prereqs
)->with_merged_prereqs(
CPAN::Meta::Prereqs->new($mbmeta->prereqs)
)->as_string_hash;
my $mymeta = CPAN::Meta->new(
{
%{$meta->as_struct},
prereqs => $prereqs_hash
}
);
print "Merging cpanfile prereqs to MYMETA.yml\n";
$mymeta->save('MYMETA.yml', { version => 1.4 });
print "Merging cpanfile prereqs to MYMETA.json\n";
$mymeta->save('MYMETA.json', { version => 2 });
perl-Text-TestBase-0.12/Changes000064400000000000000000000017631222730723600163340ustar00rootroot00000000000000Revision history for Perl extension Text::TestBase

0.12 2013-07-22T04:57:52Z

- Suppress warnings
(Hiroki Honda)

0.11 2013-06-04T22:31:09Z

- get_section: return undefined value if the key does not exist.
AUTOLOAD: die if the block does not exists.
(tokuhirom)

0.10 2013-05-07T05:22:43Z

- Fixed deps
(tokuhirom)

0.09

- fixed testing issue on older perls.

0.08

- added 'trim' filter
- added 'run_is_deeply'

0.07

- added support for 'ONLY', 'LAST', 'SKIP' for Test::Base::Less

0.06

- added 'run_is' function and 'uc' filter

0.05

- fixed line number version counting
- 0.04 is completely broken

0.04

[ THIS VERSION OF RELEASE IS BROKEN ]
- added line number counting feature for
Test::Base::Less, Data::Section::TestBase
- added 'run' function for Test::Base::Less

0.03

- use coderef as a filter for Test::Base::Less

0.02

- added Test::Base::Less

0.01 Mon Nov 5 02:07:44 2012
- original version
perl-Text-TestBase-0.12/LICENSE000064400000000000000000000440621222730723600160450ustar00rootroot00000000000000This software is copyright (c) 2012 by Tokuhiro Matsuno E<lt>tokuhirom AAJKLFJEF@ GMAIL COME<gt>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

Terms of the Perl programming language system itself

a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License"

--- The GNU General Public License, Version 1, February 1989 ---

This software is Copyright (c) 2012 by Tokuhiro Matsuno E<lt>tokuhirom AAJKLFJEF@ GMAIL COME<gt>.

This is free software, licensed under:

The GNU General Public License, Version 1, February 1989

GNU GENERAL PUBLIC LICENSE
Version 1, February 1989

Copyright (C) 1989 Free Software Foundation, Inc.
51 Franklin St, Suite 500, Boston, MA 02110-1335 USA

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble

The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.

When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.

We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

The precise terms and conditions for copying, distribution and
modification follow.

GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".

1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.

2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:

a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and

b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).

c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.

d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.

Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.

3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:

a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,

b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,

c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)

Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.

4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.

5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.

6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.

7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.

8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

NO WARRANTY

9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS

Appendix: How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.

To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.

<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice

That's all there is to it!


--- The Artistic License 1.0 ---

This software is Copyright (c) 2012 by Tokuhiro Matsuno E<lt>tokuhirom AAJKLFJEF@ GMAIL COME<gt>.

This is free software, licensed under:

The Artistic License 1.0

The Artistic License

Preamble

The intent of this document is to state the conditions under which a Package
may be copied, such that the Copyright Holder maintains some semblance of
artistic control over the development of the package, while giving the users of
the package the right to use and distribute the Package in a more-or-less
customary fashion, plus the right to make reasonable modifications.

Definitions:

- "Package" refers to the collection of files distributed by the Copyright
Holder, and derivatives of that collection of files created through
textual modification.
- "Standard Version" refers to such a Package if it has not been modified,
or has been modified in accordance with the wishes of the Copyright
Holder.
- "Copyright Holder" is whoever is named in the copyright or copyrights for
the package.
- "You" is you, if you're thinking about copying or distributing this Package.
- "Reasonable copying fee" is whatever you can justify on the basis of media
cost, duplication charges, time of people involved, and so on. (You will
not be required to justify it to the Copyright Holder, but only to the
computing community at large as a market that must bear the fee.)
- "Freely Available" means that no fee is charged for the item itself, though
there may be fees involved in handling the item. It also means that
recipients of the item may redistribute it under the same conditions they
received it.

1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.

2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such
a way shall still be considered the Standard Version.

3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:

a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or an
equivalent medium, or placing the modifications on a major archive site
such as ftp.uu.net, or by allowing the Copyright Holder to include your
modifications in the Standard Version of the Package.

b) use the modified Package only within your corporation or organization.

c) rename any non-standard executables so the names do not conflict with
standard executables, which must also be provided, and provide a separate
manual page for each non-standard executable that clearly documents how it
differs from the Standard Version.

d) make other distribution arrangements with the Copyright Holder.

4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:

a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where to
get the Standard Version.

b) accompany the distribution with the machine-readable source of the Package
with your modifications.

c) accompany any non-standard executables with their corresponding Standard
Version executables, giving the non-standard executables non-standard
names, and clearly documenting the differences in manual pages (or
equivalent), together with instructions on where to get the Standard
Version.

d) make other distribution arrangements with the Copyright Holder.

5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package. You
may not charge a fee for this Package itself. However, you may distribute this
Package in aggregate with other (possibly commercial) programs as part of a
larger (possibly commercial) software distribution provided that you do not
advertise this Package as a product of your own.

6. The scripts and library files supplied as input to or produced as output
from the programs of this Package do not automatically fall under the copyright
of this Package, but belong to whomever generated them, and may be sold
commercially, and may be aggregated with this Package.

7. C or perl subroutines supplied by you and linked into this Package shall not
be considered part of this Package.

8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.

9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

The End

perl-Text-TestBase-0.12/MANIFEST000064400000000000000000000011621222730723600161630ustar00rootroot00000000000000Build.PL
Changes
LICENSE
META.json
README.md
cpanfile
lib/Data/Section/TestBase.pm
lib/Test/Base/Less.pm
lib/Text/TestBase.pm
lib/Text/TestBase/Block.pm
t/00_compile.t
t/Data-Section-TestBase/04_data.t
t/Test-Base-Less/01_run_is.t
t/Test-Base-Less/02_only.t
t/Test-Base-Less/03_skip.t
t/Test-Base-Less/04_last.t
t/Test-Base-Less/05_test.t
t/Test-Base-Less/06_test_base_less_custom_filters.t
t/Test-Base-Less/07_test_base_less_run.t
t/Test-Base-Less/default_filters.t
t/Test-Base-Less/multiline.t
t/Test-Base-Less/run_is_deeply.t
t/Text-TestBase/02_block_offset.t
t/Text-TestBase/03_block.t
xt/02_perlcritic.t
META.yml
MANIFESTperl-Text-TestBase-0.12/META.json000064400000000000000000000046301222730723600164560ustar00rootroot00000000000000{
"abstract" : "Parser for Test::Base format",
"author" : [
"Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>"
],
"dynamic_config" : 0,
"generated_by" : "Minilla/v0.5.5",
"license" : "perl_5",
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Text-TestBase",
"no_index" : {
"directory" : [
"t",
"xt",
"inc",
"share",
"eg",
"examples",
"author"
]
},
"prereqs" : {
"configure" : {
"requires" : {
"CPAN::Meta" : "0",
"CPAN::Meta::Prereqs" : "0",
"Module::Build" : "0.38"
}
},
"develop" : {
"requires" : {
"Test::CPAN::Meta" : "0",
"Test::MinimumVersion" : "0.10108",
"Test::Pod" : "1.41",
"Test::Spellunker" : "v0.2.7"
}
},
"runtime" : {
"requires" : {
"Class::Accessor::Lite" : "0.05",
"Exporter" : "0",
"Test::Builder::Module" : "0",
"Test::More" : "0.98",
"parent" : "0",
"perl" : "5.008001"
}
},
"test" : {
"requires" : {
"Digest::MD5" : "0",
"Test::More" : "0.98",
"Test::Requires" : "0"
}
}
},
"provides" : {
"Data::Section::TestBase" : {
"file" : "lib/Data/Section/TestBase.pm",
"version" : "0.12"
},
"Test::Base::Less" : {
"file" : "lib/Test/Base/Less.pm",
"version" : "0.12"
},
"Test::Base::Less::Filter" : {
"file" : "lib/Test/Base/Less.pm"
},
"Text::TestBase" : {
"file" : "lib/Text/TestBase.pm",
"version" : "0.12"
},
"Text::TestBase::Block" : {
"file" : "lib/Text/TestBase/Block.pm"
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/tokuhirom/Text-TestBase/issues"
},
"homepage" : "https://github.com/tokuhirom/Text-TestBase",
"repository" : {
"url" : "git://github.com/tokuhirom/Text-TestBase.git",
"web" : "https://github.com/tokuhirom/Text-TestBase"
}
},
"version" : "0.12",
"x_contributors" : [
"Hiroki Honda <cside.story@gmail.com>",
"tokuhirom <tokuhirom@gmail.com>"
]
}
perl-Text-TestBase-0.12/META.yml000064400000000000000000000025151222730723600163060ustar00rootroot00000000000000---
abstract: 'Parser for Test::Base format'
author:
- 'Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>'
build_requires:
Digest::MD5: 0
Test::More: 0.98
Test::Requires: 0
configure_requires:
CPAN::Meta: 0
CPAN::Meta::Prereqs: 0
Module::Build: 0.38
dynamic_config: 0
generated_by: 'Minilla/v0.5.5, CPAN::Meta::Converter version 2.130880'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Text-TestBase
no_index:
directory:
- t
- xt
- inc
- share
- eg
- examples
- author
provides:
Data::Section::TestBase:
file: lib/Data/Section/TestBase.pm
version: 0.12
Test::Base::Less:
file: lib/Test/Base/Less.pm
version: 0.12
Test::Base::Less::Filter:
file: lib/Test/Base/Less.pm
Text::TestBase:
file: lib/Text/TestBase.pm
version: 0.12
Text::TestBase::Block:
file: lib/Text/TestBase/Block.pm
requires:
Class::Accessor::Lite: 0.05
Exporter: 0
Test::Builder::Module: 0
Test::More: 0.98
parent: 0
perl: 5.008001
resources:
bugtracker: https://github.com/tokuhirom/Text-TestBase/issues
homepage: https://github.com/tokuhirom/Text-TestBase
repository: git://github.com/tokuhirom/Text-TestBase.git
version: 0.12
x_contributors:
- 'Hiroki Honda <cside.story@gmail.com>'
- 'tokuhirom <tokuhirom@gmail.com>'
perl-Text-TestBase-0.12/README.md000064400000000000000000000020631222730723600163120ustar00rootroot00000000000000# NAME

Text::TestBase - Parser for Test::Base format

# SYNOPSIS

use Text::TestBase;

my $parser = Text::TestBase->new();
$parser->parse(<<'...');
=== hogehoge
--- input: yyy
--- got: xxx
...

# DESCRIPTION

Text::TestBase is a parser for Test::Base format.

# MOTIVATION

I love Test::Base. But it's bit too magical. It uses Spiffy, and it depends to YAML.
Test::Base breaks my distribution sometime. I need more simple implementation for Test::Base format.

# METHODS

- `my $parser = Text::TestBase->new();`

Create new parser instance.

- `$parser->parse($src: Str): List of Text::TestBase::Block`

Parse $src and get a list of [Text::TestBase::Block](http://search.cpan.org/perldoc?Text::TestBase::Block)

# AUTHOR

Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>

# SEE ALSO

Most of the code was taken from [Test::Base](http://search.cpan.org/perldoc?Test::Base), of course.

# LICENSE

Copyright (C) Tokuhiro Matsuno

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
perl-Text-TestBase-0.12/cpanfile000064400000000000000000000004431222730723600165370ustar00rootroot00000000000000requires 'Class::Accessor::Lite', '0.05';
requires 'Exporter';
requires 'Test::More', '0.98';
requires 'parent';
requires 'Test::Builder::Module';
requires 'perl', '5.008001';

on test => sub {
requires 'Test::More', '0.98';
requires 'Test::Requires';
requires 'Digest::MD5';
};
perl-Text-TestBase-0.12/lib/000075500000000000000000000000001222730723600156005ustar00rootroot00000000000000perl-Text-TestBase-0.12/lib/Data/000075500000000000000000000000001222730723600164515ustar00rootroot00000000000000perl-Text-TestBase-0.12/lib/Data/Section/000075500000000000000000000000001222730723600200555ustar00rootroot00000000000000perl-Text-TestBase-0.12/lib/Data/Section/TestBase.pm000064400000000000000000000022131222730723600221230ustar00rootroot00000000000000package Data::Section::TestBase;
use strict;
use warnings;
use utf8;

use parent qw/Exporter/;
our @EXPORT = qw/blocks/;
use Text::TestBase;

our $VERSION = '0.12';

sub new {
my $class = shift;
my %args= @_==1 ? %{$_[0]} : @_;
bless { %args }, $class;
}

sub blocks() {
my $self = ref $_[0] ? shift : __PACKAGE__->new(package => scalar caller);

my $d = do { no strict 'refs'; \*{$self->{package}."::DATA"} };
return unless defined fileno $d;

seek $d, 0, 0;

my $line_offset = 0;

my $content = join '', <$d>;

my $parser = Text::TestBase->new();
my @blocks = $parser->parse($content);
for my $block (@blocks) {
$block->{_lineno} += $line_offset;
}
return @blocks;
}

1;
__END__

=head1 NAME

Data::Section::TestBase - Parse Test::Base format from DATA section

=head1 SYNOPSIS

use Data::Section::TestBase;

my @blocks = blocks;

=head1 DESCRIPTION

This module parse a DATA section as Test::Base format by L<Text::TestBase>.

=head1 FUNCTIONS

=over 4

=item my @blocks = blocks();

Get a list of blocks from DATA section Element of @list is a instance of Text::TestBase::Block.

=back

perl-Text-TestBase-0.12/lib/Test/000075500000000000000000000000001222730723600165175ustar00rootroot00000000000000perl-Text-TestBase-0.12/lib/Test/Base/000075500000000000000000000000001222730723600173715ustar00rootroot00000000000000perl-Text-TestBase-0.12/lib/Test/Base/Less.pm000064400000000000000000000122751222730723600206440ustar00rootroot00000000000000package Test::Base::Less;
use strict;
use warnings;
use utf8;

our $VERSION = '0.12';

use parent qw/Test::Builder::Module Exporter/;
use Test::More;
use Data::Section::TestBase ();
use Carp ();

our @EXPORT = (@Test::More::EXPORT, qw/filters blocks register_filter run run_is run_is_deeply/);

our %FILTER_MAP;
our %FILTERS;

sub register_filter($&) {
my ($name, $code) = @_;
$FILTERS{$name} = $code;
}

sub filters($) {
my $data = shift;
for my $key (keys %$data) {
$FILTER_MAP{$key} ||= [];
push @{$FILTER_MAP{$key}}, @{$data->{$key}};
}
return;
}

sub blocks() {
my @blocks = _get_blocks(scalar(caller(0)));
return @blocks;
}

sub _get_blocks {
my $package = shift;

my $d = do { no strict 'refs'; \*{"${package}::DATA"} };
unless (defined fileno $d) {
Carp::croak("Missing __DATA__ section in $package.");
}
seek $d, 0, 0;

my $content = join '', <$d>;

my $parser = Text::TestBase->new();
my @blocks = $parser->parse($content);
my @retval;
for my $block (@blocks) {
for my $section_name ($block->get_section_names) {
my @data = $block->get_section($section_name);
if (my $filter_names = $FILTER_MAP{$section_name}) {
for my $filter_stuff (@$filter_names) {
if (ref $filter_stuff eq 'CODE') { # filters { input => [\&code] };
@data = $filter_stuff->(@data);
} else { # filters { input => [qw/eval/] };
my $filter = $FILTERS{$filter_stuff};
unless ($filter) {
Carp::croak "Unknown filter name: $filter_stuff";
}
@data = $filter->(@data);
}
}
}
$block->set_section($section_name => @data);
}
if ($block->has_section('ONLY')) {
__PACKAGE__->builder->diag("I found ONLY: maybe you're debugging?");
return $block;
}
if ($block->has_section('SKIP')) {
next;
}
push @retval, $block;
if ($block->has_section('LAST')) {
return @retval;
}
}
return @retval;
}

sub run(&) {
my $code = shift;

for my $block (_get_blocks(scalar(caller(0)))) {
__PACKAGE__->builder->subtest($block->name || 'L: ' . $block->get_lineno, sub {
$code->($block);
});
}
}

sub run_is($$) {
my ($a, $b) = @_;

for my $block (_get_blocks(scalar(caller(0)))) {
__PACKAGE__->builder->is_eq(
$block->get_section($a),
$block->get_section($b),
$block->name || 'L: ' . $block->get_lineno
);
}
}

sub run_is_deeply($$) {
my ($a, $b) = @_;

for my $block (_get_blocks(scalar(caller(0)))) {
local $Test::Builder::Level = $Test::Builder::Level + 1;
Test::More::is_deeply(
$block->get_section($a),
$block->get_section($b),
$block->name || 'L: ' . $block->get_lineno
);
}
}

package Test::Base::Less::Filter;

Test::Base::Less::register_filter(eval => \&_eval);

sub _eval {
my $src = shift;
no warnings;
my @return = CORE::eval $src;
return $@ if $@;
return @return;
}

Test::Base::Less::register_filter(chomp => \&_chomp);
sub _chomp {
map { CORE::chomp; $_ } @_;
}

Test::Base::Less::register_filter(uc => \&_uc);
sub _uc {
map { CORE::uc($_) } @_;
}

Test::Base::Less::register_filter(trim => \&_trim);
sub _trim {
map {
s/\A([ \t]*\n)+//;
s/(?<=\n)\s*\z//g;
$_;
} @_;
}

1;
__END__

=head1 NAME

Test::Base::Less - Limited version of Test::Base.

=head1 SYNOPSIS

use Test::Base::Less;

filters {
input => [qw/eval/],
};

for my $block (blocks) {
is($block->input, $block->expected);
}
done_testing;

__DATA__

===
--- input: 4*2
--- expected: 8

=head1 DESCRIPTION

This is a less clever version of Test::Base.

=head1 FUNCTIONS

This module exports all Test::More's exportable functions, and following functions:

=over 4

=item filters(+{ } : HashRef);

filters {
input => [qw/eval/],
};

Set a filter for the section name.

=item blocks()

Get a list of Text::TestBase::Block as filtered.

=item register_filter($name: Str, $code: CodeRef)

Register a filter for $name using $code.

=back

=head1 DEFAULT FILTERS

This module provides only few filters. If you want to add more filters, pull-reqs welcome.
(I only merge a patch using no depended modules)

=over 4

=item eval

eval() the code.

=item chomp

C<chomp()> the arguments.

=item uc

C<uc()> the arguments.

=item trim

Remove extra blank lines from the beginning and end of the data. This
allows you to visually separate your test data with blank lines.

=back

=head1 REGISTER YOUR OWN FILTER

You can register your own filter by following form:

use Digest::MD5 qw/md5_hex/;
Test::Base::Less::register_filter(md5_hex => \&md5_hex);

=head1 USE CODEREF AS FILTER

You can use a CodeRef as filter.

use Digest::MD5 qw/md5_hex/;
filters {
input => [\&md5_hex],
};

=head1 SEE ALSO

Most of code is taken from L<Test::Base>. Thanks Ingy.
perl-Text-TestBase-0.12/lib/Text/000075500000000000000000000000001222730723600165245ustar00rootroot00000000000000perl-Text-TestBase-0.12/lib/Text/TestBase.pm000064400000000000000000000070201222730723600205730ustar00rootroot00000000000000package Text::TestBase;
use strict;
use warnings;
use 5.008001;
our $VERSION = '0.12';

use Class::Accessor::Lite (
rw => [qw/block_delim data_delim block_class/],
);
use Carp ();

use Text::TestBase::Block;

sub new {
my $class = shift;
my %args = @_==1 ? %{$_[0]} : @_;
bless {
block_delim => '===',
data_delim => '---',
block_class => 'Text::TestBase::Block',
%args,
}, $class;
}

sub parse {
my ($self, $spec) = @_;
my $cd = $self->block_delim;
my $lineno = 1;
my @hunks;

$spec =~ s/
^(\Q${cd}\E.*?(?=^\Q${cd}\E|\z))
| ^([^\n]*\n)
/
if ($1) {
push @hunks, $1;
} elsif ($2) {
$lineno++;
}
'';
/msgxe;

my @blocks;
for my $hunk (@hunks) {
push @blocks, $self->_make_block($hunk, $lineno);
$hunk =~ s/\n/$lineno++/ge;
}
return @blocks;
}

sub _make_block {
my ($self, $hunk, $lineno) = @_;

my $cd = $self->block_delim;
my $dd = $self->data_delim;
$hunk =~ s/\A\Q${cd}\E[ \t]*(.*)\s+// or die;
my $name = $1;
my @parts = split /^\Q${dd}\E +\(?(\w+)\)? *(.*)?\n/m, $hunk;
my $description = shift @parts;
$description ||= '';
unless ($description =~ /\S/) {
$description = $name;
}
$description =~ s/\s*\z//;
my $block = $self->block_class->new(
description => $description,
name => $name,
_lineno => $lineno,
);

my $filter_map = {};
my $section_order = [];
while (@parts) {
my ($type, $filters, $value) = splice(@parts, 0, 3);
$self->_check_reserved($type);
$value = '' unless defined $value;
$filters = '' unless defined $filters;
if ($filters =~ /:(\s|\z)/) {
Carp::croak "Extra lines not allowed in '$type' section"
if $value =~ /\S/;
($filters, $value) = split /\s*:(?:\s+|\z)/, $filters, 2;
$value = '' unless defined $value;
$value =~ s/^\s*(.*?)\s*$/$1/;
}
$block->push_section($type, $value, $filters);
}
return $block;
}

my $reserved_section_names = {};
{
%$reserved_section_names = map {
($_, 1);
} keys(%Text::TestBase::Block::), qw( new DESTROY );
}
sub _check_reserved {
my $id = shift;
Carp::croak "'$id' is a reserved name. Use something else.\n"
if $reserved_section_names->{$id} or
$id =~ /^_/ or $id =~ /^(get_|set_|push_)/;
}


1;
__END__

=encoding utf8

=head1 NAME

Text::TestBase - Parser for Test::Base format

=head1 SYNOPSIS

use Text::TestBase;

my $parser = Text::TestBase->new();
$parser->parse(<<'...');
=== hogehoge
--- input: yyy
--- got: xxx
...

=head1 DESCRIPTION

Text::TestBase is a parser for Test::Base format.

=head1 MOTIVATION

I love Test::Base. But it's bit too magical. It uses Spiffy, and it depends to YAML.
Test::Base breaks my distribution sometime. I need more simple implementation for Test::Base format.

=head1 METHODS

=over 4

=item C<< my $parser = Text::TestBase->new(); >>

Create new parser instance.

=item C<< $parser->parse($src: Str): List of Text::TestBase::Block >>

Parse $src and get a list of L<Text::TestBase::Block>

=back

=head1 AUTHOR

Tokuhiro Matsuno E<lt>tokuhirom AAJKLFJEF@ GMAIL COME<gt>

=head1 SEE ALSO

Most of the code was taken from L<Test::Base>, of course.

=head1 LICENSE

Copyright (C) Tokuhiro Matsuno

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut
perl-Text-TestBase-0.12/lib/Text/TestBase/000075500000000000000000000000001222730723600202365ustar00rootroot00000000000000perl-Text-TestBase-0.12/lib/Text/TestBase/Block.pm000064400000000000000000000035551222730723600216360ustar00rootroot00000000000000package Text::TestBase::Block;
use strict;
use warnings;
use utf8;
use Class::Accessor::Lite (
ro => [qw/name description/],
);

sub new {
my $class = shift;
my %args = @_==1 ? %{$_[0]} : @_;
bless {
_section_order => [],
%args
}, $class;
}

sub has_section {
my ($self, $key) = @_;
return exists($self->{_value_map}->{$key});
}

sub get_section {
my ($self, $key) = @_;
my $value = $self->{_value_map}->{$key};
return undef unless defined $value;
return wantarray ? @$value : $value->[0];
}

sub get_sections {
my ($self, $key) = @_;
map { $self->{_value_map}->{$_} } $self->get_section_names();
}

sub get_section_names {
my ($self, $key) = @_;
@{$self->{_section_order}};
}

sub get_filter {
my ($self, $key) = @_;
$self->{_filter_map}->{$key};
}

sub get_lineno {
my $self = shift;
return $self->{_lineno};
}

sub push_section {
my ($self, $key, $value, $filters) = @_;
$self->{_filter_map}->{$key} = $filters;
$self->{_value_map}->{$key} = [$value];
push @{$self->{_section_order}}, $key;
}

sub set_section {
my ($self, $key, @values) = @_;
$self->{_value_map}->{$key} = [@values];
}

our $AUTOLOAD;
sub AUTOLOAD {
$AUTOLOAD =~ s/.*:://;
my $self = shift;
return if $AUTOLOAD eq 'DESTROY';
unless ($self->has_section($AUTOLOAD)) {
Carp::croak("There is no $AUTOLOAD' sction in the block.");
}
$self->get_section($AUTOLOAD);
}

1;
__END__

=head1 NAME

Text::TestBase::Block - Block object for Text::TestBase

=head1 METHODS

=over 4

=item $block->has_section(): Bool

=item $block->get_section($section_name: Str) : Str

Get a section body by $section_name.

=item $block->get_sections() : List of Str

Get a list of sections in arrayref.

=item $block->get_filter($section_name: Str) : ArrayRef[Str]

Get a filter list for $section_name.

=back
perl-Text-TestBase-0.12/t/000075500000000000000000000000001222730723600152755ustar00rootroot00000000000000perl-Text-TestBase-0.12/t/00_compile.t000064400000000000000000000001121222730723600174030ustar00rootroot00000000000000use strict;
use Test::More tests => 1;

BEGIN { use_ok 'Text::TestBase' }
perl-Text-TestBase-0.12/t/Data-Section-TestBase/000075500000000000000000000000001222730723600212605ustar00rootroot00000000000000perl-Text-TestBase-0.12/t/Data-Section-TestBase/04_data.t000064400000000000000000000012101222730723600226530ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::More;
use Data::Section::TestBase;

my @blocks = blocks;

is(0+@blocks, 2);

subtest 'first block' => sub {
my $b = $blocks[0];
is($b->name, 'foo');
is($b->get_section('input'), 'yyy');
is($b->get_section('expected'), 'zzz');
is($b->get_lineno, 31, 'lineno');
};

subtest 'second block' => sub {
my $b = $blocks[1];
is($b->name, 'bar');
is($b->get_section('input'), "xxx\n");
is($b->get_section('expected'), "ppp\n");
is($b->get_lineno, 35, 'lineno');
};

done_testing;

__DATA__

=== foo
--- input: yyy
--- expected: zzz

=== bar
--- input
xxx
--- expected
ppp
perl-Text-TestBase-0.12/t/Test-Base-Less/000075500000000000000000000000001222730723600177705ustar00rootroot00000000000000perl-Text-TestBase-0.12/t/Test-Base-Less/01_run_is.t000064400000000000000000000002671222730723600217610ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::Base::Less;

filters {
input => [qw/uc/],
};

run_is input => 'expected';

done_testing;

__DATA__

===
--- input: x
--- expected: X
perl-Text-TestBase-0.12/t/Test-Base-Less/02_only.t000064400000000000000000000003251222730723600214370ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::Base::Less;

run {
my $block = shift;
is($block->input, 'MMM');
};

done_testing;
__END__

===
--- input: YYY

===
--- ONLY
--- input: MMM

===
--- input: ZZZ
perl-Text-TestBase-0.12/t/Test-Base-Less/03_skip.t000064400000000000000000000003141222730723600214230ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::Base::Less;

run {
my $block = shift;
is($block->input, 1);
};

done_testing;

__END__

===
--- input: 1

===
--- SKIP
--- input: 2

===
--- input: 1
perl-Text-TestBase-0.12/t/Test-Base-Less/04_last.t000064400000000000000000000003421222730723600214220ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::Base::Less;

plan tests => 3;

run {
my $block = shift;
is($block->input, 1);
};

__END__

===
--- input: 1

===
--- input: 1

===
--- LAST
--- input: 1

===
--- input: 2

perl-Text-TestBase-0.12/t/Test-Base-Less/05_test.t000064400000000000000000000006151222730723600214420ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::Base::Less;

filters {
code => [qw/eval/],
};

is(0+blocks, 2) or die "BAIL OUT";
isa_ok([blocks]->[0], 'Text::TestBase::Block');

is_deeply([blocks]->[0]->code, +{ a => 'b' });
is(scalar([blocks]->[1]->code), 'X');
is_deeply([[blocks]->[1]->code], [qw/X Y/]);

done_testing;
__DATA__

===
--- code: +{ a => 'b' }

===
--- code
(
'X' => 'Y'
)
perl-Text-TestBase-0.12/t/Test-Base-Less/06_test_base_less_custom_filters.t000064400000000000000000000003531222730723600266040ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::Base::Less;
use Digest::MD5 qw/md5_hex/;

filters {
input => [\&md5_hex],
};

is([blocks]->[0]->input, 'f561aaf6ef0bf14d4208bb46a4ccb3ad');

done_testing;

__DATA__

===
--- input: xxx
perl-Text-TestBase-0.12/t/Test-Base-Less/07_test_base_less_run.t000064400000000000000000000003611222730723600243460ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::Base::Less;

run {
my $block = shift;
is(uc($block->input), $block->expected);
};
done_testing;

__DATA__

===
--- input: x
--- expected: X

=== have a name
--- input: y
--- expected: Y

perl-Text-TestBase-0.12/t/Test-Base-Less/default_filters.t000064400000000000000000000003751222730723600233360ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::Base::Less;

filters {
test_trim => [qw/trim/],
};

my ($block) = blocks();
is($block->test_trim, $block->expected_trim);

done_testing;
__END__

===
--- test_trim

xxx


--- expected_trim
xxx
--- test_
perl-Text-TestBase-0.12/t/Test-Base-Less/multiline.t000064400000000000000000000004511222730723600221570ustar00rootroot00000000000000use strict;
use Test::Base::Less;

filters {
input => ['trim', sub { uc(shift) }],
expected => ['trim'],
};

run_is input => 'expected';

done_testing;

__DATA__

=== Normal Case
--- input
x
y
z
--- expected
X
Y
Z

=== Contains numeric chars
--- input
Hello,
5963
--- expected
HELLO,
5963
perl-Text-TestBase-0.12/t/Test-Base-Less/run_is_deeply.t000064400000000000000000000004251222730723600230170ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::Base::Less;

filters {
input => ['eval', sub { $_[0]->{x} *= 2; $_[0] }],
expected => ['eval'],
};

run_is_deeply 'input' => 'expected';

done_testing;

__END__

===
--- input
+{
x => 2,
}
--- expected
+{
x => 4,
}
perl-Text-TestBase-0.12/t/Text-TestBase/000075500000000000000000000000001222730723600177315ustar00rootroot00000000000000perl-Text-TestBase-0.12/t/Text-TestBase/02_block_offset.t000064400000000000000000000007611222730723600230630ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::More;
use Text::TestBase;
use Data::Dumper;

my $hunk = <<'...';
=== hogehoge
--- input
xxx
--- expected
yyy

=== XXX
...

my @blocks = Text::TestBase->new()->parse($hunk);
subtest 'block1' => sub {
my $block = $blocks[0];
is($block->name, 'hogehoge');
is($block->get_lineno, 1);
};

subtest 'block2' => sub {
my $block = $blocks[1];
is($block->name, 'XXX');
is($block->get_lineno, 7);
};
# note Dumper($block);

done_testing;
perl-Text-TestBase-0.12/t/Text-TestBase/03_block.t000064400000000000000000000013271222730723600215150ustar00rootroot00000000000000use strict;
use warnings;
use utf8;
use Test::More;
use Text::TestBase;
use Data::Dumper;

my $hunk = <<'...';
=== hogehoge
--- ONLY
--- input
xxx
--- expected
yyy
...

subtest 'check' => sub {
my $warnings = '';
local $SIG{__WARN__} = sub { $warnings .= $_[0] };
{
my $block = Text::TestBase->new()->_make_block($hunk);
is($block->get_section('input'), "xxx\n");
is($block->input, "xxx\n");
is($block->get_section('expected'), "yyy\n");
is($block->description, "hogehoge");
is($block->name, "hogehoge");
ok($block->has_section('ONLY'));
ok(not $block->has_section('SKIP'));
note Dumper($block);
}
is($warnings, '');
};

done_testing;
perl-Text-TestBase-0.12/xt/000075500000000000000000000000001222730723600154655ustar00rootroot00000000000000perl-Text-TestBase-0.12/xt/02_perlcritic.t000064400000000000000000000024031222730723600203120ustar00rootroot00000000000000use strict;
use warnings;
use Test::More;

eval {
require Perl::Critic;
Perl::Critic->VERSION(1.105);

require Test::Perl::Critic;
Test::Perl::Critic->VERSION(1.02);
Test::Perl::Critic->import(
-profile => \(join q{}, <DATA>)
);
};
note $@ if $@;
plan skip_all => "Perl::Critic 1.105+ or Test::Perl::Critic 1.02+ is not installed." if $@;

all_critic_ok('lib', 'script', 'bin');

__END__

only=1

# -------------------------------------------------------------------------
# Not important.

[BuiltinFunctions::ProhibitSleepViaSelect]
[BuiltinFunctions::RequireGlobFunction]
[ClassHierarchies::ProhibitOneArgBless]

# -------------------------------------------------------------------------
# Bug detection
[InputOutput::ProhibitBarewordFileHandles]
[Modules::RequireFilenameMatchesPackage]
[Subroutines::ProhibitNestedSubs]
[Subroutines::ProhibitReturnSort]
[TestingAndDebugging::RequireUseStrict]
[Variables::ProhibitConditionalDeclarations]
[Variables::RequireLexicalLoopIterators]

[TestingAndDebugging::ProhibitNoStrict]
allow=refs

# -------------------------------------------------------------------------
# Security issue detection
[InputOutput::RequireEncodingWithUTF8Layer]
[Modules::ProhibitEvilModules]
[InputOutput::ProhibitTwoArgOpen]

 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009