2017-06-03 17:45:03 +03:00
|
|
|
#![cfg(test)]
|
|
|
|
|
2017-06-05 15:30:03 +03:00
|
|
|
#[derive(Deserialize, Debug)]
|
2017-06-03 17:45:03 +03:00
|
|
|
pub struct RuntimeValue {
|
|
|
|
#[serde(rename = "type")]
|
2017-06-03 21:20:52 +03:00
|
|
|
pub value_type: String,
|
|
|
|
pub value: String,
|
2017-06-03 17:45:03 +03:00
|
|
|
}
|
|
|
|
|
2017-06-05 15:30:03 +03:00
|
|
|
#[derive(Deserialize, Debug)]
|
2017-06-03 17:45:03 +03:00
|
|
|
#[serde(tag = "type")]
|
|
|
|
pub enum Action {
|
|
|
|
#[serde(rename = "invoke")]
|
|
|
|
Invoke { field: String, args: Vec<RuntimeValue> }
|
|
|
|
}
|
|
|
|
|
2017-06-05 15:30:03 +03:00
|
|
|
#[derive(Deserialize, Debug)]
|
2017-06-03 17:45:03 +03:00
|
|
|
#[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,
|
|
|
|
},
|
2017-06-05 18:13:17 +03:00
|
|
|
#[serde(rename = "assert_invalid")]
|
|
|
|
AssertInvalid {
|
|
|
|
line: u64,
|
|
|
|
filename: String,
|
|
|
|
text: String,
|
|
|
|
}
|
2017-06-03 17:45:03 +03:00
|
|
|
}
|
|
|
|
|
2017-06-05 15:30:03 +03:00
|
|
|
#[derive(Deserialize, Debug)]
|
2017-06-03 21:20:52 +03:00
|
|
|
pub struct Spec {
|
|
|
|
pub source_filename: String,
|
|
|
|
pub commands: Vec<Command>,
|
2017-06-03 17:45:03 +03:00
|
|
|
}
|