Skip to content

Commit e670294

Browse files
committed
refactor
1 parent b813339 commit e670294

File tree

5 files changed

+20
-80
lines changed

5 files changed

+20
-80
lines changed

gix-ref/src/display_tests.rs

Lines changed: 0 additions & 74 deletions
This file was deleted.

gix-ref/src/fullname.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use std::{borrow::Borrow, path::Path};
2-
31
use gix_object::bstr::{BStr, BString, ByteSlice};
2+
use std::{borrow::Borrow, path::Path};
43

54
use crate::{bstr::ByteVec, name::is_pseudo_ref, Category, FullName, FullNameRef, Namespace, PartialNameRef};
65

gix-ref/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,3 @@ pub enum TargetRef<'a> {
213213
/// A ref that points to another reference by its validated name, adding a level of indirection.
214214
Symbolic(&'a FullNameRef),
215215
}
216-
217-
#[cfg(test)]
218-
mod display_tests;

gix-ref/tests/refs/fullname.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::borrow::Cow;
22

3-
use gix_ref::{Category, FullNameRef, PartialNameRef};
3+
use gix_ref::{Category, FullName, FullNameRef, PartialNameRef};
44

55
#[test]
66
fn cow() {
@@ -137,3 +137,12 @@ fn prefix_with_namespace_and_stripping() {
137137
"idempotent stripping"
138138
);
139139
}
140+
141+
#[test]
142+
fn display() {
143+
let full_name = FullName::try_from("refs/heads/main").unwrap();
144+
assert_eq!(format!("{full_name}"), "refs/heads/main");
145+
146+
let full_name_ref = full_name.as_ref();
147+
assert_eq!(format!("{full_name_ref}"), "refs/heads/main");
148+
}

gix-ref/tests/refs/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ mod partialname {
3636
);
3737
Ok(())
3838
}
39+
40+
#[test]
41+
fn display() {
42+
let partial_name = PartialName::try_from("heads/main").unwrap();
43+
assert_eq!(format!("{partial_name}"), "heads/main");
44+
45+
let partial_name_ref = partial_name.as_ref();
46+
assert_eq!(format!("{partial_name_ref}"), "heads/main");
47+
}
3948
}
4049
mod namespace;
4150
mod packed;

0 commit comments

Comments
 (0)