less boilerplate by using Test::Kit and -It/lib in Makefile

This commit is contained in:
Michael Stapelberg 2010-04-17 22:49:26 +02:00
parent a2e3bb1cdd
commit 206e1ed041
22 changed files with 36 additions and 131 deletions

View File

@ -1,4 +1,7 @@
test: test:
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(1)" t/16*.t PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(1)" -It/lib t/03* t/05*
all: test all: test
testfull:
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(1)" -It/lib t/01* t/02* t/03* t/05* t/17* t/18* t/19* t/20*

View File

@ -1,9 +1,7 @@
#!perl #!perl
use Test::More tests => 4; use i3test tests => 4;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
BEGIN { BEGIN {

View File

@ -1,20 +1,11 @@
#!perl #!perl
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
use Test::More tests => 24; use i3test tests => 24;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
use List::Util qw(first); use List::Util qw(first);
use v5.10;
# We use relatively long sleeps (1/4 second) to make sure the window manager
# reacted.
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use v5.10;
my $i3 = i3("/tmp/nestedcons"); my $i3 = i3("/tmp/nestedcons");

View File

@ -1,10 +1,8 @@
#!perl #!perl
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
use Test::More tests => 5; use i3test tests => 5;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
BEGIN { BEGIN {
use_ok('X11::XCB::Window'); use_ok('X11::XCB::Window');

View File

@ -1,14 +1,9 @@
#!perl #!perl
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
use Test::More tests => 10; use i3test tests => 10;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
BEGIN { BEGIN {
use_ok('X11::XCB::Window'); use_ok('X11::XCB::Window');

View File

@ -1,18 +1,11 @@
#!perl #!perl
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
use Test::More tests => 3; use i3test tests => 3;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
BEGIN { BEGIN {
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
} }

View File

@ -4,15 +4,9 @@
# the workspace to be empty). # the workspace to be empty).
# TODO: skip it by default? # TODO: skip it by default?
use Test::More tests => 13; use i3test tests => 13;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
BEGIN { BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');

View File

@ -4,15 +4,9 @@
# the workspace to be empty). # the workspace to be empty).
# TODO: skip it by default? # TODO: skip it by default?
use Test::More tests => 8; use i3test tests => 8;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
BEGIN { BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');

View File

@ -3,15 +3,9 @@
# Checks if the focus is correctly restored, when creating a floating client # Checks if the focus is correctly restored, when creating a floating client
# over an unfocused tiling client and destroying the floating one again. # over an unfocused tiling client and destroying the floating one again.
use Test::More tests => 4; use i3test tests => 4;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
BEGIN { BEGIN {
use_ok('X11::XCB::Window') or BAIL_OUT('Could not load X11::XCB::Window'); use_ok('X11::XCB::Window') or BAIL_OUT('Could not load X11::XCB::Window');

View File

@ -4,15 +4,9 @@
# the workspace to be empty). # the workspace to be empty).
# TODO: skip it by default? # TODO: skip it by default?
use Test::More tests => 22; use i3test tests => 22;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
BEGIN { BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');

View File

@ -1,14 +1,9 @@
#!perl #!perl
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
use Test::More tests => 2; use i3test tests => 2;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use List::Util qw(first); use List::Util qw(first);
BEGIN { BEGIN {

View File

@ -4,16 +4,10 @@
# the workspace to be empty). # the workspace to be empty).
# TODO: skip it by default? # TODO: skip it by default?
use Test::More tests => 7; use i3test tests => 7;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use Digest::SHA1 qw(sha1_base64); use Digest::SHA1 qw(sha1_base64);
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
BEGIN { BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');

View File

@ -4,16 +4,9 @@
# the workspace to be empty). # the workspace to be empty).
# TODO: skip it by default? # TODO: skip it by default?
use Test::More tests => 15; use i3test tests => 15;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use Digest::SHA1 qw(sha1_base64);
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
BEGIN { BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');

View File

@ -4,16 +4,9 @@
# the workspace to be empty). # the workspace to be empty).
# TODO: skip it by default? # TODO: skip it by default?
use Test::More tests => 7; use i3test tests => 7;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use Digest::SHA1 qw(sha1_base64);
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
BEGIN { BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');

View File

@ -4,16 +4,9 @@
# the workspace to be empty). # the workspace to be empty).
# TODO: skip it by default? # TODO: skip it by default?
use Test::More tests => 3; use i3test tests => 3;
use Test::Deep;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use Data::Dumper;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use FindBin;
use Digest::SHA1 qw(sha1_base64);
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
BEGIN { BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');

View File

@ -1,13 +1,8 @@
#!perl #!perl
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
use Test::More tests => 3; use i3test tests => 2;
use Test::Exception;
use List::MoreUtils qw(all); use List::MoreUtils qw(all);
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
my $i3 = i3; my $i3 = i3;

View File

@ -1,11 +1,8 @@
#!perl #!perl
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
use Test::More tests => 8; use i3test tests => 8;
use Test::Deep;
use List::MoreUtils qw(all none); use List::MoreUtils qw(all none);
use Data::Dumper;
use AnyEvent::I3;
my $i3 = i3("/tmp/nestedcons"); my $i3 = i3("/tmp/nestedcons");

View File

@ -4,11 +4,7 @@
# Tests whether we can switch to a non-existant workspace # Tests whether we can switch to a non-existant workspace
# (necessary for further tests) # (necessary for further tests)
# #
use Test::More tests => 2; use i3test tests => 2;
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
use v5.10; use v5.10;
my $i3 = i3("/tmp/nestedcons"); my $i3 = i3("/tmp/nestedcons");

View File

@ -3,12 +3,7 @@
# #
# Tests whether opening an empty container and killing it again works # Tests whether opening an empty container and killing it again works
# #
use Test::More tests => 6; use i3test tests => 6;
use Data::Dumper;
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
use v5.10; use v5.10;
my $i3 = i3("/tmp/nestedcons"); my $i3 = i3("/tmp/nestedcons");

View File

@ -3,12 +3,7 @@
# #
# Tests all kinds of matching methods # Tests all kinds of matching methods
# #
use Test::More tests => 4; use i3test tests => 4;
use Data::Dumper;
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use v5.10; use v5.10;

View File

@ -3,12 +3,7 @@
# #
# Tests multiple commands (using ';') and multiple operations (using ',') # Tests multiple commands (using ';') and multiple operations (using ',')
# #
use Test::More tests => 24; use i3test tests => 24;
use Data::Dumper;
use FindBin;
use lib "$FindBin::Bin/lib";
use i3test;
use AnyEvent::I3;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use v5.10; use v5.10;

View File

@ -1,12 +1,22 @@
package i3test; package i3test;
# vim:ts=4:sw=4:expandtab # vim:ts=4:sw=4:expandtab
use Test::Kit qw(
Test::Exception
Data::Dumper
AnyEvent::I3
),
'Test::Deep' => {
exclude => [ qw(all) ],
};
use File::Temp qw(tmpnam); use File::Temp qw(tmpnam);
use X11::XCB::Rect; use X11::XCB::Rect;
use X11::XCB::Window; use X11::XCB::Window;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use AnyEvent::I3; use AnyEvent::I3;
use Exporter qw(import); # Test::Kit already uses Exporter
#use Exporter qw(import);
use base 'Exporter'; use base 'Exporter';
our @EXPORT = qw(get_workspace_names get_unused_workspace get_ws_content); our @EXPORT = qw(get_workspace_names get_unused_workspace get_ws_content);