From b1595338cb8bbd5f2b54adeedd04b83fc0e835c6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 8 Jul 2021 20:32:34 +0100 Subject: [PATCH] jstest: Introduce Rust helper code Signed-off-by: Ian Jackson --- Cargo.lock | 9 +++++++++ Cargo.toml | 2 +- Makefile | 6 +++++- jstest/Cargo.toml | 39 +++++++++++++++++++++++++++++++++++++++ jstest/jst-lower.rs | 9 +++++++++ jstest/jstest.rs | 5 +++++ make-release | 2 +- 7 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 jstest/Cargo.toml create mode 100644 jstest/jst-lower.rs create mode 100644 jstest/jstest.rs diff --git a/Cargo.lock b/Cargo.lock index 13a86088..8797f75a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml index 5e4aa93a..f5f85d3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ authors=["Ian Jackson ", "and the contributors to Otter"] [workspace] -members=["cli", "wasm", "daemon", "wdriver", "apitest"] +members=["cli", "wasm", "daemon", "wdriver", "apitest", "jstest"] [build-dependencies] usvg="0.14" diff --git a/Makefile b/Makefile index 72222b2b..ced38ac4 100644 --- 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 index 00000000..b5108850 --- /dev/null +++ b/jstest/Cargo.toml @@ -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 ", + "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 index 00000000..fe60acc1 --- /dev/null +++ b/jstest/jst-lower.rs @@ -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 index 00000000..52b070ed --- /dev/null +++ b/jstest/jstest.rs @@ -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::*; diff --git a/make-release b/make-release index 5590fabf..5c202fa9 100755 --- a/make-release +++ b/make-release @@ -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[@]}" ) -- 2.30.2