diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-05-22 11:05:04 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-05-22 11:05:04 -0500 |
commit | 72b41860244cea8901109e52ae79a0604e8309a5 (patch) | |
tree | b918d34fec4300349fb69b32193958f72538fb77 /t | |
parent | 1fb281a03424d0942d4c275391cf194b5bd9a0ff (diff) | |
download | language-teco-72b41860244cea8901109e52ae79a0604e8309a5.tar.gz language-teco-72b41860244cea8901109e52ae79a0604e8309a5.zip |
refactor the error handling test
Diffstat (limited to 't')
-rw-r--r-- | t/100-errors.t | 20 |
1 files changed, 15 insertions, 5 deletions
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); +} |