MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / test_gen_with_derives

Function test_gen_with_derives

sea-orm-codegen/src/entity/writer.rs:2379–2577  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2377
2378 #[test]
2379 fn test_gen_with_derives() -> io::Result<()> {
2380 let mut cake_entity = setup().get_mut(0).unwrap().clone();
2381
2382 assert_eq!(cake_entity.get_table_name_snake_case(), "cake");
2383
2384 // Compact code blocks
2385 assert_eq!(
2386 comparable_file_string(include_str!(
2387 "../../tests/compact_with_derives/cake_none.rs"
2388 ))?,
2389 generated_to_string(EntityWriter::gen_compact_code_blocks(
2390 &cake_entity,
2391 &WithSerde::None,
2392 &DateTimeCrate::Chrono,
2393 &None,
2394 false,
2395 false,
2396 &TokenStream::new(),
2397 &TokenStream::new(),
2398 false,
2399 true,
2400 ))
2401 );
2402 assert_eq!(
2403 comparable_file_string(include_str!("../../tests/compact_with_derives/cake_one.rs"))?,
2404 generated_to_string(EntityWriter::gen_compact_code_blocks(
2405 &cake_entity,
2406 &WithSerde::None,
2407 &DateTimeCrate::Chrono,
2408 &None,
2409 false,
2410 false,
2411 &bonus_derive(["ts_rs::TS"]),
2412 &TokenStream::new(),
2413 false,
2414 true,
2415 ))
2416 );
2417 assert_eq!(
2418 comparable_file_string(include_str!(
2419 "../../tests/compact_with_derives/cake_multiple.rs"
2420 ))?,
2421 generated_to_string(EntityWriter::gen_compact_code_blocks(
2422 &cake_entity,
2423 &WithSerde::None,
2424 &DateTimeCrate::Chrono,
2425 &None,
2426 false,
2427 false,
2428 &bonus_derive(["ts_rs::TS", "utoipa::ToSchema"]),
2429 &TokenStream::new(),
2430 false,
2431 true,
2432 ))
2433 );
2434
2435 // Expanded code blocks
2436 assert_eq!(

Callers

nothing calls this directly

Calls 4

unwrapMethod · 0.80
setupFunction · 0.70
newFunction · 0.50

Tested by

no test coverage detected