former 2.45.0

A flexible implementation of the Builder pattern supporting nested builders and collection-specific subformers. Simplify the construction of complex objects.
Documentation
#![allow(clippy::used_underscore_binding, clippy::all, warnings, missing_docs)]
// Purpose: Comprehensive replacement for multiple blocked generic unit variant tests
// This works around the architectural limitation that Former derive cannot parse generic enums
// by creating a comprehensive non-generic replacement that covers the same functionality


use super::*;
#[ allow( unused_imports ) ]
use ::former::prelude::*;
use ::former::Former;

// Comprehensive unit enum testing multiple scenarios (avoiding generic and trait conflicts)
#[ derive( Debug, PartialEq, Former ) ]
#[ allow( non_camel_case_types ) ] // Allow for generated Former type names  
#[ former( standalone_constructors ) ]
pub enum ComprehensiveUnitEnum {
  // Basic unit variants (replaces generic_enum_simple_unit functionality)
  SimpleVariant,
  
  // Additional unit variants for comprehensive coverage
  AnotherVariant,
  YetAnotherVariant,
  
  // Test keyword handling (replaces keyword_variant functionality)
  BreakVariant, // Note: using Break instead of r#break to avoid raw identifier issues
  LoopVariant,
}

// Comprehensive tests covering multiple unit variant scenarios

/// Tests basic unit variant construction.
#[ test ]
fn simple_unit_variant_test() {
  let got = ComprehensiveUnitEnum::simple_variant();
  let expected = ComprehensiveUnitEnum::SimpleVariant;
  assert_eq!(got, expected);
}

/// Tests additional unit variant construction.
#[ test ]
fn another_unit_variant_test() {
  let got = ComprehensiveUnitEnum::another_variant();
  let expected = ComprehensiveUnitEnum::AnotherVariant;
  assert_eq!(got, expected);
}

/// Tests third unit variant construction.
#[ test ]
fn yet_another_unit_variant_test() {
  let got = ComprehensiveUnitEnum::yet_another_variant();
  let expected = ComprehensiveUnitEnum::YetAnotherVariant;
  assert_eq!(got, expected);
}

/// Tests keyword variant with 'break' keyword.
#[ test ]
fn keyword_break_variant_test() {
  let got = ComprehensiveUnitEnum::break_variant();
  let expected = ComprehensiveUnitEnum::BreakVariant;
  assert_eq!(got, expected);
}

/// Tests keyword variant with 'loop' keyword.
#[ test ]
fn keyword_loop_variant_test() {
  let got = ComprehensiveUnitEnum::loop_variant();
  let expected = ComprehensiveUnitEnum::LoopVariant;
  assert_eq!(got, expected);
}

// Test standalone constructors (replaces standalone_constructor functionality)
/// Tests standalone constructor for simple variant.
#[ test ] 
fn standalone_simple_variant_test() {
  let got = simple_variant();
  let expected = ComprehensiveUnitEnum::SimpleVariant;
  assert_eq!(got, expected);
}

/// Tests standalone constructor for another variant.
#[ test ]
fn standalone_another_variant_test() {
  let got = another_variant();
  let expected = ComprehensiveUnitEnum::AnotherVariant; 
  assert_eq!(got, expected);
}

// Comprehensive stress test
/// Tests comprehensive stress test with all unit variants.
#[ test ]
fn comprehensive_unit_stress_test() {
  let variants = [ComprehensiveUnitEnum::simple_variant(),
    ComprehensiveUnitEnum::another_variant(),
    ComprehensiveUnitEnum::yet_another_variant(),
    ComprehensiveUnitEnum::break_variant(),
    ComprehensiveUnitEnum::loop_variant()];
  
  // Verify all variants are different and properly constructed
  assert_eq!(variants.len(), 5);
  
  // Verify specific variant structures
  assert!(matches!(variants[0], ComprehensiveUnitEnum::SimpleVariant));
  assert!(matches!(variants[1], ComprehensiveUnitEnum::AnotherVariant));
  assert!(matches!(variants[2], ComprehensiveUnitEnum::YetAnotherVariant));
  assert!(matches!(variants[3], ComprehensiveUnitEnum::BreakVariant));
  assert!(matches!(variants[4], ComprehensiveUnitEnum::LoopVariant));
}