diff options
Diffstat (limited to 'testsuite/cut.tests')
-rwxr-xr-x | testsuite/cut.tests | 35 |
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 |
97 | optional FEATURE_CUT_REGEX | 97 | optional FEATURE_CUT_REGEX |
98 | testing "cut -DF" "cut -DF 2,7,5" \ | 98 | testing "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 | "\ |
100 | said and your | ||
101 | are | ||
102 | is demand. supply | ||
103 | forecast : | ||
104 | you you better, | ||
105 | |||
106 | Em: 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. |
101 | Cheerios are donut seeds. | 109 | Cheerios are donut seeds. |
102 | Talk is cheap because supply exceeds demand. | 110 | Talk is cheap because supply exceeds demand. |
@@ -105,6 +113,29 @@ Apple: you can buy better, but you can't pay more. | |||
105 | Subcalifragilisticexpialidocious. | 113 | Subcalifragilisticexpialidocious. |
106 | Auntie Em: Hate you, hate Kansas. Took the dog. Dorothy." | 114 | Auntie Em: Hate you, hate Kansas. Took the dog. Dorothy." |
107 | 115 | ||
116 | # No delimiter found: print entire line regardless of -F RANGES | ||
117 | testing "cut -F1" "cut -d: -F1" \ | ||
118 | "the_only_field\n" "" \ | ||
119 | "the_only_field\n" | ||
120 | testing "cut -F2" "cut -d: -F2" \ | ||
121 | "the_only_field\n" "" \ | ||
122 | "the_only_field\n" | ||
123 | # No delimiter found and -s: skip entire line | ||
124 | testing "cut -sF1" "cut -d: -sF1" \ | ||
125 | "" "" \ | ||
126 | "the_only_field\n" | ||
127 | #^^^ the above is probably mishandled by toybox, it prints the line | ||
128 | testing "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 | ||
132 | testing "cut -DF1" "cut -d: -DF1" \ | ||
133 | "the_only_field\n" "" \ | ||
134 | "the_only_field\n" | ||
135 | testing "cut -DF2" "cut -d: -DF2" \ | ||
136 | "\n" "" \ | ||
137 | "the_only_field\n" | ||
138 | |||
108 | optional FEATURE_CUT_REGEX LONG_OPTS | 139 | optional FEATURE_CUT_REGEX LONG_OPTS |
109 | testing "cut -F preserves intermediate delimiters" \ | 140 | testing "cut -F preserves intermediate delimiters" \ |
110 | "cut --output-delimiter=: -F2,4-6,7" \ | 141 | "cut --output-delimiter=: -F2,4-6,7" \ |