-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtext_test.sh
More file actions
38 lines (29 loc) · 755 Bytes
/
text_test.sh
File metadata and controls
38 lines (29 loc) · 755 Bytes
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
#
# tests for bashfoo text module
#
bashfoo_require test
bashfoo_require text
#@bashfoo.test test_text_prefix
test_text_prefix()
{
( echo "a" ; echo ; echo "zz" ) | bashfoo.prefix FOO: > stdout
assert_equals 3 $(wc -l stdout)
assert_grep '^FOO:zz$' stdout
assert_grep '^FOO:$' stdout
assert_grep '^FOO:a$' stdout
assert_grepv '^a$' stdout
assert_grepv '^zz$' stdout
assert_grepv '^$' stdout
}
#@bashfoo.test test_text_tac
test_text_tac()
{
#set -x
( echo "a" ; echo "exp" ; echo ; echo "zz" ) > f1
( echo "zz" ; echo ; echo "exp"; echo "a" ) > f2
bashfoo.tac f1 > f1.rev
bashfoo.tac f2 > f2.rev
assert_files_equal f1 f2.rev
assert_files_equal f2 f1.rev
}
autotest