2020-03-29 04:05:57 +02:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
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
|
2020-05-04 10:44:33 +02:00
|
|
|
| from json"#
|
2020-03-29 04:05:57 +02:00
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert_eq!(actual.out, "r1c0r2c0")
|
2020-03-29 04:05:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn headers_adds_missing_column_name() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
open sample_headers.xlsx
|
|
|
|
| get Sheet1
|
|
|
|
| headers
|
|
|
|
| get Column1
|
2020-05-04 10:44:33 +02:00
|
|
|
| from json"#
|
2020-03-29 04:05:57 +02:00
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert_eq!(actual.out, "r1c1r2c1")
|
2020-03-29 04:05:57 +02:00
|
|
|
}
|