From 1c760112eef92eb51ada4ab00e45568adcf62b97 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdx@users.noreply.github.com> Date: Wed, 29 May 2024 23:43:42 -0500 Subject: [PATCH] test: added reset() to more tests --- src/shell/fish.rs | 8 +++++++- src/shell/zsh.rs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/shell/fish.rs b/src/shell/fish.rs index 843e17dfb..cce2ee9c5 100644 --- a/src/shell/fish.rs +++ b/src/shell/fish.rs @@ -126,13 +126,15 @@ impl Shell for Fish { #[cfg(test)] mod tests { use insta::assert_snapshot; + use test_log::test; - use crate::test::replace_path; + use crate::test::{replace_path, reset}; use super::*; #[test] fn test_activate() { + reset(); let fish = Fish::default(); let exe = Path::new("/some/dir/mise"); assert_snapshot!(fish.activate(exe, " --status".into())); @@ -140,22 +142,26 @@ mod tests { #[test] fn test_set_env() { + reset(); assert_snapshot!(Fish::default().set_env("FOO", "1")); } #[test] fn test_prepend_env() { + reset(); let sh = Fish::default(); assert_snapshot!(replace_path(&sh.prepend_env("PATH", "/some/dir:/2/dir"))); } #[test] fn test_unset_env() { + reset(); assert_snapshot!(Fish::default().unset_env("FOO")); } #[test] fn test_deactivate() { + reset(); let deactivate = Fish::default().deactivate(); assert_snapshot!(replace_path(&deactivate)); } diff --git a/src/shell/zsh.rs b/src/shell/zsh.rs index b4b63c628..d65ef5031 100644 --- a/src/shell/zsh.rs +++ b/src/shell/zsh.rs @@ -104,13 +104,15 @@ impl Shell for Zsh { #[cfg(test)] mod tests { use insta::assert_snapshot; + use test_log::test; - use crate::test::replace_path; + use crate::test::{replace_path, reset}; use super::*; #[test] fn test_activate() { + reset(); let zsh = Zsh::default(); let exe = Path::new("/some/dir/mise"); assert_snapshot!(zsh.activate(exe, " --status".into())); @@ -118,22 +120,26 @@ mod tests { #[test] fn test_set_env() { + reset(); assert_snapshot!(Zsh::default().set_env("FOO", "1")); } #[test] fn test_prepend_env() { + reset(); let sh = Bash::default(); assert_snapshot!(replace_path(&sh.prepend_env("PATH", "/some/dir:/2/dir"))); } #[test] fn test_unset_env() { + reset(); assert_snapshot!(Zsh::default().unset_env("FOO")); } #[test] fn test_deactivate() { + reset(); let deactivate = Zsh::default().deactivate(); assert_snapshot!(replace_path(&deactivate)); }