Bidirectional communication and streams for plugins (#11911)

This commit is contained in:
Devyn Cairns
2024-02-25 14:32:50 -08:00
committed by GitHub
parent 461f69ac5d
commit 88f1f386bb
47 changed files with 8025 additions and 1496 deletions

View File

@ -26,6 +26,20 @@ fn can_get_custom_value_from_plugin_and_pass_it_over() {
);
}
#[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!(
@ -65,7 +79,10 @@ fn fails_if_passing_engine_custom_values_to_plugins() {
assert!(actual
.err
.contains("Plugin custom-value update can not handle the custom value SQLiteDatabase"));
.contains("`SQLiteDatabase` cannot be sent to plugin"));
assert!(actual
.err
.contains("the `custom_values` plugin does not support this kind of value"));
}
#[test]
@ -81,5 +98,8 @@ fn fails_if_passing_custom_values_across_plugins() {
assert!(actual
.err
.contains("Plugin inc can not handle the custom value CoolCustomValue"));
.contains("`CoolCustomValue` cannot be sent to plugin"));
assert!(actual
.err
.contains("the `inc` plugin does not support this kind of value"));
}