nushell/tests/plugins/register.rs
Devyn Cairns a29efe28f7
Merge stream_example into example plugin and clean up names (#12234)
# Description

As suggested by @WindSoilder, since plugins can now contain both simple
commands that produce `Value` and commands that produce `PipelineData`
without having to choose one or the other for the whole plugin, this
change merges `stream_example` into `example`.

# User-Facing Changes

All of the example plugins are renamed.

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

- [ ] Check nushell/nushell.github.io for any docs that match the
command names changed
2024-03-19 12:36:46 -05:00

30 lines
818 B
Rust

use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
#[test]
fn help() {
Playground::setup("help", |dirs, _| {
let actual = nu_with_plugins!(
cwd: dirs.test(),
plugin: ("nu_plugin_example"),
"example one --help"
);
assert!(actual.out.contains("PluginSignature test 1"));
assert!(actual.out.contains("Extra usage for example one"));
})
}
#[test]
fn search_terms() {
Playground::setup("search_terms", |dirs, _| {
let actual = nu_with_plugins!(
cwd: dirs.test(),
plugin: ("nu_plugin_example"),
r#"help commands | where name == "example one" | echo $"search terms: ($in.search_terms)""#
);
assert!(actual.out.contains("search terms: [example]"));
})
}