MCPcopy Index your code
hub / github.com/assert-rs/assert_cmd / stderr_example

Function stderr_example

tests/assert.rs:121–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119
120#[test]
121fn stderr_example() {
122 Command::cargo_bin("bin_fixture")
123 .unwrap()
124 .env("stdout", "hello")
125 .env("stderr", "world")
126 .assert()
127 .stderr(predicate::eq(b"world\n" as &[u8]));
128
129 Command::cargo_bin("bin_fixture")
130 .unwrap()
131 .env("stdout", "hello")
132 .env("stderr", "world")
133 .assert()
134 .stderr(predicate::str::diff("world\n"));
135
136 Command::cargo_bin("bin_fixture")
137 .unwrap()
138 .env("stdout", "hello")
139 .env("stderr", "world")
140 .assert()
141 .stderr(b"world\n" as &[u8]);
142
143 Command::cargo_bin("bin_fixture")
144 .unwrap()
145 .env("stdout", "hello")
146 .env("stderr", "world")
147 .assert()
148 .stderr(vec![b'w', b'o', b'r', b'l', b'd', b'\n']);
149
150 Command::cargo_bin("bin_fixture")
151 .unwrap()
152 .env("stdout", "hello")
153 .env("stderr", "world")
154 .assert()
155 .stderr("world\n");
156}

Callers

nothing calls this directly

Calls 5

cargo_binFunction · 0.85
stderrMethod · 0.80
envMethod · 0.80
assertMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected