aboutsummaryrefslogtreecommitdiff
path: root/testsuite/cut.tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/cut.tests')
-rwxr-xr-xtestsuite/cut.tests35
1 files changed, 33 insertions, 2 deletions
diff --git a/testsuite/cut.tests b/testsuite/cut.tests
index e57b028ac..21cfea809 100755
--- a/testsuite/cut.tests
+++ b/testsuite/cut.tests
@@ -95,8 +95,16 @@ testing "cut with -d -s omits blank lines" "cut -d' ' -f2 -s input" "bar\nbong\n
95 95
96# substitute for awk 96# substitute for awk
97optional FEATURE_CUT_REGEX 97optional FEATURE_CUT_REGEX
98testing "cut -DF" "cut -DF 2,7,5" \ 98testing "cut -DF unordered" "cut -DF 2,7,5" \
99 "said and your\nare\nis demand. supply\nforecast :\nyou you better,\n\nEm: Took hate\n" "" \ 99 "\
100said and your
101are
102is demand. supply
103forecast :
104you you better,
105
106Em: Took hate
107" "" \
100"Bother, said Pooh. It's your husband, and he has a gun. 108"Bother, said Pooh. It's your husband, and he has a gun.
101Cheerios are donut seeds. 109Cheerios are donut seeds.
102Talk is cheap because supply exceeds demand. 110Talk is cheap because supply exceeds demand.
@@ -105,6 +113,29 @@ Apple: you can buy better, but you can't pay more.
105Subcalifragilisticexpialidocious. 113Subcalifragilisticexpialidocious.
106Auntie Em: Hate you, hate Kansas. Took the dog. Dorothy." 114Auntie Em: Hate you, hate Kansas. Took the dog. Dorothy."
107 115
116# No delimiter found: print entire line regardless of -F RANGES
117testing "cut -F1" "cut -d: -F1" \
118 "the_only_field\n" "" \
119 "the_only_field\n"
120testing "cut -F2" "cut -d: -F2" \
121 "the_only_field\n" "" \
122 "the_only_field\n"
123# No delimiter found and -s: skip entire line
124testing "cut -sF1" "cut -d: -sF1" \
125 "" "" \
126 "the_only_field\n"
127#^^^ the above is probably mishandled by toybox, it prints the line
128testing "cut -sF2" "cut -d: -sF2" \
129 "" "" \
130 "the_only_field\n"
131# -D disables special handling of lines with no delimiters, the line is treated as the 1st field
132testing "cut -DF1" "cut -d: -DF1" \
133 "the_only_field\n" "" \
134 "the_only_field\n"
135testing "cut -DF2" "cut -d: -DF2" \
136 "\n" "" \
137 "the_only_field\n"
138
108optional FEATURE_CUT_REGEX LONG_OPTS 139optional FEATURE_CUT_REGEX LONG_OPTS
109testing "cut -F preserves intermediate delimiters" \ 140testing "cut -F preserves intermediate delimiters" \
110 "cut --output-delimiter=: -F2,4-6,7" \ 141 "cut --output-delimiter=: -F2,4-6,7" \