freebsd-skq/usr.bin/col/tests/col_test.sh
markj 9dd06b18fc col(1): Fix a couple of bugs
- When flushing extra lines after all input has been processed, make
  sure that local state is reinitialized correctly.
- When -f is specified, make sure to end output with a full newline.
- Fix some style issues and update comments.
- Add some regression tests.

PR:		249308
Submitted by:	Yang Zhong <yzhong@freebsdfoundation.org>
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D26536
2020-10-09 15:27:37 +00:00

114 lines
1.6 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# $FreeBSD$
atf_test_case nl
nl_head()
{
atf_set "descr" "testing just newlines"
}
nl_body()
{
atf_check \
-o inline:"a\nb\n" \
-e empty \
-s exit:0 \
col < $(atf_get_srcdir)/nl.in
atf_check \
-o inline:"a\nb\n" \
-e empty \
-s exit:0 \
col -f < $(atf_get_srcdir)/nl.in
atf_check \
-o inline:"a\nb\n" \
-e empty \
-s exit:0 \
col < $(atf_get_srcdir)/nl2.in
atf_check \
-o inline:"a\nb\n" \
-e empty \
-s exit:0 \
col -f < $(atf_get_srcdir)/nl2.in
atf_check \
-o inline:"a\n\nb\n\n" \
-e empty \
-s exit:0 \
col < $(atf_get_srcdir)/nl3.in
}
atf_test_case rlf
rlf_head()
{
atf_set "descr" "testing reverse line feed"
}
rlf_body()
{
atf_check \
-o inline:"a b\n" \
-e empty \
-s exit:0 \
col < $(atf_get_srcdir)/rlf.in
atf_check \
-o inline:"a b\n" \
-e empty \
-s exit:0 \
col < $(atf_get_srcdir)/rlf2.in
atf_check \
-o inline:"a b\n" \
-e empty \
-s exit:0 \
col -x < $(atf_get_srcdir)/rlf2.in
atf_check \
-o inline:" b\na\n" \
-e empty \
-s exit:0 \
col < $(atf_get_srcdir)/rlf3.in
}
atf_test_case hlf
hlf_head()
{
atf_set "descr" "testing half line feed"
}
hlf_body()
{
atf_check \
-o inline:"a f\naf\n" \
-e empty \
-s exit:0 \
col < $(atf_get_srcdir)/hlf.in
atf_check \
-o inline:"a f9
f9
a\n" \
-e empty \
-s exit:0 \
col -f < $(atf_get_srcdir)/hlf.in
atf_check \
-o inline:"a\n f\n" \
-e empty \
-s exit:0 \
col < $(atf_get_srcdir)/hlf2.in
atf_check \
-o inline:"a9
f\n9" \
-e empty \
-s exit:0 \
col -f < $(atf_get_srcdir)/hlf2.in
}
atf_init_test_cases()
{
atf_add_test_case nl
atf_add_test_case rlf
atf_add_test_case hlf
}