#[cfg(test)]
mod tests {
use btl::*;
#[cfg(target_family = "windows")]
#[test]
fn windows() {
shell! {
"ls";
};
let curr = pwd!();
println!("Current directory {}", curr);
let foo = 5;
detach! {
"echo a > example.txt";
"sleep {}" foo;
"rm example.txt";
};
cd! {
"./{}" "tests"
};
if exec! {
"ls -la";
} {
println!("No errors executing command");
} else {
println!("Command not successful");
}
let out: std::process::Output = detailed_exec! {
"pwd";
};
println!("{:#?}", out);
}
fn linux() {
let foo = 2;
let bar = 5;
shell! {
"pwd";
"cd ..";
"pwd";
"echo {} > example.txt" foo;
};
let curr = pwd!();
println!("Current dir through macro: {:?}", curr);
detach! {
"touch example.txt";
"sleep {}" bar;
"rm example.txt";
};
let contents = execute! {
"ls -la";
};
println!("Current directory's contents: {}", contents);
if exec! {
"ls -la | grep Cargo";
} {
println!("Cargo found");
} else {
println!("Cargo not found");
}
shell! {
"pwd";
};
let dir = "..";
cd! {
"{}" dir
};
shell! {
"echo CURRENT DIR $(pwd)";
};
cd! {
"{}" curr
};
shell! {
"echo CURRENT DIR $(pwd)";
};
let out: std::process::Output = detailed_exec! {
"pwd";
};
println!("{:#?}", out);
}
}