File tree Expand file tree Collapse file tree
samples/client/petstore/rust/reqwest Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,13 +21,22 @@ fn test_inline_enum_not_boxed_in_constructor() {
2121}
2222
2323#[ test]
24- fn test_existing_ref_enum_still_works ( ) {
25- // The Order model has a Status enum, which should still work
26- // This ensures the fix didn't break existing enum handling
27- let order = Order :: new ( ) ;
24+ fn test_existing_inline_enum_in_order_model ( ) {
25+ // The Order model has an inline Status enum (placed, approved, shipped)
26+ // This ensures the fix works for enums in other models too
27+ let mut order = Order :: new ( ) ;
2828
29- // The status field should work normally
30- assert ! ( order. status. is_none( ) || order. status. is_some( ) ) ;
29+ // Set the status to a specific enum value
30+ order. status = Some ( petstore_reqwest_async:: models:: order:: Status :: Placed ) ;
31+
32+ // Verify we can access and compare the enum
33+ assert_eq ! ( order. status, Some ( petstore_reqwest_async:: models:: order:: Status :: Placed ) ) ;
34+
35+ // Verify it's not boxed - this is a compile-time check
36+ if let Some ( status) = order. status {
37+ let _status_ref: petstore_reqwest_async:: models:: order:: Status = status;
38+ assert_eq ! ( status, petstore_reqwest_async:: models:: order:: Status :: Placed ) ;
39+ }
3140}
3241
3342#[ test]
Original file line number Diff line number Diff line change @@ -21,13 +21,22 @@ fn test_inline_enum_not_boxed_in_constructor() {
2121}
2222
2323#[ test]
24- fn test_existing_ref_enum_still_works ( ) {
25- // The Order model has a Status enum, which should still work
26- // This ensures the fix didn't break existing enum handling
27- let order = Order :: new ( ) ;
24+ fn test_existing_inline_enum_in_order_model ( ) {
25+ // The Order model has an inline Status enum (placed, approved, shipped)
26+ // This ensures the fix works for enums in other models too
27+ let mut order = Order :: new ( ) ;
2828
29- // The status field should work normally
30- assert ! ( order. status. is_none( ) || order. status. is_some( ) ) ;
29+ // Set the status to a specific enum value
30+ order. status = Some ( petstore_reqwest:: models:: order:: Status :: Placed ) ;
31+
32+ // Verify we can access and compare the enum
33+ assert_eq ! ( order. status, Some ( petstore_reqwest:: models:: order:: Status :: Placed ) ) ;
34+
35+ // Verify it's not boxed - this is a compile-time check
36+ if let Some ( status) = order. status {
37+ let _status_ref: petstore_reqwest:: models:: order:: Status = status;
38+ assert_eq ! ( status, petstore_reqwest:: models:: order:: Status :: Placed ) ;
39+ }
3140}
3241
3342#[ test]
You can’t perform that action at this time.
0 commit comments