forked from extern/nushell
b2c5af457e
This improves incremental build time when working on what was previously the root package. For example, previously all plugins would be rebuilt with a change to `src/commands/classified/external.rs`, but now only `nu-cli` will have to be rebuilt (and anything that depends on it).
31 lines
876 B
Rust
31 lines
876 B
Rust
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
use nu_test_support::playground::Playground;
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
fn extracts_fields_from_the_given_the_pattern() {
|
|
Playground::setup("parse_test_1", |dirs, sandbox| {
|
|
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
"key_value_separated_arepa_ingredients.txt",
|
|
r#"
|
|
VAR1=Cheese
|
|
VAR2=JonathanParsed
|
|
VAR3=NushellSecretIngredient
|
|
"#,
|
|
)]);
|
|
|
|
let actual = nu!(
|
|
cwd: dirs.test(), pipeline(
|
|
r#"
|
|
open key_value_separated_arepa_ingredients.txt
|
|
| parse "{Name}={Value}"
|
|
| nth 1
|
|
| get Value
|
|
| echo $it
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual, "JonathanParsed");
|
|
})
|
|
}
|