diff options
author | Melody Horn <melody@boringcactus.com> | 2024-11-11 14:46:19 -0700 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2024-11-11 14:46:19 -0700 |
commit | fbbcf325b8bbe72f924da6a7cdb128d973ef0026 (patch) | |
tree | 783dc988b77c95fd739b30a436a496b7c0c550c2 /tests | |
parent | 5aa6e1122830611dccc2eab9b7f4a53a10056111 (diff) | |
download | makers-fbbcf325b8bbe72f924da6a7cdb128d973ef0026.tar.gz makers-fbbcf325b8bbe72f924da6a7cdb128d973ef0026.zip |
fix conditional assignment when original is inherited
Diffstat (limited to 'tests')
-rw-r--r-- | tests/conditional_assignment_inheritance.rs | 28 | ||||
-rw-r--r-- | tests/update_logic.rs | 14 | ||||
-rw-r--r-- | tests/utils/mod.rs | 13 |
3 files changed, 44 insertions, 11 deletions
diff --git a/tests/conditional_assignment_inheritance.rs b/tests/conditional_assignment_inheritance.rs new file mode 100644 index 0000000..cb7e806 --- /dev/null +++ b/tests/conditional_assignment_inheritance.rs @@ -0,0 +1,28 @@ +mod utils; + +use std::fs; +use utils::{make, R}; + +#[test] +#[cfg(feature = "full")] +fn conditional_assignment_inheritance_test() -> R { + let dir = tempfile::tempdir()?; + + let file_a = " +EGG = bug +include file_b.mk +check: +\t@echo $(EGG) +"; + fs::write(dir.path().join("Makefile"), file_a)?; + let file_b = " +EGG ?= nope +"; + fs::write(dir.path().join("file_b.mk"), file_b)?; + + let result = make(&dir)?; + assert!(result.status.success()); + assert_eq!(String::from_utf8(result.stdout)?.trim(), "bug"); + + Ok(()) +} diff --git a/tests/update_logic.rs b/tests/update_logic.rs index 9e37b19..0c97ad5 100644 --- a/tests/update_logic.rs +++ b/tests/update_logic.rs @@ -1,19 +1,11 @@ use std::fs; -use std::path::Path; -use std::process::{Command, Output}; -use eyre::{Result, WrapErr}; +use eyre::WrapErr; use std::thread::sleep; use std::time::Duration; -type R = Result<()>; - -fn make(dir: impl AsRef<Path>) -> Result<Output> { - Command::new(env!("CARGO_BIN_EXE_makers")) - .current_dir(dir) - .output() - .wrap_err("") -} +mod utils; +use utils::{make, R}; #[test] fn basic_test() -> R { diff --git a/tests/utils/mod.rs b/tests/utils/mod.rs new file mode 100644 index 0000000..8b834c1 --- /dev/null +++ b/tests/utils/mod.rs @@ -0,0 +1,13 @@ +use std::path::Path; +use std::process::{Command, Output}; + +use eyre::Context; + +pub type R = eyre::Result<()>; + +pub fn make(dir: impl AsRef<Path>) -> eyre::Result<Output> { + Command::new(env!("CARGO_BIN_EXE_makers")) + .current_dir(dir) + .output() + .wrap_err("") +} |