#![allow(dead_code)]
use serde::Deserialize;
use std::collections::HashMap;
#[derive(Debug, Deserialize)]
pub struct IdentityFixtures {
pub tests: Vec<IdentityTest>,
}
#[derive(Debug, Deserialize)]
pub struct IdentityTest {
pub line: usize,
pub sql: String,
}
#[derive(Debug, Deserialize)]
pub struct PrettyFixtures {
pub tests: Vec<PrettyTest>,
}
#[derive(Debug, Deserialize)]
pub struct PrettyTest {
pub line: usize,
pub input: String,
pub expected: String,
}
#[derive(Debug, Deserialize)]
pub struct DialectFixture {
pub dialect: String,
pub identity: Vec<DialectIdentityTest>,
#[serde(default)]
pub transpilation: Vec<TranspilationTest>,
}
#[derive(Debug, Deserialize)]
pub struct DialectIdentityTest {
pub sql: String,
pub expected: Option<String>,
}
#[derive(Debug, Deserialize)]
pub struct TranspilationTest {
pub sql: String,
#[serde(default)]
pub read: HashMap<String, String>,
#[serde(default)]
pub write: HashMap<String, String>,
}
#[derive(Debug, Deserialize)]
pub struct CustomDialectFixtureFile {
pub dialect: String,
#[serde(default)]
pub category: String,
#[serde(default)]
pub identity: Vec<CustomIdentityTest>,
#[serde(default)]
pub transpilation: Vec<CustomTranspileTest>,
}
#[derive(Debug, Deserialize)]
pub struct CustomIdentityTest {
pub sql: String,
#[serde(default)]
pub expected: Option<String>,
#[serde(default)]
pub description: String,
}
#[derive(Debug, Deserialize)]
pub struct CustomTranspileTest {
pub sql: String,
#[serde(default)]
pub write: HashMap<String, String>,
#[serde(default)]
pub read: HashMap<String, String>,
#[serde(default)]
pub description: String,
}
pub struct CustomDialectFixtures {
pub dialect: String,
pub files: Vec<CustomDialectFixtureFile>,
}
pub struct AllCustomFixtures {
pub dialects: Vec<CustomDialectFixtures>,
}
#[derive(Debug, Deserialize)]
pub struct NormalizationTest {
pub sql: String,
pub expected: String,
pub line: usize,
}
#[derive(Debug, Deserialize)]
pub struct TranspileWriteTest {
pub sql: String,
pub expected: String,
#[serde(default)]
pub write: Option<String>,
#[serde(default)]
pub read: Option<String>,
pub line: usize,
}
#[derive(Debug, Deserialize)]
pub struct TranspileFixtures {
pub normalization: Vec<NormalizationTest>,
pub transpilation: Vec<TranspileWriteTest>,
}
#[derive(Debug, Deserialize)]
pub struct ParserRoundtripTest {
pub sql: String,
pub expected: String,
#[serde(default)]
pub read: Option<String>,
#[serde(default)]
pub write: Option<String>,
pub line: usize,
}
#[derive(Debug, Deserialize)]
pub struct ParserErrorTest {
pub sql: String,
#[serde(default)]
pub read: Option<String>,
pub line: usize,
}
#[derive(Debug, Deserialize)]
pub struct ParserFixtures {
pub roundtrips: Vec<ParserRoundtripTest>,
pub errors: Vec<ParserErrorTest>,
}