From 903d37a254f931e79ecded26f30a3b517c6d27da Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 21 Jun 2026 03:16:34 +0900 Subject: test(repository): port InstalledRepositoryTest testAddRepository maps the expected LogicException to #[should_panic] since InstalledRepository::add_repository guards with assert!. testFindPackagesWithReplacersAndProviders is #[ignore] because that assert omits InstalledRepositoryInterface, so adding an InstalledArrayRepository panics before the lookup runs. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../tests/repository/array_repository_test.rs | 40 +++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'crates/shirabe/tests/repository/array_repository_test.rs') diff --git a/crates/shirabe/tests/repository/array_repository_test.rs b/crates/shirabe/tests/repository/array_repository_test.rs index ae34d4d..ee6dfb9 100644 --- a/crates/shirabe/tests/repository/array_repository_test.rs +++ b/crates/shirabe/tests/repository/array_repository_test.rs @@ -127,12 +127,20 @@ fn test_search() { assert_eq!( vec![("foo".to_string(), None, Abandoned::No)], - reprs(&repo.search("foo".to_string(), SEARCH_FULLTEXT, None).unwrap()) + reprs( + &repo + .search("foo".to_string(), SEARCH_FULLTEXT, None) + .unwrap() + ) ); assert_eq!( vec![("bar".to_string(), None, Abandoned::No)], - reprs(&repo.search("bar".to_string(), SEARCH_FULLTEXT, None).unwrap()) + reprs( + &repo + .search("bar".to_string(), SEARCH_FULLTEXT, None) + .unwrap() + ) ); assert!( @@ -160,15 +168,23 @@ fn test_search_with_package_type() { vec![("foo".to_string(), None, Abandoned::No)], reprs( &repo - .search("foo".to_string(), SEARCH_FULLTEXT, Some("library".to_string())) + .search( + "foo".to_string(), + SEARCH_FULLTEXT, + Some("library".to_string()) + ) .unwrap() ) ); assert!( - repo.search("bar".to_string(), SEARCH_FULLTEXT, Some("package".to_string())) - .unwrap() - .is_empty() + repo.search( + "bar".to_string(), + SEARCH_FULLTEXT, + Some("package".to_string()) + ) + .unwrap() + .is_empty() ); assert_eq!( @@ -197,8 +213,16 @@ fn test_search_with_abandoned_packages() { assert_eq!( vec![ ("foo1".to_string(), None, Abandoned::Yes), - ("foo2".to_string(), None, Abandoned::Replacement("bar".to_string())), + ( + "foo2".to_string(), + None, + Abandoned::Replacement("bar".to_string()) + ), ], - reprs(&repo.search("foo".to_string(), SEARCH_FULLTEXT, None).unwrap()) + reprs( + &repo + .search("foo".to_string(), SEARCH_FULLTEXT, None) + .unwrap() + ) ); } -- cgit v1.3.1