Change instances of Value::string("foo", Span::test_data()) to Value::test_string("foo") (#7592)

This commit is contained in:
Leon
2022-12-24 19:25:38 +10:00
committed by GitHub
parent 3d682fe957
commit 11bdab7e61
50 changed files with 191 additions and 235 deletions

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, Example, PipelineData, Signature, Span, SyntaxShape, Type, Value};
use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value};
#[derive(Clone)]
pub struct DefEnv;
@ -72,7 +72,7 @@ def-env cd_with_fallback [arg = ""] {
vec![Example {
description: "Set environment variable by call a custom command",
example: r#"def-env foo [] { let-env BAR = "BAZ" }; foo; $env.BAR"#,
result: Some(Value::string("BAZ", Span::test_data())),
result: Some(Value::test_string("BAZ")),
}]
}
}

View File

@ -2,7 +2,7 @@ use nu_engine::get_full_help;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, IntoPipelineData, PipelineData, Signature, Span, Type, Value,
Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value,
};
#[derive(Clone)]
@ -56,7 +56,7 @@ impl Command for ExportCommand {
vec![Example {
description: "Export a definition from a module",
example: r#"module utils { export def my-command [] { "hello" } }; use utils my-command; my-command"#,
result: Some(Value::string("hello", Span::test_data())),
result: Some(Value::test_string("hello")),
}]
}

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, Example, PipelineData, Signature, Span, SyntaxShape, Type, Value};
use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value};
#[derive(Clone)]
pub struct ExportDef;
@ -46,7 +46,7 @@ impl Command for ExportDef {
vec![Example {
description: "Define a custom command in a module and call it",
example: r#"module spam { export def foo [] { "foo" } }; use spam foo; foo"#,
result: Some(Value::string("foo", Span::test_data())),
result: Some(Value::test_string("foo")),
}]
}

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, Example, PipelineData, Signature, Span, SyntaxShape, Type, Value};
use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value};
#[derive(Clone)]
pub struct ExportDefEnv;
@ -72,7 +72,7 @@ export def-env cd_with_fallback [arg = ""] {
vec![Example {
description: "Define a custom command that participates in the environment in a module and call it",
example: r#"module foo { export def-env bar [] { let-env FOO_BAR = "BAZ" } }; use foo bar; bar; $env.FOO_BAR"#,
result: Some(Value::string("BAZ", Span::test_data())),
result: Some(Value::test_string("BAZ")),
}]
}

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, Example, PipelineData, Signature, Span, SyntaxShape, Type, Value};
use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value};
#[derive(Clone)]
pub struct ExportUse;
@ -53,7 +53,7 @@ impl Command for ExportUse {
use eggs foo
foo
"#,
result: Some(Value::string("foo", Span::test_data())),
result: Some(Value::test_string("foo")),
}]
}

View File

@ -1,6 +1,6 @@
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, Example, PipelineData, Signature, Span, SyntaxShape, Type, Value};
use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value};
#[derive(Clone)]
pub struct Module;
@ -46,17 +46,17 @@ impl Command for Module {
Example {
description: "Define a custom command in a module and call it",
example: r#"module spam { export def foo [] { "foo" } }; use spam foo; foo"#,
result: Some(Value::string("foo", Span::test_data())),
result: Some(Value::test_string("foo")),
},
Example {
description: "Define an environment variable in a module",
example: r#"module foo { export-env { let-env FOO = "BAZ" } }; use foo; $env.FOO"#,
result: Some(Value::string("BAZ", Span::test_data())),
result: Some(Value::test_string("BAZ")),
},
Example {
description: "Define a custom command that participates in the environment in a module and call it",
example: r#"module foo { export def-env bar [] { let-env FOO_BAR = "BAZ" } }; use foo bar; bar; $env.FOO_BAR"#,
result: Some(Value::string("BAZ", Span::test_data())),
result: Some(Value::test_string("BAZ")),
},
]
}

View File

@ -1,7 +1,7 @@
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Type, Value,
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
};
#[derive(Clone)]
@ -52,7 +52,7 @@ impl Command for OverlayList {
example: r#"module spam { export def foo [] { "foo" } }
overlay use spam
overlay list | last"#,
result: Some(Value::string("spam", Span::test_data())),
result: Some(Value::test_string("spam")),
}]
}
}

View File

@ -2,7 +2,7 @@ use nu_engine::{eval_block, find_in_dirs_env, redirect_env};
use nu_protocol::ast::{Call, Expr, Expression};
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
};
#[derive(Clone)]
@ -122,12 +122,12 @@ impl Command for Use {
Example {
description: "Define a custom command in a module and call it",
example: r#"module spam { export def foo [] { "foo" } }; use spam foo; foo"#,
result: Some(Value::string("foo", Span::test_data())),
result: Some(Value::test_string("foo")),
},
Example {
description: "Define a custom command that participates in the environment in a module and call it",
example: r#"module foo { export def-env bar [] { let-env FOO_BAR = "BAZ" } }; use foo bar; bar; $env.FOO_BAR"#,
result: Some(Value::string("BAZ", Span::test_data())),
result: Some(Value::test_string("BAZ")),
},
]
}