From 28fdd3643088ce4692bae0cb792ea0b1decc89a0 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Thu, 3 Jun 2021 01:12:39 -0400 Subject: [PATCH] Remove `dotenv_load` from tests (#853) --- justfile | 2 +- tests/dotenv.rs | 4 ---- tests/misc.rs | 6 +----- tests/test.rs | 42 +++++++++++++++++------------------------- 4 files changed, 19 insertions(+), 35 deletions(-) diff --git a/justfile b/justfile index 03e5299..2dc2089 100755 --- a/justfile +++ b/justfile @@ -83,7 +83,7 @@ push: check git push github pr: push - hub pull-request -o + gh pr create --web # clean up feature branch BRANCH done BRANCH=`git rev-parse --abbrev-ref HEAD`: diff --git a/tests/dotenv.rs b/tests/dotenv.rs index 5ca41ca..6964690 100644 --- a/tests/dotenv.rs +++ b/tests/dotenv.rs @@ -37,7 +37,6 @@ test! { "#, stdout: "undefined\n", stderr: "if [ -n \"${DOTENV_KEY+1}\" ]; then echo defined; else echo undefined; fi\n", - dotenv_load: false, } test! { @@ -50,7 +49,6 @@ test! { "#, stdout: "dotenv-value\n", stderr: "echo $DOTENV_KEY\n", - dotenv_load: false, } test! { @@ -63,7 +61,6 @@ test! { "#, stdout: "dotenv-value\n", stderr: "echo $DOTENV_KEY\n", - dotenv_load: false, } // Un-comment this on 2021-07-01. @@ -89,5 +86,4 @@ test! { // See https://github.com/casey/just/issues/469 for more details. // echo $DOTENV_KEY // ", -// dotenv_load: false, // } diff --git a/tests/misc.rs b/tests/misc.rs index 65e80b6..7bbe6d0 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -1949,14 +1949,10 @@ test! { stdout: " default stdin = `cat justfile`: echo {{stdin}} - - set dotenv-load := true ", stderr: " echo 'default stdin = `cat justfile`: - echo '{{stdin}}' - - set dotenv-load := true' + echo '{{stdin}}'' ", } diff --git a/tests/test.rs b/tests/test.rs index 3067e89..d617c2c 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -15,7 +15,6 @@ macro_rules! test { $(stderr: $stderr:expr,)? $(status: $status:expr,)? $(shell: $shell:expr,)? - $(dotenv_load: $dotenv_load:expr,)? ) => { #[test] fn $name() { @@ -32,7 +31,6 @@ macro_rules! test { $(stderr: $stderr,)? $(status: $status,)? $(shell: $shell,)? - $(dotenv_load: $dotenv_load,)? env, ..crate::test::Test::default() }.run(); @@ -41,29 +39,27 @@ macro_rules! test { } pub(crate) struct Test<'a> { - pub(crate) justfile: &'a str, - pub(crate) args: &'a [&'a str], - pub(crate) env: BTreeMap, - pub(crate) stdin: &'a str, - pub(crate) stdout: &'a str, - pub(crate) stderr: &'a str, - pub(crate) status: i32, - pub(crate) shell: bool, - pub(crate) dotenv_load: bool, + pub(crate) justfile: &'a str, + pub(crate) args: &'a [&'a str], + pub(crate) env: BTreeMap, + pub(crate) stdin: &'a str, + pub(crate) stdout: &'a str, + pub(crate) stderr: &'a str, + pub(crate) status: i32, + pub(crate) shell: bool, } impl<'a> Default for Test<'a> { fn default() -> Test<'a> { Test { - justfile: "", - args: &[], - env: BTreeMap::new(), - stdin: "", - stdout: "", - stderr: "", - status: EXIT_SUCCESS, - shell: true, - dotenv_load: true, + justfile: "", + args: &[], + env: BTreeMap::new(), + stdin: "", + stdout: "", + stderr: "", + status: EXIT_SUCCESS, + shell: true, } } } @@ -72,11 +68,7 @@ impl<'a> Test<'a> { pub(crate) fn run(self) { let tmp = tempdir(); - let mut justfile = unindent(self.justfile); - - if self.dotenv_load { - justfile.push_str("\nset dotenv-load := true\n"); - } + let justfile = unindent(self.justfile); let stdout = unindent(self.stdout); let stderr = unindent(self.stderr);