From 327d871c1627d593b13e35ad7ad6b8ab6efb7f4e Mon Sep 17 00:00:00 2001 From: John Turner Date: Fri, 28 Nov 2025 17:22:16 +0000 Subject: [PATCH] add repo parser test --- check_commands.txt | 2 +- tests/meson.build | 1 + tests/repo/meson.build | 1 + tests/repo/repo.rs | 17 +++++++++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/repo/meson.build create mode 100644 tests/repo/repo.rs diff --git a/check_commands.txt b/check_commands.txt index f1c34fd..4f961b7 100644 --- a/check_commands.txt +++ b/check_commands.txt @@ -1,4 +1,4 @@ /usr/bin/meson format --recursive --check-only rustfmt --edition 2024 --check $(find src -type f -name '*.rs') ninja clippy -C build -meson test unittests -C build +meson test unittests '*repo*' -C build diff --git a/tests/meson.build b/tests/meson.build index e99c9c7..27fdce9 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,6 +1,7 @@ tests = {} subdir('porthole') +subdir('repo') foreach test, test_args : tests name = fs.name(test) diff --git a/tests/repo/meson.build b/tests/repo/meson.build new file mode 100644 index 0000000..00da4e8 --- /dev/null +++ b/tests/repo/meson.build @@ -0,0 +1 @@ +tests += {meson.current_source_dir() / 'repo.rs': []} diff --git a/tests/repo/repo.rs b/tests/repo/repo.rs new file mode 100644 index 0000000..20b6980 --- /dev/null +++ b/tests/repo/repo.rs @@ -0,0 +1,17 @@ +use std::error::Error; + +use gentoo_utils::repo::Repo; + +fn main() -> Result<(), Box> { + let repo = Repo::new("/var/db/repos/gentoo"); + + for result in repo.categories()? { + let cat = result?; + + for result in cat.ebuilds()? { + let _ = result?; + } + } + + Ok(()) +}