Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit ddba232

Browse files
committed
[tests] Keep RUST_BACKTRACE value.
1 parent f7110f8 commit ddba232

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ fn has_backtrace_depending_on_env() {
213213
}
214214
}
215215

216+
let original_value = env::var_os("RUST_BACKTRACE");
217+
216218
// missing RUST_BACKTRACE and RUST_BACKTRACE=0
217219
env::remove_var("RUST_BACKTRACE");
218220
let err = Error::from(ErrorKind::MyError);
@@ -225,6 +227,10 @@ fn has_backtrace_depending_on_env() {
225227
env::set_var("RUST_BACKTRACE", "yes");
226228
let err = Error::from(ErrorKind::MyError);
227229
assert!(err.backtrace().is_some());
230+
231+
if let Some(var) = original_value {
232+
env::set_var("RUST_BACKTRACE", var);
233+
}
228234
}
229235

230236
#[test]

0 commit comments

Comments
 (0)