From 9f8d558f461f3bc54c417c146ec6b50ca566b2e8 Mon Sep 17 00:00:00 2001 From: vms Date: Wed, 7 Apr 2021 23:33:20 +0300 Subject: [PATCH] fix tests --- .circleci/config.yml | 1 + .../export_functions/array_inner_refs.stderr | 10 ++++---- .../export_functions/inner_vec_refs.rs | 11 +++++++++ .../export_functions/inner_vec_refs.stderr | 23 +++++++++++++++++++ .../export_functions/ref_arrays.rs | 10 -------- fluence/tests/compilation_tests_runner.rs | 1 + 6 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 fluence/tests/compilation_tests/export_functions/inner_vec_refs.rs create mode 100644 fluence/tests/compilation_tests/export_functions/inner_vec_refs.stderr diff --git a/.circleci/config.yml b/.circleci/config.yml index 2d6e1c5..d347b2d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,6 +23,7 @@ jobs: (cd fluence; cargo build -v --target wasm32-wasi --all-features) (cd fluence; cargo clippy -v --target wasm32-wasi) (cd fluence-test; cargo build) + (cd crates/wit; cargo test) TARGET=wasm32-wasi cargo test -v --all-features diff --git a/fluence/tests/compilation_tests/export_functions/array_inner_refs.stderr b/fluence/tests/compilation_tests/export_functions/array_inner_refs.stderr index c47c125..76e4aee 100644 --- a/fluence/tests/compilation_tests/export_functions/array_inner_refs.stderr +++ b/fluence/tests/compilation_tests/export_functions/array_inner_refs.stderr @@ -1,28 +1,28 @@ -error: vector type in export functions should take arguments only by value +error: a vector type in arguments of export functions shouldn't contain references --> $DIR/array_inner_refs.rs:13:23 | 13 | pub fn inner_arrays_1(_arg: Vec<&Vec>>>) -> Vec>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: vector type in export functions should take arguments only by value +error: a vector type in arguments of export functions shouldn't contain references --> $DIR/array_inner_refs.rs:18:23 | 18 | pub fn inner_arrays_2(_arg: Vec>>>) -> Vec>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: vector type in export functions should take arguments only by value +error: a vector type in arguments of export functions shouldn't contain references --> $DIR/array_inner_refs.rs:23:23 | 23 | pub fn inner_arrays_3(_arg: Vec>>>) -> Vec>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: vector type in export functions should take arguments only by value +error: a vector type in arguments of export functions shouldn't contain references --> $DIR/array_inner_refs.rs:28:23 | 28 | pub fn inner_arrays_4(_arg: Vec>>>) -> Vec>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: vector type in export functions should take arguments only by value +error: a vector type in arguments of export functions shouldn't contain references --> $DIR/array_inner_refs.rs:33:35 | 33 | pub fn inner_arrays_5(_arg1: i32, _arg2: Vec>>>, _arg3: i32) -> Vec>>> { diff --git a/fluence/tests/compilation_tests/export_functions/inner_vec_refs.rs b/fluence/tests/compilation_tests/export_functions/inner_vec_refs.rs new file mode 100644 index 0000000..cbc346a --- /dev/null +++ b/fluence/tests/compilation_tests/export_functions/inner_vec_refs.rs @@ -0,0 +1,11 @@ +#![allow(improper_ctypes)] + +#[fce] +pub fn inner_arrays_2(_arg: &Vec>>>) -> &Vec>>> { + unimplemented!() +} + +#[fce] +pub fn inner_arrays_3(_arg: &Vec>>>) -> &Vec<&Vec<&Vec<&Vec<&u8>>>> { + unimplemented!() +} diff --git a/fluence/tests/compilation_tests/export_functions/inner_vec_refs.stderr b/fluence/tests/compilation_tests/export_functions/inner_vec_refs.stderr new file mode 100644 index 0000000..0120a33 --- /dev/null +++ b/fluence/tests/compilation_tests/export_functions/inner_vec_refs.stderr @@ -0,0 +1,23 @@ +error: cannot find attribute `fce` in this scope + --> $DIR/inner_vec_refs.rs:8:3 + | +8 | #[fce] + | ^^^ + +error: cannot find attribute `fce` in this scope + --> $DIR/inner_vec_refs.rs:3:3 + | +3 | #[fce] + | ^^^ + +error[E0601]: `main` function not found in crate `$CRATE` + --> $DIR/inner_vec_refs.rs:1:1 + | +1 | / #![allow(improper_ctypes)] +2 | | +3 | | #[fce] +4 | | pub fn inner_arrays_2(_arg: &Vec>>>) -> &Vec>>> { +... | +10 | | unimplemented!() +11 | | } + | |_^ consider adding a `main` function to `$DIR/tests/compilation_tests/export_functions/inner_vec_refs.rs` diff --git a/fluence/tests/compilation_tests/export_functions/ref_arrays.rs b/fluence/tests/compilation_tests/export_functions/ref_arrays.rs index 3607282..85bb278 100644 --- a/fluence/tests/compilation_tests/export_functions/ref_arrays.rs +++ b/fluence/tests/compilation_tests/export_functions/ref_arrays.rs @@ -14,16 +14,6 @@ pub fn inner_arrays_1(_arg: &Vec>>>) -> &Vec>>> unimplemented!() } -#[fce] -pub fn inner_arrays_2(_arg: &Vec>>>) -> &Vec>>> { - unimplemented!() -} - -#[fce] -pub fn inner_arrays_3(_arg: &Vec>>>) -> &Vec<&Vec<&Vec<&Vec<&u8>>>> { - unimplemented!() -} - #[fce] #[derive(Default)] pub struct TestRecord { diff --git a/fluence/tests/compilation_tests_runner.rs b/fluence/tests/compilation_tests_runner.rs index 3fa3371..ba0ca3a 100644 --- a/fluence/tests/compilation_tests_runner.rs +++ b/fluence/tests/compilation_tests_runner.rs @@ -4,6 +4,7 @@ fn fce_compilation_tests() { tests.compile_fail("tests/compilation_tests/export_functions/array_inner_refs.rs"); tests.pass("tests/compilation_tests/export_functions/arrays.rs"); tests.pass("tests/compilation_tests/export_functions/ref_arrays.rs"); + tests.compile_fail("tests/compilation_tests/export_functions/inner_vec_refs.rs"); tests.pass("tests/compilation_tests/export_functions/basic_types.rs"); tests.pass("tests/compilation_tests/export_functions/ref_basic_types.rs"); tests.compile_fail("tests/compilation_tests/export_functions/improper_types.rs");