Remove dotenv_load from tests (#853)

This commit is contained in:
Casey Rodarmor 2021-06-03 01:12:39 -04:00 committed by GitHub
parent 0a9ffd7a7b
commit 28fdd36430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 35 deletions

View File

@ -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`:

View File

@ -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,
// }

View File

@ -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}}''
",
}

View File

@ -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<String, String>,
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<String, String>,
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);