mirror of
https://github.com/fluencelabs/wasm-utils
synced 2025-06-26 13:01:37 +00:00
use indoc!
This commit is contained in:
@ -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"]
|
||||||
|
21
src/graph.rs
21
src/graph.rs
@ -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);
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user