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

Function test_enum_string_value

src/avro/src/lib.rs:427–466  ·  view source on GitHub ↗

unsupported operation: inline assembly is not supported

()

Source from the content-addressed store, hash-verified

425 #[mz_ore::test]
426 #[cfg_attr(miri, ignore)] // unsupported operation: inline assembly is not supported
427 fn test_enum_string_value() {
428 let raw_schema = r#"
429 {
430 "type": "record",
431 "name": "test",
432 "fields": [
433 {"name": "a", "type": "long", "default": 42},
434 {"name": "b", "type": "string"},
435 {
436 "name": "c",
437 "type": {
438 "type": "enum",
439 "name": "suit",
440 "symbols": ["diamonds", "spades", "clubs", "hearts"]
441 },
442 "default": "spades"
443 }
444 ]
445 }
446 "#;
447 let schema = Schema::from_str(raw_schema).unwrap();
448 let mut writer = Writer::with_codec(schema.clone(), Vec::new(), Codec::Null);
449 let mut record = Record::new(schema.top_node()).unwrap();
450 record.put("a", 27i64);
451 record.put("b", "foo");
452 record.put("c", "clubs");
453 writer.append(record).unwrap();
454 writer.flush().unwrap();
455 let input = writer.into_inner();
456 let mut reader = Reader::with_schema(&schema, &input[..]).unwrap();
457 assert_eq!(
458 reader.next().unwrap().unwrap(),
459 Value::Record(vec![
460 ("a".to_string(), Value::Long(27)),
461 ("b".to_string(), Value::String("foo".to_string())),
462 ("c".to_string(), Value::Enum(2, "clubs".to_string())),
463 ])
464 );
465 assert_none!(reader.next());
466 }
467
468 //TODO: move where it fits better
469 #[mz_ore::test]

Callers

nothing calls this directly

Calls 7

unwrapMethod · 0.80
top_nodeMethod · 0.80
putMethod · 0.80
cloneMethod · 0.45
appendMethod · 0.45
flushMethod · 0.45
into_innerMethod · 0.45

Tested by

no test coverage detected