mirror of
https://github.com/nushell/nushell.git
synced 2025-04-25 05:38:20 +02: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};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[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!(
|
let actual = nu!(
|
||||||
cwd: "tests/fixtures/formats", pipeline(
|
cwd: "tests/fixtures/formats", pipeline(
|
||||||
r#"
|
r#"
|
||||||
@ -11,5 +26,6 @@ fn headers() {
|
|||||||
| get Column1
|
| get Column1
|
||||||
| from-json"#
|
| from-json"#
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_eq!(actual, "r1c1r2c1")
|
assert_eq!(actual, "r1c1r2c1")
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ mod first;
|
|||||||
mod format;
|
mod format;
|
||||||
mod get;
|
mod get;
|
||||||
mod group_by;
|
mod group_by;
|
||||||
|
mod headers;
|
||||||
mod histogram;
|
mod histogram;
|
||||||
mod insert;
|
mod insert;
|
||||||
mod last;
|
mod last;
|
||||||
|
Loading…
Reference in New Issue
Block a user