chiark / gitweb /
apitest: Sort out plumbing of exe_module_path
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Feb 2021 22:25:49 +0000 (22:25 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Feb 2021 22:25:49 +0000 (22:25 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
wdriver.rs
wdriver/wdt-altergame.rs
wdriver/wdt-hand.rs
wdriver/wdt-simple.rs

index 0795d283c9670e15ed31289f76219b607328268a..3a5ef62288bc83eb1ea4f2839bc7532cee1edc56 100644 (file)
@@ -729,8 +729,8 @@ pub struct UsualSetup {
 
 impl UsualSetup {
   #[throws(AE)]
-  pub fn new() -> UsualSetup {
-    let (mut su, inst) = setup(module_path!()).always_context("setup")?;
+  pub fn new(exe_module_path: &str) -> UsualSetup {
+    let (mut su, inst) = setup(exe_module_path).always_context("setup")?;
     let [alice, bob] : [Window; 2] =
       su.setup_static_users(&inst)?.try_into().unwrap();
     let spec = su.ds.game_spec_data()?;
@@ -739,8 +739,10 @@ impl UsualSetup {
 }
 
 #[throws(AE)]
-pub fn as_usual<F: FnOnce(UsualSetup) -> Result<(), AE>>(f: F) {
-  let usual = UsualSetup::new()?;
+pub fn as_usual<F: FnOnce(UsualSetup) -> Result<(), AE>>(
+  f: F, exe_module_path: &str,
+) {
+  let usual = UsualSetup::new(exe_module_path)?;
   f(usual)?;
   info!("ok");
 }
index 07d69d96fcbfa2b4c6737b050ae0e86b147c8b61..133e5033ba81a1a86221e53ec301fa74672d2f00 100644 (file)
@@ -89,4 +89,4 @@ fn tests(UsualSetup { su, alice, ..}: UsualSetup) {
 }
 
 #[throws(AE)]
-fn main() { as_usual(tests)? }
+fn main() { as_usual(tests, module_path!())? }
index 808a56ad3321b0aa04fd10e09f65aab38fb5532b..6422e3ec93b3556c89a3731cb3ccb42ee34c6184 100644 (file)
@@ -103,4 +103,4 @@ fn tests(UsualSetup { su, alice, bob, ..}: UsualSetup) {
 }
 
 #[throws(AE)]
-fn main() { as_usual(tests)? }
+fn main() { as_usual(tests, module_path!())? }
index 818aca1f92539d76b4dd95adb5d8259b35fc5b9f..13a9d2e832dc87e979d3edb35baaae42e112da0f 100644 (file)
@@ -296,4 +296,4 @@ fn tests(UsualSetup { su, alice, bob, spec, ..}: UsualSetup) {
 }
 
 #[throws(AE)]
-fn main() { as_usual(tests)? }
+fn main() { as_usual(tests, module_path!())? }