2019-12-17 19:54:39 +01:00
|
|
|
use nu_test_support::{nu, pipeline};
|
2019-12-15 17:15:06 +01:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn table_to_yaml_text_and_from_yaml_text_back_into_table() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
open appveyor.yml
|
2020-05-04 10:44:33 +02:00
|
|
|
| to yaml
|
|
|
|
| from yaml
|
2019-12-15 17:15:06 +01:00
|
|
|
| get environment.global.PROJECT_NAME
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert_eq!(actual.out, "nushell");
|
2019-12-15 17:15:06 +01:00
|
|
|
}
|
2022-12-27 17:28:24 +01:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn convert_dict_to_yaml_with_boolean_key() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
"true: BooleanKey " | from yaml
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
assert!(actual.out.contains("BooleanKey"));
|
|
|
|
assert!(actual.err.is_empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn convert_dict_to_yaml_with_integer_key() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
"200: [] " | from yaml
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert!(actual.out.contains("200"));
|
|
|
|
assert!(actual.err.is_empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn convert_dict_to_yaml_with_integer_floats_key() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
"2.11: "1" " | from yaml
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
assert!(actual.out.contains("2.11"));
|
|
|
|
assert!(actual.err.is_empty());
|
|
|
|
}
|