From 717aa8f0cb69a7930121d5f2766a67be21011338 Mon Sep 17 00:00:00 2001 From: Sergey Shulepov Date: Wed, 9 Jun 2021 19:17:54 +0200 Subject: [PATCH 1/2] Add BLESS env option Right now if there is a diff between the actual and expected results, the expected file will be overwritten. This may be annoying. To make it controlled we introduce BLESS option. This means that the expected files won't be regenerated unless this environment variable is set. Therefore to regenerate the tests use: BLESS=1 cargo test --- tests/diff.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/diff.rs b/tests/diff.rs index b57a4bb..0c91eb2 100644 --- a/tests/diff.rs +++ b/tests/diff.rs @@ -66,9 +66,11 @@ fn run_diff_test Vec>(test_dir: &str, name: &str, test: } } - dump(&expected_path, actual_wat.as_bytes()).expect("Failed to write to expected"); - - panic!(); + if std::env::var("BLESS").is_ok() { + dump(&expected_path, actual_wat.as_bytes()).expect("Failed to write to expected"); + } else { + panic!(); + } } } From 9e98400de028a8a38f98630b17cd1f8541419077 Mon Sep 17 00:00:00 2001 From: Sergei Shulepov Date: Thu, 10 Jun 2021 10:49:16 +0200 Subject: [PATCH 2/2] Update tests/diff.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- tests/diff.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/diff.rs b/tests/diff.rs index 0c91eb2..12200f4 100644 --- a/tests/diff.rs +++ b/tests/diff.rs @@ -66,7 +66,7 @@ fn run_diff_test Vec>(test_dir: &str, name: &str, test: } } - if std::env::var("BLESS").is_ok() { + if std::env::var_os("BLESS").is_some() { dump(&expected_path, actual_wat.as_bytes()).expect("Failed to write to expected"); } else { panic!();