diff options
author | Simon Ruderich <simon@ruderich.org> | 2011-03-01 02:19:59 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2011-03-01 02:19:59 +0000 |
commit | 38b08f34d836a13f7ac9bbb5bdd516dd9d94fb5f (patch) | |
tree | b9c96d85341ee63ecffb327a5209ed57f6ef38ee /vim-mode | |
parent | vim-mode: Add irssi configuration directory used for testing. (diff) | |
download | irssi-scripts-38b08f34d836a13f7ac9bbb5bdd516dd9d94fb5f.tar.gz irssi-scripts-38b08f34d836a13f7ac9bbb5bdd516dd9d94fb5f.zip |
vim-mode: Add tests.pl.
Diffstat (limited to 'vim-mode')
-rw-r--r-- | vim-mode/tests.pl | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/vim-mode/tests.pl b/vim-mode/tests.pl new file mode 100644 index 0000000..2a85b29 --- /dev/null +++ b/vim-mode/tests.pl @@ -0,0 +1,48 @@ +#!/usr/bin/perl + +# Must be run in a 80x24 terminal unless a fixed POE is released. + + +use strict; +use warnings; + +use lib '../testing/blib/lib'; + +use Test::Irssi; + + +sub statusbar_mode { + my ($test, $mode) = @_; + + $test->add_pattern_match(qr/^ \[\d{2}:\d{2}\] \[\] \[1\] \[$mode\]\s+$/, + 'window_sbar', "[$mode] in vim-mode statusbar"); +} + +my $tester = Test::Irssi->new + (irssi_binary => "irssi", + irssi_homedir => "irssi"); + + +my $test; + + +$test = $tester->new_test('insert-command-mode'); + +# Make sure irssi is finished - not entirely sure why this is necessary. +$test->add_delay(3); + +# We start in insert mode. +statusbar_mode($test, 'Insert'); + +$test->add_input_sequence("\e"); +$test->add_delay(1); +statusbar_mode($test, 'Command'); + +$test->add_input_sequence("i"); +$test->add_delay(1); +statusbar_mode($test, 'Insert'); + +# Quit irssi, necessary to terminate the test. +$test->add_input_sequence("\n/quit\n"); + +$tester->run; |