use std::collections::HashMap;
use std::path::PathBuf;
use std::time::Duration;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TestPlan {
pub path: PathBuf,
pub steps: Vec<Step>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Step {
pub line_no: usize,
pub raw: String,
pub kind: StepKind,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum StepKind {
Directive(Directive),
Command(CommandLine),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum Directive {
Set {
key: String,
value: String,
},
Env {
key: String,
value: String,
},
Cd {
path: String,
},
Timeout {
duration: Duration,
},
ExpectExit {
equals: Option<i32>,
not_equals: Option<i32>,
},
Capture {
name: String,
},
Print {
name: String,
},
Skip {
reason: String,
},
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommandLine {
pub argv: Vec<String>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SubstitutionContext {
pub test_vars: HashMap<String, String>,
pub env_vars: HashMap<String, String>,
pub builtin: HashMap<String, String>,
}