2019-12-17 18:54:39 +00:00
|
|
|
use nu_test_support::{nu, pipeline};
|
2019-12-15 16:15:06 +00: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 08:44:33 +00:00
|
|
|
| to yaml
|
|
|
|
| from yaml
|
2019-12-15 16:15:06 +00:00
|
|
|
| get environment.global.PROJECT_NAME
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 11:03:43 +00:00
|
|
|
assert_eq!(actual.out, "nushell");
|
2019-12-15 16:15:06 +00:00
|
|
|
}
|
2022-12-27 16:28:24 +00: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());
|
|
|
|
}
|