From 72b41860244cea8901109e52ae79a0604e8309a5 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Thu, 22 May 2008 11:05:04 -0500 Subject: refactor the error handling test --- t/100-errors.t | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 't') diff --git a/t/100-errors.t b/t/100-errors.t index cc8c7b9..26275c5 100644 --- a/t/100-errors.t +++ b/t/100-errors.t @@ -1,13 +1,23 @@ #!perl -T use strict; use warnings; -use Test::More tests => 4; +use Test::More; use Test::Exception; use Language::TECO; +my @test_cmds = qw/j c d/; +plan tests => @test_cmds * 4; + my $buftext = "this is\nan initial buffer"; my $te = Language::TECO->new($buftext); -throws_ok { $te->execute("100j") } qr/Pointer off page/, - 'moving the pointer off the end of the buffer'; -throws_ok { $te->execute("-10j") } qr/Pointer off page/, - 'moving the pointer off the end of the buffer'; +$te->execute("5j"); +for my $cmd (@test_cmds) { + throws_ok { $te->execute("100$cmd") } qr/Pointer off page/, + "moving the pointer off the end of the buffer ($cmd)"; + is($te->pointer, 5); + is($te->buffer, $buftext); + throws_ok { $te->execute("-100$cmd") } qr/Pointer off page/, + "moving the pointer off the beginning of the buffer ($cmd)"; + is($te->pointer, 5); + is($te->buffer, $buftext); +} -- cgit v1.2.3-54-g00ecf