chiark / gitweb /
fix various targets and tests
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Oct 2020 23:09:45 +0000 (00:09 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Oct 2020 23:09:45 +0000 (00:09 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Makefile
zcoord/zcoord.rs

index eddc22434175aeefe3cb3853b5cdd52d83b45ad9..d489fbd0e2255e1ea62feef149f54684f463d297 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -85,11 +85,14 @@ WASM := wasm32-unknown-unknown
 check: stamp/cargo.check
        @echo 'All tests passed.'
 
+doc: cargo-doc
+
 debug release:: %: stamp/cargo.% assets extra-%
 
 cargo: cargo-debug cargo-wasm-release
 
-cargo-debug cargo-release cargo-check cargo-wasm-debug cargo-wasm-release:: \
+cargo-debug cargo-release cargo-check cargo-doc \
+cargo-wasm-debug cargo-wasm-release:: \
 cargo-%: stamp/cargo.%
 
 cargo-wasm: cargo-wasm-release
@@ -114,7 +117,11 @@ stamp/cargo.%: $(call rsrcs,. ! -path './wasm/*')
        $(stamp)
 
 stamp/cargo.check: $(call rsrcs,.)
-       $(CARGO) test
+       $(CARGO) test --workspace
+       $(stamp)
+
+stamp/cargo.doc: $(call rsrcs,.)
+       $(CARGO) doc --workspace
        $(stamp)
 
 $(addprefix stamp/cargo.wasm-,$(DR)):: \
index a5871db61cc8b15e4fd2c5b84de4dd15894554e8..3418261bec5ea96582a8fc1ac45cb688c6fc2a1b 100644 (file)
@@ -452,8 +452,8 @@ mod innards {
 
 #[cfg(test)]
 mod test {
-  // everything from here on is seded by the js test extractor!
   use super::*;
+  use std::mem;
 
   fn bf(s: &str) -> ZCoord {
     ZCoord::from_str(s).unwrap()
@@ -500,20 +500,24 @@ mod test {
   }
 
   #[test]
-  fn addition() {
+  fn incdec() {
     fn mk(s: &str) -> super::Mutable { bf(s).clone_mut() }
     impl Mutable {
-      fn tincdec(mut self, exp: &str, id: IncDecOffset) -> Self {
+      fn tincdec<ID:IncDecOffset>(mut self, exp: &str, id: ID) -> Self {
         let got = self.incdec(id).unwrap();
         assert_eq!(got.to_string(), exp);
         self
       }
-      fn tinc(mut self, exp: &str) -> Self { self.tincdec(exp, IncDecInc) }
-      fn tdec(mut self, exp: &str) -> Self { self.tincdec(exp, IncDecDec) }
+      fn tinc(self, exp: &str) -> Self { self.tincdec(exp, IncDecInc) }
+      fn tdec(self, exp: &str) -> Self { self.tincdec(exp, IncDecDec) }
     }
     mk("000000000a")
       .tinc("000100000a")
       .tinc("000200000a")
+      .tdec("000100000a")
+      .tdec("000000000a")
+      .tdec("000000000a_vvvvvvvvvv_vvvuvvvvvv")
+      .tdec("000000000a_vvvvvvvvvv_vvvtvvvvvv")
       ;
     mk("vvvvvvvvvv")
       .tinc("vvvvvvvvvv_0000000000_0001000000")