chiark / gitweb /
wdt-simple: Allow "piece held by another player" as if it were conflict
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 14 Jul 2021 18:30:02 +0000 (19:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 14 Jul 2021 18:41:53 +0000 (19:41 +0100)
Regrab will allow us to try to grab the thing, not mind that it
doesn't work, and then get this conflict.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
wdriver/wdt-simple.rs

index 5b641bb312cbeec540f6f965446930bebf66624d..5263a418056d2e99fc1e12e9ca9a5ad09097da0f 100644 (file)
@@ -250,9 +250,20 @@ impl Ctx {
 
       for got in &gots {
         let conflicts = got.log.find_conflicts();
-        assert_eq!(conflicts.len(),
-                   if got.yes { 0 } else { 1},
-                   "wrong # conflicts {:?}", &conflicts);
+        let helderrs = got.log.iter()
+          .filter(|m| m.contains("piece held by another player"))
+          .cloned().collect_vec();
+
+        dbg!( &conflicts, &helderrs );
+        assert!( conflicts.len() <= 1 );
+        assert!( helderrs .len() <= 1 );
+        if got.yes {
+          assert_eq!( conflicts.len(), 0 );
+          assert_eq!( helderrs .len(), 0 );
+        } else {
+          assert!( conflicts.len() == 1 ||
+                   helderrs .len() == 1 );
+        }
       }
 
       let mut yw = su.w(&y.window)?;