summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-11-28 17:22:16 +0000
committerJohn Turner <jturner.usa@gmail.com>2025-11-28 17:22:16 +0000
commit327d871c1627d593b13e35ad7ad6b8ab6efb7f4e (patch)
tree321f1a7a771e46d0b173ce0493fc47a1a60f08f5
parent7b600344251e79b1554b78ed8a972cac2aea4f3f (diff)
downloadgentoo-utils-327d871c1627d593b13e35ad7ad6b8ab6efb7f4e.tar.gz
add repo parser test
-rw-r--r--check_commands.txt2
-rw-r--r--tests/meson.build1
-rw-r--r--tests/repo/meson.build1
-rw-r--r--tests/repo/repo.rs17
4 files changed, 20 insertions, 1 deletions
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<dyn Error>> {
+ let repo = Repo::new("/var/db/repos/gentoo");
+
+ for result in repo.categories()? {
+ let cat = result?;
+
+ for result in cat.ebuilds()? {
+ let _ = result?;
+ }
+ }
+
+ Ok(())
+}