Fix tests

This commit is contained in:
Yehuda Katz 2019-11-29 16:21:05 -08:00
parent 0f193c2337
commit a1e21828d6
33 changed files with 39 additions and 61 deletions

View File

@ -1,11 +1,11 @@
use crate::commands::{RawCommandArgs, WholeStreamCommand};
use crate::data::value;
use nu_parser::hir::{Expression, NamedArguments};
use crate::prelude::*;
use futures::stream::TryStreamExt;
use nu_errors::ShellError;
use nu_parser::hir::{Expression, NamedArguments};
use nu_protocol::{Primitive, ReturnSuccess, Signature, UntaggedValue, Value};
use std::sync::atomic::Ordering;
use nu_errors::{ShellError};
pub struct Autoview;

View File

@ -1,7 +1,7 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use nu_protocol::{SyntaxShape, Signature};
use nu_errors::ShellError;
use nu_protocol::{Signature, SyntaxShape};
pub struct CD;

View File

@ -1,7 +1,7 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use nu_protocol::{CommandAction, ReturnSuccess, Signature};
use nu_errors::ShellError;
use nu_protocol::{CommandAction, ReturnSuccess, Signature};
pub struct Next;

View File

@ -1,10 +1,8 @@
use crate::commands::UnevaluatedCallInfo;
use crate::data::value;
use crate::prelude::*;
use nu_protocol::{
CallInfo, ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value,
};
use nu_errors::ShellError;
use nu_protocol::{CallInfo, ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value};
use nu_source::{AnchorLocation, Span};
use std::path::{Path, PathBuf};

View File

@ -2,8 +2,8 @@ use crate::commands::WholeStreamCommand;
use crate::context::CommandRegistry;
use crate::data::base::select_fields;
use crate::prelude::*;
use nu_protocol::{Signature, SyntaxShape};
use nu_errors::ShellError;
use nu_protocol::{Signature, SyntaxShape};
use nu_source::Tagged;
#[derive(Deserialize)]

View File

@ -3,8 +3,8 @@ use crate::data::base::property_get::get_data_by_key;
use crate::data::value;
use crate::prelude::*;
use crate::TaggedDictBuilder;
use nu_protocol::{ReturnSuccess, Signature, SyntaxShape, Value};
use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature, SyntaxShape, Value};
use nu_source::{SpannedItem, Tagged};
pub struct Pivot;

View File

@ -3,10 +3,8 @@ use crate::data::value;
use crate::prelude::*;
use derive_new::new;
use log::trace;
use nu_protocol::{
Primitive, ReturnSuccess, ReturnValue, Signature, UntaggedValue, Value,
};
use nu_errors::ShellError;
use nu_protocol::{Primitive, ReturnSuccess, ReturnValue, Signature, UntaggedValue, Value};
use serde::{self, Deserialize, Serialize};
use std::io::prelude::*;
use std::io::BufReader;

View File

@ -3,10 +3,10 @@ use crate::data::value;
use crate::prelude::*;
use base64::encode;
use mime::Mime;
use nu_errors::ShellError;
use nu_protocol::{
CallInfo, Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value,
};
use nu_errors::ShellError;
use nu_source::AnchorLocation;
use std::path::PathBuf;
use std::str::FromStr;

View File

@ -1,6 +1,6 @@
use crate::prelude::*;
use nu_protocol::{CommandAction, ReturnSuccess, Signature};
use nu_errors::ShellError;
use nu_protocol::{CommandAction, ReturnSuccess, Signature};
use crate::commands::WholeStreamCommand;

View File

@ -1,7 +1,7 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use nu_protocol::{Signature};
use nu_errors::ShellError;
use nu_protocol::Signature;
pub struct PWD;

View File

@ -1,10 +1,8 @@
use crate::commands::WholeStreamCommand;
use crate::data::TaggedDictBuilder;
use crate::prelude::*;
use nu_protocol::{
ReturnSuccess, Signature, SpannedTypeName, SyntaxShape, UntaggedValue, Value,
};
use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature, SpannedTypeName, SyntaxShape, UntaggedValue, Value};
use nu_source::Tagged;
pub struct SplitBy;

View File

@ -2,8 +2,8 @@ use crate::commands::WholeStreamCommand;
use crate::data::TaggedDictBuilder;
use crate::prelude::*;
use log::trace;
use nu_protocol::{Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue};
use nu_errors::ShellError;
use nu_protocol::{Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue};
use nu_source::Tagged;
#[derive(Deserialize)]

View File

@ -1,8 +1,8 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use log::trace;
use nu_protocol::{Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue};
use nu_errors::ShellError;
use nu_protocol::{Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue};
use nu_source::Tagged;
#[derive(Deserialize)]

View File

@ -3,10 +3,8 @@ use crate::data::base::property_get::get_data_by_key;
use crate::data::{value, TaggedDictBuilder, TaggedListBuilder};
use crate::prelude::*;
use chrono::{DateTime, NaiveDate, Utc};
use nu_protocol::{
Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value,
};
use nu_errors::ShellError;
use nu_protocol::{Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value};
use nu_source::Tagged;
pub struct TSortBy;

View File

@ -2,10 +2,8 @@ use crate::commands::WholeStreamCommand;
use crate::data::value;
use crate::format::TableView;
use crate::prelude::*;
use nu_protocol::{
Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value,
};
use nu_errors::ShellError;
use nu_protocol::{Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value};
pub struct Table;

View File

@ -1,8 +1,8 @@
use crate::commands::WholeStreamCommand;
use crate::data::TaggedDictBuilder;
use crate::prelude::*;
use nu_protocol::{Signature};
use nu_errors::ShellError;
use nu_protocol::Signature;
pub struct Tags;

View File

@ -1,10 +1,8 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use hex::encode;
use nu_protocol::{
Dictionary, Primitive, ReturnSuccess, Signature, UntaggedValue, Value,
};
use nu_errors::ShellError;
use nu_protocol::{Dictionary, Primitive, ReturnSuccess, Signature, UntaggedValue, Value};
use rusqlite::{Connection, NO_PARAMS};
use std::io::Read;

View File

@ -1,10 +1,7 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use nu_protocol::{
Primitive, ReturnSuccess, Signature, UnspannedPathMember, UntaggedValue, Value,
};
use nu_errors::{ShellError, CoerceInto};
use nu_errors::{CoerceInto, ShellError};
use nu_protocol::{Primitive, ReturnSuccess, Signature, UnspannedPathMember, UntaggedValue, Value};
pub struct ToTOML;

View File

@ -1,8 +1,8 @@
use crate::commands::WholeStreamCommand;
use crate::data::value;
use crate::prelude::*;
use nu_protocol::{ReturnSuccess, Signature, UntaggedValue, Value};
use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature, UntaggedValue, Value};
pub struct ToURL;

View File

@ -1,11 +1,7 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use nu_protocol::{
Primitive, ReturnSuccess, Signature, UnspannedPathMember,
UntaggedValue, Value,
};
use nu_errors::{ShellError, CoerceInto};
use nu_errors::{CoerceInto, ShellError};
use nu_protocol::{Primitive, ReturnSuccess, Signature, UnspannedPathMember, UntaggedValue, Value};
pub struct ToYAML;

View File

@ -1,8 +1,8 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use nu_protocol::{ReturnSuccess, Signature};
use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature};
pub struct Trim;

View File

@ -1,8 +1,8 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use indexmap::IndexMap;
use nu_protocol::{Dictionary, Signature, UntaggedValue};
use nu_errors::ShellError;
use nu_protocol::{Dictionary, Signature, UntaggedValue};
pub struct Version;

View File

@ -4,8 +4,8 @@ use crate::data::value;
use crate::prelude::*;
use futures::StreamExt;
use futures_util::pin_mut;
use nu_protocol::{ReturnSuccess, ReturnValue, Signature};
use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, ReturnValue, Signature};
use nu_source::PrettyDebug;
pub struct What;

View File

@ -1,7 +1,7 @@
use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use nu_protocol::{Primitive, Signature, SyntaxShape, UntaggedValue, Value};
use nu_errors::ShellError;
use nu_protocol::{Primitive, Signature, SyntaxShape, UntaggedValue, Value};
pub struct Which;

View File

@ -1,10 +1,10 @@
use crate::commands::{command::CommandArgs, Command, UnevaluatedCallInfo};
use crate::env::host::Host;
use nu_parser::{hir, hir::syntax_shape::ExpandContext, hir::syntax_shape::SignatureRegistry};
use crate::shell::shell_manager::ShellManager;
use crate::stream::{InputStream, OutputStream};
use indexmap::IndexMap;
use nu_errors::ShellError;
use nu_parser::{hir, hir::syntax_shape::ExpandContext, hir::syntax_shape::SignatureRegistry};
use nu_protocol::{errln, Signature};
use nu_source::{Tag, Text};
use std::error::Error;

View File

@ -4,8 +4,8 @@ use crate::prelude::*;
use app_dirs::*;
use indexmap::IndexMap;
use log::trace;
use nu_protocol::{Dictionary, ShellTypeName, UntaggedValue, Value};
use nu_errors::ShellError;
use nu_protocol::{Dictionary, ShellTypeName, UntaggedValue, Value};
use serde::{Deserialize, Serialize};
use std::fs::{self, OpenOptions};
use std::io;

View File

@ -1,7 +1,7 @@
use crate::data::TaggedDictBuilder;
use crate::prelude::*;
use nu_protocol::{Value};
use nu_errors::ShellError;
use nu_protocol::Value;
#[derive(Debug)]
pub enum FileType {

View File

@ -1,7 +1,7 @@
use crate::prelude::*;
use log::trace;
use nu_errors::{CoerceInto, ShellError};
use nu_protocol::{Primitive, SpannedTypeName, UntaggedValue, Value};
use nu_errors::{ShellError, CoerceInto};
use nu_source::Tagged;
pub trait ExtractType: Sized {

View File

@ -48,10 +48,7 @@ fn process_docker_output(cmd_output: &str, tag: Tag) -> Result<Vec<Value>, Shell
let mut dict = TaggedDictBuilder::new(&tag);
for (i, v) in values.iter().enumerate() {
dict.insert(
header[i].to_string(),
value::string(v.trim().to_string()),
);
dict.insert(header[i].to_string(), value::string(v.trim().to_string()));
}
output.push(dict.into_value());

View File

@ -110,11 +110,11 @@ pub(crate) use futures::stream::BoxStream;
pub(crate) use futures::{FutureExt, Stream, StreamExt};
pub(crate) use nu_protocol::{EvaluateTrait, MaybeOwned};
pub(crate) use nu_source::{
b, AnchorLocation, DebugDocBuilder, HasSpan, PrettyDebug,
PrettyDebugWithSource, Span, SpannedItem, Tag, TaggedItem, Text,
b, AnchorLocation, DebugDocBuilder, HasSpan, PrettyDebug, PrettyDebugWithSource, Span,
SpannedItem, Tag, TaggedItem, Text,
};
pub(crate) use num_bigint::BigInt;
pub(crate) use num_traits::cast::{ToPrimitive};
pub(crate) use num_traits::cast::ToPrimitive;
pub(crate) use serde::Deserialize;
pub(crate) use std::collections::VecDeque;
pub(crate) use std::future::Future;

View File

@ -3,9 +3,9 @@ use crate::commands::cp::CopyArgs;
use crate::commands::mkdir::MkdirArgs;
use crate::commands::mv::MoveArgs;
use crate::commands::rm::RemoveArgs;
use nu_errors::ShellError;
use crate::prelude::*;
use crate::stream::OutputStream;
use nu_errors::ShellError;
use nu_source::Tagged;
use std::path::PathBuf;

View File

@ -3,11 +3,11 @@ use crate::commands::cp::CopyArgs;
use crate::commands::mkdir::MkdirArgs;
use crate::commands::mv::MoveArgs;
use crate::commands::rm::RemoveArgs;
use nu_errors::ShellError;
use crate::prelude::*;
use crate::shell::filesystem_shell::FilesystemShell;
use crate::shell::shell::Shell;
use crate::stream::OutputStream;
use nu_errors::ShellError;
use nu_source::Tagged;
use std::error::Error;
use std::path::PathBuf;

View File

@ -131,7 +131,7 @@ fn find_and_replaces() {
cwd: dirs.test(), h::pipeline(
r#"
open sample.toml
| str fortune.teller.phone --find-replace [KATZ 5289]
| str fortune.teller.phone --find-replace [KATZ "5289"]
| get fortune.teller.phone
| echo $it
"#
@ -157,7 +157,7 @@ fn find_and_replaces_without_passing_field() {
r#"
open sample.toml
| get fortune.teller.phone
| str --find-replace [KATZ 5289]
| str --find-replace [KATZ "5289"]
| echo $it
"#
));