Clean up which/which-support Cargo feature (#5019)

* Rename "which" feature to "which-support"

* Ignore currently broken environment tests
This commit is contained in:
Reilly Wood 2022-03-29 04:10:43 -07:00 committed by GitHub
parent a2872b4ccc
commit 79182db587
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 30 additions and 14 deletions

View File

@ -74,13 +74,13 @@ embed-resource = "1"
[features]
plugin = ["nu-plugin", "nu-cli/plugin", "nu-parser/plugin", "nu-command/plugin", "nu-protocol/plugin", "nu-engine/plugin"]
default = ["plugin", "which", "zip-support", "trash-support"]
default = ["plugin", "which-support", "zip-support", "trash-support"]
stable = ["default"]
extra = ["default", "dataframe"]
wasi = []
# Stable (Default)
which = ["nu-command/which"]
which-support = ["nu-command/which"]
zip-support = ["nu-command/zip"]
trash-support = ["nu-command/trash-support"]

View File

@ -256,7 +256,7 @@ fn features_enabled() -> Vec<String> {
names.push("uuid".to_string());
}
#[cfg(feature = "which")]
#[cfg(feature = "which-support")]
{
names.push("which".to_string());
}

View File

@ -142,7 +142,7 @@ pub fn create_default_context(cwd: impl AsRef<Path>) -> EngineState {
Sys,
};
#[cfg(feature = "which")]
#[cfg(feature = "which-support")]
bind_command! { Which };
// Strings

View File

@ -128,7 +128,7 @@ fn get_entries_in_nu(
all_entries
}
#[cfg(feature = "which")]
#[cfg(feature = "which-support")]
fn get_first_entry_in_path(
item: &str,
span: Span,
@ -140,7 +140,7 @@ fn get_first_entry_in_path(
.ok()
}
#[cfg(not(feature = "which"))]
#[cfg(not(feature = "which-support"))]
fn get_first_entry_in_path(
_item: &str,
_span: Span,
@ -150,7 +150,7 @@ fn get_first_entry_in_path(
None
}
#[cfg(feature = "which")]
#[cfg(feature = "which-support")]
fn get_all_entries_in_path(
item: &str,
span: Span,
@ -165,7 +165,7 @@ fn get_all_entries_in_path(
.unwrap_or_default()
}
#[cfg(not(feature = "which"))]
#[cfg(not(feature = "which-support"))]
fn get_all_entries_in_path(
_item: &str,
_span: Span,

View File

@ -66,7 +66,7 @@ mod update;
mod upsert;
mod use_;
mod where_;
#[cfg(feature = "which")]
#[cfg(feature = "which-support")]
mod which;
mod with_env;
mod wrap;

View File

@ -14,6 +14,8 @@ fn env_shorthand() {
assert_eq!(actual.out, "bar");
}
// FIXME: shorthand breaks when there's an equals sign in the env var
#[ignore]
#[test]
fn env_shorthand_with_equals() {
let actual = nu!(cwd: ".", r#"
@ -22,6 +24,8 @@ fn env_shorthand_with_equals() {
assert_eq!(actual.out, "my_module=info");
}
// FIXME: shorthand breaks when there's an equals sign in the env var
#[ignore]
#[test]
fn env_shorthand_with_comma_equals() {
let actual = nu!(cwd: ".", r#"
@ -30,6 +34,8 @@ fn env_shorthand_with_comma_equals() {
assert_eq!(actual.out, "info,my_module=info");
}
// FIXME: shorthand breaks when there's an equals sign in the env var
#[ignore]
#[test]
fn env_shorthand_with_comma_colons_equals() {
let actual = nu!(cwd: ".", r#"
@ -38,6 +44,8 @@ fn env_shorthand_with_comma_colons_equals() {
assert_eq!(actual.out, "info,my_module=info,lib_crate::lib_mod=trace");
}
// FIXME: shorthand breaks when there's an equals sign in the env var
#[ignore]
#[test]
fn env_shorthand_multi_second_with_comma_colons_equals() {
let actual = nu!(cwd: ".", r#"
@ -49,6 +57,8 @@ fn env_shorthand_multi_second_with_comma_colons_equals() {
);
}
// FIXME: shorthand breaks when there's an equals sign in the env var
#[ignore]
#[test]
fn env_shorthand_multi_first_with_comma_colons_equals() {
let actual = nu!(cwd: ".", r#"
@ -68,6 +78,8 @@ fn env_shorthand_multi() {
assert_eq!(actual.out, "barbaz");
}
// FIXME: for some reason Nu is attempting to execute foo in `let-env FOO = foo`
#[ignore]
#[test]
fn passes_let_env_env_var_to_external_process() {
let actual = nu!(cwd: ".", r#"
@ -85,6 +97,8 @@ fn passes_with_env_env_var_to_external_process() {
assert_eq!(actual.out, "foo");
}
// FIXME: autoenv not currently implemented
#[ignore]
#[test]
#[serial]
fn passes_env_from_local_cfg_to_external_process() {

View File

@ -1,5 +1,7 @@
mod env;
mod nu_env;
// FIXME: nu_env tests depend on autoenv which hasn't been ported yet
// mod nu_env;
pub mod support {
use nu_test_support::{nu, playground::*, Outcome};

View File

@ -1,6 +1,6 @@
use nu_test_support::nu;
#[cfg(feature = "which")]
#[cfg(feature = "which-support")]
#[test]
fn shows_error_for_command_not_found() {
let actual = nu!(
@ -11,7 +11,7 @@ fn shows_error_for_command_not_found() {
assert!(!actual.err.is_empty());
}
#[cfg(feature = "which")]
#[cfg(feature = "which-support")]
#[test]
fn shows_error_for_command_not_found_in_pipeline() {
let actual = nu!(
@ -23,7 +23,7 @@ fn shows_error_for_command_not_found_in_pipeline() {
}
#[ignore] // jt: we can't test this using the -c workaround currently
#[cfg(feature = "which")]
#[cfg(feature = "which-support")]
#[test]
fn automatically_change_directory() {
use nu_test_support::playground::Playground;

View File

@ -647,7 +647,7 @@ fn run_dynamic_blocks() {
assert_eq!(actual.out, "holaaaa");
}
#[cfg(feature = "which")]
#[cfg(feature = "which-support")]
#[test]
fn argument_subexpression_reports_errors() {
let actual = nu!(