use indoc!

This commit is contained in:
NikVolf
2019-01-27 12:14:14 +03:00
parent 5b2cd9c4c6
commit 38e0f254b0
3 changed files with 79 additions and 80 deletions

View File

@ -16,6 +16,7 @@ byteorder = { version = "1", default-features = false }
tempdir = "0.3" tempdir = "0.3"
wabt = "0.2" wabt = "0.2"
diff = "0.1.11" diff = "0.1.11"
indoc = "0.3"
[features] [features]
default = ["std"] default = ["std"]

View File

@ -792,15 +792,13 @@ mod tests {
#[test] #[test]
fn smoky() { fn smoky() {
let sample = load_sample(r#" let sample = load_sample(indoc!(r#"
(module (module
(type (func)) (type (func))
(func (type 0)) (func (type 0))
(memory 0 1) (memory 0 1)
(export "simple" (func 0)) (export "simple" (func 0)))"#
) ));
"#
);
assert_eq!(sample.types.len(), 1); assert_eq!(sample.types.len(), 1);
assert_eq!(sample.funcs.len(), 1); assert_eq!(sample.funcs.len(), 1);
@ -814,7 +812,7 @@ mod tests {
#[test] #[test]
fn table() { fn table() {
let mut sample = load_sample(r#" let mut sample = load_sample(indoc!(r#"
(module (module
(import "env" "foo" (func $foo)) (import "env" "foo" (func $foo))
(func (param i32) (func (param i32)
@ -833,7 +831,7 @@ mod tests {
;; Refer all types of functions: imported, defined not exported and defined exported. ;; Refer all types of functions: imported, defined not exported and defined exported.
(elem (i32.const 0) 0 1 2) (elem (i32.const 0) 0 1 2)
)"# )"#
); ));
{ {
let element_func = &sample.elements[0].value[1]; let element_func = &sample.elements[0].value[1];
@ -864,7 +862,7 @@ mod tests {
#[test] #[test]
fn new_import() { fn new_import() {
let mut sample = load_sample(r#" let mut sample = load_sample(indoc!(r#"
(module (module
(type (;0;) (func)) (type (;0;) (func))
(type (;1;) (func (param i32 i32) (result i32))) (type (;1;) (func (param i32 i32) (result i32)))
@ -880,7 +878,7 @@ mod tests {
call 1 call 1
) )
)"# )"#
); ));
{ {
let type_ref_0 = sample.types.clone_ref(0); let type_ref_0 = sample.types.clone_ref(0);
@ -922,7 +920,7 @@ mod tests {
#[test] #[test]
fn simple_opt() { fn simple_opt() {
let mut sample = load_sample(r#" let mut sample = load_sample(indoc!(r#"
(module (module
(type (;0;) (func)) (type (;0;) (func))
(type (;1;) (func (param i32 i32) (result i32))) (type (;1;) (func (param i32 i32) (result i32)))
@ -952,9 +950,8 @@ mod tests {
(func (type 0) (func (type 0)
call 3 call 3
) )
)"# )"#
); ));
validate_sample(&sample); validate_sample(&sample);

View File

@ -7,8 +7,9 @@ extern crate alloc;
extern crate byteorder; extern crate byteorder;
extern crate parity_wasm; extern crate parity_wasm;
#[macro_use] #[macro_use] extern crate log;
extern crate log; #[cfg(test)] #[macro_use] extern crate indoc;
pub mod rules; pub mod rules;