mirror of
https://github.com/nushell/nushell.git
synced 2024-11-29 11:54:02 +01:00
run rustfmt
This commit is contained in:
parent
f47349c1a0
commit
127381497c
@ -10,8 +10,7 @@ impl WholeStreamCommand for CD {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("cd")
|
Signature::build("cd").optional("directory", SyntaxType::Path)
|
||||||
.optional("directory", SyntaxType::Path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::{Dictionary, Value};
|
use crate::data::{Dictionary, Value};
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use chrono::{DateTime, Local, Utc};
|
use chrono::{DateTime, Local, Utc};
|
||||||
|
|
||||||
|
@ -11,8 +11,7 @@ impl WholeStreamCommand for Exit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("exit")
|
Signature::build("exit").switch("now")
|
||||||
.switch("now")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
|
@ -16,8 +16,7 @@ impl WholeStreamCommand for First {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("first")
|
Signature::build("first").required("amount", SyntaxType::Literal)
|
||||||
.required("amount", SyntaxType::Literal)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ExpectedRange;
|
|
||||||
use crate::data::{Primitive, TaggedDictBuilder, Value};
|
use crate::data::{Primitive, TaggedDictBuilder, Value};
|
||||||
|
use crate::errors::ExpectedRange;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use bson::{decode_document, spec::BinarySubtype, Bson};
|
use bson::{decode_document, spec::BinarySubtype, Bson};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::Value;
|
use crate::data::Value;
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
pub struct Get;
|
pub struct Get;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::commands::command::CommandAction;
|
use crate::commands::command::CommandAction;
|
||||||
use crate::commands::PerItemCommand;
|
use crate::commands::PerItemCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::{command_dict, TaggedDictBuilder};
|
use crate::data::{command_dict, TaggedDictBuilder};
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::parser::registry;
|
use crate::parser::registry;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::{Primitive, Value};
|
use crate::data::{Primitive, Value};
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::context::CommandRegistry;
|
use crate::context::CommandRegistry;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::base::select_fields;
|
use crate::data::base::select_fields;
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::commands::UnevaluatedCallInfo;
|
use crate::commands::UnevaluatedCallInfo;
|
||||||
use crate::context::SpanSource;
|
use crate::context::SpanSource;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::Value;
|
use crate::data::Value;
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::parser::hir::SyntaxType;
|
use crate::parser::hir::SyntaxType;
|
||||||
use crate::parser::registry::Signature;
|
use crate::parser::registry::Signature;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::base::reject_fields;
|
use crate::data::base::reject_fields;
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::{UnevaluatedCallInfo, WholeStreamCommand};
|
use crate::commands::{UnevaluatedCallInfo, WholeStreamCommand};
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::Value;
|
use crate::data::Value;
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::TaggedDictBuilder;
|
use crate::data::TaggedDictBuilder;
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
pub struct Shells;
|
pub struct Shells;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::{TaggedDictBuilder, Value};
|
use crate::data::{TaggedDictBuilder, Value};
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
pub struct Size;
|
pub struct Size;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::{Primitive, TaggedDictBuilder, Value};
|
use crate::data::{Primitive, TaggedDictBuilder, Value};
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
|
||||||
@ -40,7 +40,11 @@ impl WholeStreamCommand for SplitColumn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn split_column(
|
fn split_column(
|
||||||
SplitColumnArgs { separator, rest, collapse_empty}: SplitColumnArgs,
|
SplitColumnArgs {
|
||||||
|
separator,
|
||||||
|
rest,
|
||||||
|
collapse_empty,
|
||||||
|
}: SplitColumnArgs,
|
||||||
RunnableContext { input, name, .. }: RunnableContext,
|
RunnableContext { input, name, .. }: RunnableContext,
|
||||||
) -> Result<OutputStream, ShellError> {
|
) -> Result<OutputStream, ShellError> {
|
||||||
Ok(input
|
Ok(input
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::{Primitive, Value};
|
use crate::data::{Primitive, Value};
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
|
||||||
@ -17,8 +17,7 @@ impl WholeStreamCommand for SplitRow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("split-row")
|
Signature::build("split-row").required("separator", SyntaxType::Any)
|
||||||
.required("separator", SyntaxType::Any)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::{TaggedDictBuilder, Value};
|
use crate::data::{TaggedDictBuilder, Value};
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
pub struct Tags;
|
pub struct Tags;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::Value;
|
use crate::data::Value;
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
pub struct Trim;
|
pub struct Trim;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::{Dictionary, Value};
|
use crate::data::{Dictionary, Value};
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::parser::registry::Signature;
|
use crate::parser::registry::Signature;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
|
@ -12,8 +12,7 @@ impl PerItemCommand for Where {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> registry::Signature {
|
fn signature(&self) -> registry::Signature {
|
||||||
Signature::build("where")
|
Signature::build("where").required("condition", SyntaxType::Block)
|
||||||
.required("condition", SyntaxType::Block)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
@ -43,9 +42,7 @@ impl PerItemCommand for Where {
|
|||||||
VecDeque::new()
|
VecDeque::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => return Err(e),
|
||||||
return Err(e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Tagged { tag, .. } => {
|
Tagged { tag, .. } => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::errors::ShellError;
|
|
||||||
use crate::data::Value;
|
use crate::data::Value;
|
||||||
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
@ -13,8 +13,7 @@ impl WholeStreamCommand for Which {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("which")
|
Signature::build("which").required("name", SyntaxType::Any)
|
||||||
.required("name", SyntaxType::Any)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
|
@ -28,8 +28,8 @@ pub use crate::parser::parse::token_tree_builder::TokenTreeBuilder;
|
|||||||
pub use crate::plugin::{serve_plugin, Plugin};
|
pub use crate::plugin::{serve_plugin, Plugin};
|
||||||
pub use crate::utils::{AbsoluteFile, AbsolutePath, RelativePath};
|
pub use crate::utils::{AbsoluteFile, AbsolutePath, RelativePath};
|
||||||
pub use cli::cli;
|
pub use cli::cli;
|
||||||
pub use data::config::{APP_INFO, config_path};
|
|
||||||
pub use data::base::{Primitive, Value};
|
pub use data::base::{Primitive, Value};
|
||||||
|
pub use data::config::{config_path, APP_INFO};
|
||||||
pub use data::dict::{Dictionary, TaggedDictBuilder};
|
pub use data::dict::{Dictionary, TaggedDictBuilder};
|
||||||
pub use data::meta::{Span, Tag, Tagged, TaggedItem};
|
pub use data::meta::{Span, Tag, Tagged, TaggedItem};
|
||||||
pub use errors::{CoerceInto, ShellError};
|
pub use errors::{CoerceInto, ShellError};
|
||||||
|
@ -20,7 +20,6 @@ impl ToDebug for Operator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Operator {
|
impl Operator {
|
||||||
|
|
||||||
pub fn print(&self) -> String {
|
pub fn print(&self) -> String {
|
||||||
self.as_str().to_string()
|
self.as_str().to_string()
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ impl Skip {
|
|||||||
|
|
||||||
impl Plugin for Skip {
|
impl Plugin for Skip {
|
||||||
fn config(&mut self) -> Result<Signature, ShellError> {
|
fn config(&mut self) -> Result<Signature, ShellError> {
|
||||||
Ok(Signature::build("skip")
|
Ok(Signature::build("skip")
|
||||||
.desc("Skip a number of rows")
|
.desc("Skip a number of rows")
|
||||||
.rest(SyntaxType::Number)
|
.rest(SyntaxType::Number)
|
||||||
.filter())
|
.filter())
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
pub(crate) mod completer;
|
pub(crate) mod completer;
|
||||||
pub(crate) mod filesystem_shell;
|
pub(crate) mod filesystem_shell;
|
||||||
|
pub(crate) mod help_shell;
|
||||||
pub(crate) mod helper;
|
pub(crate) mod helper;
|
||||||
pub(crate) mod shell;
|
pub(crate) mod shell;
|
||||||
pub(crate) mod shell_manager;
|
pub(crate) mod shell_manager;
|
||||||
pub(crate) mod value_shell;
|
pub(crate) mod value_shell;
|
||||||
pub(crate) mod help_shell;
|
|
||||||
|
|
||||||
pub(crate) use helper::Helper;
|
pub(crate) use helper::Helper;
|
||||||
|
@ -207,8 +207,7 @@ impl Shell for FilesystemShell {
|
|||||||
|
|
||||||
let mut stream = VecDeque::new();
|
let mut stream = VecDeque::new();
|
||||||
|
|
||||||
stream.push_back(
|
stream.push_back(ReturnSuccess::change_cwd(
|
||||||
ReturnSuccess::change_cwd(
|
|
||||||
path.to_string_lossy().to_string(),
|
path.to_string_lossy().to_string(),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -113,29 +113,30 @@ fn filesystem_change_to_a_directory_containing_spaces() {
|
|||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(PathBuf::from(actual), dirs.test().join("robalino turner katz"));
|
assert_eq!(
|
||||||
|
PathBuf::from(actual),
|
||||||
|
dirs.test().join("robalino turner katz")
|
||||||
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn filesystem_directory_not_found() {
|
fn filesystem_directory_not_found() {
|
||||||
let actual = nu_error!(
|
let actual = nu_error!(
|
||||||
cwd: "tests/fixtures",
|
cwd: "tests/fixtures",
|
||||||
"cd dir_that_does_not_exist"
|
"cd dir_that_does_not_exist"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert!(actual.contains("dir_that_does_not_exist"));
|
assert!(actual.contains("dir_that_does_not_exist"));
|
||||||
assert!(actual.contains("directory not found"));
|
assert!(actual.contains("directory not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn valuesystem_change_from_current_path_using_relative_path() {
|
fn valuesystem_change_from_current_path_using_relative_path() {
|
||||||
Playground::setup("cd_test_8", |dirs, sandbox| {
|
Playground::setup("cd_test_8", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
path = "src/plugins/turner.rs"
|
path = "src/plugins/turner.rs"
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ fn valuesystem_change_from_current_path_using_relative_path() {
|
|||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
path = "src/plugins/katz.rs"
|
path = "src/plugins/katz.rs"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -164,10 +165,9 @@ fn valuesystem_change_from_current_path_using_relative_path() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn valuesystem_change_from_current_path_using_absolute_path() {
|
fn valuesystem_change_from_current_path_using_absolute_path() {
|
||||||
Playground::setup("cd_test_9", |dirs, sandbox| {
|
Playground::setup("cd_test_9", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
turner-ts = "0.1.1"
|
turner-ts = "0.1.1"
|
||||||
robalino-tkd = "0.0.1"
|
robalino-tkd = "0.0.1"
|
||||||
@ -178,7 +178,7 @@ fn valuesystem_change_from_current_path_using_absolute_path() {
|
|||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
path = "src/plugins/bbq.rs"
|
path = "src/plugins/bbq.rs"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -199,10 +199,9 @@ fn valuesystem_change_from_current_path_using_absolute_path() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn valuesystem_switch_back_to_previous_working_path() {
|
fn valuesystem_switch_back_to_previous_working_path() {
|
||||||
Playground::setup("cd_test_10", |dirs, sandbox| {
|
Playground::setup("cd_test_10", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
turner-ts = "0.1.1"
|
turner-ts = "0.1.1"
|
||||||
robalino-tkd = "0.0.1"
|
robalino-tkd = "0.0.1"
|
||||||
@ -214,7 +213,7 @@ fn valuesystem_switch_back_to_previous_working_path() {
|
|||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
path = "src/plugins/bbq.rs"
|
path = "src/plugins/bbq.rs"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -267,7 +266,6 @@ fn valuesystem_change_from_current_path_using_relative_path_and_dash() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn valuesystem_change_current_path_to_parent_path() {
|
fn valuesystem_change_current_path_to_parent_path() {
|
||||||
Playground::setup("cd_test_12", |dirs, sandbox| {
|
Playground::setup("cd_test_12", |dirs, sandbox| {
|
||||||
@ -298,13 +296,12 @@ fn valuesystem_change_current_path_to_parent_path() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn valuesystem_change_to_home_directory() {
|
fn valuesystem_change_to_home_directory() {
|
||||||
Playground::setup("cd_test_13", |dirs, sandbox| {
|
Playground::setup("cd_test_13", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[paquete]
|
[paquete]
|
||||||
el = "pollo loco"
|
el = "pollo loco"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -325,13 +322,12 @@ fn valuesystem_change_to_home_directory() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn valuesystem_change_to_a_path_containing_spaces() {
|
fn valuesystem_change_to_a_path_containing_spaces() {
|
||||||
Playground::setup("cd_test_14", |dirs, sandbox| {
|
Playground::setup("cd_test_14", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
["pa que te"]
|
["pa que te"]
|
||||||
el = "pollo loco"
|
el = "pollo loco"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
|
@ -7,25 +7,23 @@ use std::path::PathBuf;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn has_default_configuration_file() {
|
fn has_default_configuration_file() {
|
||||||
let expected = "config.toml";
|
let expected = "config.toml";
|
||||||
|
|
||||||
Playground::setup("config_test_1", |dirs, _| {
|
Playground::setup("config_test_1", |dirs, _| {
|
||||||
|
|
||||||
nu!(cwd: dirs.root(), "config");
|
nu!(cwd: dirs.root(), "config");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
dirs.config_path().join(expected),
|
dirs.config_path().join(expected),
|
||||||
nu::config_path().unwrap().join(expected)
|
nu::config_path().unwrap().join(expected)
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn shows_path_of_configuration_file() {
|
fn shows_path_of_configuration_file() {
|
||||||
let expected = "config.toml";
|
let expected = "config.toml";
|
||||||
|
|
||||||
Playground::setup("config_test_2", |dirs, _| {
|
Playground::setup("config_test_2", |dirs, _| {
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(),
|
cwd: dirs.test(),
|
||||||
"config --path | echo $it"
|
"config --path | echo $it"
|
||||||
@ -38,14 +36,13 @@ fn shows_path_of_configuration_file() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn use_different_configuration() {
|
fn use_different_configuration() {
|
||||||
Playground::setup("config_test_3", |dirs, sandbox| {
|
Playground::setup("config_test_3", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"test_3.toml",
|
||||||
"test_3.toml",
|
r#"
|
||||||
r#"
|
|
||||||
caballero_1 = "Andrés N. Robalino"
|
caballero_1 = "Andrés N. Robalino"
|
||||||
caballero_2 = "Jonathan Turner"
|
caballero_2 = "Jonathan Turner"
|
||||||
caballero_3 = "Yehuda katz"
|
caballero_3 = "Yehuda katz"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -57,20 +54,19 @@ fn use_different_configuration() {
|
|||||||
assert_eq!(actual, "Andrés N. Robalino");
|
assert_eq!(actual, "Andrés N. Robalino");
|
||||||
});
|
});
|
||||||
|
|
||||||
h::delete_file_at(nu::config_path().unwrap().join("test_3.toml"));
|
h::delete_file_at(nu::config_path().unwrap().join("test_3.toml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sets_configuration_value() {
|
fn sets_configuration_value() {
|
||||||
Playground::setup("config_test_4", |dirs, sandbox| {
|
Playground::setup("config_test_4", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"test_4.toml",
|
||||||
"test_4.toml",
|
r#"
|
||||||
r#"
|
|
||||||
caballero_1 = "Andrés N. Robalino"
|
caballero_1 = "Andrés N. Robalino"
|
||||||
caballero_2 = "Jonathan Turner"
|
caballero_2 = "Jonathan Turner"
|
||||||
caballero_3 = "Yehuda katz"
|
caballero_3 = "Yehuda katz"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
nu!(
|
nu!(
|
||||||
@ -79,27 +75,26 @@ fn sets_configuration_value() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.root(),
|
cwd: dirs.root(),
|
||||||
r#"open "{}/test_4.toml" | get caballero_4 | echo $it"#,
|
r#"open "{}/test_4.toml" | get caballero_4 | echo $it"#,
|
||||||
dirs.config_path()
|
dirs.config_path()
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(actual, "jonas");
|
assert_eq!(actual, "jonas");
|
||||||
});
|
});
|
||||||
|
|
||||||
h::delete_file_at(nu::config_path().unwrap().join("test_4.toml"));
|
h::delete_file_at(nu::config_path().unwrap().join("test_4.toml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn removes_configuration_value() {
|
fn removes_configuration_value() {
|
||||||
Playground::setup("config_test_5", |dirs, sandbox| {
|
Playground::setup("config_test_5", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"test_5.toml",
|
||||||
"test_5.toml",
|
r#"
|
||||||
r#"
|
|
||||||
caballeros = [1, 1, 1]
|
caballeros = [1, 1, 1]
|
||||||
podershell = [1, 1, 1]
|
podershell = [1, 1, 1]
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
nu!(
|
nu!(
|
||||||
@ -108,13 +103,13 @@ fn removes_configuration_value() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let actual = nu_error!(
|
let actual = nu_error!(
|
||||||
cwd: dirs.root(),
|
cwd: dirs.root(),
|
||||||
r#"open "{}/test_5.toml" | get podershell | echo $it"#,
|
r#"open "{}/test_5.toml" | get podershell | echo $it"#,
|
||||||
dirs.config_path()
|
dirs.config_path()
|
||||||
);
|
);
|
||||||
|
|
||||||
assert!(actual.contains("table missing column"));
|
assert!(actual.contains("table missing column"));
|
||||||
});
|
});
|
||||||
|
|
||||||
h::delete_file_at(nu::config_path().unwrap().join("test_5.toml"));
|
h::delete_file_at(nu::config_path().unwrap().join("test_5.toml"));
|
||||||
}
|
}
|
@ -6,11 +6,10 @@ use helpers::{Playground, Stub::*};
|
|||||||
#[test]
|
#[test]
|
||||||
fn ls_lists_regular_files() {
|
fn ls_lists_regular_files() {
|
||||||
Playground::setup("ls_test_1", |dirs, sandbox| {
|
Playground::setup("ls_test_1", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![
|
||||||
.with_files(vec![
|
EmptyFile("yehuda.10.txt"),
|
||||||
EmptyFile("yehuda.10.txt"),
|
EmptyFile("jonathan.10.txt"),
|
||||||
EmptyFile("jonathan.10.txt"),
|
EmptyFile("andres.10.txt"),
|
||||||
EmptyFile("andres.10.txt"),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -34,12 +33,11 @@ fn ls_lists_regular_files() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn ls_lists_regular_files_using_asterisk_wildcard() {
|
fn ls_lists_regular_files_using_asterisk_wildcard() {
|
||||||
Playground::setup("ls_test_2", |dirs, sandbox| {
|
Playground::setup("ls_test_2", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![
|
||||||
.with_files(vec![
|
EmptyFile("los.1.txt"),
|
||||||
EmptyFile("los.1.txt"),
|
EmptyFile("tres.1.txt"),
|
||||||
EmptyFile("tres.1.txt"),
|
EmptyFile("amigos.1.txt"),
|
||||||
EmptyFile("amigos.1.txt"),
|
EmptyFile("arepas.1.clu"),
|
||||||
EmptyFile("arepas.1.clu"),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -63,12 +61,11 @@ fn ls_lists_regular_files_using_asterisk_wildcard() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn ls_lists_regular_files_using_question_mark_wildcard() {
|
fn ls_lists_regular_files_using_question_mark_wildcard() {
|
||||||
Playground::setup("ls_test_3", |dirs, sandbox| {
|
Playground::setup("ls_test_3", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![
|
||||||
.with_files(vec![
|
EmptyFile("yehuda.10.txt"),
|
||||||
EmptyFile("yehuda.10.txt"),
|
EmptyFile("jonathan.10.txt"),
|
||||||
EmptyFile("jonathan.10.txt"),
|
EmptyFile("andres.10.txt"),
|
||||||
EmptyFile("andres.10.txt"),
|
EmptyFile("chicken_not_to_be_picked_up.100.txt"),
|
||||||
EmptyFile("chicken_not_to_be_picked_up.100.txt"),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
|
@ -26,11 +26,7 @@ fn moves_a_file() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn overwrites_if_moving_to_existing_file() {
|
fn overwrites_if_moving_to_existing_file() {
|
||||||
Playground::setup("mv_test_2", |dirs, sandbox| {
|
Playground::setup("mv_test_2", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![EmptyFile("andres.txt"), EmptyFile("jonathan.txt")]);
|
||||||
.with_files(vec![
|
|
||||||
EmptyFile("andres.txt"),
|
|
||||||
EmptyFile("jonathan.txt")
|
|
||||||
]);
|
|
||||||
|
|
||||||
let original = dirs.test().join("andres.txt");
|
let original = dirs.test().join("andres.txt");
|
||||||
let expected = dirs.test().join("jonathan.txt");
|
let expected = dirs.test().join("jonathan.txt");
|
||||||
@ -142,7 +138,7 @@ fn moves_using_path_with_wildcard() {
|
|||||||
EmptyFile("sgml_description.json"),
|
EmptyFile("sgml_description.json"),
|
||||||
EmptyFile("sample.ini"),
|
EmptyFile("sample.ini"),
|
||||||
EmptyFile("utf16.ini"),
|
EmptyFile("utf16.ini"),
|
||||||
EmptyFile("yehuda.ini")
|
EmptyFile("yehuda.ini"),
|
||||||
])
|
])
|
||||||
.mkdir("work_dir")
|
.mkdir("work_dir")
|
||||||
.mkdir("expected");
|
.mkdir("expected");
|
||||||
@ -150,10 +146,7 @@ fn moves_using_path_with_wildcard() {
|
|||||||
let work_dir = dirs.test().join("work_dir");
|
let work_dir = dirs.test().join("work_dir");
|
||||||
let expected = dirs.test().join("expected");
|
let expected = dirs.test().join("expected");
|
||||||
|
|
||||||
nu!(
|
nu!(cwd: work_dir, "mv ../originals/*.ini ../expected");
|
||||||
cwd: work_dir,
|
|
||||||
"mv ../originals/*.ini ../expected"
|
|
||||||
);
|
|
||||||
|
|
||||||
assert!(h::files_exist_at(
|
assert!(h::files_exist_at(
|
||||||
vec!["yehuda.ini", "jonathan.ini", "sample.ini", "andres.ini",],
|
vec!["yehuda.ini", "jonathan.ini", "sample.ini", "andres.ini",],
|
||||||
@ -170,7 +163,7 @@ fn moves_using_a_glob() {
|
|||||||
.with_files(vec![
|
.with_files(vec![
|
||||||
EmptyFile("arepa.txt"),
|
EmptyFile("arepa.txt"),
|
||||||
EmptyFile("empanada.txt"),
|
EmptyFile("empanada.txt"),
|
||||||
EmptyFile("taquiza.txt")
|
EmptyFile("taquiza.txt"),
|
||||||
])
|
])
|
||||||
.mkdir("work_dir")
|
.mkdir("work_dir")
|
||||||
.mkdir("expected");
|
.mkdir("expected");
|
||||||
@ -179,10 +172,7 @@ fn moves_using_a_glob() {
|
|||||||
let work_dir = dirs.test().join("work_dir");
|
let work_dir = dirs.test().join("work_dir");
|
||||||
let expected = dirs.test().join("expected");
|
let expected = dirs.test().join("expected");
|
||||||
|
|
||||||
nu!(
|
nu!(cwd: work_dir, "mv ../meals/* ../expected");
|
||||||
cwd: work_dir,
|
|
||||||
"mv ../meals/* ../expected"
|
|
||||||
);
|
|
||||||
|
|
||||||
assert!(meal_dir.exists());
|
assert!(meal_dir.exists());
|
||||||
assert!(h::files_exist_at(
|
assert!(h::files_exist_at(
|
||||||
|
@ -6,9 +6,7 @@ use helpers::{Playground, Stub::*};
|
|||||||
#[test]
|
#[test]
|
||||||
fn rm_removes_a_file() {
|
fn rm_removes_a_file() {
|
||||||
Playground::setup("rm_test_1", |dirs, sandbox| {
|
Playground::setup("rm_test_1", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![EmptyFile("i_will_be_deleted.txt")]);
|
||||||
.with_files(vec![EmptyFile("i_will_be_deleted.txt")
|
|
||||||
]);
|
|
||||||
|
|
||||||
nu!(
|
nu!(
|
||||||
cwd: dirs.root(),
|
cwd: dirs.root(),
|
||||||
@ -29,7 +27,7 @@ fn rm_removes_files_with_wildcard() {
|
|||||||
.with_files(vec![
|
.with_files(vec![
|
||||||
EmptyFile("cli.rs"),
|
EmptyFile("cli.rs"),
|
||||||
EmptyFile("lib.rs"),
|
EmptyFile("lib.rs"),
|
||||||
EmptyFile("prelude.rs")
|
EmptyFile("prelude.rs"),
|
||||||
])
|
])
|
||||||
.within("src/parser")
|
.within("src/parser")
|
||||||
.with_files(vec![EmptyFile("parse.rs"), EmptyFile("parser.rs")])
|
.with_files(vec![EmptyFile("parse.rs"), EmptyFile("parser.rs")])
|
||||||
@ -38,8 +36,8 @@ fn rm_removes_files_with_wildcard() {
|
|||||||
.within("src/parser/hir")
|
.within("src/parser/hir")
|
||||||
.with_files(vec![
|
.with_files(vec![
|
||||||
EmptyFile("baseline_parse.rs"),
|
EmptyFile("baseline_parse.rs"),
|
||||||
EmptyFile("baseline_parse_tokens.rs")
|
EmptyFile("baseline_parse_tokens.rs"),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
nu!(
|
nu!(
|
||||||
cwd: dirs.test(),
|
cwd: dirs.test(),
|
||||||
@ -70,7 +68,7 @@ fn rm_removes_deeply_nested_directories_with_wildcard_and_recursive_flag() {
|
|||||||
.with_files(vec![
|
.with_files(vec![
|
||||||
EmptyFile("cli.rs"),
|
EmptyFile("cli.rs"),
|
||||||
EmptyFile("lib.rs"),
|
EmptyFile("lib.rs"),
|
||||||
EmptyFile("prelude.rs")
|
EmptyFile("prelude.rs"),
|
||||||
])
|
])
|
||||||
.within("src/parser")
|
.within("src/parser")
|
||||||
.with_files(vec![EmptyFile("parse.rs"), EmptyFile("parser.rs")])
|
.with_files(vec![EmptyFile("parse.rs"), EmptyFile("parser.rs")])
|
||||||
@ -79,8 +77,8 @@ fn rm_removes_deeply_nested_directories_with_wildcard_and_recursive_flag() {
|
|||||||
.within("src/parser/hir")
|
.within("src/parser/hir")
|
||||||
.with_files(vec![
|
.with_files(vec![
|
||||||
EmptyFile("baseline_parse.rs"),
|
EmptyFile("baseline_parse.rs"),
|
||||||
EmptyFile("baseline_parse_tokens.rs")
|
EmptyFile("baseline_parse_tokens.rs"),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
nu!(
|
nu!(
|
||||||
cwd: dirs.test(),
|
cwd: dirs.test(),
|
||||||
@ -109,11 +107,10 @@ fn rm_removes_directory_contents_without_recursive_flag_if_empty() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn rm_removes_directory_contents_with_recursive_flag() {
|
fn rm_removes_directory_contents_with_recursive_flag() {
|
||||||
Playground::setup("rm_test_5", |dirs, sandbox| {
|
Playground::setup("rm_test_5", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![
|
||||||
.with_files(vec![
|
EmptyFile("yehuda.txt"),
|
||||||
EmptyFile("yehuda.txt"),
|
EmptyFile("jonathan.txt"),
|
||||||
EmptyFile("jonathan.txt"),
|
EmptyFile("andres.txt"),
|
||||||
EmptyFile("andres.txt")
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
nu!(
|
nu!(
|
||||||
@ -128,9 +125,7 @@ fn rm_removes_directory_contents_with_recursive_flag() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn rm_errors_if_attempting_to_delete_a_directory_with_content_without_recursive_flag() {
|
fn rm_errors_if_attempting_to_delete_a_directory_with_content_without_recursive_flag() {
|
||||||
Playground::setup("rm_test_6", |dirs, sandbox| {
|
Playground::setup("rm_test_6", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![EmptyFile("some_empty_file.txt")]);
|
||||||
.with_files(vec![EmptyFile("some_empty_file.txt")
|
|
||||||
]);
|
|
||||||
|
|
||||||
let actual = nu_error!(
|
let actual = nu_error!(
|
||||||
cwd: dirs.root(),
|
cwd: dirs.root(),
|
||||||
|
@ -3,8 +3,8 @@ mod helpers;
|
|||||||
#[test]
|
#[test]
|
||||||
fn external_command() {
|
fn external_command() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests/fixtures",
|
cwd: "tests/fixtures",
|
||||||
"echo 1"
|
"echo 1"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert!(actual.contains("1"));
|
assert!(actual.contains("1"));
|
||||||
|
@ -15,13 +15,12 @@ fn can_only_apply_one() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn by_one_with_field_passed() {
|
fn by_one_with_field_passed() {
|
||||||
Playground::setup("plugin_inc_test_1", |dirs, sandbox| {
|
Playground::setup("plugin_inc_test_1", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[package]
|
[package]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -36,13 +35,12 @@ fn by_one_with_field_passed() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn by_one_with_no_field_passed() {
|
fn by_one_with_no_field_passed() {
|
||||||
Playground::setup("plugin_inc_test_2", |dirs, sandbox| {
|
Playground::setup("plugin_inc_test_2", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[package]
|
[package]
|
||||||
contributors = "2"
|
contributors = "2"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -57,13 +55,12 @@ fn by_one_with_no_field_passed() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn semversion_major_inc() {
|
fn semversion_major_inc() {
|
||||||
Playground::setup("plugin_inc_test_3", |dirs, sandbox| {
|
Playground::setup("plugin_inc_test_3", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[package]
|
[package]
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -78,13 +75,12 @@ fn semversion_major_inc() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn semversion_minor_inc() {
|
fn semversion_minor_inc() {
|
||||||
Playground::setup("plugin_inc_test_4", |dirs, sandbox| {
|
Playground::setup("plugin_inc_test_4", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[package]
|
[package]
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -99,13 +95,12 @@ fn semversion_minor_inc() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn semversion_patch_inc() {
|
fn semversion_patch_inc() {
|
||||||
Playground::setup("plugin_inc_test_5", |dirs, sandbox| {
|
Playground::setup("plugin_inc_test_5", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[package]
|
[package]
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
@ -120,13 +115,12 @@ fn semversion_patch_inc() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn semversion_without_passing_field() {
|
fn semversion_without_passing_field() {
|
||||||
Playground::setup("plugin_inc_test_6", |dirs, sandbox| {
|
Playground::setup("plugin_inc_test_6", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[package]
|
[package]
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
"#
|
"#,
|
||||||
)]);
|
)]);
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
mod helpers;
|
mod helpers;
|
||||||
|
|
||||||
use helpers as h;
|
|
||||||
use h::{Playground, Stub::*};
|
use h::{Playground, Stub::*};
|
||||||
|
use helpers as h;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_only_apply_one() {
|
fn can_only_apply_one() {
|
||||||
@ -39,10 +39,9 @@ fn acts_without_passing_field() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn downcases() {
|
fn downcases() {
|
||||||
Playground::setup("plugin_str_test_2", |dirs, sandbox| {
|
Playground::setup("plugin_str_test_2", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[dependency]
|
[dependency]
|
||||||
name = "LIGHT"
|
name = "LIGHT"
|
||||||
"#,
|
"#,
|
||||||
@ -60,10 +59,9 @@ fn downcases() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn upcases() {
|
fn upcases() {
|
||||||
Playground::setup("plugin_str_test_3", |dirs, sandbox| {
|
Playground::setup("plugin_str_test_3", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[package]
|
[package]
|
||||||
name = "nushell"
|
name = "nushell"
|
||||||
"#,
|
"#,
|
||||||
@ -98,10 +96,9 @@ fn converts_to_int() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn replaces() {
|
fn replaces() {
|
||||||
Playground::setup("plugin_str_test_4", |dirs, sandbox| {
|
Playground::setup("plugin_str_test_4", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[package]
|
[package]
|
||||||
name = "nushell"
|
name = "nushell"
|
||||||
"#,
|
"#,
|
||||||
@ -124,10 +121,9 @@ fn replaces() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn find_and_replaces() {
|
fn find_and_replaces() {
|
||||||
Playground::setup("plugin_str_test_5", |dirs, sandbox| {
|
Playground::setup("plugin_str_test_5", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
"sample.toml",
|
||||||
"sample.toml",
|
r#"
|
||||||
r#"
|
|
||||||
[fortune.teller]
|
[fortune.teller]
|
||||||
phone = "1-800-KATZ"
|
phone = "1-800-KATZ"
|
||||||
"#,
|
"#,
|
||||||
@ -150,10 +146,9 @@ fn find_and_replaces() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn find_and_replaces_without_passing_field() {
|
fn find_and_replaces_without_passing_field() {
|
||||||
Playground::setup("plugin_str_test_6", |dirs, sandbox| {
|
Playground::setup("plugin_str_test_6", |dirs, sandbox| {
|
||||||
sandbox
|
sandbox.with_files(vec![FileWithContent(
|
||||||
.with_files(vec![FileWithContent(
|
|
||||||
"sample.toml",
|
"sample.toml",
|
||||||
r#"
|
r#"
|
||||||
[fortune.teller]
|
[fortune.teller]
|
||||||
phone = "1-800-KATZ"
|
phone = "1-800-KATZ"
|
||||||
"#,
|
"#,
|
||||||
|
Loading…
Reference in New Issue
Block a user