mirror of
https://github.com/nushell/nushell.git
synced 2024-11-07 09:04:18 +01:00
Revert "Show ?
for optional entries when displaying CellPath
s (#14042)"
This reverts commit 03015ed33f
.
This commit is contained in:
parent
ccab3d6b6e
commit
ac111e547e
@ -166,7 +166,7 @@ fn select_ignores_errors_successfully1() {
|
||||
fn select_ignores_errors_successfully2() {
|
||||
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());
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ fn select_ignores_errors_successfully2() {
|
||||
fn select_ignores_errors_successfully3() {
|
||||
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());
|
||||
}
|
||||
|
||||
@ -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"#
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
r#"[[foo?]; [null], [null], [null]]"#.to_string()
|
||||
);
|
||||
assert_eq!(actual.out, r#"[[foo]; [null], [null], [null]]"#.to_string());
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
@ -237,7 +234,7 @@ fn ignore_errors_works() {
|
||||
[{}] | select -i $path | to nuon
|
||||
"#);
|
||||
|
||||
assert_eq!(actual.out, "[[foo?]; [null]]");
|
||||
assert_eq!(actual.out, "[[foo]; [null]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -182,14 +182,8 @@ impl Display for CellPath {
|
||||
write!(f, ".")?;
|
||||
}
|
||||
match elem {
|
||||
PathMember::Int { val, optional, .. } => {
|
||||
let question_mark = if *optional { "?" } else { "" };
|
||||
write!(f, "{val}{question_mark}")?
|
||||
}
|
||||
PathMember::String { val, optional, .. } => {
|
||||
let question_mark = if *optional { "?" } else { "" };
|
||||
write!(f, "{val}{question_mark}")?
|
||||
}
|
||||
PathMember::Int { val, .. } => write!(f, "{val}")?,
|
||||
PathMember::String { val, .. } => write!(f, "{val}")?,
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user