From 02aeadc9a10c86f4cdf0a83d75c79529fdbe6df8 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Sat, 24 May 2008 16:54:02 -0500 Subject: add a test for the t command --- t/022-printing.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 t/022-printing.t diff --git a/t/022-printing.t b/t/022-printing.t new file mode 100644 index 0000000..e6c0d52 --- /dev/null +++ b/t/022-printing.t @@ -0,0 +1,27 @@ +#!perl -T +use strict; +use warnings; +use Test::More; +use Language::TECO; + +my %tests = ( + 0 => ["", "", "", "this is\n", "this is\nan initial buffer"], + 3 => ["thi", "thi", "thi", "s is\n", "s is\nan initial buffer"], + 7 => ["this is", "this is", "this is", "\n", "\nan initial buffer"], + 8 => ["this is\n", "this is\n", "", "an initial buffer", "an initial buffer"], + 10 => ["this is\nan", "this is\nan", "an", " initial buffer", " initial buffer"], + 25 => ["this is\nan initial buffer", "this is\nan initial buffer", "an initial buffer", "", ""], +); +plan tests => 1 + map { @{ $tests{$_} } } keys %tests; + +my $buftext = "this is\nan initial buffer"; +my $te = Language::TECO->new($buftext); +for my $pos (keys %tests) { + $te->execute("${pos}j"); + for my $arg (-2..2) { + is($te->execute("${arg}t"), $tests{$pos}[$arg + 2], + "\"${arg}t\" at position $pos"); + } +} +is($te->execute("ht"), "this is\nan initial buffer", + "ht prints the whole buffer"); -- cgit v1.2.3