Compare commits

...

No commits in common. "master" and "pristine-tar" have entirely different histories.

31 changed files with 1 additions and 3353 deletions

389
ChangeLog
View File

@ -1,389 +0,0 @@
2003-01-15 13:48 Michael Granger <ged@FaerieMUD.org>
* t/15_setupteardown.t (1.4):
- Added/refined tests to match refined setup/teardown behaviour.
2003-01-15 13:47 Michael Granger <ged@FaerieMUD.org>
* Makefile.PL (1.5):
- Converted to use ExtUtils::AutoInstall.
2003-01-15 13:46 Michael Granger <ged@FaerieMUD.org>
* t/: 05_importTestData.t (1.1), 12_testdata.t (1.1):
Initial commit.
2003-01-15 12:58 Michael Granger <ged@FaerieMUD.org>
* lib/Test/SimpleUnit.pm (1.21):
- Removed leftover conflict section.
2003-01-15 12:48 Michael Granger <ged@FaerieMUD.org>
* lib/Test/SimpleUnit.pm (1.20):
- Added 'AutoskipFailedTeardown' global and accessors.
- Added loadTestData() and saveTestData() functions and ':testdata' export flag
- Modified comparison assertions to use Data::Compare.
- Added functions/data to allow modification of output handle.
- Generalized assertion-bookkeeping into functions.
- Handled undefined values more cleanly in assertion messages.
- Added ability to stack setup/teardown functions for one-time setup or
teardowns.
2002-06-24 16:28 Michael Granger <ged@FaerieMUD.org>
* t/: 05_asserts.t (1.5), 06_skips.t (1.4), 07_setupteardown.t
(1.4), 08_emptysuite.t (1.2), 09_bugs.t (1.2):
'Updated'
2002-05-14 17:39 Michael Granger <ged@FaerieMUD.org>
* lib/Test/SimpleUnit.pm (1.19):
- Cleaned up handling of undef values in default error messages for
assertKindOf() and assertInstanceOf().
2002-05-13 21:02 Michael Granger <ged@FaerieMUD.org>
* Makefile.PL (1.4, RELEASE_1_18):
- Added some dependencies to the require list.
2002-05-13 21:01 Michael Granger <ged@FaerieMUD.org>
* lib/Test/SimpleUnit.pm (1.18, RELEASE_1_18):
- Added functions/package variables to support switching the test output IO
handle to something different for the purposes of self-testing.
- Modified assertion counter code to support recursive calls to runTests().
2002-05-13 20:59 Michael Granger <ged@FaerieMUD.org>
* t/: 09_bugs.t (1.1), 30_bugs.t (1.1) (utags: RELEASE_1_18):
- Initial commit.
2002-04-25 14:53 Michael Granger <ged@FaerieMUD.org>
* t/: 07_setupteardown.t (1.3), 15_setupteardown.t (1.3) (utags:
RELEASE_1_18, RELEASE_1_17):
- Modified to test the setup/teardown superseding rules.
2002-04-25 14:52 Michael Granger <ged@FaerieMUD.org>
* README (1.4, RELEASE_1_18, RELEASE_1_17):
- Cleaned up to reflect the changes made to the module.
- Clarified meaning of parts, added better example, etc.
- Removed references to XUnit, as this isn't exactly an XUnit-type framework.
2002-04-25 14:50 Michael Granger <ged@FaerieMUD.org>
* lib/Test/SimpleUnit.pm (1.17, RELEASE_1_17):
- Cleaned up and corrected documentation.
- Separated example code from synopsis
- Added beginnings of debugging code
- Modified setup/teardown to use superseding rule instead of additive rules.
2002-04-23 16:04 Michael Granger <ged@FaerieMUD.org>
* lib/Test/SimpleUnit.pm (1.16, RELEASE_1_16):
- Split up somewhat into functions.
- Fixed bug that surfaced when running an empty test suite, or a suite with only
'setup' and 'teardown' tests.
- Fixed error reporting: now failures are reported for TEST_VERBOSE=1 as well as
VERBOSE=1.
2002-04-23 16:01 Michael Granger <ged@FaerieMUD.org>
* t/: 08_emptysuite.t (1.1), 20_emptysuite.t (1.1) (utags:
RELEASE_1_18, RELEASE_1_17, RELEASE_1_16):
Initial commit.
2002-04-22 16:15 Michael Granger <ged@FaerieMUD.org>
* lib/Test/SimpleUnit.pm (1.15, RELEASE_1_15):
- Fixed some X<> POD constructs that should have been L<> ones.
2002-04-22 16:14 Michael Granger <ged@FaerieMUD.org>
* README (1.3, RELEASE_1_16, RELEASE_1_15):
- Added longer description.
2002-04-15 13:54 Michael Granger <ged@FaerieMUD.org>
* t/: 06_skips.t (1.3), 11_skips.t (1.3) (utags: RELEASE_1_18,
RELEASE_1_15, RELEASE_1_14, RELEASE_1_17, RELEASE_1_16):
- Added 'AutoskipFailedSetup' tests.
2002-04-15 13:54 Michael Granger <ged@FaerieMUD.org>
* lib/Test/SimpleUnit.pm (1.14, RELEASE_1_14):
- Updated, added documentation
- Changed AutoskipFailedSetup to a function, as it was rather incongruous as a
method. The method style stills works, but it's deprecated.
- Added code to allow 'setup' and 'teardown' cases to specify their coderefs
with a 'func' key rather than 'test' for clarity.
2002-04-08 12:57 Michael Granger <ged@FaerieMUD.org>
* README (1.2, RELEASE_1_14, RELEASE_1_13):
- De-tabified.
2002-04-08 12:52 Michael Granger <ged@FaerieMUD.org>
* README (1.1):
Initial commit.
2002-04-08 12:50 Michael Granger <ged@FaerieMUD.org>
* t/: 05_asserts.t (1.4), 10_asserts.t (1.4) (utags: RELEASE_1_18,
RELEASE_1_15, RELEASE_1_14, RELEASE_1_17, RELEASE_1_16,
RELEASE_1_13):
- Modified error messages to reflect changes in assert().
2002-04-08 12:47 Michael Granger <ged@FaerieMUD.org>
* lib/Test/SimpleUnit.pm (1.13, RELEASE_1_13):
- Modified to pass "\n" as the last arg to die to remove the irrelevant 'at
line...' message. When I have more time, I should add code to backtrace
through caller() and get a useful equivalent.
- Look for $ENV{TEST_VERBOSE}, too.
2002-03-29 16:45 Michael Granger <ged@FaerieMUD.org>
* Makefile.PL (1.3, RELEASE_1_17, RELEASE_1_16, RELEASE_1_15,
RELEASE_1_14, RELEASE_1_13, RELEASE_1_12):
- Fixed ci/tag target
2002-03-29 16:41 Michael Granger <ged@FaerieMUD.org>
* Makefile.PL (1.2), lib/Test/SimpleUnit.pm (1.12, RELEASE_1_12),
t/00_require.t (1.2, RELEASE_1_18, RELEASE_1_17, RELEASE_1_16,
RELEASE_1_15, RELEASE_1_14, RELEASE_1_13, RELEASE_1_12),
t/01_importAll.t (1.2, RELEASE_1_18, RELEASE_1_17, RELEASE_1_16,
RELEASE_1_15, RELEASE_1_14, RELEASE_1_13, RELEASE_1_12),
t/02_importAsserts.t (1.3, RELEASE_1_18, RELEASE_1_17,
RELEASE_1_16, RELEASE_1_15, RELEASE_1_14, RELEASE_1_13,
RELEASE_1_12), t/03_importTfuncs.t (1.2, RELEASE_1_18,
RELEASE_1_17, RELEASE_1_16, RELEASE_1_15, RELEASE_1_14,
RELEASE_1_13, RELEASE_1_12), t/04_importSkips.t (1.2, RELEASE_1_18,
RELEASE_1_17, RELEASE_1_16, RELEASE_1_15, RELEASE_1_14,
RELEASE_1_13, RELEASE_1_12), t/05_asserts.t (1.3, RELEASE_1_12),
t/06_skips.t (1.2, RELEASE_1_13, RELEASE_1_12),
t/07_setupteardown.t (1.2, RELEASE_1_16, RELEASE_1_15,
RELEASE_1_14, RELEASE_1_13, RELEASE_1_12), t/10_asserts.t (1.3,
RELEASE_1_12), t/11_skips.t (1.2, RELEASE_1_13, RELEASE_1_12),
t/15_setupteardown.t (1.2, RELEASE_1_16, RELEASE_1_15,
RELEASE_1_14, RELEASE_1_13, RELEASE_1_12):
- Renamed to Test::SimpleUnit
2002-03-29 15:59 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.12):
Renamed and moved into lib/Test
2002-03-28 14:01 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.11, RELEASE_1_11), lib/Test/SimpleUnit.pm
(1.11):
- Fixed copyright.
2002-03-28 13:59 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.10), lib/Test/SimpleUnit.pm (1.10):
- assertExceptionMatches(): New assertion function.
- assertExceptionType(): New assertion function.
- assertKindOf(): New assertion function.
- Corrected skip handling for setup/teardown.
- Added handler for 'skipAll' to setup/teardown.
2002-03-28 12:00 Michael Granger <ged@FaerieMUD.org>
* t/: 05_asserts.t (1.2), 10_asserts.t (1.2) (utags: RELEASE_1_11):
- Added tests for assertExceptionType() and assertExceptionMatch().
- Simplified some of the other tests with new asserts.
2002-03-22 18:21 Michael Granger <ged@FaerieMUD.org>
* t/: 07_setupteardown.t (1.1), 15_setupteardown.t (1.1) (utags:
RELEASE_1_11, RELEASE_1_09):
First commit.
2002-03-22 18:20 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.9, RELEASE_1_09), lib/Test/SimpleUnit.pm
(1.9):
- Added 'setup' and 'teardown' test handling to facilitate XUnit-style pre- and post-test functions. This feature still needs documenting.
- AutoskipFailedSetup(): New method to automatically skip any tests in a test case after a 'setup' test has failed.
2002-03-21 18:30 Michael Granger <ged@FaerieMUD.org>
* t/: 04_importSkips.t (1.1, RELEASE_1_11), 05_asserts.t (1.1),
06_skips.t (1.1, RELEASE_1_11), 10_asserts.t (1.1), 11_skips.t
(1.1, RELEASE_1_11) (utags: RELEASE_1_09):
Initial commit.
2002-03-21 18:30 Michael Granger <ged@FaerieMUD.org>
* t/04_asserts.t (1.3):
- Renamed to 05_asserts.t to make room for the skip-import tests.
2002-03-21 18:27 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.8), lib/Test/SimpleUnit.pm (1.8):
- fail: New function
- skipOne: New function
- skipAll: New function
- Fixed up some warnings that showed up when using assertUndef() and assertNot()
with undefined values and no message.
2002-03-05 15:47 Michael Granger <ged@FaerieMUD.org>
* t/04_asserts.t (1.2):
- Modified import tag to reflect name change from 'assertFunctions' to
'asserts'.
- Added tests for new assertions 'assertDefined' and 'assertUndef'.
2002-03-05 15:46 Michael Granger <ged@FaerieMUD.org>
* t/02_importAsserts.t (1.2, RELEASE_1_11, RELEASE_1_09):
- Modified import tag to reflect name change from 'assertFunctions' to
'asserts'.
2002-03-05 15:46 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.7), lib/Test/SimpleUnit.pm (1.7):
- Changed the name of the assertion exporter tag to 'asserts'; an
'assertFunctions' tag remains for backwards-compatibility, but may be
deprecated in the future.
- Added 'assertUndef' assertion
- Added 'assertDefined' assertion
2001-11-28 13:13 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.6), lib/Test/SimpleUnit.pm (1.6):
- Update documentation.
2001-10-29 12:43 Michael Granger <ged@FaerieMUD.org>
* t/04_asserts.t (1.1):
First release.
2001-10-29 12:43 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.5), lib/Test/SimpleUnit.pm (1.5):
- Cleaned up a bunch of places where an undefined value in an assertion value
was not handled gracefully. There are probably more somewhere.
- Added two more assertion functions: assertMatches() and assertNotRef().
- Moved the scalar test out of assertRef() and into the new assertNotRef().
- Made the error message for assertInstanceOf() a bit more accurate.
2001-09-08 23:12 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.4), lib/Test/SimpleUnit.pm (1.4):
- Fixed POD escape thingies in the docs.
2001-09-08 23:10 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.3), lib/Test/SimpleUnit.pm (1.3):
- Fixed auto-generated docs, as the moduletool parser apparently doesn't like
code sample indent stuff.
2001-08-03 16:35 Michael Granger <ged@FaerieMUD.org>
* TestFramework.pm (1.2), lib/Test/SimpleUnit.pm (1.2):
- Fixed and added more documentation
- Added true return value at module end
2001-08-03 15:55 Michael Granger <ged@FaerieMUD.org>
* Makefile.PL (1.1.1.1, RELEASE_1_11, RELEASE_1_09, RELEASE_1_1),
TestFramework.pm (1.1.1.1, RELEASE_1_1), lib/Test/SimpleUnit.pm
(1.1.1.1), t/00_require.t (1.1.1.1, RELEASE_1_11, RELEASE_1_09,
RELEASE_1_1), t/01_importAll.t (1.1.1.1, RELEASE_1_11,
RELEASE_1_09, RELEASE_1_1), t/02_importAsserts.t (1.1.1.1,
RELEASE_1_1), t/03_importTfuncs.t (1.1.1.1, RELEASE_1_11,
RELEASE_1_09, RELEASE_1_1):
Initial release.
2001-08-03 15:55 Michael Granger <ged@FaerieMUD.org>
* Makefile.PL (1.1), TestFramework.pm (1.1), lib/Test/SimpleUnit.pm
(1.1), t/00_require.t (1.1), t/01_importAll.t (1.1),
t/02_importAsserts.t (1.1), t/03_importTfuncs.t (1.1):
Initial revision

View File

@ -1,17 +0,0 @@
ChangeLog
MANIFEST
Makefile.PL
README
lib/Test/SimpleUnit.pm
t/00_require.t
t/01_importAll.t
t/02_importAsserts.t
t/03_importTfuncs.t
t/04_importSkips.t
t/05_importTestData.t
t/10_asserts.t
t/11_skips.t
t/12_testdata.t
t/15_setupteardown.t
t/20_emptysuite.t
t/30_bugs.t

View File

@ -1,66 +0,0 @@
#!/usr/bin/perl
#
# Perl Makefile for Test::SimpleUnit
# $Id: Makefile.PL,v 1.5 2003/01/15 20:47:17 deveiant Exp $
#
# Invocation:
# $ perl Makefile.PL # interactive behaviour
# $ perl Makefile.PL --defaultdeps # accept default value on prompts
# $ perl Makefile.PL --checkdeps # check only, no Makefile produced
# $ perl Makefile.PL --skipdeps # ignores all dependencies
# $ perl Makefile.PL --testonly # don't write installation targets
#
# Then, to build:
# $ make [all|test|install] # install dependencies first
# $ make checkdeps # same as the --checkdeps above
# $ make installdeps # install dependencies only
#
# ExtUtils::AutoInstall Bootstrap Code, version 5.
BEGIN{my$p='ExtUtils::AutoInstall';my$v=0.40;eval"use $p $v;1
"or do{my$e=$ENV{PERL_EXTUTILS_AUTOINSTALL};(!defined($e)||$e
!~m/--(?:default|skip|testonly)/and-t STDIN or eval"use Ext".
"Utils::MakeMaker;WriteMakefile('PREREQ_PM'=>{'$p',$v});1"and
exit)and print"==> $p $v required. Install it from CPAN? [Y".
"/n] "and<STDIN>!~/^n/i and print"*** Installing $p\n"and do{
eval{require CPANPLUS;CPANPLUS::install $p};eval"use $p $v;1"
or eval{require CPAN;CPAN::install$p};eval"use $p $v;1"or die
"*** Please install $p $v manually from cpan.org first.\n"}}}
# the above handlers must be declared before the 'use' statement
use ExtUtils::AutoInstall (
# required AutoInstall version
-version => '0.40',
# core modules; may also be 'all'
-core => {
Data::Compare => '0.02',
Data::Dumper => '',
Scalar::Util => '',
Carp => '',
IO::Handle => '',
IO::File => '',
Fcntl => '',
constant => '',
},
);
WriteMakefile(
NAME => 'Test::SimpleUnit',
DISTNAME => 'Test-SimpleUnit',
VERSION_FROM => 'lib/Test/SimpleUnit.pm', # finds $VERSION
AUTHOR => 'Michael Granger <ged@FaerieMUD.org>',
ABSTRACT => 'A simplified XUnit testing framework',
dist => {
CI => "cvs commit",
RCS_LABEL => 'cvs tag RELEASE_$(VERSION_SYM)',
SUFFIX => ".bz2",
DIST_DEFAULT => 'all tardist',
COMPRESS => "bzip2",
},
clean => { FILES => "*testdata*" },
);

237
README
View File

@ -1,237 +0,0 @@
Test::SimpleUnit
a simplified unit testing framework
Authors
-------
Michael Granger <ged@FaerieMUD.org>
General Information
-------------------
This is a simplified Perl unit-testing framework for creating unit tests to be
run either standalone or under Test::Harness.
Testing
Testing in Test::SimpleUnit is done by running a test suite, either via 'make
test', which uses the Test::Harness 'test' target written by
ExtUtils::MakeMaker, or as a standalone script.
If errors occur while running tests via the 'make test' method, you can get
more verbose output about the test run by adding "TEST_VERBOSE=1" to the end
of the "make" invocation:
$ make test TEST_VERBOSE=1
If you want to display only the messages caused by failing assertions, you can
add a "VERBOSE=1" to the end of the "make" invocation instead:
$ make test VERBOSE=1
Test Suites
A test suite is one or more test cases, each of which tests a specific unit of
functionality.
Test Cases
A test case is a unit of testing which consists of one or more tests, combined
with setup and teardown functions that make the necessary preparations for
testing.
You may wish to split test cases up into separate files under a "t/" directory
so they will run under a Test::Harness-style "make test".
Tests
A test is a hashref which contains two key-value pairs: a name key with the
name of the test as the value, and a code reference under a test key:
{
name => 'This is the name of the test',
test => sub { ...testing code... }
}
Each test's "test" function can make one or more assertions by using the
Assertion Functions provided, or can indicate that it or any trailing tests in
the same test case should be skipped by calling one of the provided Skip
Functions.
Setup and Teardown Functions
If a test has the name 'setup' or 'teardown', it is run before or after each
test that follows it, respectively. A second or succeeding setup or teardown
function will supersede any function of the same type which preceded it. This
allows a test designer to change the setup function as the tests progress. See
the EXAMPLE section for an example of how to use this.
If a test is preceeded by multiple new setup/teardown functions, the last one
to be specified is kept, and any others are discarded after being executed
once. This allows one to specify one-time setup and/or teardown functions at a
given point of testing.
The code reference value within a *setup* or *teardown* test case can
optionally be named "func" instead of "test" for clarity. If there are both
"func" and "test" key-value pairs in a *setup* or *teardown* case, the "test"
pair is silently ignored.
Saving Test Data
If the test suite requires configuration, or some other data which should
persist between test cases, it can be dumped via Data::Dumper to a file with
the saveTestData() function. In succeeding tests, it can be reloaded using the
loadTestData() function.
Example
-------
use Test::SimpleUnit qw{:functions};
# If a setup function fails, skip the rest of the tests
Test::SimpleUnit::AutoskipFailedSetup( 1 );
my $Instance;
my $RequireWasOkay = 0;
my @tests = (
# Require the module
{
name => 'require',
test => sub {
# Make sure we can load the module to be tested.
assertNoException { require MyClass };
# Try to import some functions, generating a custom error message if it
# fails.
assertNoException { MyClass->import(':myfuncs') } "Failed to import :myfuncs";
# Make sure calling 'import()' actually imported the functions
assertRef 'CODE', *::myfunc{CODE};
assertRef 'CODE', *::myotherfunc{CODE};
# Set the flag to let the setup function know the module loaded okay
$RequireWasOkay = 1;
},
},
# Setup function (this will be run before any tests which follow)
{
name => 'setup',
test => sub {
# If the previous test didn't finish, it's untestable, so just skip the
# rest of the tests
skipAll "Module failed to load" unless $RequireWasOkay;
$Instance = new MyClass;
},
},
# Teardown function (this will be run after any tests which follow)
{
name => 'teardown',
test => sub {
undef $Instance;
},
},
# One-time setup function -- overrides the previous setup, but is
# immediately discarded after executing once.
{
name => 'setup',
func => sub {
MyClass::prepNetwork();
},
},
# Test the connect() and disconnect() methods
{
name => 'connect() and disconnect()',
test => sub {
my $rval;
assertNoException { $rval = $Instance->connect };
assert $rval, "Connect failed without error.";
assertNoException { $Instance->disconnect };
},
},
# Now override the previous setup function with a new one that does
# a connect() before each remaining test.
{
name => 'setup',
test => sub {
$Instance = new MyClass;
$Instance->connect;
},
}
# Same thing for teardown/disconnect()
{
name => 'teardown',
test => sub {
$Instance->disconnect;
undef $Instance;
},
},
...
);
runTests( @testSuite );
Caveats
-------
I would greatly appreciate feedback on any aspect of this software. Suggestions,
feature requests, questions, design critiques, and bug reports are most
welcome. Relevant patches are particularly helpful. I may be reached at
<ged@FaerieMUD.org>.
Installation
------------
$ perl Makefile.PL
$ make
$ make test
(become root)
# make install
== Legal
This module is Open Source Software which is Copyright (c) 1999-2003 by The
FaerieMUD Consortium.
You may use, modify, and/or redistribute this software under the terms of either
the Perl Artistic License or the GNU Public License (version 2 or later),
whichever you prefer. A copy of the Artistic license should have been included
in this distribution (See the file Artistic). If it was not, a copy of it may be
obtained from http://language.perl.com/misc/Artistic.html or
http://www.faeriemud.org/artistic.html).
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.
Rev: $Id: README,v 1.5 2003/01/15 21:48:39 deveiant Exp $

54
debian/changelog vendored
View File

@ -1,54 +0,0 @@
libtest-simpleunit-perl (1.21-5) unstable; urgency=low
[ Ansgar Burchardt ]
* debian/control: Convert Vcs-* fields to Git.
[ gregor herrmann ]
* Switch to source format 3.0 (quilt).
* Add patch perl_re.patch: adjust regexp to work with older and newer
perl versions. (Closes: #636522)
* Update to debhelper (compat level) 8, use tiny debian/rules.
* debian/copyright: reformat according to current DEP5 draft.
* Set Standards-Version to 3.9.2, drop version from perl build
dependency.
* Add /me to Uploaders.
* Improve short and long description a bit.
* Add a patch to fix a spelling mistake.
-- gregor herrmann <gregoa@debian.org> Tue, 15 Nov 2011 20:00:23 +0100
libtest-simpleunit-perl (1.21-4) unstable; urgency=low
[ Nathan Handler ]
* debian/watch: Update to ignore development releases.
[ gregor herrmann ]
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
(source stanza).
[ Christoph Berg ]
* Remove myself from Uploaders.
* Remove stray 12testdata.1767 file from package.
-- Christoph Berg <myon@debian.org> Wed, 09 Dec 2009 14:33:14 +0100
libtest-simpleunit-perl (1.21-3) unstable; urgency=low
* Set Maintainer to Debian Perl Group.
* Add libextutils-autoinstall-perl to Build-Depends-Indep.
-- Christoph Berg <myon@debian.org> Tue, 26 May 2009 13:24:00 +0200
libtest-simpleunit-perl (1.21-2) unstable; urgency=low
* Fix missing build dependency (Closes: #489115)
* Updated Standards version, no changes needed.
* Fix copyright-contains-dh-make-perl-boilerplate.
-- Martin Zobel-Helas <zobel@debian.org> Sun, 06 Jul 2008 12:39:04 +0200
libtest-simpleunit-perl (1.21-1) unstable; urgency=low
* Initial Release.
-- Martin Zobel-Helas <zobel@debian.org> Thu, 19 Jun 2008 17:20:32 +0200

1
debian/compat vendored
View File

@ -1 +0,0 @@
8

22
debian/control vendored
View File

@ -1,22 +0,0 @@
Source: libtest-simpleunit-perl
Section: perl
Priority: optional
Build-Depends: debhelper (>= 8)
Build-Depends-Indep: perl,
libdata-compare-perl,
libextutils-autoinstall-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
Uploaders: Martin Zobel-Helas <zobel@debian.org>,
gregor herrmann <gregoa@debian.org>
Standards-Version: 3.9.2
Homepage: http://search.cpan.org/dist/Test-SimpleUnit/
Vcs-Git: git://git.debian.org/pkg-perl/packages/libtest-simpleunit-perl.git
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-perl/packages/libtest-simpleunit-perl.git
Package: libtest-simpleunit-perl
Architecture: all
Depends: ${perl:Depends}, ${misc:Depends},
libdata-compare-perl
Description: simplified Perl unit-testing framework
Test::SimpleUnit is a simplified Perl unit-testing framework for creating
unit tests to be run either standalone or under Test::Harness.

31
debian/copyright vendored
View File

@ -1,31 +0,0 @@
Format-Specification: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?view=markup&pathrev=135
Maintainer: Michael Granger <ged@FaerieMUD.org>
Source: http://search.cpan.org/dist/Test-SimpleUnit/
Name: Test-SimpleUnit
Files: *
Copyright: 1999-2003, The FaerieMUD Consortium
License: Artistic or GPL-2+
Files: debian/*
Copyright: 2008, Martin Zobel-Helas <zobel@debian.org>
2009, Christoph Berg <myon@debian.org>
2011, Ansgar Burchardt <ansgar@debian.org>
2011, gregor herrmann <gregoa@debian.org>
License: Artistic or GPL-2+
License: Artistic
This program is free software; you can redistribute it and/or modify
it under the terms of the Artistic License, which comes with Perl.
.
On Debian systems, the complete text of the Artistic License can be
found in `/usr/share/common-licenses/Artistic'.
License: GPL-2+
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 2, or (at your option)
any later version.
.
On Debian systems, the complete text of version 2 of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL-2'.

View File

@ -1 +0,0 @@
README

View File

@ -1,16 +0,0 @@
Description: Fix m//and constuct, invalid with perl 5.18
Author: Damyan Ivanov <dmn@debian.org>
Origin: vendor
Bug-Debian: http://bugs.debian.org/711617
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -19,7 +19,7 @@
# ExtUtils::AutoInstall Bootstrap Code, version 5.
BEGIN{my$p='ExtUtils::AutoInstall';my$v=0.40;eval"use $p $v;1
"or do{my$e=$ENV{PERL_EXTUTILS_AUTOINSTALL};(!defined($e)||$e
-!~m/--(?:default|skip|testonly)/and-t STDIN or eval"use Ext".
+!~m/--(?:default|skip|testonly)/ and -t STDIN or eval"use Ext".
"Utils::MakeMaker;WriteMakefile('PREREQ_PM'=>{'$p',$v});1"and
exit)and print"==> $p $v required. Install it from CPAN? [Y".
"/n] "and<STDIN>!~/^n/i and print"*** Installing $p\n"and do{

View File

@ -1,53 +0,0 @@
Description: Adjust extended regexp to perl 5.14
Cf. http://search.cpan.org/~jesse/perl-5.14.0/pod/perldelta.pod#%28?^...%29_construct_signifies_default_modifiers
Origin: vendor
Bug: https://rt.cpan.org/Ticket/Display.html?id=72449
Bug-Debian: http://bugs.debian.org/636522
Forwarded: https://rt.cpan.org/Ticket/Display.html?id=72449
Author: gregor herrmann <gregoa@debian.org>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2011-11-15
--- a/t/10_asserts.t
+++ b/t/10_asserts.t
@@ -201,10 +201,17 @@
# assertExceptionMatches { 1 } 'any'
eval { assertExceptionMatches {1} qr{any} };
die "assertExceptionMatches unexpectedly succeeded" unless $@;
- die "Unexpected error message for assertExceptionMatches {1} qr{any}: $@ ",
- "(expected 'Expected an exception which matched /(?-xism:any)/, but none ",
- "was raised.')"
- unless "$@" =~ m{Expected an exception which matched \Q/(?-xism:any)/\E, but none was raised\.};
+ if ( $] >= 5.014 ) {
+ die "Unexpected error message for assertExceptionMatches {1} qr{any}: $@ ",
+ "(expected 'Expected an exception which matched /(?^:any)/, but none ",
+ "was raised.')"
+ unless "$@" =~ m{Expected an exception which matched \Q/(?^:any)/\E, but none was raised\.};
+ } else {
+ die "Unexpected error message for assertExceptionMatches {1} qr{any}: $@ ",
+ "(expected 'Expected an exception which matched /(?-xism:any)/, but none ",
+ "was raised.')"
+ unless "$@" =~ m{Expected an exception which matched \Q/(?-xism:any)/\E, but none was raised\.};
+ }
# assertExceptionMatches { 1 } 'any', $msg
eval { assertExceptionMatches {1} 'any', "Ack! No exception?"; };
@@ -307,9 +314,15 @@
undef $res;
# assertMatches( qr{\s+}, 1 )
- assertExceptionMatches {
- $res = assertMatches( qr{\s+}, 1 )
- } qr{Tested value '1' did not match wanted regex '\Q(?-xism:\s+)\E};
+ if ( $] >= 5.014 ) {
+ assertExceptionMatches {
+ $res = assertMatches( qr{\s+}, 1 )
+ } qr{Tested value '1' did not match wanted regex '\Q(?^:\s+)\E};
+ } else {
+ assertExceptionMatches {
+ $res = assertMatches( qr{\s+}, 1 )
+ } qr{Tested value '1' did not match wanted regex '\Q(?-xism:\s+)\E};
+ }
assertNot( $res );
undef $res;
},

View File

@ -1,3 +0,0 @@
perl_re.patch
spelling.patch
perl5.18-re-a-mod.patch

View File

@ -1,29 +0,0 @@
Description: minor spelling fix
Origin: vendor
Bug: https://rt.cpan.org/Ticket/Display.html?id=72450
Forwarded: https://rt.cpan.org/Ticket/Display.html?id=72450
Author: gregor herrmann <gregoa@debian.org>
Last-Update: 2011-11-15
--- a/README
+++ b/README
@@ -73,7 +73,7 @@
allows a test designer to change the setup function as the tests progress. See
the EXAMPLE section for an example of how to use this.
- If a test is preceeded by multiple new setup/teardown functions, the last one
+ If a test is preceded by multiple new setup/teardown functions, the last one
to be specified is kept, and any others are discarded after being executed
once. This allows one to specify one-time setup and/or teardown functions at a
given point of testing.
--- a/lib/Test/SimpleUnit.pm
+++ b/lib/Test/SimpleUnit.pm
@@ -171,7 +171,7 @@
allows a test designer to change the setup function as the tests progress. See
the L<EXAMPLE|"EXAMPLE"> section for an example of how to use this.
-If a test is preceeded by multiple new setup/teardown functions, the last one to
+If a test is preceded by multiple new setup/teardown functions, the last one to
be specified is kept, and any others are discarded after being executed
once. This allows one to specify one-time setup and/or teardown functions at a
given point of testing.

4
debian/rules vendored
View File

@ -1,4 +0,0 @@
#!/usr/bin/make -f
%:
dh $@

View File

@ -1 +0,0 @@
3.0 (quilt)

4
debian/watch vendored
View File

@ -1,4 +0,0 @@
# format version number, currently 3; this line is compulsory!
version=3
# URL to the package page followed by a regex to search
http://search.cpan.org/dist/Test-SimpleUnit/ .*/Test-SimpleUnit-v?(\d[\d.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1 @@
3bc4304d6974cfc1a4971fb425a2cf87696fbd27

View File

@ -1,34 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit (require)
# $Id: 00_require.t,v 1.2 2002/03/29 23:41:49 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; use vars qw{$LoadedOkay} }
END { print "1..1\nnot ok 1\n" unless $LoadedOkay; }
### Load up the test framework
require Test::SimpleUnit;
### Test suite (in the order they're run)
my @testSuite = (
{
name => 'Require',
test => sub {
$LoadedOkay = 1;
},
},
);
Test::SimpleUnit::runTests( @testSuite );

View File

@ -1,36 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit (import functions)
# $Id: 01_importAll.t,v 1.2 2002/03/29 23:41:49 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl t/01_import.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:functions};
sub genTest {
my $functionName = shift;
return {
name => $functionName,
test => sub {
no strict 'refs';
die "$functionName() was not imported" unless defined *{"main::${functionName}"}{CODE};
},
};
}
### Generate a test suite out of the list of exported functions for the
### 'functions' tag
my @testSuite = map { s{^&}{}; genTest $_ } @{$Test::SimpleUnit::EXPORT_TAGS{functions}};
Test::SimpleUnit::runTests( @testSuite );

View File

@ -1,36 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit (import functions)
# $Id: 02_importAsserts.t,v 1.3 2002/03/29 23:41:49 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl t/01_import.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:asserts};
sub genTest {
my $functionName = shift;
return {
name => $functionName,
test => sub {
no strict 'refs';
die "$functionName() was not imported" unless defined *{"main::${functionName}"}{CODE};
},
};
}
### Generate a test suite out of the list of exported functions for the
### 'functions' tag
my @testSuite = map { s{^&}{}; genTest $_ } @{$Test::SimpleUnit::EXPORT_TAGS{asserts}};
Test::SimpleUnit::runTests( @testSuite );

View File

@ -1,36 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit (import functions)
# $Id: 03_importTfuncs.t,v 1.2 2002/03/29 23:41:49 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl t/01_import.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:testFunctions};
sub genTest {
my $functionName = shift;
return {
name => $functionName,
test => sub {
no strict 'refs';
die "$functionName() was not imported" unless defined *{"main::${functionName}"}{CODE};
},
};
}
### Generate a test suite out of the list of exported functions for the
### 'functions' tag
my @testSuite = map { s{^&}{}; genTest $_ } @{$Test::SimpleUnit::EXPORT_TAGS{testFunctions}};
Test::SimpleUnit::runTests( @testSuite );

View File

@ -1,36 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit (import skip functions)
# $Id: 04_importSkips.t,v 1.2 2002/03/29 23:41:49 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl t/01_import.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:skips};
sub genTest {
my $functionName = shift;
return {
name => $functionName,
test => sub {
no strict 'refs';
die "$functionName() was not imported" unless defined *{"main::${functionName}"}{CODE};
},
};
}
### Generate a test suite out of the list of exported functions for the
### 'functions' tag
my @testSuite = map { s{^&}{}; genTest $_ } @{$Test::SimpleUnit::EXPORT_TAGS{skips}};
Test::SimpleUnit::runTests( @testSuite );

View File

@ -1,36 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit
# $Id: 05_importTestData.t,v 1.1 2003/01/15 20:46:44 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 05_importTestData.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:testdata};
sub genTest {
my $functionName = shift;
return {
name => $functionName,
test => sub {
no strict 'refs';
die "$functionName() was not imported" unless defined *{"main::${functionName}"}{CODE};
},
};
}
### Generate a test suite out of the list of exported functions for the
### 'functions' tag
my @testSuite = map { s{^&}{}; genTest $_ } @{$Test::SimpleUnit::EXPORT_TAGS{testdata}};
Test::SimpleUnit::runTests( @testSuite );

View File

@ -1,482 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit (import functions)
# $Id: 10_asserts.t,v 1.4 2002/04/08 18:50:24 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl t/01_import.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
# Packages for testing OO asserts
package ClassA;
sub new {return bless {}, $_[0]}
package ClassB;
use base qw{ClassA};
package ClassC;
use base qw{ClassB};
# Main testing package
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:asserts};
my @testSuite = (
# Test the basic assert() function
{
name => 'Assert',
test => sub {
# Assert( true )
eval { assert(1); };
die "Failed assert(1): $@" if $@;
# Assert( false )
eval { assert(0); };
die "assert(0) unexpectedly succeeded." unless $@;
die "Unexpected error message for assert(0): $@ (expected '0')"
unless "$@" =~ m{0};
# Assert( false ) with message
eval { assert(0, "message test") };
die "assert(0,msg) unexpectedly succeeded." unless $@;
die "Unexpected error message for assert(0): $@ (expected 'message test')"
unless "$@" =~ m{message test};
},
},
# Test assertNot()
{
name => 'AssertNot',
test => sub {
# assertNot( 0 )
eval { assertNot(0); };
die "Failed assertNot(0): $@" if $@;
# assertNot( "" )
eval { assertNot(""); };
die "Failed assertNot(\"\"): $@" if $@;
# assertNot( undef )
eval { assertNot(undef); };
die "Failed assertNot(undef): $@" if $@;
# assertNot( 1 )
eval { assertNot(1); };
die "assertNot(1) unexpectedly succeeded." unless $@;
die "Unexpected error message for assertNot(1): $@ (expected 'Expected a false value, got \"1\"')"
unless "$@" =~ m{Expected a false value, got '1'};
# AssertNot( false ) with message
eval { assertNot(1, "message test") };
die "assertNot(1,msg) unexpectedly succeeded." unless $@;
die "Unexpected error message for assertNot(0): $@ (expected 'message test')"
unless "$@" =~ m{message test};
},
},
# Test assertDefined()
{
name => 'AssertDefined',
test => sub {
# assertDefined( 0 )
eval { assertDefined(0); };
die "Failed assertDefined(0): $@" if $@;
# assertDefined( "" )
eval { assertDefined(""); };
die "Failed assertDefined(\"\"): $@" if $@;
# assertDefined( undef )
eval { assertDefined(undef); };
die "assertDefined(undef) unexpectedly succeeded." unless $@;
die "Unexpected error message for assertDefined(undef): $@ ",
"(expected 'Expected a defined value, got an undef')"
unless "$@" =~ m{Expected a defined value, got an undef};
# AssertDefined( undef ) with message
eval { assertDefined(undef, "message test") };
die "assertDefined(undef,msg) unexpectedly succeeded." unless $@;
die "Unexpected error message for assertDefined(undef,msg): $@ ",
"(expected 'message test')"
unless "$@" =~ m{message test};
},
},
# Test assertUndef()
{
name => 'AssertUndef',
test => sub {
# assertUndef( undef )
eval { assertUndef(undef); };
die "Failed assertUndef(undef): $@" if $@;
# assertUndef( undef )
eval { assertUndef(1); };
die "assertUndef(1) unexpectedly succeeded." unless $@;
die "Unexpected error message for assertUndef(1): $@ ",
"(expected 'Expected an undefined value, got '1'')"
unless "$@" =~ m{Expected an undefined value, got '1'};
# AssertUndef( undef ) with message
eval { assertUndef(1, "message test") };
die "assertUndef(1,msg) unexpectedly succeeded." unless $@;
die "Unexpected error message for assertUndef(1,msg): $@ ",
"(expected 'message test')"
unless "$@" =~ m{message test};
},
},
# Test assertException()
{
name => 'AssertException',
test => sub {
my $res;
# assertException { die "test" }
$res = eval { assertException {die "test"}; };
die "Failed assertException {die \"test\"}: $@" if $@;
assert( $res );
undef $res;
# assertException { 1 }
eval { assertException {1} };
die "assertException unexpectedly succeeded" unless $@;
die "Unexpected error message for assertException {1}: $@ ",
"(expected 'No exception raised.')"
unless "$@" =~ m{No exception raised\.};
# assertException { 1 }, $msg
eval { assertException {1} "Ack! No exception?"; };
die "assertException unexpectedly succeeded" unless $@;
die "Unexpected error message for assertException {1}: $@ ",
"(expected 'Ack! No exception?')"
unless "$@" =~ m{Ack! No exception\?};
},
},
# Test assertExceptionType()
{
name => 'AssertExceptionType',
test => sub {
# assertExceptionType { die "test" }
eval { assertExceptionType {die bless ["test"], 'test'} 'test'; };
die "Failed assertExceptionType {die bless [\"test\"], 'test'} 'test': $@" if $@;
# assertExceptionType { 1 }
eval { assertExceptionType {1} 'any' };
die "assertExceptionType unexpectedly succeeded" unless $@;
die "Unexpected error message for assertExceptionType {1} 'any': $@ ",
"(expected 'Expected an exception of type 'any', but none was raised. at ",
"blib/lib/Test/SimpleUnit.pm line...')"
unless "$@" =~ m{Expected an exception of type 'any', but none was raised\.};
# assertExceptionType { 1 }, $msg
eval { assertExceptionType {1} 'any', "Ack! No exception?"; };
die "assertExceptionType unexpectedly succeeded" unless $@;
die "Unexpected error message for assertExceptionType {1} 'any', \"Ack! No exception?\": $@ ",
"(expected 'Ack! No exception?')"
unless "$@" =~ m{Ack! No exception\?};
},
},
# Test assertExceptionMatch()
{
name => 'AssertExceptionMatches',
test => sub {
# Match a die()
eval { assertExceptionMatches {die "Just testing"} qr{test}i; };
die "Failed assertExceptionMatches {die \"Just testing\"} qr{test}i: $@" if $@;
# assertExceptionMatches { 1 } 'any'
eval { assertExceptionMatches {1} qr{any} };
die "assertExceptionMatches unexpectedly succeeded" unless $@;
die "Unexpected error message for assertExceptionMatches {1} qr{any}: $@ ",
"(expected 'Expected an exception which matched /(?-xism:any)/, but none ",
"was raised.')"
unless "$@" =~ m{Expected an exception which matched \Q/(?-xism:any)/\E, but none was raised\.};
# assertExceptionMatches { 1 } 'any', $msg
eval { assertExceptionMatches {1} 'any', "Ack! No exception?"; };
die "assertExceptionMatches unexpectedly succeeded" unless $@;
die "Unexpected error message for assertExceptionMatches {1} 'any', \"Ack! No exception?\": $@ ",
"(expected 'Ack! No exception?')"
unless "$@" =~ m{Ack! No exception\?};
},
},
# Test assertNoException()
{
name => 'AssertNoException',
test => sub {
my $res;
my $file = __FILE__;
my $line;
# assertNoException { 1 }
$res = eval { assertNoException {1}; };
die "Failed assertNoException {1}: $@" if $@;
assert( $res );
undef $res;
# assertNoException { die "test" }
$line = __LINE__ + 1;
eval { assertNoException {die "test"} };
die "assertNoException unexpectedly succeeded" unless $@;
die "Unexpected error message for assertNoException {die \"test\"}: $@ ",
"(expected 'Exception raised: test at $file line $line')"
unless "$@" =~ m{Exception raised: test at $file line $line};
# assertNoException { die "test" }, $msg
eval { assertNoException {die "test"} "Ack! Exception raised!"; };
die "assertNoException unexpectedly succeeded" unless $@;
die "Unexpected error message for assertNoException {die \"test\"}: $@ ",
"(expected 'Ack! Exception raised!')"
unless "$@" =~ m{Ack! Exception raised!};
},
},
# Test assertEquals()
{
name => 'AssertEquals',
test => sub {
my $res;
# assertEquals( 1, 1 )
assertNoException { $res = assertEquals( 1, 1 ) };
assert( $res );
undef $res;
# assertEquals( 1, "1" )
assertNoException { $res = assertEquals( 1, "1" ) };
assert( $res );
undef $res;
# assertEquals( "this", "this" )
assertNoException { $res = assertEquals( "this", "this" ) };
assert( $res );
undef $res;
# assertEquals( undef, undef )
assertNoException { $res = assertEquals( undef, undef ) };
assert( $res );
undef $res;
# assertEquals( 1, 2 )
assertExceptionMatches { $res = assertEquals(1, 2) } qr{Wanted '1', got '2' instead};
assertNot( $res );
undef $res;
# assertEquals( 1, 1.1 )
assertExceptionMatches { $res = assertEquals(1, 1.1) } qr{Wanted '1', got '1.1' instead};
assertNot( $res );
undef $res;
},
},
# Test assertMatches()
{
name => 'AssertMatches',
test => sub {
my $res;
# assertMatches( '\d+', 1 )
assertNoException { $res = assertMatches( '\d+', 1 ) };
assert( $res );
undef $res;
# assertMatches( qr{\d+}, 1 )
assertNoException { $res = assertMatches( qr{\d+}, 1 ) };
assert( $res );
undef $res;
# assertMatches( qr{\s+}, " 1" )
assertNoException { $res = assertMatches( qr{\s+}, " 1" ) };
assert( $res );
undef $res;
# assertMatches( qr{\s+}, 1 )
assertExceptionMatches {
$res = assertMatches( qr{\s+}, 1 )
} qr{Tested value '1' did not match wanted regex '\Q(?-xism:\s+)\E};
assertNot( $res );
undef $res;
},
},
# Test assertRef()
{
name => 'AssertRef',
test => sub {
my $res;
assertNoException { $res = assertRef('HASH', {}) };
assert( $res );
undef $res;
assertNoException { $res = assertRef('GLOB', \*STDIN) };
assert( $res );
undef $res;
assertNoException { $res = assertRef('ARRAY', []) };
assert( $res );
undef $res;
assertNoException { $res = assertRef('SCALAR', \"something") };
assert( $res );
undef $res;
assertNoException { $res = assertRef('ClassA', ClassA->new) };
assert( $res );
undef $res;
assertException { $res = assertRef('HASH', 'something') };
assertMatches( qr{Expected a HASH value, got a scalar}, $@ );
assertNot( $res );
undef $res;
assertException { $res = assertRef('HASH', undef) };
assertMatches( qr{Expected a HASH value, got a undefined value}, $@ );
assertNot( $res );
undef $res;
assertException { $res = assertRef('HASH', []) };
assertMatches( qr{Expected a HASH value, got a ARRAY}, $@ );
assertNot( $res );
undef $res;
assertException { $res = assertRef('ClassA', []) };
assertMatches( qr{Expected a ClassA value, got a ARRAY}, $@ );
assertNot( $res );
undef $res;
},
},
# Test assertInstanceOf()
{
name => 'AssertInstanceOf',
test => sub {
my ( $res, $aInstance, $bInstance, $cInstance );
$aInstance = ClassA->new;
$bInstance = ClassB->new;
$cInstance = ClassC->new;
# aInstance should be only a ClassA object...
assertException { assertInstanceOf('ClassB', $aInstance) };
assertMatches qr{Expected an instance of 'ClassB', got an instance of 'ClassA'}, $@;
assertException { assertInstanceOf('ClassC', $aInstance) };
assertMatches qr{Expected an instance of 'ClassC', got an instance of 'ClassA'}, $@;
assertNoException { assertInstanceOf('ClassA', $aInstance) };
# bInstance should be only a ClassB object
assertException { assertInstanceOf('ClassA', $bInstance) };
assertMatches qr{Expected an instance of 'ClassA', got an instance of 'ClassB'}, $@;
assertException { assertInstanceOf('ClassC', $bInstance) };
assertMatches qr{Expected an instance of 'ClassC', got an instance of 'ClassB'}, $@;
assertNoException { assertInstanceOf('ClassB', $bInstance) };
# cInstance should be only a ClassC object
assertException { assertInstanceOf('ClassA', $cInstance) };
assertMatches qr{Expected an instance of 'ClassA', got an instance of 'ClassC'}, $@;
assertException { assertInstanceOf('ClassB', $cInstance) };
assertMatches qr{Expected an instance of 'ClassB', got an instance of 'ClassC'}, $@;
assertNoException { assertInstanceOf('ClassC', $cInstance) };
# A simple scalar shouldn't even make the ->isa() test
assertException { assertInstanceOf('ClassA', "something") };
assertMatches( qr{Expected an instance of 'ClassA', got a non-object \Q('something')\E}, $@ );
# Neither should a plain (unblessed) reference
assertException { assertInstanceOf('ClassA', []) };
assertMatches( qr{Expected an instance of 'ClassA', got a non-object \('ARRAY\(0x\w+\)'\)}, $@ );
},
},
# Test assertKindOf()
{
name => 'AssertKindOf',
test => sub {
my ( $res, $aInstance, $bInstance, $cInstance );
$aInstance = ClassA->new;
$bInstance = ClassB->new;
$cInstance = ClassC->new;
# aInstance should be an ClassA object...
assertNoException { $res = assertKindOf('ClassA', $aInstance) };
assert( $res );
undef $res;
# bInstance should be both a ClassA and a ClassB object
assertNoException { $res = assertKindOf('ClassA', $bInstance) };
assert( $res );
undef $res;
assertNoException { $res = assertKindOf('ClassB', $bInstance) };
assert( $res );
undef $res;
# cInstance should be all three
assertNoException { $res = assertKindOf('ClassA', $cInstance) };
assert( $res );
undef $res;
assertNoException { $res = assertKindOf('ClassB', $cInstance) };
assert( $res );
undef $res;
assertNoException { $res = assertKindOf('ClassC', $cInstance) };
assert( $res );
undef $res;
# But aInstance should be neither a B nor a C
assertException { $res = assertKindOf('ClassB', $aInstance) };
assertMatches( qr{Expected an instance of 'ClassB' or a subclass, got an instance of 'ClassA'}, $@ );
assertNot( $res );
undef $res;
assertException { $res = assertKindOf('ClassC', $aInstance) };
assertMatches( qr{Expected an instance of 'ClassC' or a subclass, got an instance of 'ClassA'}, $@ );
assertNot( $res );
undef $res;
# Neither should bInstance be a C
assertException { $res = assertKindOf('ClassC', $bInstance) };
assertMatches( qr{Expected an instance of 'ClassC' or a subclass, got an instance of 'ClassB'}, $@ );
assertNot( $res );
undef $res;
# A simple scalar shouldn't even make the ->isa() test
assertException { $res = assertKindOf('ClassA', "something") };
assertMatches( qr{Expected an instance of 'ClassA' or a subclass, got a non-object \Q('something')\E}, $@ );
assertNot( $res );
undef $res;
# Neither should a plain (unblessed) reference
assertException { $res = assertKindOf('ClassA', []) };
assertMatches( qr{Expected an instance of 'ClassA' or a subclass, got a non-object \('ARRAY\(0x\w+\)'\)}, $@ );
assertNot( $res );
undef $res;
},
},
);
Test::SimpleUnit::runTests( @testSuite );

View File

@ -1,97 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit
# $Id: 11_skips.t,v 1.3 2002/04/15 19:54:35 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 05_skip.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:functions};
### Test suite (in the order they're run)
my @testSuite = (
{
name => 'Autoskip setting',
test => sub {
# Backwards compat
assertNoException { Test::SimpleUnit->AutoskipFailedSetup(1) };
assert Test::SimpleUnit::AutoskipFailedSetup();
assertNoException { Test::SimpleUnit::AutoskipFailedSetup(0) };
assertNot Test::SimpleUnit::AutoskipFailedSetup();
},
},
{
name => 'Skip one (no message)',
test => sub {
eval { skipOne };
assertInstanceOf 'SKIPONE', $@;
},
},
{
name => 'Skip one (with message)',
test => sub {
eval { skipOne "Testing" };
assertInstanceOf 'SKIPONE', $@;
assertEquals "Testing", ${$@};
},
},
{
name => 'Real skip one',
test => sub {
skipOne "Passed.";
fail "Test wasn't skipped.";
},
},
{
name => 'Skip all (no message)',
test => sub {
eval { skipAll };
assertInstanceOf 'SKIPALL', $@;
},
},
{
name => 'Skip all (with message)',
test => sub {
eval { skipAll "Testing" };
assertInstanceOf 'SKIPALL', $@;
assertEquals "Testing", ${$@};
},
},
{
name => 'Real skip all',
test => sub {
skipAll "Passed.";
fail "Immediate test body wasn't skipped by skipAll.";
},
},
{
name => 'Should be skipped',
test => sub {
fail "Following test body wasn't skipped by skipAll.";
},
},
);
runTests( @testSuite );

View File

@ -1,87 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit
# $Id: 12_testdata.t,v 1.1 2003/01/15 20:46:44 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 10_testdata.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:functions};
my (
$filename,
%testData,
);
### Test suite (in the order they're run)
my @testSuite = (
### Setup/Teardown functions
{
name => 'setup',
func => sub {
$filename = "12testdata.$$";
%testData = (
some => 'data',
for => "testing",
complex => [qw{an arrayref }],
hoh => {
more => 'keys',
and => 'vals',
another => {},
},
);
},
},
{
name => 'teardown',
func => sub {
$filename = '';
%testData = ();
},
},
### Save the test data
{
name => 'savedata',
test => sub {
Test::SimpleUnit::Debug( 1 );
assertNoException {
saveTestData( $filename, %testData );
};
assert -f $filename;
},
},
### Load the test data back up and compare it with the original
{
name => 'loaddata',
test => sub {
my $datahash;
Test::SimpleUnit::Debug( 1 );
assertNoException {
$datahash = loadTestData( $filename );
};
assertRef 'HASH', $datahash;
assertEquals \%testData, $datahash;
},
},
);
runTests( @testSuite );

View File

@ -1,230 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit
# $Id: 15_setupteardown.t,v 1.4 2003/01/15 20:48:07 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 07_setupteardown.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:functions};
#Test::SimpleUnit::Debug( 1 );
my %setupRuns = ();
my %teardownRuns = ();
### Test suite (in the order they're run)
my @testSuite = (
### Plain setup
# First setup function
{
name => 'setup',
func => sub {
$setupRuns{first}++;
},
},
# Test to make sure the setup ran
{
name => 'test first setup',
test => sub {
assertEquals 1, $setupRuns{first};
},
},
### Overridden setup
# Override the first setup with this, the second one
{
name => 'setup',
test => sub {
$setupRuns{second}++;
},
},
# Test to be sure the two setup functions have run exactly once each
{
name => 'test second setup',
test => sub {
assertEquals 1, $setupRuns{first};
assertEquals 1, $setupRuns{second};
},
},
# Test to be sure the first setup has still only run once, but that the
# second has now run twice
{
name => 'test second setup again',
test => sub {
assertEquals 1, $setupRuns{first};
assertEquals 2, $setupRuns{second};
},
},
### Assure all setups run at least once
# Override the second setup with this, the third one, but then clobber this
# one with a fourth. This one should only be run once.
{
name => 'setup',
test => sub {
$setupRuns{third}++;
},
},
# Override the third setup with this, the fourth one.
{
name => 'setup',
test => sub {
$setupRuns{fourth}++;
},
},
# Test to be sure the first has now run once, the second twice, the third
# once, and the fourth one once.
{
name => 'test third and fourth setup (1st run)',
test => sub {
assertEquals 1, $setupRuns{first};
assertEquals 2, $setupRuns{second};
assertEquals 1, $setupRuns{third};
assertEquals 1, $setupRuns{fourth};
},
},
# Test again to be sure the first has now run once, the second twice, the
# third still only once, and the fourth two times.
{
name => 'test third and fourth setup (2nd run)',
test => sub {
assertEquals 1, $setupRuns{first};
assertEquals 2, $setupRuns{second};
assertEquals 1, $setupRuns{third};
assertEquals 2, $setupRuns{fourth};
},
},
### Now do the same thing for teardown functions
# First teardown function
{
name => 'teardown',
func => sub {
$teardownRuns{first}++;
},
},
# Test to make sure the teardown hasn't yet run, but will in the second test.
{
name => 'test first teardown (pre-run)',
test => sub {
assertNot exists $teardownRuns{first};
},
},
# Test to make sure the teardown hasn't yet run, but will in the second test.
{
name => 'test first teardown (post-run)',
test => sub {
assertEquals 1, $teardownRuns{first};
},
},
### Overridden teardown
# Override the first teardown with this, the second one
{
name => 'teardown',
test => sub {
$teardownRuns{second}++;
},
},
# Test the second teardown, pre-run
{
name => 'test second teardown',
test => sub {
assertEquals 2, $teardownRuns{first};
assertNot exists $teardownRuns{second};
},
},
# Test the second teardown, post-run
{
name => 'test second teardown',
test => sub {
assertEquals 2, $teardownRuns{first};
assertEquals 1, $teardownRuns{second};
},
},
### Assure all teardowns run at least once
# Override the second teardown with this, the third one, but then clobber this
# one with a fourth. This one should then only be run once.
{
name => 'teardown',
test => sub {
$teardownRuns{third}++;
},
},
# Override the third teardown with this, the fourth one.
{
name => 'teardown',
test => sub {
$teardownRuns{fourth}++;
},
},
# Bogus test for the third and fourth teardown, pre-run
{
name => 'test third and fourth teardown (pre-run)',
test => sub { 1 },
},
# Test to be sure the first has now run once, the second twice, and the
# third and fourth once each.
{
name => 'test third and fourth teardown (1st run)',
test => sub {
assertEquals 2, $teardownRuns{first};
assertEquals 2, $teardownRuns{second};
assertEquals 1, $teardownRuns{third};
assertEquals 1, $teardownRuns{fourth};
},
},
# Now make sure the third test has still only run once, but the fourth
# should have run a second time.
{
name => 'test third and fourth teardown (2nd run)',
test => sub {
assertEquals 2, $teardownRuns{first};
assertEquals 2, $teardownRuns{second};
assertEquals 1, $teardownRuns{third};
assertEquals 2, $teardownRuns{fourth};
},
},
);
runTests( @testSuite );

View File

@ -1,40 +0,0 @@
#!/usr/bin/perl
#
# Test script for Test::SimpleUnit
# $Id: 20_emptysuite.t,v 1.1 2002/04/23 22:01:34 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 08_emptysuite.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:functions};
### Test an empty test suite -- used to fail because the setup and teardown
### tests are spliced out. Should now just skip gracefully.
my @testSuite = (
{
name => 'setup',
func => sub {
},
},
{
name => 'teardown',
func => sub {
},
},
);
runTests( @testSuite );

View File

@ -1,60 +0,0 @@
#!/usr/bin/perl
#
# Test script for fixed bugs that don't need their own suite
# $Id: 30_bugs.t,v 1.1 2002/05/14 02:59:02 deveiant Exp $
#
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 09_bugs.t'
#
# Please do not commit any changes you make to the module without a
# successful 'make test'!
#
package main;
use strict;
BEGIN { $| = 1; }
### Load up the test framework
use Test::SimpleUnit qw{:functions};
use IO::Handle;
use IO::File;
#$Test::SimpleUnit::Debug = 1;
# Get a reference to stdout so we can switch it off for recursive tests
my $Stdout = IO::Handle->new_from_fd( fileno STDOUT, 'w' )
or die "Ack: STDOUT doesn't exist";
my $DummyIO = new IO::File '/dev/null', 'w';
### Test suite (in the order they're run)
my @testSuite = (
# Can't use string ("") as a subroutine ref while "strict refs" in use at
# /usr/lib/perl5/site_perl/5.6.1/Test/SimpleUnit.pm line 665.
{
name => 'Missing "test" key-val pair',
test => sub {
assertNoException {
Test::SimpleUnit::OutputHandle( $DummyIO );
runTests({ name => 'subtest' });
Test::SimpleUnit::OutputHandle();
};
},
},
# Error related to the above one: Test isn't a coderef.
{
name => 'non-coderef value in "test" key-val pair',
test => sub {
assertNoException {
Test::SimpleUnit::OutputHandle( $DummyIO );
runTests({ name => 'subtest', test => {} });
Test::SimpleUnit::OutputHandle();
};
},
},
);
runTests( @testSuite );