History

Omit excess punctuation in `expect` messages

This removes the periods from the ends of sentences passed as `expect` messages in recently introduced tests and their helpers, because when called on a `Result`, `Some text: Result info` is better than `Some text.: Result info`. Doing this also improves stylistic consistency with other `expect` messages in the project. I didn't make an analogous change to assertion messages, because the awkward `.:` construction does not arise from them. There may be further refinement that can be done, as the new `expect` messages are still worded as assertions and, as such, could be misread as claiming that the situation they decribe wrongly happened, rather than the intended meaning that it wrongly did not happen. This also changes "key" to "registry key" in one of the `expect` messages so that its meaning is clear in output of big test runs.

Eliah Kagan committed 2 years ago

Commit 76e3b281 parent 464e0a21 file · +11 −11Browse files

Unified · Split

gix-path/src/env/git.rs+11−11
@@ -388,14 +388,14 @@ mod tests { · 387 unmodified lines
388 /// [knownfolderid]: https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid#remarks388 /// [knownfolderid]: https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid#remarks
389 fn obtain_envlessly() -> Self {389 fn obtain_envlessly() -> Self {
390 let pf_current = get_known_folder_path(KnownFolder::ProgramFiles)390 let pf_current = get_known_folder_path(KnownFolder::ProgramFiles)
391 .expect("The process architecture specific program files folder is always available.");391 .expect("The process architecture specific program files folder is always available");
392 392
393 let pf_x86 = get_known_folder_path(KnownFolder::ProgramFilesX86)393 let pf_x86 = get_known_folder_path(KnownFolder::ProgramFilesX86)
394 .expect("The x86 program files folder will in practice always be available.");394 .expect("The x86 program files folder will in practice always be available");
395 395
396 let maybe_pf_64bit = RegKey::predef(HKEY_LOCAL_MACHINE)396 let maybe_pf_64bit = RegKey::predef(HKEY_LOCAL_MACHINE)
397 .open_subkey_with_flags(r"SOFTWARE\Microsoft\Windows\CurrentVersion", KEY_QUERY_VALUE)397 .open_subkey_with_flags(r"SOFTWARE\Microsoft\Windows\CurrentVersion", KEY_QUERY_VALUE)
398 .expect("The `CurrentVersion` key exists and allows reading.")398 .expect("The `CurrentVersion` registry key exists and allows reading")
399 .get_value::<OsString, _>("ProgramW6432Dir")399 .get_value::<OsString, _>("ProgramW6432Dir")
400 .map(PathBuf::from)400 .map(PathBuf::from)
401 .map_err(|error| {401 .map_err(|error| {
@@ -416,7 +416,7 @@ mod tests { · 14 unmodified lines
416 /// This checks that `obtain_envlessly()` returned paths that are likely to be correct and416 /// This checks that `obtain_envlessly()` returned paths that are likely to be correct and
417 /// that satisfy the most important properties based on the current system and process.417 /// that satisfy the most important properties based on the current system and process.
418 fn validate(self) -> Self {418 fn validate(self) -> Self {
419 match PlatformArchitecture::current().expect("Process and system 'bitness' should be available.") {419 match PlatformArchitecture::current().expect("Process and system 'bitness' should be available") {
420 PlatformArchitecture::Is32on32 => {420 PlatformArchitecture::Is32on32 => {
421 assert_eq!(421 assert_eq!(
422 self.current.as_os_str(),422 self.current.as_os_str(),
@@ -425,7 +425,7 @@ mod tests { · 2 unmodified lines
425 );425 );
426 for trailing_arch in [" (x86)", " (Arm)"] {426 for trailing_arch in [" (x86)", " (Arm)"] {
427 let is_adorned = ends_with_case_insensitive(self.current.as_os_str(), trailing_arch)427 let is_adorned = ends_with_case_insensitive(self.current.as_os_str(), trailing_arch)
428 .expect("Assume the test system's important directories are valid Unicode.");428 .expect("Assume the test system's important directories are valid Unicode");
429 assert!(429 assert!(
430 !is_adorned,430 !is_adorned,
431 "The 32-bit program files directory name on a 32-bit system mentions no architecture.",431 "The 32-bit program files directory name on a 32-bit system mentions no architecture.",
@@ -445,7 +445,7 @@ mod tests { · 13 unmodified lines
445 let pf_64bit = self445 let pf_64bit = self
446 .maybe_64bit446 .maybe_64bit
447 .as_ref()447 .as_ref()
448 .expect("The 64-bit program files directory exists.");448 .expect("The 64-bit program files directory exists");
449 assert_ne!(449 assert_ne!(
450 &self.x86, pf_64bit,450 &self.x86, pf_64bit,
451 "The 32-bit and 64-bit program files directories have different locations.",451 "The 32-bit and 64-bit program files directories have different locations.",
@@ -455,7 +455,7 @@ mod tests { · 3 unmodified lines
455 let pf_64bit = self455 let pf_64bit = self
456 .maybe_64bit456 .maybe_64bit
457 .as_ref()457 .as_ref()
458 .expect("The 64-bit program files directory exists.");458 .expect("The 64-bit program files directory exists");
459 assert_eq!(459 assert_eq!(
460 self.current.as_os_str(),460 self.current.as_os_str(),
461 pf_64bit.as_os_str(),461 pf_64bit.as_os_str(),
@@ -487,13 +487,13 @@ mod tests { · 25 unmodified lines
487 let prefix_64bit = pf487 let prefix_64bit = pf
488 .maybe_64bit488 .maybe_64bit
489 .as_ref()489 .as_ref()
490 .expect("It gives two paths only if one can be 64-bit.");490 .expect("It gives two paths only if one can be 64-bit");
491 let suffix_64bit = primary491 let suffix_64bit = primary
492 .strip_prefix(prefix_64bit)492 .strip_prefix(prefix_64bit)
493 .expect("It gives the 64-bit path and lists it first.");493 .expect("It gives the 64-bit path and lists it first");
494 let suffix_x86 = secondary494 let suffix_x86 = secondary
495 .strip_prefix(pf.x86.as_path())495 .strip_prefix(pf.x86.as_path())
496 .expect("It gives the 32-bit path and lists it second.");496 .expect("It gives the 32-bit path and lists it second");
497 Self {497 Self {
498 x86: suffix_x86,498 x86: suffix_x86,
499 maybe_64bit: Some(suffix_64bit),499 maybe_64bit: Some(suffix_64bit),
@@ -503,7 +503,7 @@ mod tests { · 3 unmodified lines
503 assert_eq!(pf.maybe_64bit, None, "It gives one path only if none can be 64-bit.");503 assert_eq!(pf.maybe_64bit, None, "It gives one path only if none can be 64-bit.");
504 let suffix_x86 = only504 let suffix_x86 = only
505 .strip_prefix(pf.x86.as_path())505 .strip_prefix(pf.x86.as_path())
506 .expect("The one path it gives is the 32-bit path.");506 .expect("The one path it gives is the 32-bit path");
507 Self {507 Self {
508 x86: suffix_x86,508 x86: suffix_x86,
509 maybe_64bit: None,509 maybe_64bit: None,