File: gate-tests.patch

package info (click to toggle)
rust-wasm-encoder 0.239.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 896 kB
  • sloc: makefile: 2
file content (105 lines) | stat: -rw-r--r-- 2,834 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
diff --git a/Cargo.toml b/Cargo.toml
index d84e5bd..9dc7c17 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -68,6 +68,12 @@ version = "3.2.0"
 version = "0.239.0"
 default-features = false
 
+[dev-dependencies.wasmparser]
+version = "0.239.0"
+features = [
+    "validate",
+]
+
 [lints.clippy]
 allow_attributes_without_reason = "warn"
 clone_on_copy = "warn"
diff --git a/src/core/code.rs b/src/core/code.rs
index fb87217..a31ee23 100644
--- a/src/core/code.rs
+++ b/src/core/code.rs
@@ -87,6 +87,7 @@ impl CodeSection {
     /// into a new code section encoder:
     ///
     /// ```
+    /// #[cfg(feature = "wasmparser")] {
     /// # use wasmparser::{BinaryReader, CodeSectionReader};
     /// //                  id, size, # entries, entry
     /// let code_section = [10, 6,    1,         4, 0, 65, 0, 11];
@@ -101,6 +102,7 @@ impl CodeSection {
     /// // than re-parsing and re-encoding it.
     /// let mut encoder = wasm_encoder::CodeSection::new();
     /// encoder.raw(&code_section[body_range.start..body_range.end]);
+    /// }
     /// ```
     pub fn raw(&mut self, data: &[u8]) -> &mut Self {
         data.encode(&mut self.bytes);
diff --git a/src/core/dump.rs b/src/core/dump.rs
index dd6db41..12b92dd 100644
--- a/src/core/dump.rs
+++ b/src/core/dump.rs
@@ -334,7 +334,7 @@ impl Encode for CoreDumpValue {
     }
 }
 
-#[cfg(test)]
+#[cfg(all(test, feature = "wasmparser"))]
 mod tests {
     use super::*;
     use crate::Module;
diff --git a/src/core/producers.rs b/src/core/producers.rs
index 38e7f0d..e5fbfaa 100644
--- a/src/core/producers.rs
+++ b/src/core/producers.rs
@@ -116,7 +116,7 @@ impl Encode for ProducersField {
     }
 }
 
-#[cfg(test)]
+#[cfg(all(test, feature = "wasmparser"))]
 mod test {
     #[test]
     fn roundtrip_example() {
diff --git a/src/core/types.rs b/src/core/types.rs
index a84ffd3..40ca95d 100644
--- a/src/core/types.rs
+++ b/src/core/types.rs
@@ -700,7 +700,7 @@ impl<'a> CoreTypeEncoder<'a> {
     }
 }
 
-#[cfg(test)]
+#[cfg(all(test, feature = "wasmparser"))]
 mod tests {
     use super::*;
     use crate::Module;
diff --git a/src/lib.rs b/src/lib.rs
index d53a8e2..df64741 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -25,6 +25,7 @@
 //! then we would do this:
 //!
 //! ```
+//! #[cfg(feature = "wasmparser")] {
 //! use wasm_encoder::{
 //!     CodeSection, ExportKind, ExportSection, Function, FunctionSection,
 //!     Module, TypeSection, ValType,
@@ -67,6 +68,7 @@
 //!
 //! // We generated a valid Wasm module!
 //! assert!(wasmparser::validate(&wasm_bytes).is_ok());
+//! }
 //! ```
 
 #![cfg_attr(docsrs, feature(doc_auto_cfg))]
@@ -201,7 +203,7 @@ fn encode_section(sink: &mut Vec<u8>, count: u32, bytes: &[u8]) {
     sink.extend(bytes);
 }
 
-#[cfg(test)]
+#[cfg(all(test, feature = "wasmparser", feature="component-model"))]
 mod test {
     use super::*;