summaryrefslogtreecommitdiffhomepage
path: root/testsuite/rev.tests
blob: dd65dcd3ba6cb708fbed36476e2c503f1bbc1f09 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Copyright 2021 by Ron Yorston
# Licensed under GPLv2, see file LICENSE in this source tree.

. ./testing.sh

# testing "test name" "commands" "expected result" "file input" "stdin"

testing "rev works" \
	"rev input" \
"\
1 enil

3 enil
" \
	"line 1\n\nline 3\n" \
	""

testing "rev file with missing newline" \
	"rev input" \
"\
1 enil

3 enil" \
	"line 1\n\nline 3" \
	""

testing "rev file with NUL character" \
	"rev input" \
"\
nil
3 enil
" \
	"lin\000e 1\n\nline 3\n" \
	""

testing "rev file with long line" \
	"rev input" \
"\
+--------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------
cba
" \
	"---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+--------------+\nabc\n" \
	""

exit $FAILCOUNT