]> git.proxmox.com Git - proxmox-apt.git/commitdiff
tests: parse and write the result again
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 2 Jul 2021 09:31:24 +0000 (11:31 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 2 Jul 2021 11:04:00 +0000 (13:04 +0200)
A cheap way to "double" the number of test cases.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
tests/repositories.rs

index 289bbe47ae3e61db658bb581a27de8d83ecdb5ac..67b0255e1600d2c72d6dbd66c43bc44ecc6dea94 100644 (file)
@@ -11,8 +11,15 @@ use proxmox_apt::repositories::{
 
 #[test]
 fn test_parse_write() -> Result<(), Error> {
+    test_parse_write_dir("sources.list.d")?;
+    test_parse_write_dir("sources.list.d.expected")?; // check if it's idempotent
+
+    Ok(())
+}
+
+fn test_parse_write_dir(read_dir: &str) -> Result<(), Error> {
     let test_dir = std::env::current_dir()?.join("tests");
-    let read_dir = test_dir.join("sources.list.d");
+    let read_dir = test_dir.join(read_dir);
     let write_dir = test_dir.join("sources.list.d.actual");
     let expected_dir = test_dir.join("sources.list.d.expected");