aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lib/Test/Irssi.pm
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-02-26 00:37:11 +0000
committerTom Feist <shabble@metavore.org>2011-02-26 00:37:11 +0000
commitbf563d29e40e6bb6cb9732b4457e633468a8c6c2 (patch)
treefddb146dd73cf06f75d21801cd70d89a487dae7f /testing/lib/Test/Irssi.pm
parentadded T:I:T as the base object for creating tests with. (diff)
downloadirssi-scripts-bf563d29e40e6bb6cb9732b4457e633468a8c6c2.tar.gz
irssi-scripts-bf563d29e40e6bb6cb9732b4457e633468a8c6c2.zip
lots of work moving things around so it mostly works. Hooray
Diffstat (limited to 'testing/lib/Test/Irssi.pm')
-rw-r--r--testing/lib/Test/Irssi.pm40
1 files changed, 31 insertions, 9 deletions
diff --git a/testing/lib/Test/Irssi.pm b/testing/lib/Test/Irssi.pm
index dbb2505..a8ee49e 100644
--- a/testing/lib/Test/Irssi.pm
+++ b/testing/lib/Test/Irssi.pm
@@ -19,9 +19,7 @@ class Test::Irssi {
use Test::Irssi::Driver;
use Test::Irssi::Callbacks;
- use Test::Irssi::API;
-
-
+ use Test::Irssi::Test;
has 'irssi_binary'
@@ -98,17 +96,28 @@ class Test::Irssi {
builder => '_build_callback_obj',
);
- has 'api'
+ has 'tests'
=> (
is => 'ro',
- isa => "Test::Irssi::API",
+ isa => "HashRef",
required => 1,
- lazy => 1,
- builder => "_build_api"
+ default => sub { {} },
+ traits => [qw/Hash/],
+ handles => {
+ all_tests => 'values'
+ },
+ );
+
+ has 'active_test'
+ => (
+ is => 'rw',
+ isa => 'Test::Irssi::Test',
);
- method _build_api {
- Test::Irssi::API->new(parent => $self);
+ sub new_test {
+ my ($self, $name, @params) = @_;
+ my $new = Test::Irssi::Test->new(name => $name, parent => $self);
+ $self->tests->{$name} = $new;
}
method _build_callback_obj {
@@ -153,6 +162,12 @@ class Test::Irssi {
$self->_logfile_fh->say($msg);
}
+ method run_tests {
+ foreach my $test ($self->all_tests) {
+ $test->execute();
+ }
+ }
+
method run {
$self->_driver->setup;
$self->_vt_setup;
@@ -161,6 +176,13 @@ class Test::Irssi {
$poe_kernel->run();
}
+ sub apply_delay {
+ my ($self, $delay, $next_index) = @_;
+ $poe_kernel->post(IrssiTestDriver
+ => create_delay
+ => $delay, $next_index);
+ }
+
sub inject_text {
my ($self, $text) = @_;
$poe_kernel->post(IrssiTestDriver => got_terminal_stdin