aboutsummaryrefslogtreecommitdiffstats
path: root/testing/t
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-03-04 05:19:41 +0000
committerTom Feist <shabble@metavore.org>2011-03-04 05:19:41 +0000
commit41c95c731cae9d39468acce966ed3e14e39191cf (patch)
treeeef5ed6865c7d2cd6b4a79143c010570d754868b /testing/t
parentworking with TAP::Harness (diff)
downloadirssi-scripts-41c95c731cae9d39468acce966ed3e14e39191cf.tar.gz
irssi-scripts-41c95c731cae9d39468acce966ed3e14e39191cf.zip
testing: mostly working TAP output, test.pl uses TAP::Harness to run tests. now
we just need some tests.
Diffstat (limited to '')
-rwxr-xr-xtesting/tests/001-basic.t28
-rwxr-xr-xtesting/tests/002-cursor-test.t29
2 files changed, 42 insertions, 15 deletions
diff --git a/testing/tests/001-basic.t b/testing/tests/001-basic.t
index 4373855..60578d8 100755
--- a/testing/tests/001-basic.t
+++ b/testing/tests/001-basic.t
@@ -4,17 +4,19 @@ 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");
-say "Created test instance";
-$tester->run_headless(1);
+if (exists $ENV{IRSSI_TEST_HEADLESS} and $ENV{IRSSI_TEST_NOHEADLESS} == 1) {
+ $tester->run_headless(0);
+ $tester->generate_tap(0);
+} else {
+ $tester->run_headless(1);
+ $tester->generate_tap(1);
+}
my $test = $tester->new_test('test1');
$test->description("simple echo tests");
@@ -22,15 +24,17 @@ $test->description("simple echo tests");
$test->add_input_sequence("/echo Hello cats\n");
$test->add_delay(1);
$test->add_input_sequence("/echo Hello Again\n");
-$test->add_input_sequence("this is a lang test");
-$test->add_pattern_match(qw/long/, 'prompt', 'prompt contains hello');
-$test->add_pattern_match(qw/longfdajkfd/, 'prompt', 'prompt contains hello');
+$test->add_input_sequence("this is a long test");
+$test->add_delay(0.5);
+$test->add_pattern_match(qr/long/, 'prompt', 'prompt contains long');
+$test->add_delay(1);
+$test->add_pattern_match(qr/this is a .*? test/, 'prompt', 'prompt matches');
my $test2 = $tester->new_test('test2');
$test2->description("cursor movement and deletion");
-$test2->add_delay(2);
+$test2->add_delay(1);
$test2->add_input_sequence("\x01");
$test2->add_delay(0.1);
$test2->add_input_sequence("\x0b");
@@ -43,10 +47,4 @@ my $quit = $tester->new_test('quit');
$quit->description('quitting');
$quit->add_input_sequence("/quit\n");
-# for (1..10) {
-# $test->add_input_sequence("\xff");
-# $test->add_delay(0.1);
-
-# }
-
$tester->run;
diff --git a/testing/tests/002-cursor-test.t b/testing/tests/002-cursor-test.t
new file mode 100755
index 0000000..eb35170
--- /dev/null
+++ b/testing/tests/002-cursor-test.t
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use feature qw/say/;
+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");
+
+if (exists $ENV{IRSSI_TEST_HEADLESS} and $ENV{IRSSI_TEST_NOHEADLESS} == 1) {
+ $tester->run_headless(0);
+ $tester->generate_tap(0);
+} else {
+ $tester->run_headless(1);
+ $tester->generate_tap(1);
+}
+
+my $test = $tester->new_test('test1');
+$test->description("simple echo tests");
+$test->add_diag("Testing 123");
+
+my $quit = $tester->new_test('quit');
+$quit->description('quitting');
+$quit->add_input_sequence("/quit\n");
+
+$tester->run;