2010-09-09 14:05:08 +00:00
|
|
|
#
|
2012-06-25 11:37:50 +00:00
|
|
|
# spec file for package perl-Test-Simple
|
2010-09-09 14:05:08 +00:00
|
|
|
#
|
2013-12-10 06:35:36 +00:00
|
|
|
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
2010-09-09 14:05:08 +00:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2008-05-07 10:17:13 +00:00
|
|
|
|
2010-08-27 00:56:15 +00:00
|
|
|
Name: perl-Test-Simple
|
2013-12-10 06:35:36 +00:00
|
|
|
Version: 1.001002
|
2012-06-25 11:37:50 +00:00
|
|
|
Release: 0
|
2013-12-10 06:35:36 +00:00
|
|
|
%define cpan_name Test-Simple
|
|
|
|
Summary: Basic utilities for writing tests.
|
|
|
|
License: Artistic-1.0 or GPL-1.0+
|
|
|
|
Group: Development/Libraries/Perl
|
2010-09-09 14:05:08 +00:00
|
|
|
Url: http://search.cpan.org/dist/Test-Simple/
|
2013-12-10 06:35:36 +00:00
|
|
|
Source: http://www.cpan.org/authors/id/R/RJ/RJBS/%{cpan_name}-%{version}.tar.gz
|
2010-09-09 14:05:08 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
2010-08-27 00:56:15 +00:00
|
|
|
BuildRequires: perl
|
2010-09-09 14:05:08 +00:00
|
|
|
BuildRequires: perl-macros
|
2013-12-10 06:35:36 +00:00
|
|
|
#BuildRequires: perl(Dev::Null)
|
|
|
|
#BuildRequires: perl(MyOverload)
|
|
|
|
#BuildRequires: perl(Test::Builder::IO::Scalar)
|
|
|
|
#BuildRequires: perl(Test::Builder::NoOutput)
|
|
|
|
#BuildRequires: perl(Test::Simple::Catch)
|
|
|
|
#BuildRequires: perl(TieOut)
|
|
|
|
%{perl_requires}
|
2008-05-07 10:17:13 +00:00
|
|
|
|
|
|
|
%description
|
2013-12-10 06:35:36 +00:00
|
|
|
** If you are unfamiliar with testing *read Test::Tutorial* first! **
|
|
|
|
|
2010-08-27 00:56:15 +00:00
|
|
|
This is an extremely simple, extremely basic module for writing tests
|
|
|
|
suitable for CPAN modules and other pursuits. If you wish to do more
|
|
|
|
complicated testing, use the Test::More module (a drop-in replacement for
|
|
|
|
this one).
|
2008-05-07 10:17:13 +00:00
|
|
|
|
2013-12-10 06:35:36 +00:00
|
|
|
The basic unit of Perl testing is the ok. For each thing you want to test
|
|
|
|
your program will print out an "ok" or "not ok" to indicate pass or fail.
|
|
|
|
You do this with the ok() function (see below).
|
|
|
|
|
|
|
|
The only other constraint is you must pre-declare how many tests you plan
|
|
|
|
to run. This is in case something goes horribly wrong during the test and
|
|
|
|
your test program aborts, or skips a test or whatever. You do this like so:
|
|
|
|
|
|
|
|
use Test::Simple tests => 23;
|
|
|
|
|
|
|
|
You must have a plan.
|
|
|
|
|
|
|
|
* *ok*
|
|
|
|
|
|
|
|
ok( $foo eq $bar, $name );
|
|
|
|
ok( $foo eq $bar );
|
|
|
|
|
|
|
|
ok() is given an expression (in this case '$foo eq $bar'). If it's true,
|
|
|
|
the test passed. If it's false, it didn't. That's about it.
|
|
|
|
|
|
|
|
ok() prints out either "ok" or "not ok" along with a test number (it
|
|
|
|
keeps track of that for you).
|
|
|
|
|
|
|
|
# This produces "ok 1 - Hell not yet frozen over" (or not ok)
|
|
|
|
ok( get_temperature($hell) > 0, 'Hell not yet frozen over' );
|
|
|
|
|
|
|
|
If you provide a $name, that will be printed along with the "ok/not ok"
|
|
|
|
to make it easier to find your test when if fails (just search for the
|
|
|
|
name). It also makes it easier for the next guy to understand what your
|
|
|
|
test is for. It's highly recommended you use test names.
|
|
|
|
|
|
|
|
All tests are run in scalar context. So this:
|
|
|
|
|
|
|
|
ok( @stuff, 'I have some stuff' );
|
|
|
|
|
|
|
|
will do what you mean (fail if stuff is empty)
|
|
|
|
|
|
|
|
Test::Simple will start by printing number of tests run in the form "1..M"
|
|
|
|
(so "1..5" means you're going to run 5 tests). This strange format lets
|
|
|
|
Test::Harness know how many tests you plan on running in case something
|
|
|
|
goes horribly wrong.
|
|
|
|
|
|
|
|
If all your tests passed, Test::Simple will exit with zero (which is
|
|
|
|
normal). If anything failed it will exit with how many failed. If you run
|
|
|
|
less (or more) tests than you planned, the missing (or extras) will be
|
|
|
|
considered failures. If no tests were ever run Test::Simple will throw a
|
|
|
|
warning and exit with 255. If the test died, even after having successfully
|
|
|
|
completed all its tests, it will still be considered a failure and will
|
|
|
|
exit with 255.
|
|
|
|
|
|
|
|
So the exit codes are...
|
|
|
|
|
|
|
|
0 all tests successful
|
|
|
|
255 test died or all passed but wrong # of tests run
|
|
|
|
any other number how many failed (including missing or extras)
|
|
|
|
|
|
|
|
If you fail more than 254 tests, it will be reported as 254.
|
|
|
|
|
|
|
|
This module is by no means trying to be a complete testing system. It's
|
|
|
|
just to get you started. Once you're off the ground its recommended you
|
|
|
|
look at the Test::More manpage.
|
2010-09-09 14:05:08 +00:00
|
|
|
|
2008-05-07 10:17:13 +00:00
|
|
|
%prep
|
2010-09-09 14:05:08 +00:00
|
|
|
%setup -q -n %{cpan_name}-%{version}
|
2008-05-07 10:17:13 +00:00
|
|
|
|
|
|
|
%build
|
2010-09-09 14:05:08 +00:00
|
|
|
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
|
|
|
%{__make} %{?_smp_mflags}
|
|
|
|
|
|
|
|
%check
|
|
|
|
%{__make} test
|
2008-05-07 10:17:13 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
%perl_make_install
|
2010-11-30 10:15:11 +00:00
|
|
|
%perl_process_packlist
|
2010-09-09 14:05:08 +00:00
|
|
|
%perl_gen_filelist
|
2008-05-07 10:17:13 +00:00
|
|
|
|
2010-09-09 14:05:08 +00:00
|
|
|
%files -f %{name}.files
|
2013-12-10 06:35:36 +00:00
|
|
|
%defattr(-,root,root,755)
|
|
|
|
%doc Changes examples README TODO
|
2008-05-07 10:17:13 +00:00
|
|
|
|
2010-09-09 14:05:08 +00:00
|
|
|
%changelog
|