Skip to content

Commit fb2a276

Browse files
committed
test_echo: check for -- arguments between
This adds a test for passing `--` as a non-first argument to `echo`. Fixes #7558.
1 parent fcf00a0 commit fb2a276

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/by-util/test_echo.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ fn test_hyphen_values_between() {
243243
}
244244

245245
#[test]
246-
fn test_double_hyphens() {
246+
fn test_double_hyphens_at_start() {
247247
new_ucmd!().arg("--").succeeds().stdout_only("--\n");
248248
new_ucmd!()
249249
.arg("--")
@@ -252,6 +252,24 @@ fn test_double_hyphens() {
252252
.stdout_only("-- --\n");
253253
}
254254

255+
#[test]
256+
fn test_double_hyphens_between() {
257+
new_ucmd!()
258+
.arg("a")
259+
.arg("--")
260+
.arg("b")
261+
.succeeds()
262+
.stdout_only("a -- b\n");
263+
264+
new_ucmd!()
265+
.arg("foo ")
266+
.arg("-- --")
267+
.arg("bar")
268+
.arg("hehehe")
269+
.succeeds()
270+
.stdout_only("foo -- -- bar hehehe\n");
271+
}
272+
255273
#[test]
256274
fn wrapping_octal() {
257275
// Some odd behavior of GNU. Values of \0400 and greater do not fit in the

0 commit comments

Comments
 (0)