MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_duplicate_field_error

Function test_duplicate_field_error

src/avro/src/reader.rs:1179–1212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1177
1178 #[mz_ore::test]
1179 fn test_duplicate_field_error() {
1180 let r = r#"
1181{
1182 "type": "record",
1183 "name": "com.materialize.bar",
1184 "fields": [
1185 {"name": "f1", "type": "int"},
1186 {"name": "f1", "type": "int"}
1187 ]
1188}
1189"#;
1190 let w = r#"
1191{
1192 "type": "record",
1193 "name": "com.materialize.bar",
1194 "fields": [
1195 {"name": "f1", "type": "int"}
1196 ]
1197}
1198"#;
1199 let r: Schema = r.parse().unwrap();
1200 let w: Schema = w.parse().unwrap();
1201 let err_str = if let Result::Err(AvroError::ResolveSchema(SchemaResolutionError(s))) =
1202 resolve_schemas(&w, &r)
1203 {
1204 s
1205 } else {
1206 panic!("Expected schema resolution failure");
1207 };
1208 assert_eq!(
1209 &err_str,
1210 "Duplicate field `com.materialize.bar.f1` in schema"
1211 );
1212 }
1213
1214 #[mz_ore::test]
1215 fn test_decimal_field_mismatch_error() {

Callers

nothing calls this directly

Calls 3

resolve_schemasFunction · 0.85
unwrapMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected