File tree Expand file tree Collapse file tree
crates/wasm-mutate/src/mutators Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,10 +106,7 @@ impl Mutator for AddFunctionMutator {
106106 added_func = true ;
107107 }
108108
109- if !added_code
110- && sec_id >= wasm_encoder:: SectionId :: Code as u8
111- && sec_id != wasm_encoder:: SectionId :: DataCount as u8
112- {
109+ if !added_code && sec_id == wasm_encoder:: SectionId :: Data as u8 {
113110 module. section ( & code_sec_enc) ;
114111 added_code = true ;
115112 }
@@ -188,4 +185,24 @@ mod tests {
188185 "# ,
189186 ) ;
190187 }
188+
189+ #[ test]
190+ fn test_add_function_before_tag ( ) {
191+ crate :: mutators:: match_mutation (
192+ r#"
193+ (module
194+ (type (;0;) (func))
195+ (tag (;0;) (type 0))
196+ )
197+ "# ,
198+ AddFunctionMutator ,
199+ r#"
200+ (module
201+ (type (;0;) (func))
202+ (tag (;0;) (type 0))
203+ (func (;0;) (type 0))
204+ )
205+ "# ,
206+ ) ;
207+ }
191208}
You can’t perform that action at this time.
0 commit comments