chiark / gitweb /
jstest: Introduce Rust helper code
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 8 Jul 2021 19:32:34 +0000 (20:32 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 8 Jul 2021 19:36:30 +0000 (20:36 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Cargo.lock
Cargo.toml
Makefile
jstest/Cargo.toml [new file with mode: 0644]
jstest/jst-lower.rs [new file with mode: 0644]
jstest/jstest.rs [new file with mode: 0644]
make-release

index 13a86088edb7bde08e80e3dc1123b8fb535ca2b0..8797f75a1c51463323280fb6fe88256ee68dc58f 100644 (file)
@@ -2560,6 +2560,15 @@ dependencies = [
  "strum",
 ]
 
+[[package]]
+name = "otter-nodejs-tests"
+version = "0.7.1"
+dependencies = [
+ "fehler",
+ "otter",
+ "structopt",
+]
+
 [[package]]
 name = "otter-wasm"
 version = "0.7.1"
index 5e4aa93ac14f11f66786f87476791add80f55276..f5f85d3f5911d82cda0c0df2446a1e9f91dfd958 100644 (file)
@@ -16,7 +16,7 @@ authors=["Ian Jackson <ijackson@chiark.greenend.org.uk>",
          "and the contributors to Otter"]
 
 [workspace]
-members=["cli", "wasm", "daemon", "wdriver", "apitest"]
+members=["cli", "wasm", "daemon", "wdriver", "apitest", "jstest"]
 
 [build-dependencies]
 usvg="0.14"
index 72222b2b1693af566bb275163ebe6627edba1613..ced38ac4db2384fee6ee58dcb1fb97b9baf2e457 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -217,6 +217,10 @@ stamp/cargo-wdt.debug: $(call rsrcs,.)
        $(CARGO) build --workspace $(call cr,$*) -p otter-webdriver-tests
        $(stamp)
 
+stamp/cargo-jstest.debug: $(call rsrcs,.)
+       $(CARGO) build --workspace $(call cr,$*) -p otter-nodejs-tests
+       $(stamp)
+
 stamp/cargo.doc: $(call rsrcs,.)
        set -o pipefail -e; \
        $(CARGO) doc $(CARGO_DOC_OPTS) --workspace 2>&1 |egrep -vf .cargo-doc-suppress-errors
@@ -260,7 +264,7 @@ JSTESTS= basic lower
 jstest jstests: $(foreach t,$(JSTESTS),stamp/$t.jstest)
 
 stamp/%.jstest: jstest/run1 jstest/%.nodejs templates/script.js \
-               stamp/wasm-bindgen-jstest
+               stamp/wasm-bindgen-jstest stamp/cargo-jstest.debug
        $(NAILING_CARGO_JUST_RUN) $(abspath $(filter-out stamp/%,$^))
        $(stamp)
 
diff --git a/jstest/Cargo.toml b/jstest/Cargo.toml
new file mode 100644 (file)
index 0000000..b510885
--- /dev/null
@@ -0,0 +1,39 @@
+# Copyright 2020-2021 Ian Jackson and contributors to Otter
+# SPDX-License-Identifier: AGPL-3.0-or-later
+# There is NO WARRANTY.
+
+[package]
+name="otter-nodejs-tests"
+description="Otter game system; JavaScript out-of-browser test support."
+
+version="0.7.1"
+license="AGPL-3.0-or-later"
+edition="2018"
+homepage="https://www.chiark.greenend.org.uk/~ianmdlvl/otter/docs/"
+repository="https://salsa.debian.org/iwj/otter"
+keywords=["games"]
+authors=["Ian Jackson <ijackson@chiark.greenend.org.uk>",
+         "and the contributors to Otter"]
+
+[lib]
+name="otter_nodejs_tests"
+path="jstest.rs"
+
+[[bin]]
+name="jst-lower"
+path="jst-lower.rs"
+
+
+[dependencies]
+
+otter.path=".."
+otter.version="=0.7.1"
+
+fehler="1"
+structopt="0.3"
+
+#serde        = { version="1"    , features=["derive", "rc"] }
+#strum        = { version="0.21" , features=["derive"      ] }
+
+
+#fin.
diff --git a/jstest/jst-lower.rs b/jstest/jst-lower.rs
new file mode 100644 (file)
index 0000000..fe60acc
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright 2020-2021 Ian Jackson and contributors to Otter
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+use otter_nodejs_tests::*;
+
+#[throws(AE)]
+fn main() {
+}
diff --git a/jstest/jstest.rs b/jstest/jstest.rs
new file mode 100644 (file)
index 0000000..52b070e
--- /dev/null
@@ -0,0 +1,5 @@
+// Copyright 2020-2021 Ian Jackson and contributors to Otter
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+pub use otter::prelude::*;
index 5590fabf106aed3508fa6079763508cd70695582..5c202fa90af3a0fb145beac4afcd59cded53f777 100755 (executable)
@@ -82,7 +82,7 @@ if [ "x$tag_exists" != x ]; then trouble "tag $tag already exists"; fi
 head -1 CHANGELOG.md | grep "^Version $version" \
 || trouble "CHANGELOG.md not updated"
 
-cargo_order='base . cli daemon wasm apitest wdriver'
+cargo_order='base . cli daemon wasm apitest wdriver jstest'
 missing=(git ls-files :\*/Cargo.toml :Cargo.toml)
 for x in $cargo_order; do missing+=(:!$x/Cargo.toml); done
 missing=$( "${missing[@]}" )