Add PATH to fish env
This commit is contained in:
parent
714ab9fbdd
commit
8fc9bb3a29
19
src/shell.rs
19
src/shell.rs
|
|
@ -54,6 +54,8 @@ mod tests {
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
use seq_macro::seq;
|
use seq_macro::seq;
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
|
||||||
macro_rules! with_opts_size {
|
macro_rules! with_opts_size {
|
||||||
($macro:ident) => {
|
($macro:ident) => {
|
||||||
$macro!(24);
|
$macro!(24);
|
||||||
|
|
@ -96,6 +98,17 @@ mod tests {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn make_cmd(cmd: &str) -> Command {
|
||||||
|
let home = tempfile::tempdir().unwrap();
|
||||||
|
let home = home.path();
|
||||||
|
let path = env::var_os("PATH").unwrap_or_default();
|
||||||
|
|
||||||
|
let mut cmd = Command::new(cmd);
|
||||||
|
cmd.env_clear().env("HOME", home).env("PATH", path);
|
||||||
|
|
||||||
|
cmd
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! generate_tests {
|
macro_rules! generate_tests {
|
||||||
($N:literal) => {
|
($N:literal) => {
|
||||||
seq!(i in 0..$N {
|
seq!(i in 0..$N {
|
||||||
|
|
@ -143,13 +156,9 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn fish_fish_#i() {
|
fn fish_fish_#i() {
|
||||||
let opts = dbg!(&opts()[i]);
|
let opts = dbg!(&opts()[i]);
|
||||||
let home = tempfile::tempdir().unwrap();
|
|
||||||
let home = home.path();
|
|
||||||
let source = Fish(opts).render().unwrap();
|
let source = Fish(opts).render().unwrap();
|
||||||
Command::new("fish")
|
make_cmd("fish")
|
||||||
.args(&["--command", &source, "--private"])
|
.args(&["--command", &source, "--private"])
|
||||||
.env_clear()
|
|
||||||
.env("HOME", home)
|
|
||||||
.assert()
|
.assert()
|
||||||
.success()
|
.success()
|
||||||
.stdout("")
|
.stdout("")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue