mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-11-21 10:30:43 +08:00
Reorganise the tests into module files, rather than all being in a single file. No tests were changed in this patch. The `serialize` flag was also not enabled in `test/Cargo.toml`. This is enabled to ensure those tests are run moving forward. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
34 lines
1.0 KiB
Rust
34 lines
1.0 KiB
Rust
use std::sync::{Mutex, MutexGuard};
|
|
|
|
use git_ref_format::{name::component, refname};
|
|
use radicle_surf::git::{Branch, Error, Glob, Repository};
|
|
|
|
use super::GIT_PLATINUM;
|
|
|
|
#[test]
|
|
fn basic_test() -> Result<(), Error> {
|
|
let shared_repo = Mutex::new(Repository::open(GIT_PLATINUM)?);
|
|
let locked_repo: MutexGuard<Repository> = shared_repo.lock().unwrap();
|
|
let mut branches = locked_repo
|
|
.branches(&Glob::heads("*")?.and_remotes("*")?)?
|
|
.collect::<Result<Vec<_>, _>>()?;
|
|
branches.sort();
|
|
|
|
let origin = component!("origin");
|
|
let banana = component!("banana");
|
|
assert_eq!(
|
|
branches,
|
|
vec![
|
|
Branch::local(refname!("dev")),
|
|
Branch::local(refname!("master")),
|
|
Branch::remote(banana.clone(), refname!("orange/pineapple")),
|
|
Branch::remote(banana, refname!("pineapple")),
|
|
Branch::remote(origin.clone(), refname!("HEAD")),
|
|
Branch::remote(origin.clone(), refname!("dev")),
|
|
Branch::remote(origin, refname!("master")),
|
|
]
|
|
);
|
|
|
|
Ok(())
|
|
}
|