aboutsummaryrefslogtreecommitdiffstats
path: root/testing/t
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-03-04 04:12:47 +0000
committerTom Feist <shabble@metavore.org>2011-03-04 04:12:47 +0000
commit7ec10e516a04a05a85cb82b30a8f9982f13c6c90 (patch)
tree98e01316dbd57e4b0debb2d5d444b19cef5bf026 /testing/t
parenttesting: cleaned up a lot of the testing logic. Subtests are now reported at ... (diff)
downloadirssi-scripts-7ec10e516a04a05a85cb82b30a8f9982f13c6c90.tar.gz
irssi-scripts-7ec10e516a04a05a85cb82b30a8f9982f13c6c90.zip
working with TAP::Harness
Diffstat (limited to '')
-rwxr-xr-xtesting/t/002-init.t2
-rwxr-xr-xtesting/test.pl46
-rwxr-xr-xtesting/test2.pl38
-rwxr-xr-xtesting/tests/001-basic.t (renamed from testing/test3.pl)7
4 files changed, 16 insertions, 77 deletions
diff --git a/testing/t/002-init.t b/testing/t/002-init.t
index df61e1e..b688f9f 100755
--- a/testing/t/002-init.t
+++ b/testing/t/002-init.t
@@ -19,7 +19,7 @@ if (-f $test->logfile) {
ok(unlink $test->logfile, 'deleted old logfile');
}
-my $drv = $test->_driver;
+my $drv = $test->driver;
isa_ok($drv, 'Test::Irssi::Driver', 'driver created ok');
diag "Starting POE session";
diff --git a/testing/test.pl b/testing/test.pl
index ea90e1c..bf01530 100755
--- a/testing/test.pl
+++ b/testing/test.pl
@@ -4,42 +4,14 @@ use strict;
use warnings;
use feature qw/say/;
+#use lib 'blib/lib';
-use lib 'blib/lib';
+use TAP::Harness;
+my $harness = TAP::Harness->new({ verbosity => 1,
+ lib => 'blib/lib',
+ color => 1,
+ });
-use Test::Irssi;
-
-my $tester = Test::Irssi->new
- (irssi_binary => "/opt/stow/repo/irssi-debug/bin/irssi",
- irssi_homedir => $ENV{HOME} . "/projects/tmp/test/irssi-debug");
-
-say "Created test instance";
-
-
-
-my $test = $tester->new_test('test1');
-
-$test->add_input_sequence("/echo Hello cats\n");
-$test->add_delay(20);
-$test->add_input_sequence("/echo Hello Again\n");
-for (1..10) {
- $test->add_input_sequence($_);
- $test->add_delay(0.2);
-}
-$test->add_evaluation_function(sub { 1 }, 'this should succeed');
-$test->add_pattern_match(qr/2345/, 'prompt', 'prompt contains numbers');
-
-#$test->add_input_sequence("This is\x0acursor movement\x0a");
-# $test->add_delay(5);
-$test->add_input_sequence("\n");
-
-$test->add_input_sequence("/clear\n");
-
-
-my $test2 = $tester->new_test("Test2");
-$test2->add_input_sequence("hello from twooooooo");
-$test2->add_delay(5);
-$test2->add_pattern_match(qr/hello/, 'prompt', 'hello');
-
-
-$tester->run;
+my @tests = glob($ARGV[0]);
+say "Tests: " . join (", ", @tests);
+$harness->runtests(@tests);
diff --git a/testing/test2.pl b/testing/test2.pl
deleted file mode 100755
index 661e66b..0000000
--- a/testing/test2.pl
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-
-use feature qw/say/;
-
-use lib 'blib/lib';
-
-use Test::Irssi;
-
-my $tester = Test::Irssi->new
- (irssi_binary => "/opt/stow/repo/irssi-debug/bin/irssi",
- irssi_homedir => $ENV{HOME} . "/projects/tmp/test/irssi-debug");
-
-my $test = $tester->new_test('test2');
-$test->add_input_sequence("/echo 'Window one'\n");
-$test->add_delay(5);
-$test->add_input_sequence("/window new hide\n");
-$test->add_input_sequence("/win 2\n");
-for (1..10) {
- $test->add_input_sequence($_);
- $test->add_delay(0.2);
-}
-$test->add_input_sequence("\x01/echo \x05\n");
-$test->add_delay(10);
-$test->add_input_sequence("\x1b\x31");
-$test->add_delay(10);
-#$test->add_input_sequence("This is\x0acursor movement\x0a");
-# $test->add_delay(5);
-
-
-
-# $test->add_expected_output("Hello");
-
-
-
-$tester->run;
diff --git a/testing/test3.pl b/testing/tests/001-basic.t
index 57be5ed..4373855 100755
--- a/testing/test3.pl
+++ b/testing/tests/001-basic.t
@@ -5,7 +5,7 @@ use warnings;
use feature qw/say/;
-use lib 'blib/lib';
+#use lib 'blib/lib';
use Test::Irssi;
@@ -14,8 +14,10 @@ my $tester = Test::Irssi->new
irssi_homedir => $ENV{HOME} . "/projects/tmp/test/irssi-debug");
say "Created test instance";
+$tester->run_headless(1);
my $test = $tester->new_test('test1');
+$test->description("simple echo tests");
$test->add_input_sequence("/echo Hello cats\n");
$test->add_delay(1);
@@ -26,6 +28,8 @@ $test->add_pattern_match(qw/longfdajkfd/, 'prompt', 'prompt contains hello');
my $test2 = $tester->new_test('test2');
+$test2->description("cursor movement and deletion");
+
$test2->add_delay(2);
$test2->add_input_sequence("\x01");
$test2->add_delay(0.1);
@@ -36,6 +40,7 @@ $test2->add_delay(0.1);
$test2->add_input_sequence("/echo moo\n");
my $quit = $tester->new_test('quit');
+$quit->description('quitting');
$quit->add_input_sequence("/quit\n");
# for (1..10) {