Some cleanups for cd/PWD (#667)

* Some cleanups for cd/PWD

* Some cleanups for cd/PWD
This commit is contained in:
JT
2022-01-05 11:26:01 +11:00
committed by GitHub
parent 4584d69715
commit 41dbc641cc
14 changed files with 104 additions and 49 deletions

View File

@ -57,6 +57,22 @@ pub fn test_examples(cmd: impl Command + 'static) {
}
let start = std::time::Instant::now();
let mut stack = Stack::new();
// Set up PWD
stack.add_env_var(
"PWD".to_string(),
Value::String {
val: cwd.to_string_lossy().to_string(),
span: Span::test_data(),
},
);
let _ = engine_state.merge_delta(
StateWorkingSet::new(&*engine_state).render(),
Some(&mut stack),
&cwd,
);
let (block, delta) = {
let mut working_set = StateWorkingSet::new(&*engine_state);
let (output, err) = parse(&mut working_set, None, example.example.as_bytes(), false);