Home | History | Annotate | Line # | Download | only in col
      1 #!/usr/bin/atf-sh
      2 # $FreeBSD: head/usr.bin/col/tests/col_test.sh 366577 2020-10-09 15:27:37Z markj $
      3 
      4 atf_test_case nl
      5 
      6 nl_head()
      7 {
      8 	atf_set "descr" "testing just newlines"
      9 }
     10 nl_body()
     11 {
     12 	atf_check \
     13 		-o inline:"a\nb\n" \
     14 		-e empty \
     15 		-s exit:0 \
     16 		col < $(atf_get_srcdir)/nl.in
     17 
     18 	atf_check \
     19 		-o inline:"a\nb\n" \
     20 		-e empty \
     21 		-s exit:0 \
     22 		col -f < $(atf_get_srcdir)/nl.in
     23 
     24 	atf_check \
     25 		-o inline:"a\nb\n" \
     26 		-e empty \
     27 		-s exit:0 \
     28 		col < $(atf_get_srcdir)/nl2.in
     29 
     30 	atf_check \
     31 		-o inline:"a\nb\n" \
     32 		-e empty \
     33 		-s exit:0 \
     34 		col -f < $(atf_get_srcdir)/nl2.in
     35 
     36 	atf_check \
     37 		-o inline:"a\n\nb\n\n" \
     38 		-e empty \
     39 		-s exit:0 \
     40 		col < $(atf_get_srcdir)/nl3.in
     41 }
     42 
     43 atf_test_case rlf
     44 
     45 rlf_head()
     46 {
     47 	atf_set "descr" "testing reverse line feed"
     48 }
     49 rlf_body()
     50 {
     51 	atf_check \
     52 		-o inline:"a b\n" \
     53 		-e empty \
     54 		-s exit:0 \
     55 		col < $(atf_get_srcdir)/rlf.in
     56 
     57 	atf_check \
     58 		-o inline:"a	b\n" \
     59 		-e empty \
     60 		-s exit:0 \
     61 		col < $(atf_get_srcdir)/rlf2.in
     62 
     63 	atf_check \
     64 		-o inline:"a       b\n" \
     65 		-e empty \
     66 		-s exit:0 \
     67 		col -x < $(atf_get_srcdir)/rlf2.in
     68 
     69 	atf_check \
     70 		-o inline:" b\na\n" \
     71 		-e empty \
     72 		-s exit:0 \
     73 		col < $(atf_get_srcdir)/rlf3.in
     74 }
     75 
     76 atf_test_case hlf
     77 
     78 hlf_head()
     79 {
     80 	atf_set "descr" "testing half line feed"
     81 }
     82 hlf_body()
     83 {
     84 	atf_check \
     85 		-o inline:"a f\naf\n" \
     86 		-e empty \
     87 		-s exit:0 \
     88 		col < $(atf_get_srcdir)/hlf.in
     89 
     90 	atf_check \
     91 		-o inline:"a f9
 f9
a\n" \
     94 		-e empty \
     95 		-s exit:0 \
     96 		col -f < $(atf_get_srcdir)/hlf.in
     97 
     98 	atf_check \
     99 		-o inline:"a\n f\n" \
    100 		-e empty \
    101 		-s exit:0 \
    102 		col < $(atf_get_srcdir)/hlf2.in
    103 
    104 	atf_check \
    105 		-o inline:"a9
 f\n9"  \
    107 		-e empty \
    108 		-s exit:0 \
    109 		col -f < $(atf_get_srcdir)/hlf2.in
    110 }
    111 
    112 atf_init_test_cases()
    113 {
    114 	atf_add_test_case nl
    115 	atf_add_test_case rlf
    116 	atf_add_test_case hlf
    117 }
    118