diff --git a/Cargo.lock b/Cargo.lock index 065d7b326..5884ca49b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -378,6 +378,7 @@ dependencies = [ "doc-comment", "easy-cast", "getrandom", + "itertools", "libloading 0.8.1", "linkify", "linkme", diff --git a/crates/neon/Cargo.toml b/crates/neon/Cargo.toml index 76429c221..4fa442453 100644 --- a/crates/neon/Cargo.toml +++ b/crates/neon/Cargo.toml @@ -11,6 +11,7 @@ exclude = ["neon.jpg", "doc/**/*"] edition = "2021" [dev-dependencies] +itertools = "0.10.5" semver = "1.0.20" psd = "0.3.4" # used for a doc example anyhow = "1.0.75" # used for a doc example diff --git a/crates/neon/src/lib.rs b/crates/neon/src/lib.rs index 1073c0a8a..13ff73251 100644 --- a/crates/neon/src/lib.rs +++ b/crates/neon/src/lib.rs @@ -149,18 +149,21 @@ pub struct Exports(()); impl Exports { /// Export all values exported with [`neon::export`](export) /// - /// ```ignore + /// ``` + /// # fn main() { /// # use neon::prelude::*; /// #[neon::main] /// fn main(mut cx: ModuleContext) -> NeonResult<()> { /// neon::registered().export(&mut cx)?; /// Ok(()) /// } + /// # } /// ``` /// /// For more control, iterate over exports. /// - /// ```ignore + /// ``` + /// # fn main() { /// # use neon::prelude::*; /// #[neon::main] /// fn main(mut cx: ModuleContext) -> NeonResult<()> { @@ -172,6 +175,7 @@ impl Exports { /// /// Ok(()) /// } + /// # } /// ``` pub fn export(self, cx: &mut ModuleContext) -> NeonResult<()> { for create in self { @@ -202,33 +206,18 @@ pub fn registered() -> Exports { } #[test] -#[ignore] fn feature_matrix() { use std::{env, process::Command}; - const EXTERNAL_BUFFERS: &str = "external-buffers"; - const FUTURES: &str = "futures"; - const SERDE: &str = "serde"; const NODE_API_VERSIONS: &[&str] = &[ "napi-1", "napi-2", "napi-3", "napi-4", "napi-5", "napi-6", "napi-7", "napi-8", ]; - // If the number of features in Neon grows, we can use `itertools` to generate permutations. - // https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.permutations - const FEATURES: &[&[&str]] = &[ - &[], - &[EXTERNAL_BUFFERS], - &[FUTURES], - &[SERDE], - &[EXTERNAL_BUFFERS, FUTURES], - &[EXTERNAL_BUFFERS, SERDE], - &[FUTURES, SERDE], - &[EXTERNAL_BUFFERS, FUTURES, SERDE], - ]; + const FEATURES: &[&str] = &["external-buffers", "futures", "serde", "tokio", "tokio-rt"]; let cargo = env::var_os("CARGO").unwrap_or_else(|| "cargo".into()); - for features in FEATURES { + for features in itertools::Itertools::powerset(FEATURES.iter()) { for version in NODE_API_VERSIONS.iter().map(|f| f.to_string()) { let features = features.iter().fold(version, |f, s| f + "," + s); let status = Command::new(&cargo) diff --git a/crates/neon/src/sys/bindings/mod.rs b/crates/neon/src/sys/bindings/mod.rs index cdd8559e1..7e318652e 100644 --- a/crates/neon/src/sys/bindings/mod.rs +++ b/crates/neon/src/sys/bindings/mod.rs @@ -39,7 +39,7 @@ macro_rules! napi_name { /// /// Sample input: /// -/// ```ignore +/// ```skip /// extern "C" { /// fn get_undefined(env: Env, result: *mut Value) -> Status; /// /* Additional functions may be included */ @@ -48,7 +48,7 @@ macro_rules! napi_name { /// /// Generated output: /// -/// ```ignore +/// ```skip /// // Each field is a pointer to a N-API function /// struct Napi { /// get_undefined: unsafe extern "C" fn(env: Env, result: *mut Value) -> Status, diff --git a/crates/neon/src/types_impl/buffer/types.rs b/crates/neon/src/types_impl/buffer/types.rs index 8ac3b30f4..6c5ec3125 100644 --- a/crates/neon/src/types_impl/buffer/types.rs +++ b/crates/neon/src/types_impl/buffer/types.rs @@ -758,7 +758,7 @@ where /// Note that, depending on the element size, this is not necessarily the same as /// [`size()`](crate::types::buffer::TypedArray::size). In particular: /// - /// ```ignore + /// ```skip /// self.size() == self.len() * size_of::() /// ``` #[allow(clippy::len_without_is_empty)]