mirror of
https://github.com/nushell/nushell.git
synced 2025-08-17 11:51:46 +02:00
This reverts commit f0e93c2fa9
(PR #7417).
I'm currently [working on improving cell
paths](https://github.com/nushell/nushell/issues/7498#issuecomment-1356834798),
and I realized that I would need to make several improvements to `into
cellpath` along the lines of Jakub's comment here:
https://github.com/nushell/nushell/pull/7417#issuecomment-1345264955
I don't think `into cellpath` is quite ready for prime-time, and I'd
like to remove it before the upcoming release.
This commit is contained in:
21
src/tests.rs
21
src/tests.rs
@ -25,8 +25,6 @@ use tempfile::NamedTempFile;
|
||||
|
||||
pub type TestResult = Result<(), Box<dyn std::error::Error>>;
|
||||
|
||||
const DEFAULT_CONFIG: &str = "./crates/nu-utils/src/sample_config/default_config.nu";
|
||||
|
||||
pub fn run_test_with_env(input: &str, expected: &str, env: &HashMap<&str, &str>) -> TestResult {
|
||||
let mut file = NamedTempFile::new()?;
|
||||
let name = file.path();
|
||||
@ -56,25 +54,6 @@ pub fn run_test(input: &str, expected: &str) -> TestResult {
|
||||
run_cmd_and_assert(cmd, expected)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn run_test_with_default_config(input: &str, expected: &str) -> TestResult {
|
||||
let mut file = NamedTempFile::new()?;
|
||||
let name = file.path();
|
||||
|
||||
let mut cmd = Command::cargo_bin("nu")?;
|
||||
cmd.arg("--config");
|
||||
cmd.arg(DEFAULT_CONFIG);
|
||||
cmd.arg(name);
|
||||
cmd.env(
|
||||
"PWD",
|
||||
std::env::current_dir().expect("Can't get current dir"),
|
||||
);
|
||||
|
||||
writeln!(file, "{}", input)?;
|
||||
|
||||
run_cmd_and_assert(cmd, expected)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn run_cmd_and_assert(mut cmd: Command, expected: &str) -> TestResult {
|
||||
let output = cmd.output()?;
|
||||
|
@ -1,7 +1,5 @@
|
||||
use crate::tests::{run_test, TestResult};
|
||||
|
||||
use super::run_test_with_default_config;
|
||||
|
||||
#[test]
|
||||
fn shorthand_env_1() -> TestResult {
|
||||
run_test(r#"FOO=BAZ $env.FOO"#, "BAZ")
|
||||
@ -24,11 +22,3 @@ fn convert_non_string_env_var_to_nothing() -> TestResult {
|
||||
"nothing",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn convert_string_to_env_var_cellpath() -> TestResult {
|
||||
run_test_with_default_config(
|
||||
r#"let p = 'ls.use_ls_colors'; $env.config | upsert ($p | into cellpath) false | get ls.use_ls_colors"#,
|
||||
"false",
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user