test suite support iniital

This commit is contained in:
NikVolf
2017-06-03 17:45:03 +03:00
parent b9edc13cd0
commit 5bb4559bf8
9 changed files with 125 additions and 2 deletions

40
spec/src/test.rs Normal file
View File

@ -0,0 +1,40 @@
#![cfg(test)]
#[derive(Deserialize)]
pub struct RuntimeValue {
#[serde(rename = "type")]
value_type: String,
value: String,
}
#[derive(Deserialize)]
#[serde(tag = "type")]
pub enum Action {
#[serde(rename = "invoke")]
Invoke { field: String, args: Vec<RuntimeValue> }
}
#[derive(Deserialize)]
#[serde(tag = "type")]
pub enum Command {
#[serde(rename = "module")]
Module { line: u64, filename: String },
#[serde(rename = "assert_return")]
AssertReturn {
line: u64,
action: Action,
expected: Vec<RuntimeValue>,
},
#[serde(rename = "assert_trap")]
AssertTrap {
line: u64,
action: Action,
text: String,
},
}
#[derive(Deserialize)]
pub struct Commands {
source_filename: String,
commands: Vec<Command>,
}