mirror of
https://github.com/nushell/nushell.git
synced 2025-03-26 23:36:20 +01:00
Add tests for headers command
This commit is contained in:
parent
a520f8e370
commit
4cb22a6a45
@ -1,7 +1,22 @@
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn headers() {
|
||||
fn headers_uses_first_row_as_header() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
open sample_headers.xlsx
|
||||
| get Sheet1
|
||||
| headers
|
||||
| get header0
|
||||
| from-json"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "r1c0r2c0")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn headers_adds_missing_column_name() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
@ -11,5 +26,6 @@ fn headers() {
|
||||
| get Column1
|
||||
| from-json"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "r1c1r2c1")
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ mod first;
|
||||
mod format;
|
||||
mod get;
|
||||
mod group_by;
|
||||
mod headers;
|
||||
mod histogram;
|
||||
mod insert;
|
||||
mod last;
|
||||
|
Loading…
Reference in New Issue
Block a user