@@ -590,6 +590,48 @@ describe("test functions with body defined", function()
590590 end
591591 )
592592
593+ describe (
594+ " when a multi return only has one starting parentheses" ,
595+ function ()
596+ local winid = 0
597+ before_each (function ()
598+ winid = utils .set_test_window_value (" func Foo() (i,k| {}" )
599+ vim .cmd (" AutoFixReturn" )
600+ end )
601+
602+ it (" should add parentheses around the return type" , function ()
603+ local lines = utils .get_win_lines (winid )
604+ eq (" func Foo() (i,k) {}" , lines [1 ])
605+ end )
606+
607+ it (" should set the cursor to inside the parens" , function ()
608+ local char = utils .get_cursor_char (winid )
609+ eq (" k" , char )
610+ end )
611+ end
612+ )
613+
614+ describe (
615+ " when a multi return only has one ending parentheses" ,
616+ function ()
617+ local winid = 0
618+ before_each (function ()
619+ winid = utils .set_test_window_value (" func Foo() i|,k) {}" )
620+ vim .cmd (" AutoFixReturn" )
621+ end )
622+
623+ it (" should add parentheses around the return type" , function ()
624+ local lines = utils .get_win_lines (winid )
625+ eq (" func Foo() (i,k) {}" , lines [1 ])
626+ end )
627+
628+ it (" should set the cursor to inside the parens" , function ()
629+ local char = utils .get_cursor_char (winid )
630+ eq (" (" , char )
631+ end )
632+ end
633+ )
634+
593635 describe (" when a multi return is started with cursor at the end of the second type" , function ()
594636 local winid = 0
595637 before_each (function ()
@@ -1026,6 +1068,48 @@ describe("test functions without a body defined", function()
10261068 end )
10271069 end )
10281070
1071+ describe (
1072+ " when a multi return only has one starting parentheses" ,
1073+ function ()
1074+ local winid = 0
1075+ before_each (function ()
1076+ winid = utils .set_test_window_value (" func Foo() (i,k|" )
1077+ vim .cmd (" AutoFixReturn" )
1078+ end )
1079+
1080+ it (" should add parentheses around the return type" , function ()
1081+ local lines = utils .get_win_lines (winid )
1082+ eq (" func Foo() (i,k)" , lines [1 ])
1083+ end )
1084+
1085+ it (" should set the cursor to inside the parens" , function ()
1086+ local char = utils .get_cursor_char (winid )
1087+ eq (" k" , char )
1088+ end )
1089+ end
1090+ )
1091+
1092+ describe (
1093+ " when a multi return only has one ending parentheses" ,
1094+ function ()
1095+ local winid = 0
1096+ before_each (function ()
1097+ winid = utils .set_test_window_value (" func Foo() i|,k) {}" )
1098+ vim .cmd (" AutoFixReturn" )
1099+ end )
1100+
1101+ it (" should add parentheses around the return type" , function ()
1102+ local lines = utils .get_win_lines (winid )
1103+ eq (" func Foo() (i,k) {}" , lines [1 ])
1104+ end )
1105+
1106+ it (" should set the cursor to inside the parens" , function ()
1107+ local char = utils .get_cursor_char (winid )
1108+ eq (" (" , char )
1109+ end )
1110+ end
1111+ )
1112+
10291113 describe (" when a multi closure return with cursor at the end of the second type" , function ()
10301114 local winid = 0
10311115 before_each (function ()
@@ -2279,6 +2363,49 @@ describe("test methods with body defined", function()
22792363 eq (" F" , char )
22802364 end )
22812365 end )
2366+
2367+ describe (
2368+ " when a multi return only has one starting parentheses" ,
2369+ function ()
2370+ local winid = 0
2371+ before_each (function ()
2372+ winid = utils .set_test_window_value (" func (b *Bar) Foo() (i,k| {}" )
2373+ vim .cmd (" AutoFixReturn" )
2374+ end )
2375+
2376+ it (" should add parentheses around the return type" , function ()
2377+ local lines = utils .get_win_lines (winid )
2378+ eq (" func (b *Bar) Foo() (i,k) {}" , lines [1 ])
2379+ end )
2380+
2381+ it (" should set the cursor to inside the parens" , function ()
2382+ local char = utils .get_cursor_char (winid )
2383+ eq (" k" , char )
2384+ end )
2385+ end
2386+ )
2387+
2388+ describe (
2389+ " when a multi return only has one ending parentheses" ,
2390+ function ()
2391+ local winid = 0
2392+ before_each (function ()
2393+ winid = utils .set_test_window_value (" func Foo() i|,k) {}" )
2394+ vim .cmd (" AutoFixReturn" )
2395+ end )
2396+
2397+ it (" should add parentheses around the return type" , function ()
2398+ local lines = utils .get_win_lines (winid )
2399+ eq (" func Foo() (i,k) {}" , lines [1 ])
2400+ end )
2401+
2402+ it (" should set the cursor to inside the parens" , function ()
2403+ local char = utils .get_cursor_char (winid )
2404+ eq (" (" , char )
2405+ end )
2406+ end
2407+ )
2408+
22822409
22832410 describe (
22842411 " when a multi inline interface return is started with cursor at the end of the comma" ,
@@ -2784,6 +2911,48 @@ describe("test methods without a body defined", function()
27842911 end
27852912 )
27862913
2914+ describe (
2915+ " when a multi return only has one starting parentheses" ,
2916+ function ()
2917+ local winid = 0
2918+ before_each (function ()
2919+ winid = utils .set_test_window_value (" func (b *Bar) Foo() (i,k|" )
2920+ vim .cmd (" AutoFixReturn" )
2921+ end )
2922+
2923+ it (" should add parentheses around the return type" , function ()
2924+ local lines = utils .get_win_lines (winid )
2925+ eq (" func (b *Bar) Foo() (i,k)" , lines [1 ])
2926+ end )
2927+
2928+ it (" should set the cursor to inside the parens" , function ()
2929+ local char = utils .get_cursor_char (winid )
2930+ eq (" k" , char )
2931+ end )
2932+ end
2933+ )
2934+
2935+ describe (
2936+ " when a multi return only has one ending parentheses" ,
2937+ function ()
2938+ local winid = 0
2939+ before_each (function ()
2940+ winid = utils .set_test_window_value (" func Foo() i|,k) {}" )
2941+ vim .cmd (" AutoFixReturn" )
2942+ end )
2943+
2944+ it (" should add parentheses around the return type" , function ()
2945+ local lines = utils .get_win_lines (winid )
2946+ eq (" func Foo() (i,k) {}" , lines [1 ])
2947+ end )
2948+
2949+ it (" should set the cursor to inside the parens" , function ()
2950+ local char = utils .get_cursor_char (winid )
2951+ eq (" (" , char )
2952+ end )
2953+ end
2954+ )
2955+
27872956 describe (
27882957 " when a multi send only channel return is started with cursor at the end of the second type" ,
27892958 function ()
0 commit comments