diff options
author | Tom Feist <shabble@metavore.org> | 2011-02-26 00:37:11 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2011-02-26 00:37:11 +0000 |
commit | bf563d29e40e6bb6cb9732b4457e633468a8c6c2 (patch) | |
tree | fddb146dd73cf06f75d21801cd70d89a487dae7f /testing/lib/Test/Irssi/API.pm | |
parent | added T:I:T as the base object for creating tests with. (diff) | |
download | irssi-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/API.pm')
-rw-r--r-- | testing/lib/Test/Irssi/API.pm | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/testing/lib/Test/Irssi/API.pm b/testing/lib/Test/Irssi/API.pm deleted file mode 100644 index 3a659ed..0000000 --- a/testing/lib/Test/Irssi/API.pm +++ /dev/null @@ -1,80 +0,0 @@ -use strictures 1; -use MooseX::Declare; - -class Test::Irssi::API { - - use POE; - use Data::Dumper; - - has 'parent' - => ( - is => 'ro', - isa => 'Test::Irssi', - required => 1, - ); - - - has 'tests' - => ( - traits => [qw/Hash/], - is => 'rw', - isa => 'HashRef', - default => sub { {} }, - handles => { - test_names => 'keys', - }, - ); - - - sub create_test { - my ($self, $name, $desc) = @_; - $self->tests->{$name} = {desc => $desc, input => [], output => []}; - } - - sub simulate_input { - my ($self, $name, $input) = @_; - push @{ $self->tests->{$name}->{input} }, { input => $input }; - } - - sub simulate_delay { - my ($self, $name, $delay) = @_; - push @{ $self->tests->{$name}->{input} }, { delay => $delay }; - - } - - sub expect_output { - my ($self, $name, $regex, $line) = @_; # line is optional? - push @{ $self->tests->{$name}->{output} }, { regex => $regex, line => $line }; - } - - sub run_test { - my ($self, $test_name) = @_; - my $data = $self->tests->{$test_name}; - foreach my $entry (@{ $data->{input} }) { - if (exists $entry->{input}) { - my $text = $entry->{input}; - $self->parent->inject_text($text); - } elsif (exists $entry->{delay}) { - my $delay = $entry->{delay}; - _do_delay($delay); - } else { - die "What: " . Dumper($entry); - } - } - } - - sub run_tests { - my ($self) = @_; - foreach my $test_name ($self->test_names) { - my $test = $self->tests->{$test_name}; - print "Going to prcess: $test_name"; - print Dumper($test); - - } - } - - - sub _do_delay { - $poe_kernel->post('IrssiTestDriver' => create_delay => 5); - } -} |