aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules4
-rw-r--r--Cargo.toml8
-rw-r--r--integration_tests/Cargo.toml22
m---------integration_tests/html5lib-tests (renamed from tests/html5lib-tests)0
-rw-r--r--integration_tests/tests/test_html5lib.rs (renamed from tests/test_html5lib.rs)7
5 files changed, 29 insertions, 12 deletions
diff --git a/.gitmodules b/.gitmodules
index 2411bd3..36e58a2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
-[submodule "tests/html5lib-tests"]
- path = tests/html5lib-tests
+[submodule "html5lib-tests"]
+ path = integration_tests/html5lib-tests
url = https://github.com/html5lib/html5lib-tests
diff --git a/Cargo.toml b/Cargo.toml
index 6918f79..64306d8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,3 +1,7 @@
+[workspace]
+members = [".", "integration_tests"]
+default-members = [".", "integration_tests"]
+
[package]
name = "html5tokenizer"
authors = ["Markus Unterwaditzer <markus-honeypot@unterwaditzer.net>", "Martin Fischer <martin@push-f.com>"]
@@ -12,10 +16,6 @@ include = ["src/**/*", "LICENSE", "README.md"]
[dev-dependencies]
codespan-reporting = "0.11.1"
-glob = "0.3.1"
-pretty_assertions = "1.0.0"
-serde = { version = "1.0.130", features = ["derive"] }
-serde_json = "1.0.71"
[features]
# Feature used by integration tests in tests/ to get access to library internals.
diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml
new file mode 100644
index 0000000..1e68a0b
--- /dev/null
+++ b/integration_tests/Cargo.toml
@@ -0,0 +1,22 @@
+# The html5lib integration test lives in a separate crate because
+# we want `cargo test` to run these tests despite their dependency
+# on the `integration-tests` feature from the html5tokenizer crate
+# and cargo doesn't support features to be automatically enabled for
+# integration tests in a single crate. (required-features under [[test]]
+# just results in the test being skipped if the feature isn't enabled).
+# See https://github.com/rust-lang/cargo/issues/2911#issuecomment-524652568.
+
+[package]
+name = "integration_tests"
+publish = false
+version = "0.0.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dev-dependencies]
+glob = "0.3.1"
+html5tokenizer = { path = "..", features = ["integration-tests"] }
+pretty_assertions = "1.0.0"
+serde = { version = "1.0.130", features = ["derive"] }
+serde_json = "1.0.71"
diff --git a/tests/html5lib-tests b/integration_tests/html5lib-tests
-Subproject 6030cb6e40a0cf68ae38bf0001bb85b727b80a2
+Subproject 6030cb6e40a0cf68ae38bf0001bb85b727b80a2
diff --git a/tests/test_html5lib.rs b/integration_tests/tests/test_html5lib.rs
index fc5e89c..cf95bb6 100644
--- a/tests/test_html5lib.rs
+++ b/integration_tests/tests/test_html5lib.rs
@@ -5,11 +5,6 @@ use pretty_assertions::assert_eq;
use serde::{de::Error as _, Deserialize};
use std::{collections::BTreeMap, fs::File, io::BufReader, path::Path};
-#[cfg(not(feature = "integration-tests"))]
-compile_error!(
- "integration tests need the integration-tests feature enabled. Run cargo test --all-features"
-);
-
struct ExpectedOutputTokens(Vec<Token<()>>);
impl<'de> Deserialize<'de> for ExpectedOutputTokens {
@@ -210,7 +205,7 @@ struct Tests {
/// directory containing the `Cargo.toml` file of the current crate.
///
/// [html5lib-tests]: https://github.com/html5lib/html5lib-tests
-const HTML5LIB_TESTS_PATH: &str = "tests/html5lib-tests";
+const HTML5LIB_TESTS_PATH: &str = "html5lib-tests";
// FUTURE: it would be nice to assert that HTML5LIB_TESTS_PATH matches the path defined in .gitmodules
// but this is currently blocked by: