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
388388 /// [knownfolderid]: https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid#remarks
389389 fn obtain_envlessly() -> Self {
390390 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");
392392
393393 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");
395395
396396 let maybe_pf_64bit = RegKey::predef(HKEY_LOCAL_MACHINE)
397397 .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")
399399 .get_value::<OsString, _>("ProgramW6432Dir")
400400 .map(PathBuf::from)
401401 .map_err(|error| {
@@ -416,7 +416,7 @@ mod tests { · 14 unmodified lines
416416 /// This checks that `obtain_envlessly()` returned paths that are likely to be correct and
417417 /// that satisfy the most important properties based on the current system and process.
418418 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") {
420420 PlatformArchitecture::Is32on32 => {
421421 assert_eq!(
422422 self.current.as_os_str(),
@@ -425,7 +425,7 @@ mod tests { · 2 unmodified lines
425425 );
426426 for trailing_arch in [" (x86)", " (Arm)"] {
427427 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");
429429 assert!(
430430 !is_adorned,
431431 "The 32-bit program files directory name on a 32-bit system mentions no architecture.",
@@ -445,7 +445,7 @@ mod tests { · 13 unmodified lines
445445 let pf_64bit = self
446446 .maybe_64bit
447447 .as_ref()
448− .expect("The 64-bit program files directory exists.");
448+ .expect("The 64-bit program files directory exists");
449449 assert_ne!(
450450 &self.x86, pf_64bit,
451451 "The 32-bit and 64-bit program files directories have different locations.",
@@ -455,7 +455,7 @@ mod tests { · 3 unmodified lines
455455 let pf_64bit = self
456456 .maybe_64bit
457457 .as_ref()
458− .expect("The 64-bit program files directory exists.");
458+ .expect("The 64-bit program files directory exists");
459459 assert_eq!(
460460 self.current.as_os_str(),
461461 pf_64bit.as_os_str(),
@@ -487,13 +487,13 @@ mod tests { · 25 unmodified lines
487487 let prefix_64bit = pf
488488 .maybe_64bit
489489 .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");
491491 let suffix_64bit = primary
492492 .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");
494494 let suffix_x86 = secondary
495495 .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");
497497 Self {
498498 x86: suffix_x86,
499499 maybe_64bit: Some(suffix_64bit),
@@ -503,7 +503,7 @@ mod tests { · 3 unmodified lines
503503 assert_eq!(pf.maybe_64bit, None, "It gives one path only if none can be 64-bit.");
504504 let suffix_x86 = only
505505 .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");
507507 Self {
508508 x86: suffix_x86,
509509 maybe_64bit: None,