summaryrefslogtreecommitdiffstats
path: root/t/030-buffer-positions.t
blob: 0f468b502a21062a09403488168b7af96d1566a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!perl -T
use strict;
use warnings;
use Test::More tests => 9;
use Language::TECO;

my $buftext = "this is\nan initial buffer";
my $te = Language::TECO->new($buftext);
$te->execute("5j");
is($te->pointer, 5, "buffer position after absolute positioning");
$te->execute("bj");
is($te->pointer, 0,
   "buffer position after moving to the beginning of the buffer");
$te->execute("zj");
is($te->pointer, length $buftext,
   "buffer position after moving to the end of the buffer");
$te->execute("5j");
$te->execute("-.d");
is($te->pointer, 0,
   "buffer position after deleting everything before the pointer");
is($te->buffer, "is\nan initial buffer",
   "buffer contents after deleting everything before the pointer");
$te->execute("1,6d");
is($te->buffer, "iinitial buffer",
   "buffer contents after deleting an absolute range");
$te->execute("b,.d");
is($te->buffer, "initial buffer",
   "buffer contents after deleting from the beginning to the current position");
$te->execute("5j");
$te->execute(".,zd");
is($te->buffer, "initi",
   "buffer contents after deleting from the current position to the end");
$te->execute("hd");
is($te->buffer, "",
   "buffer contents after deleting the entire buffer (position 'h')");