@@ -792,22 +792,32 @@ func Test_pipe_from_buffer_nr()
792792 call Run_test_pipe_from_buffer (0 )
793793endfunc
794794
795- func Run_pipe_through_sort (all )
795+ func Run_pipe_through_sort (all , use_buffer )
796796 if ! executable (' sort' ) || ! has (' job' )
797797 return
798798 endif
799- split sortin
800- call setline (1 , [' ccc' , ' aaa' , ' ddd' , ' bbb' , ' eee' ])
801- let options = {' in_io' : ' buffer' , ' in_name' : ' sortin' ,
802- \ ' out_io' : ' buffer' , ' out_name' : ' sortout' }
799+ let options = {' out_io' : ' buffer' , ' out_name' : ' sortout' }
800+ if a: use_buffer
801+ split sortin
802+ call setline (1 , [' ccc' , ' aaa' , ' ddd' , ' bbb' , ' eee' ])
803+ let options .in_io = ' buffer'
804+ let options .in_name = ' sortin'
805+ endif
803806 if ! a: all
804807 let options .in_top = 2
805808 let options .in_bot = 4
806809 endif
807810 let g: job = job_start (' sort' , options )
808811 call assert_equal (" run" , job_status (g: job ))
812+
813+ if ! a: use_buffer
814+ call ch_sendraw (g: job , " ccc\n aaa\n ddd\n bbb\n eee\n " )
815+ call ch_close_in (g: job )
816+ endif
817+
809818 call WaitFor (' job_status(g:job) == "dead"' )
810819 call assert_equal (" dead" , job_status (g: job ))
820+
811821 sp sortout
812822 call assert_equal (' Reading from channel output...' , getline (1 ))
813823 if a: all
@@ -818,18 +828,25 @@ func Run_pipe_through_sort(all)
818828
819829 call job_stop (g: job )
820830 unlet g: job
821- bwipe! sortin
831+ if a: use_buffer
832+ bwipe! sortin
833+ endif
822834 bwipe! sortout
823835endfunc
824836
825837func Test_pipe_through_sort_all ()
826838 call ch_log (' Test_pipe_through_sort_all()' )
827- call Run_pipe_through_sort (1 )
839+ call Run_pipe_through_sort (1 , 1 )
828840endfunc
829841
830842func Test_pipe_through_sort_some ()
831843 call ch_log (' Test_pipe_through_sort_some()' )
832- call Run_pipe_through_sort (0 )
844+ call Run_pipe_through_sort (0 , 1 )
845+ endfunc
846+
847+ func Test_pipe_through_sort_feed ()
848+ call ch_log (' Test_pipe_through_sort_feed()' )
849+ call Run_pipe_through_sort (1 , 0 )
833850endfunc
834851
835852func Test_pipe_to_nameless_buffer ()
0 commit comments