From 6374b67079740260ad8e7d6301f11c14dd9d90a3 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Fri, 4 Mar 2011 05:25:22 +0000 Subject: testing: adapted rudi's vim_mode insert test to new format. seems to work fine. --- testing/tests/003-vim-mode.t | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 testing/tests/003-vim-mode.t (limited to 'testing/tests') diff --git a/testing/tests/003-vim-mode.t b/testing/tests/003-vim-mode.t new file mode 100755 index 0000000..a732f66 --- /dev/null +++ b/testing/tests/003-vim-mode.t @@ -0,0 +1,43 @@ +#!/usr/bin/env perl + +# Must be run in a 80x24 terminal unless a fixed POE is released. +use strict; +use warnings; + +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 => "/opt/stow/repo/irssi-debug/bin/irssi", + irssi_homedir => $ENV{HOME} . "/projects/tmp/test/irssi-debug"); + +$tester->run_headless(1); +$tester->generate_tap(1); + +my $test = $tester->new_test('insert-command-mode'); +$test->description("switching between insert and command mode in vim_mode script"); + +# Make sure irssi is finished - not entirely sure why this is necessary. +$test->add_delay(2); + +# 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; -- cgit v1.2.3