mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 09:53:43 +01:00
656f707a0b
# Description The working directory doesn't have to be set for those tests (or would be the default anyways). When appropriate also remove calls to the `pipeline()` function. In most places kept the diff minimal and only removed the superfluous part to not pollute the blame view. With simpler tests also simplified things to make them more readable overall (this included removal of the raw string literal). Work for #8670
51 lines
1.1 KiB
Rust
51 lines
1.1 KiB
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[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
|
|
| to yaml
|
|
| from yaml
|
|
| get environment.global.PROJECT_NAME
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "nushell");
|
|
}
|
|
|
|
#[test]
|
|
fn convert_dict_to_yaml_with_boolean_key() {
|
|
let actual = nu!(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!(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!(pipeline(
|
|
r#"
|
|
"2.11: "1" " | from yaml
|
|
"#
|
|
));
|
|
assert!(actual.out.contains("2.11"));
|
|
assert!(actual.err.is_empty());
|
|
}
|