summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-05-24 16:54:02 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-05-24 16:54:02 -0500
commit02aeadc9a10c86f4cdf0a83d75c79529fdbe6df8 (patch)
tree19f7f9f85f07c48942e7717154eab6a92d77a346
parent0243d3deae35114f7160263a9d3bb59c8644f727 (diff)
downloadlanguage-teco-02aeadc9a10c86f4cdf0a83d75c79529fdbe6df8.tar.gz
language-teco-02aeadc9a10c86f4cdf0a83d75c79529fdbe6df8.zip
add a test for the t command
-rw-r--r--t/022-printing.t27
1 files changed, 27 insertions, 0 deletions
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");