mirror of
https://github.com/nushell/nushell.git
synced 2024-12-24 07:59:21 +01:00
067ceedf79
# Description The intended effect of the `extra` feature has been undermined by introducing the full builds on our release pages and having more activity on some of the extra commands. To simplify the feature matrix let's get rid of it and focus our effort on truly either refining a command to well-specified behavior or discarding it entirely from the `nu` binary and moving it into plugins. ## Details - Remove `--features extra` from CI - Don't explicitly name `extra` in full build wf - Remove feature extra from build-help scripts - Update README in `nu-cmd-extra` - Remove feature `extra` - Fix previously dead `format pattern` tests - Relax signature of `to html` - Fix/ignore `html::test_no_color_flag` - Remove dead features from `version` - Refine `to html` type signature # User-Facing Changes The commands that were previously only available when building with `--features extra` will now be available to everyone. This increases the number of dependencies slightly but has a limited impact on the overall binary size. # Tests + Formatting Some tests that were left in `nu-command` during cratification were dead because the feature was not passed to `nu-command` and only to `nu-cmd-lang` for feature-flag mention in `version`. Those tests have now been either fixed or ignored in one case. # After Submitting There may be places in the documentation where we point to `--features extra` that will now be moot (apart from the generated command help)
119 lines
3.0 KiB
Rust
119 lines
3.0 KiB
Rust
use nu_test_support::nu_with_plugins;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn can_get_custom_value_from_plugin_and_instantly_collapse_it() {
|
|
let actual = nu_with_plugins!(
|
|
cwd: "tests",
|
|
plugin: ("nu_plugin_custom_values"),
|
|
"custom-value generate"
|
|
);
|
|
|
|
assert_eq!(actual.out, "I used to be a custom value! My data was (abc)");
|
|
}
|
|
|
|
#[test]
|
|
fn can_get_custom_value_from_plugin_and_pass_it_over() {
|
|
let actual = nu_with_plugins!(
|
|
cwd: "tests",
|
|
plugin: ("nu_plugin_custom_values"),
|
|
"custom-value generate | custom-value update"
|
|
);
|
|
|
|
assert_eq!(
|
|
actual.out,
|
|
"I used to be a custom value! My data was (abcxyz)"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn can_get_custom_value_from_plugin_and_pass_it_over_as_an_argument() {
|
|
let actual = nu_with_plugins!(
|
|
cwd: "tests",
|
|
plugin: ("nu_plugin_custom_values"),
|
|
"custom-value update-arg (custom-value generate)"
|
|
);
|
|
|
|
assert_eq!(
|
|
actual.out,
|
|
"I used to be a custom value! My data was (abcxyz)"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn can_generate_and_updated_multiple_types_of_custom_values() {
|
|
let actual = nu_with_plugins!(
|
|
cwd: "tests",
|
|
plugin: ("nu_plugin_custom_values"),
|
|
"custom-value generate2 | custom-value update"
|
|
);
|
|
|
|
assert_eq!(
|
|
actual.out,
|
|
"I used to be a DIFFERENT custom value! (xyzabc)"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn can_generate_custom_value_and_pass_through_closure() {
|
|
let actual = nu_with_plugins!(
|
|
cwd: "tests",
|
|
plugin: ("nu_plugin_custom_values"),
|
|
"custom-value generate2 { custom-value update }"
|
|
);
|
|
|
|
assert_eq!(
|
|
actual.out,
|
|
"I used to be a DIFFERENT custom value! (xyzabc)"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn can_get_describe_plugin_custom_values() {
|
|
let actual = nu_with_plugins!(
|
|
cwd: "tests",
|
|
plugin: ("nu_plugin_custom_values"),
|
|
"custom-value generate | describe"
|
|
);
|
|
|
|
assert_eq!(actual.out, "CoolCustomValue");
|
|
}
|
|
|
|
// There are currently no custom values defined by the engine that aren't hidden behind an extra
|
|
// feature
|
|
#[cfg(feature = "sqlite")]
|
|
#[test]
|
|
fn fails_if_passing_engine_custom_values_to_plugins() {
|
|
let actual = nu_with_plugins!(
|
|
cwd: "tests/fixtures/formats",
|
|
plugin: ("nu_plugin_custom_values"),
|
|
"open sample.db | custom-value update"
|
|
);
|
|
|
|
assert!(actual
|
|
.err
|
|
.contains("`SQLiteDatabase` cannot be sent to plugin"));
|
|
assert!(actual
|
|
.err
|
|
.contains("the `custom_values` plugin does not support this kind of value"));
|
|
}
|
|
|
|
#[test]
|
|
fn fails_if_passing_custom_values_across_plugins() {
|
|
let actual = nu_with_plugins!(
|
|
cwd: "tests",
|
|
plugins: [
|
|
("nu_plugin_custom_values"),
|
|
("nu_plugin_inc")
|
|
],
|
|
"custom-value generate | inc --major"
|
|
);
|
|
|
|
assert!(actual
|
|
.err
|
|
.contains("`CoolCustomValue` cannot be sent to plugin"));
|
|
assert!(actual
|
|
.err
|
|
.contains("the `inc` plugin does not support this kind of value"));
|
|
}
|