mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Groundwork for coverage with Nu internals. (#1205)
This commit is contained in:
committed by
GitHub
parent
5fd3191d91
commit
d3dae05714
22
crates/nu-test-support/src/bin/chop.rs
Normal file
22
crates/nu-test-support/src/bin/chop.rs
Normal 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]
|
||||
}
|
17
crates/nu-test-support/src/bin/cococo.rs
Normal file
17
crates/nu-test-support/src/bin/cococo.rs
Normal 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");
|
||||
}
|
||||
}
|
3
crates/nu-test-support/src/bin/fail.rs
Normal file
3
crates/nu-test-support/src/bin/fail.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
std::process::exit(1);
|
||||
}
|
@ -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 {
|
||||
|
@ -13,7 +13,7 @@ pub fn pipeline(commands: &str) -> String {
|
||||
.to_string()
|
||||
}
|
||||
|
||||
#[cfg(tests)]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::pipeline;
|
||||
|
||||
|
Reference in New Issue
Block a user