Skip to content

Commit e35e106

Browse files
committed
rename fixture scripts
1 parent 7eb48ae commit e35e106

File tree

6 files changed

+22
-57
lines changed

6 files changed

+22
-57
lines changed

src/info/title.rs

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -87,37 +87,18 @@ impl std::fmt::Display for Title {
8787
mod tests {
8888
use super::*;
8989
use anyhow::Result;
90-
use gix::{open, Repository, ThreadSafeRepository};
9190
use owo_colors::AnsiColors;
9291

93-
fn repo(name: &str) -> Result<Repository> {
94-
let name = name.to_string();
95-
let repo_path = gix_testtools::scripted_fixture_read_only(name).unwrap();
96-
let safe_repo = ThreadSafeRepository::open_opts(repo_path, open::Options::isolated())?;
97-
Ok(safe_repo.to_thread_local())
98-
}
99-
100-
#[test]
101-
fn test_get_git_username() -> Result<()> {
102-
let repo = repo("basic_repo.sh")?;
103-
let username = get_git_username(&repo);
104-
assert_eq!(
105-
username, "onefetch-committer-name",
106-
"see git repo local config committer.name"
107-
);
108-
Ok(())
109-
}
110-
11192
#[test]
11293
fn test_title_format() -> Result<()> {
113-
let repo = repo("basic_repo.sh")?;
114-
let mut title = Title::new(
115-
&repo,
116-
DynColors::Ansi(AnsiColors::Red),
117-
DynColors::Ansi(AnsiColors::White),
118-
DynColors::Ansi(AnsiColors::Blue),
119-
true,
120-
);
94+
let mut title = Title {
95+
git_username: "onefetch-committer-name".to_string(),
96+
git_version: "git version 2.37.2".to_string(),
97+
title_color: DynColors::Ansi(AnsiColors::Red),
98+
tilde_color: DynColors::Ansi(AnsiColors::White),
99+
underline_color: DynColors::Ansi(AnsiColors::Blue),
100+
is_bold: true,
101+
};
121102

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

tests/fixtures/basic_repo.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.
File renamed without changes.

tests/fixtures/repo.sh renamed to tests/fixtures/make_repo.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ git init -q
77
git config --local --add "committer.name" "onefetch-committer-name"
88
git config --local --add "committer.email" "[email protected]"
99

10-
git config --local --add "user.name" "onefetch-user-name"
11-
git config --local --add "user.email" "[email protected]"
12-
13-
git config --local --add "author.name" "onefetch-author-name"
14-
git config --local --add "author.email" "[email protected]"
15-
1610
git remote add origin https://github.com/user/repo.git
1711

1812
git checkout -b main
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
set -eu -o pipefail
3+
4+
git init -q
5+
6+
git checkout -b main
7+
touch this.rs
8+
git add this.rs
9+
git commit -q -m c1
10+
echo hello >> this.rs
11+
git commit -q -am c2

tests/repo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn named_repo(fixture: &str, name: &str) -> Result<Repository> {
1919

2020
#[test]
2121
fn test_bare_repo() -> Result<()> {
22-
let repo = repo("bare_repo.sh")?;
22+
let repo = repo("make_bare_repo.sh")?;
2323
let work_dir = get_work_dir(&repo);
2424
assert!(
2525
work_dir.is_err(),
@@ -34,7 +34,7 @@ fn test_bare_repo() -> Result<()> {
3434

3535
#[test]
3636
fn test_repo() -> Result<()> {
37-
let repo = repo("repo.sh")?;
37+
let repo = repo("make_repo.sh")?;
3838
let config: CliOptions = CliOptions {
3939
input: repo.path().to_path_buf(),
4040
info: InfoCliOptions {
@@ -62,7 +62,7 @@ fn test_repo() -> Result<()> {
6262

6363
#[test]
6464
fn test_repo_without_remote() -> Result<()> {
65-
let repo = repo("basic_repo.sh")?;
65+
let repo = repo("make_repo_without_remote.sh")?;
6666
let config: CliOptions = CliOptions {
6767
input: repo.path().to_path_buf(),
6868
..Default::default()

0 commit comments

Comments
 (0)