Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 703f882

Browse files
committed
Clarify assert and expect messages
This rewords some messages in recently added tests to use "It ..." in a way that people reading test run output are likely to find intuitive, using it in places where it will be clear, and rewording to remove it in one place where it would be misleading.
1 parent 60465a5 commit 703f882

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

gix-path/src/env/git/tests.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,16 @@ use serial_test::serial;
362362
fn check_exe_info() {
363363
let path = super::exe_info()
364364
.map(crate::from_bstring)
365-
.expect("Nonempty config in the test environment");
365+
.expect("It is present in the test environment (nonempty config)");
366366

367367
assert!(
368368
path.is_absolute(),
369-
"Absolute, unless overridden such as with GIT_CONFIG_SYSTEM"
369+
"It is absolute (unless overridden such as with GIT_CONFIG_SYSTEM)"
370+
);
371+
assert!(
372+
path.exists(),
373+
"It should exist on disk, since `git config` just found an entry there"
370374
);
371-
assert!(path.exists(), "Exists, since `git config` just found an entry there");
372375
}
373376

374377
#[test]
@@ -380,7 +383,7 @@ fn exe_info() {
380383
#[test]
381384
#[serial]
382385
fn exe_info_tolerates_broken_tmp() {
383-
let empty = gix_testtools::tempfile::tempdir().expect("We can create a new temporary subdirectory");
386+
let empty = gix_testtools::tempfile::tempdir().expect("can create new temporary subdirectory");
384387
let nonexistent = empty.path().join("nonexistent");
385388
assert!(!nonexistent.exists(), "Test bug: Need nonexistent directory");
386389
let nonexistent_str = nonexistent.to_str().expect("valid Unicode");
@@ -426,7 +429,7 @@ fn exe_info_never_from_local_scope_even_if_temp_is_here() {
426429
assert_eq!(
427430
std::env::temp_dir(),
428431
repo,
429-
"It is likely that setting up the test failed"
432+
"Possible test bug: Setting up the test may have failed"
430433
);
431434
let maybe_path = super::exe_info();
432435
assert_eq!(

0 commit comments

Comments
 (0)