-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
assure ref-specs handle equality, ordering and hashing according to t…
…heir instruction (#450) That way, it's possible to treat dissimilar yet effectively equal specs like they are equal.
- Loading branch information
Showing
7 changed files
with
73 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use git_refspec::parse::Operation; | ||
use git_refspec::RefSpec; | ||
use std::collections::{BTreeSet, HashSet}; | ||
use std::iter::FromIterator; | ||
|
||
fn pair() -> Vec<RefSpec> { | ||
let lhs = git_refspec::parse("refs/heads/foo".into(), Operation::Push).unwrap(); | ||
let rhs = git_refspec::parse("refs/heads/foo:refs/heads/foo".into(), Operation::Push).unwrap(); | ||
vec![lhs.to_owned(), rhs.to_owned()] | ||
} | ||
|
||
#[test] | ||
fn cmp() { | ||
assert_eq!(BTreeSet::from_iter(pair()).len(), 1) | ||
} | ||
|
||
#[test] | ||
fn hash() { | ||
let set: HashSet<_> = pair().into_iter().collect(); | ||
assert_eq!(set.len(), 1) | ||
} | ||
|
||
#[test] | ||
fn eq() { | ||
let specs = pair(); | ||
assert_eq!(&specs[0], &specs[1]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
mod impls; | ||
mod parse; |