mirror of
https://github.com/nushell/nushell.git
synced 2025-08-17 13:41:11 +02:00
Tests pass!
This commit is contained in:
@ -7,9 +7,9 @@ use std::io::Read;
|
||||
#[macro_export]
|
||||
macro_rules! nu {
|
||||
($out:ident, $cwd:expr, $commands:expr) => {
|
||||
pub use std::error::Error;
|
||||
pub use std::io::prelude::*;
|
||||
pub use std::process::{Command, Stdio};
|
||||
pub use std::error::Error;
|
||||
|
||||
let commands = &*format!(
|
||||
"
|
||||
@ -93,10 +93,11 @@ pub fn setup_playground_for(topic: &str) -> (String, String) {
|
||||
}
|
||||
|
||||
pub fn file_contents(full_path: &str) -> String {
|
||||
let mut file = std::fs::File::open(full_path).expect("can not open file");
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents).expect("can not read file");
|
||||
contents
|
||||
let mut file = std::fs::File::open(full_path).expect("can not open file");
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)
|
||||
.expect("can not read file");
|
||||
contents
|
||||
}
|
||||
|
||||
pub fn create_file_at(full_path: &str) {
|
||||
@ -112,7 +113,14 @@ pub fn delete_directory_at(full_path: &str) {
|
||||
}
|
||||
|
||||
pub fn create_directory_at(full_path: &str) {
|
||||
std::fs::create_dir(PathBuf::from(full_path)).expect("can not create directory");
|
||||
let path = PathBuf::from(full_path);
|
||||
|
||||
println!("{:?} - is_dir: {:?}", path, path.is_dir());
|
||||
|
||||
if !path.is_dir() {
|
||||
std::fs::create_dir_all(PathBuf::from(full_path))
|
||||
.expect(&format!("can not create directory {:?}", full_path));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn executable_path() -> PathBuf {
|
||||
|
Reference in New Issue
Block a user