mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 01:43:47 +01:00
Added let command to PluginTest (#12431)
# Description The `let` command is needed for many example tests. This pull request adds the `let` command to the EngineState of Test Plugin. cc: @devyn # User-Facing Changes No user changes. Plugin tests can now have examples with the let keyword. Co-authored-by: Jack Wright <jack.wright@disqo.com>
This commit is contained in:
parent
fe99729cdb
commit
1c5bd21ebc
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3060,6 +3060,7 @@ name = "nu-plugin-test-support"
|
||||
version = "0.92.2"
|
||||
dependencies = [
|
||||
"nu-ansi-term",
|
||||
"nu-cmd-lang",
|
||||
"nu-engine",
|
||||
"nu-parser",
|
||||
"nu-plugin",
|
||||
|
@ -13,6 +13,7 @@ nu-engine = { path = "../nu-engine", version = "0.92.2", features = ["plugin"] }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.92.2", features = ["plugin"] }
|
||||
nu-parser = { path = "../nu-parser", version = "0.92.2", features = ["plugin"] }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.92.2" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.92.2" }
|
||||
nu-ansi-term = { workspace = true }
|
||||
similar = "2.4"
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::{cmp::Ordering, convert::Infallible, sync::Arc};
|
||||
|
||||
use nu_ansi_term::Style;
|
||||
use nu_cmd_lang::Let;
|
||||
use nu_engine::eval_block;
|
||||
use nu_parser::parse;
|
||||
use nu_plugin::{Plugin, PluginCommand, PluginCustomValue, PluginSource};
|
||||
@ -38,6 +39,7 @@ impl PluginTest {
|
||||
) -> Result<PluginTest, ShellError> {
|
||||
let mut engine_state = EngineState::new();
|
||||
let mut working_set = StateWorkingSet::new(&engine_state);
|
||||
working_set.add_decl(Box::new(Let));
|
||||
|
||||
let reg_plugin = fake_register(&mut working_set, name, plugin)?;
|
||||
let source = Arc::new(PluginSource::new(reg_plugin));
|
||||
|
Loading…
Reference in New Issue
Block a user