Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
cli-test: Move `let mut args` closer to its uses
Lorenz Leutgeb committed 2 months ago
commit 119445ce6c9be26a3fae1b0e06f34292c5806cd5
parent 56ece48
1 file changed +8 -8
modified crates/radicle-cli-test/src/lib.rs
@@ -410,14 +410,6 @@ impl TestFormula {

            // For each command.
            for (i, assertion) in test.assertions.iter().enumerate() {
-
                // Expand environment variables.
-
                let mut args = assertion.args.clone();
-
                for arg in &mut args {
-
                    for (k, v) in run.envs() {
-
                        *arg = arg.replace(format!("${k}").as_str(), &v);
-
                    }
-
                }
-

                let location = assertion
                    .path
                    .file_name()
@@ -447,6 +439,14 @@ impl TestFormula {
                    continue;
                }

+
                // Expand environment variables.
+
                let mut args = assertion.args.clone();
+
                for arg in &mut args {
+
                    for (k, v) in run.envs() {
+
                        *arg = arg.replace(format!("${k}").as_str(), &v);
+
                    }
+
                }
+

                if !run.path().exists() {
                    log::warn!(target: "test", "{location}: Directory {} does not exist. Creating..", run.path().display());
                    fs::create_dir_all(run.path())?;