mirror of
https://github.com/nushell/nushell
synced 2024-12-26 04:53:09 +00:00
More nuon tests, fix table print (#4762)
This commit is contained in:
parent
4f43d75130
commit
0b6b321ad6
3 changed files with 58 additions and 0 deletions
|
@ -126,3 +126,39 @@ fn binary_roundtrip() {
|
|||
|
||||
assert_eq!(actual.out, "0x[1FFF]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_binary_data() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
open sample.nuon | get 5.3
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "31")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_record() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
open sample.nuon | get 4.name
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "Bobby")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_bool() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
open sample.nuon | get 3 | $in == $true
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "true")
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ pub fn get_columns(input: &[Value]) -> Vec<String> {
|
|||
columns.push(col.to_string());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return vec![];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
20
tests/fixtures/formats/sample.nuon
vendored
Normal file
20
tests/fixtures/formats/sample.nuon
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Some sample nuon values
|
||||
[
|
||||
# The nuon compact table format
|
||||
[[a, nuon, table]; [1, 2, 3], [4, 5, 6]],
|
||||
|
||||
# A filesize
|
||||
100kib,
|
||||
|
||||
# A duration
|
||||
100sec
|
||||
|
||||
# A boolean
|
||||
true,
|
||||
|
||||
# A record
|
||||
{name: "Bobby", age: 99}
|
||||
|
||||
# Binary data
|
||||
0x[11, ff, ee, 1f]
|
||||
]
|
Loading…
Reference in a new issue