mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 12:57:53 +02:00
Revert "Show ?
for optional entries when displaying CellPath
s (#14042)"
This reverts commit 03015ed33f
.
This commit is contained in:
@ -166,7 +166,7 @@ fn select_ignores_errors_successfully1() {
|
|||||||
fn select_ignores_errors_successfully2() {
|
fn select_ignores_errors_successfully2() {
|
||||||
let actual = nu!("[{a: 1} {a: 2} {a: 3}] | select b? | to nuon");
|
let actual = nu!("[{a: 1} {a: 2} {a: 3}] | select b? | to nuon");
|
||||||
|
|
||||||
assert_eq!(actual.out, "[[b?]; [null], [null], [null]]".to_string());
|
assert_eq!(actual.out, "[[b]; [null], [null], [null]]".to_string());
|
||||||
assert!(actual.err.is_empty());
|
assert!(actual.err.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ fn select_ignores_errors_successfully2() {
|
|||||||
fn select_ignores_errors_successfully3() {
|
fn select_ignores_errors_successfully3() {
|
||||||
let actual = nu!("{foo: bar} | select invalid_key? | to nuon");
|
let actual = nu!("{foo: bar} | select invalid_key? | to nuon");
|
||||||
|
|
||||||
assert_eq!(actual.out, "{invalid_key?: null}".to_string());
|
assert_eq!(actual.out, "{invalid_key: null}".to_string());
|
||||||
assert!(actual.err.is_empty());
|
assert!(actual.err.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,10 +184,7 @@ fn select_ignores_errors_successfully4() {
|
|||||||
r#""key val\na 1\nb 2\n" | lines | split column --collapse-empty " " | select foo? | to nuon"#
|
r#""key val\na 1\nb 2\n" | lines | split column --collapse-empty " " | select foo? | to nuon"#
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(actual.out, r#"[[foo]; [null], [null], [null]]"#.to_string());
|
||||||
actual.out,
|
|
||||||
r#"[[foo?]; [null], [null], [null]]"#.to_string()
|
|
||||||
);
|
|
||||||
assert!(actual.err.is_empty());
|
assert!(actual.err.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +234,7 @@ fn ignore_errors_works() {
|
|||||||
[{}] | select -i $path | to nuon
|
[{}] | select -i $path | to nuon
|
||||||
"#);
|
"#);
|
||||||
|
|
||||||
assert_eq!(actual.out, "[[foo?]; [null]]");
|
assert_eq!(actual.out, "[[foo]; [null]]");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -182,14 +182,8 @@ impl Display for CellPath {
|
|||||||
write!(f, ".")?;
|
write!(f, ".")?;
|
||||||
}
|
}
|
||||||
match elem {
|
match elem {
|
||||||
PathMember::Int { val, optional, .. } => {
|
PathMember::Int { val, .. } => write!(f, "{val}")?,
|
||||||
let question_mark = if *optional { "?" } else { "" };
|
PathMember::String { val, .. } => write!(f, "{val}")?,
|
||||||
write!(f, "{val}{question_mark}")?
|
|
||||||
}
|
|
||||||
PathMember::String { val, optional, .. } => {
|
|
||||||
let question_mark = if *optional { "?" } else { "" };
|
|
||||||
write!(f, "{val}{question_mark}")?
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Reference in New Issue
Block a user