2019-07-16 12:28:55 +02:00
|
|
|
mod helpers;
|
2019-06-02 05:37:09 +02:00
|
|
|
|
2019-07-16 12:28:55 +02:00
|
|
|
use helpers::in_directory as cwd;
|
2019-08-02 18:33:52 +02:00
|
|
|
use helpers::normalize_string;
|
2019-06-02 05:37:09 +02:00
|
|
|
|
2019-07-16 12:28:55 +02:00
|
|
|
#[test]
|
|
|
|
fn external_num() {
|
2019-08-28 19:01:16 +02:00
|
|
|
let output = nu!(
|
2019-07-16 12:28:55 +02:00
|
|
|
cwd("tests/fixtures/formats"),
|
2019-07-22 05:52:57 +02:00
|
|
|
"open sgml_description.json | get glossary.GlossDiv.GlossList.GlossEntry.Height | echo $it"
|
|
|
|
);
|
|
|
|
|
2019-07-16 12:28:55 +02:00
|
|
|
assert_eq!(output, "10");
|
|
|
|
}
|
2019-06-24 09:59:23 +02:00
|
|
|
|
2019-08-02 18:33:52 +02:00
|
|
|
#[test]
|
|
|
|
fn external_has_correct_quotes() {
|
2019-08-28 19:01:16 +02:00
|
|
|
let output = nu!(cwd("."), r#"echo "hello world""#);
|
2019-08-02 18:33:52 +02:00
|
|
|
|
|
|
|
let output = normalize_string(&output);
|
|
|
|
|
|
|
|
assert_eq!(output, r#""hello world""#);
|
|
|
|
}
|
|
|
|
|
2019-07-22 05:52:57 +02:00
|
|
|
#[test]
|
|
|
|
fn add_plugin() {
|
2019-08-28 19:01:16 +02:00
|
|
|
let output = nu!(
|
2019-07-22 05:52:57 +02:00
|
|
|
cwd("tests/fixtures/formats"),
|
2019-08-27 13:14:19 +02:00
|
|
|
r#"open cargo_sample.toml | add dev-dependencies.newdep "1" | get dev-dependencies.newdep | echo $it"#
|
2019-08-01 11:25:48 +02:00
|
|
|
);
|
2019-07-22 05:52:57 +02:00
|
|
|
|
|
|
|
assert_eq!(output, "1");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn edit_plugin() {
|
2019-08-28 19:01:16 +02:00
|
|
|
let output = nu!(
|
2019-07-22 05:52:57 +02:00
|
|
|
cwd("tests/fixtures/formats"),
|
2019-08-27 13:14:19 +02:00
|
|
|
r#"open cargo_sample.toml | edit dev-dependencies.pretty_assertions "7" | get dev-dependencies.pretty_assertions | echo $it"#
|
2019-08-01 11:25:48 +02:00
|
|
|
);
|
2019-07-22 05:52:57 +02:00
|
|
|
|
|
|
|
assert_eq!(output, "7");
|
|
|
|
}
|