File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -472,4 +472,56 @@ mod tests {
472
472
}"# ,
473
473
) ;
474
474
}
475
+
476
+ #[ test]
477
+ fn accronym_replacement_works ( ) {
478
+ #[ cw_serde]
479
+ struct IbcStruct {
480
+ a : IbcSubStruct ,
481
+ b : IbcSubEnum ,
482
+ }
483
+ #[ cw_serde]
484
+ enum IbcEnum {
485
+ A ( IbcSubStruct ) ,
486
+ B ( IbcSubEnum ) ,
487
+ }
488
+ #[ cw_serde]
489
+ struct IbcSubStruct { }
490
+ #[ cw_serde]
491
+ enum IbcSubEnum {
492
+ A ( String ) ,
493
+ }
494
+
495
+ let code = generate_go ( cosmwasm_schema:: schema_for!( IbcStruct ) ) . unwrap ( ) ;
496
+ assert_code_eq (
497
+ code,
498
+ r#"
499
+ type IBCStruct struct {
500
+ A IBCSubStruct `json:"a"`
501
+ B IBCSubEnum `json:"b"`
502
+ }
503
+ type IBCSubEnum struct {
504
+ A string `json:"a,omitempty"`
505
+ }
506
+ type IBCSubStruct struct {
507
+ }
508
+ "# ,
509
+ ) ;
510
+
511
+ let code = generate_go ( cosmwasm_schema:: schema_for!( IbcEnum ) ) . unwrap ( ) ;
512
+ assert_code_eq (
513
+ code,
514
+ r#"
515
+ type IBCEnum struct {
516
+ A *IBCSubStruct `json:"a,omitempty"`
517
+ B *IBCSubEnum `json:"b,omitempty"`
518
+ }
519
+ type IBCSubEnum struct {
520
+ A string `json:"a,omitempty"`
521
+ }
522
+ type IBCSubStruct struct {
523
+ }
524
+ "# ,
525
+ ) ;
526
+ }
475
527
}
You can’t perform that action at this time.
0 commit comments