Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor test expressions #831

Merged
merged 2 commits into from
Oct 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/info/repo/license.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ mod test {
#[test]
fn test_is_license_file() {
for file_name in LICENSE_FILES.iter() {
assert_eq!(is_license_file(file_name), true);
assert!(is_license_file(file_name));
}
assert_eq!(is_license_file("NOT_LICENSE"), false);
assert!(!is_license_file("NOT_LICENSE"));
}

#[test]
Expand Down
6 changes: 3 additions & 3 deletions src/info/title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl std::fmt::Display for Title {
mod tests {
use super::*;
use git_repository::{open, Repository, ThreadSafeRepository};
use git_testtools;

use owo_colors::AnsiColors;

type Result<T = ()> = std::result::Result<T, Box<dyn std::error::Error>>;
Expand Down Expand Up @@ -123,12 +123,12 @@ mod tests {
// setting git_version to known value
title.git_version = "git version 2.37.2".to_string();
assert!(title.to_string().contains("onefetch-committer-name"));
assert!(title.to_string().contains("~"));
assert!(title.to_string().contains('~'));
assert!(title.to_string().contains("git version 2.37.2"));

title.git_version = "".to_string();
assert!(title.to_string().contains("onefetch-committer-name"));
assert!(!title.to_string().contains("~"));
assert!(!title.to_string().contains('~'));
assert!(!title.to_string().contains("git version 2.37.2"));

title.git_username = "".to_string();
Expand Down