2021-04-04 01:56:46 +02:00
|
|
|
use nu_test_support::fs::AbsolutePath;
|
|
|
|
use nu_test_support::playground::{says, Playground};
|
2020-10-05 21:29:04 +02:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
2021-04-04 01:56:46 +02:00
|
|
|
use hamcrest2::assert_that;
|
|
|
|
use hamcrest2::prelude::*;
|
|
|
|
|
2021-02-19 02:24:27 +01:00
|
|
|
#[cfg(feature = "directories-support")]
|
|
|
|
#[cfg(feature = "which-support")]
|
|
|
|
mod environment;
|
|
|
|
|
2020-01-16 10:05:53 +01:00
|
|
|
mod pipeline;
|
2020-10-05 21:29:04 +02:00
|
|
|
|
2021-04-04 01:56:46 +02:00
|
|
|
#[test]
|
|
|
|
fn runs_configuration_startup_commands() {
|
|
|
|
Playground::setup("init_config_startup_commands_test", |dirs, nu| {
|
2021-04-04 07:14:58 +02:00
|
|
|
let file = AbsolutePath::new(dirs.config_fixtures().join("startup.toml"));
|
2021-04-04 01:56:46 +02:00
|
|
|
|
|
|
|
nu.with_config(&file);
|
|
|
|
|
2021-06-17 21:59:58 +02:00
|
|
|
assert_that!(nu.pipeline("hello-world"), says().stdout("Nu World"));
|
2021-04-04 01:56:46 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-10-05 21:29:04 +02:00
|
|
|
#[test]
|
|
|
|
fn plugins_are_declared_with_wix() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
2020-10-13 23:22:49 +02:00
|
|
|
open Cargo.toml
|
|
|
|
| get bin.name
|
|
|
|
| str find-replace "nu_plugin_(extra|core)_(.*)" "nu_plugin_$2"
|
|
|
|
| drop
|
|
|
|
| sort-by
|
|
|
|
| wrap cargo | merge {
|
2020-10-13 01:18:39 +02:00
|
|
|
open wix/main.wxs --raw | from xml
|
2020-10-05 21:29:04 +02:00
|
|
|
| get Wix.children.Product.children.0.Directory.children.0
|
|
|
|
| where Directory.attributes.Id == "$(var.PlatformProgramFilesFolder)"
|
|
|
|
| get Directory.children.Directory.children.0 | last
|
|
|
|
| get Directory.children.Component.children
|
|
|
|
| each { echo $it | first }
|
|
|
|
| skip
|
|
|
|
| where File.attributes.Name =~ "nu_plugin"
|
|
|
|
| str substring [_, -4] File.attributes.Name
|
|
|
|
| get File.attributes.Name
|
|
|
|
| sort-by
|
2020-10-13 01:18:39 +02:00
|
|
|
| wrap wix
|
|
|
|
}
|
|
|
|
| default wix _
|
2021-05-12 03:01:48 +02:00
|
|
|
| each { if $it.wix != $it.cargo { 1 } { 0 } }
|
2020-10-05 21:29:04 +02:00
|
|
|
| math sum
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "0");
|
|
|
|
}
|