mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 05:57:51 +02:00
Rewrite README and do some touchups
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::path::PathBuf;
|
||||
use std::io::prelude::*;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::error::Error;
|
||||
use std::io::prelude::*;
|
||||
use std::path::PathBuf;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
fn test_helper(test_name: &str) {
|
||||
let mut baseline_path = PathBuf::new();
|
||||
@ -27,10 +27,10 @@ mod tests {
|
||||
let process = match Command::new(executable)
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn() {
|
||||
|
||||
.spawn()
|
||||
{
|
||||
Ok(process) => process,
|
||||
Err(why) => panic!("Can't run test {}", why.description())
|
||||
Err(why) => panic!("Can't run test {}", why.description()),
|
||||
};
|
||||
|
||||
let baseline_out = std::fs::read_to_string(baseline_path).unwrap();
|
||||
@ -38,15 +38,13 @@ mod tests {
|
||||
let input_commands = std::fs::read_to_string(txt_path).unwrap();
|
||||
|
||||
match process.stdin.unwrap().write_all(input_commands.as_bytes()) {
|
||||
Err(why) => panic!("couldn't write to wc stdin: {}",
|
||||
why.description()),
|
||||
Ok(_) => {},
|
||||
Err(why) => panic!("couldn't write to wc stdin: {}", why.description()),
|
||||
Ok(_) => {}
|
||||
}
|
||||
|
||||
let mut s = String::new();
|
||||
match process.stdout.unwrap().read_to_string(&mut s) {
|
||||
Err(why) => panic!("couldn't read stdout: {}",
|
||||
why.description()),
|
||||
Err(why) => panic!("couldn't read stdout: {}", why.description()),
|
||||
Ok(_) => {
|
||||
let s = s.replace("\r\n", "\n");
|
||||
assert_eq!(s, baseline_out);
|
||||
@ -88,4 +86,9 @@ mod tests {
|
||||
fn split() {
|
||||
test_helper("split");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enter() {
|
||||
test_helper("enter");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user