From: Michael Stapelberg Date: Sat, 17 Apr 2010 20:49:26 +0000 (+0200) Subject: less boilerplate by using Test::Kit and -It/lib in Makefile X-Git-Tag: tree-pr1~229 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=206e1ed0415b737df5fdefa20fe088e024da5679;p=i3%2Fi3 less boilerplate by using Test::Kit and -It/lib in Makefile --- diff --git a/testcases/Makefile b/testcases/Makefile index 1e7a9191..0e78f6b2 100644 --- a/testcases/Makefile +++ b/testcases/Makefile @@ -1,4 +1,7 @@ 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 + +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* diff --git a/testcases/t/01-tile.t b/testcases/t/01-tile.t index a5aa143d..b40eae24 100644 --- a/testcases/t/01-tile.t +++ b/testcases/t/01-tile.t @@ -1,9 +1,7 @@ #!perl -use Test::More tests => 4; -use Test::Deep; +use i3test tests => 4; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); BEGIN { diff --git a/testcases/t/02-fullscreen.t b/testcases/t/02-fullscreen.t index cf542ee7..98194ba2 100644 --- a/testcases/t/02-fullscreen.t +++ b/testcases/t/02-fullscreen.t @@ -1,20 +1,11 @@ #!perl # vim:ts=4:sw=4:expandtab -use Test::More tests => 24; -use Test::Deep; +use i3test tests => 24; 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 v5.10; - -# We use relatively long sleeps (1/4 second) to make sure the window manager -# reacted. use Time::HiRes qw(sleep); +use v5.10; my $i3 = i3("/tmp/nestedcons"); diff --git a/testcases/t/03-unmanaged.t b/testcases/t/03-unmanaged.t index 3cd9833a..3e8cdfc1 100644 --- a/testcases/t/03-unmanaged.t +++ b/testcases/t/03-unmanaged.t @@ -1,10 +1,8 @@ #!perl # vim:ts=4:sw=4:expandtab -use Test::More tests => 5; -use Test::Deep; +use i3test tests => 5; use X11::XCB qw(:all); -use Data::Dumper; BEGIN { use_ok('X11::XCB::Window'); diff --git a/testcases/t/04-floating.t b/testcases/t/04-floating.t index 9049b9dc..4463bcbe 100644 --- a/testcases/t/04-floating.t +++ b/testcases/t/04-floating.t @@ -1,14 +1,9 @@ #!perl # vim:ts=4:sw=4:expandtab -use Test::More tests => 10; -use Test::Deep; +use i3test tests => 10; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; BEGIN { use_ok('X11::XCB::Window'); diff --git a/testcases/t/05-ipc.t b/testcases/t/05-ipc.t index 8f427938..13ebc4b2 100644 --- a/testcases/t/05-ipc.t +++ b/testcases/t/05-ipc.t @@ -1,18 +1,11 @@ #!perl # vim:ts=4:sw=4:expandtab -use Test::More tests => 3; -use Test::Deep; +use i3test tests => 3; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; 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'); } diff --git a/testcases/t/06-focus.t b/testcases/t/06-focus.t index a95e0e40..b91f8cc5 100644 --- a/testcases/t/06-focus.t +++ b/testcases/t/06-focus.t @@ -4,15 +4,9 @@ # the workspace to be empty). # TODO: skip it by default? -use Test::More tests => 13; -use Test::Deep; +use i3test tests => 13; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; BEGIN { use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); diff --git a/testcases/t/07-move.t b/testcases/t/07-move.t index efd3df15..c852d001 100644 --- a/testcases/t/07-move.t +++ b/testcases/t/07-move.t @@ -4,15 +4,9 @@ # the workspace to be empty). # TODO: skip it by default? -use Test::More tests => 8; -use Test::Deep; +use i3test tests => 8; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; BEGIN { use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); diff --git a/testcases/t/08-focus-stack.t b/testcases/t/08-focus-stack.t index 4ae92407..9dd7726f 100644 --- a/testcases/t/08-focus-stack.t +++ b/testcases/t/08-focus-stack.t @@ -3,15 +3,9 @@ # Checks if the focus is correctly restored, when creating a floating client # over an unfocused tiling client and destroying the floating one again. -use Test::More tests => 4; -use Test::Deep; +use i3test tests => 4; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; BEGIN { use_ok('X11::XCB::Window') or BAIL_OUT('Could not load X11::XCB::Window'); diff --git a/testcases/t/09-stacking.t b/testcases/t/09-stacking.t index 59d2e6f4..c809be9e 100644 --- a/testcases/t/09-stacking.t +++ b/testcases/t/09-stacking.t @@ -4,15 +4,9 @@ # the workspace to be empty). # TODO: skip it by default? -use Test::More tests => 22; -use Test::Deep; +use i3test tests => 22; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; BEGIN { use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); diff --git a/testcases/t/10-dock.t b/testcases/t/10-dock.t index 52063131..83816296 100644 --- a/testcases/t/10-dock.t +++ b/testcases/t/10-dock.t @@ -1,14 +1,9 @@ #!perl # vim:ts=4:sw=4:expandtab -use Test::More tests => 2; -use Test::Deep; +use i3test tests => 2; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; use List::Util qw(first); BEGIN { diff --git a/testcases/t/11-goto.t b/testcases/t/11-goto.t index 9b06112b..ea17b406 100644 --- a/testcases/t/11-goto.t +++ b/testcases/t/11-goto.t @@ -4,16 +4,10 @@ # the workspace to be empty). # TODO: skip it by default? -use Test::More tests => 7; -use Test::Deep; +use i3test tests => 7; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; use Digest::SHA1 qw(sha1_base64); -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; BEGIN { use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); diff --git a/testcases/t/12-floating-resize.t b/testcases/t/12-floating-resize.t index 74f66535..0d309c68 100644 --- a/testcases/t/12-floating-resize.t +++ b/testcases/t/12-floating-resize.t @@ -4,16 +4,9 @@ # the workspace to be empty). # TODO: skip it by default? -use Test::More tests => 15; -use Test::Deep; +use i3test tests => 15; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use Digest::SHA1 qw(sha1_base64); -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; BEGIN { use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); diff --git a/testcases/t/13-urgent.t b/testcases/t/13-urgent.t index 5fce6aee..cf847456 100644 --- a/testcases/t/13-urgent.t +++ b/testcases/t/13-urgent.t @@ -4,16 +4,9 @@ # the workspace to be empty). # TODO: skip it by default? -use Test::More tests => 7; -use Test::Deep; +use i3test tests => 7; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use Digest::SHA1 qw(sha1_base64); -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; BEGIN { use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); diff --git a/testcases/t/14-client-leader.t b/testcases/t/14-client-leader.t index b9160131..bf07b927 100644 --- a/testcases/t/14-client-leader.t +++ b/testcases/t/14-client-leader.t @@ -4,16 +4,9 @@ # the workspace to be empty). # TODO: skip it by default? -use Test::More tests => 3; -use Test::Deep; +use i3test tests => 3; use X11::XCB qw(:all); -use Data::Dumper; use Time::HiRes qw(sleep); -use FindBin; -use Digest::SHA1 qw(sha1_base64); -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; BEGIN { use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); diff --git a/testcases/t/15-ipc-workspaces.t b/testcases/t/15-ipc-workspaces.t index 4e2c0e8d..3cf3e562 100644 --- a/testcases/t/15-ipc-workspaces.t +++ b/testcases/t/15-ipc-workspaces.t @@ -1,13 +1,8 @@ #!perl # vim:ts=4:sw=4:expandtab -use Test::More tests => 3; -use Test::Exception; +use i3test tests => 2; use List::MoreUtils qw(all); -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; my $i3 = i3; diff --git a/testcases/t/16-nestedcons.t b/testcases/t/16-nestedcons.t index 39087e85..3159929b 100644 --- a/testcases/t/16-nestedcons.t +++ b/testcases/t/16-nestedcons.t @@ -1,11 +1,8 @@ #!perl # vim:ts=4:sw=4:expandtab -use Test::More tests => 8; -use Test::Deep; +use i3test tests => 8; use List::MoreUtils qw(all none); -use Data::Dumper; -use AnyEvent::I3; my $i3 = i3("/tmp/nestedcons"); diff --git a/testcases/t/17-workspace.t b/testcases/t/17-workspace.t index 227b754d..c350d9d9 100644 --- a/testcases/t/17-workspace.t +++ b/testcases/t/17-workspace.t @@ -4,11 +4,7 @@ # Tests whether we can switch to a non-existant workspace # (necessary for further tests) # -use Test::More tests => 2; -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; +use i3test tests => 2; use v5.10; my $i3 = i3("/tmp/nestedcons"); diff --git a/testcases/t/18-openkill.t b/testcases/t/18-openkill.t index 935523d4..1d9d705d 100644 --- a/testcases/t/18-openkill.t +++ b/testcases/t/18-openkill.t @@ -3,12 +3,7 @@ # # Tests whether opening an empty container and killing it again works # -use Test::More tests => 6; -use Data::Dumper; -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; +use i3test tests => 6; use v5.10; my $i3 = i3("/tmp/nestedcons"); diff --git a/testcases/t/19-match.t b/testcases/t/19-match.t index 9babb074..b5c01977 100644 --- a/testcases/t/19-match.t +++ b/testcases/t/19-match.t @@ -3,12 +3,7 @@ # # Tests all kinds of matching methods # -use Test::More tests => 4; -use Data::Dumper; -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; +use i3test tests => 4; use X11::XCB qw(:all); use v5.10; diff --git a/testcases/t/20-multiple-cmds.t b/testcases/t/20-multiple-cmds.t index 361bb06b..9ee5b41c 100644 --- a/testcases/t/20-multiple-cmds.t +++ b/testcases/t/20-multiple-cmds.t @@ -3,12 +3,7 @@ # # Tests multiple commands (using ';') and multiple operations (using ',') # -use Test::More tests => 24; -use Data::Dumper; -use FindBin; -use lib "$FindBin::Bin/lib"; -use i3test; -use AnyEvent::I3; +use i3test tests => 24; use X11::XCB qw(:all); use v5.10; diff --git a/testcases/t/lib/i3test.pm b/testcases/t/lib/i3test.pm index 684e8118..68455bd2 100644 --- a/testcases/t/lib/i3test.pm +++ b/testcases/t/lib/i3test.pm @@ -1,12 +1,22 @@ package i3test; # 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 X11::XCB::Rect; use X11::XCB::Window; use X11::XCB qw(:all); use AnyEvent::I3; -use Exporter qw(import); +# Test::Kit already uses Exporter +#use Exporter qw(import); use base 'Exporter'; our @EXPORT = qw(get_workspace_names get_unused_workspace get_ws_content);