This commit is contained in:
Anthony Miyaguchi 2019-01-17 13:39:42 -08:00
Родитель 506b604f64
Коммит 2d6f8ac45a
2 изменённых файлов: 59 добавлений и 35 удалений

Просмотреть файл

@ -9,11 +9,17 @@ use std::fs::{self, File};
use std::io::{BufReader, Write};
use std::path::{Path, PathBuf};
#[derive(Deserialize, Debug)]
struct TestData {
avro: Value,
bigquery: Value,
json: Value,
}
#[derive(Deserialize, Debug)]
struct TestCase {
name: String,
avro: Value,
json: Value,
test: TestData,
}
#[derive(Deserialize, Debug)]
@ -59,8 +65,8 @@ fn {name}() {{
}}
"##,
name = case.name,
input_data = format_json(case.json),
expected = format_json(case.avro),
input_data = format_json(case.test.json),
expected = format_json(case.test.avro),
);
write!(outfile, "{}", formatted).unwrap()
}

Просмотреть файл

@ -2,42 +2,60 @@
"name": "atomic",
"tests": [
{
"avro": {
"name": "root",
"type": "int"
},
"json": {
"type": "integer"
},
"name": "test_atomic"
"name": "test_atomic",
"test": {
"avro": {
"name": "root",
"type": "int"
},
"bigquery": {
"mode": "REQUIRED",
"type": "INTEGER"
},
"json": {
"type": "integer"
}
}
},
{
"avro": {
"name": "root",
"type": [
"int",
"null"
]
},
"json": {
"type": [
"integer",
"null"
]
},
"name": "test_atomic_with_null"
"name": "test_atomic_with_null",
"test": {
"avro": {
"name": "root",
"type": [
"int",
"null"
]
},
"bigquery": {
"mode": "NULLABLE",
"type": "INTEGER"
},
"json": {
"type": [
"integer",
"null"
]
}
}
},
{
"name": "test_incompatible_atomic_multitype",
"json": {
"type": [
"boolean",
"integer"
]
},
"avro": {
"type": "string"
"test": {
"avro": {
"type": "string"
},
"bigquery": {
"mode": "REQUIRED",
"type": "STRING"
},
"json": {
"type": [
"boolean",
"integer"
]
}
}
}
]
}
}