chiark / gitweb /
apitest: check_library_item: Check count of matches
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 17 May 2021 18:37:54 +0000 (19:37 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 17 May 2021 23:21:11 +0000 (00:21 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
apitest/at-bundles.rs

index 2990b4a179fb1da2625fd95ae60881592fad2db2..34c7059ddeddc82c8d0901c12be2b974f9f0fbd1 100644 (file)
@@ -19,15 +19,15 @@ impl Ctx {
     assert_eq!( added.len(), 1 );
 
     let output: String = self.otter(&ds.ss("list-pieces @table@")?)?.into();
-    assert!( Regex::new(
+    assert_eq!( Regex::new(
       &format!(
         r#"(?m)(?:[^\w-]|^){}[^\w-].*\W{}(?:\W|$)"#,
         item, desc,
       )
     )?
-             .find(&output)
-             .is_some(),
-             "got: {}", &output);
+                .find_iter(&output).count(),
+                1,
+                "got: {}", &output);
   }
 
   #[throws(Explode)]