Groundwork for coverage with Nu internals. (#1205)

This commit is contained in:
Andrés N. Robalino
2020-01-12 16:44:22 -05:00
committed by GitHub
parent 5fd3191d91
commit d3dae05714
8 changed files with 190 additions and 17 deletions

View File

@ -0,0 +1,22 @@
use std::io::{self, BufRead};
fn main() {
let stdin = io::stdin();
let mut input = stdin.lock().lines();
if let Some(Ok(given)) = input.next() {
if !given.is_empty() {
println!("{}", chop(&given));
std::process::exit(0);
}
}
std::process::exit(0);
}
fn chop(word: &str) -> &str {
let to = word.len() - 1;
&word[..to]
}

View File

@ -0,0 +1,17 @@
fn main() {
let args: Vec<String> = std::env::args().collect();
if args.len() > 1 {
// Write back out all the arguments passed
// if given at least 1 instead of chickens
// speaking co co co.
let mut arguments = args.iter();
arguments.next();
for arg in arguments {
println!("{}", &arg);
}
} else {
println!("cococo");
}
}

View File

@ -0,0 +1,3 @@
fn main() {
std::process::exit(1);
}

View File

@ -220,11 +220,16 @@ pub fn delete_directory_at(full_path: &str) {
}
pub fn executable_path() -> PathBuf {
let mut buf = PathBuf::new();
buf.push("target");
buf.push("debug");
buf.push("nu");
buf
let mut path = binaries();
path.push("nu");
path
}
pub fn binaries() -> PathBuf {
let mut path = PathBuf::new();
path.push("target");
path.push("debug");
path
}
pub fn in_directory(str: impl AsRef<Path>) -> String {

View File

@ -13,7 +13,7 @@ pub fn pipeline(commands: &str) -> String {
.to_string()
}
#[cfg(tests)]
#[cfg(test)]
mod tests {
use super::pipeline;