Files

23 lines
941 B
Rust
Raw Permalink Normal View History

use roto_codegen::generator::generate_rust_code;
use roto_codegen::google::protobuf::descriptor::{
DescriptorProto, FieldDescriptorProto, FileDescriptorSet,
};
use std::collections::HashMap;
#[test]
fn test_oneof_generation() {
let mut set = FileDescriptorSet::new(b"").unwrap(); // Simplified for testing
// In a real scenario, we'd build up a FileDescriptorSet from a proto.
// For this unit test, we'll manually construct a DescriptorProto that has a oneof.
// However, generate_rust_code takes a FileDescriptorSet.
// Let's mock a simple setup.
// Since manually constructing FileDescriptorSet is complex, let's instead check if the
// generator logic for oneofs produces the expected strings given a DescriptorProto.
// But the current tests use load_generated_code() which reads from data/request.bin.
// Let's see if we can find a way to test just the write_message function or similar.
}