@@ -300,30 +300,47 @@ impl<'a> Parser<'a> {
300300 Output :: Values ( vec ! [ ] )
301301 } else {
302302 let mut vals: Vec < String > = output_str. lines ( ) . map ( |s| s. to_owned ( ) ) . collect ( ) ;
303- if let Mode :: Cockroach = self . mode {
304- let mut rows: Vec < Vec < String > > = vec ! [ ] ;
305- for line in vals {
306- let cols = split_cols ( & line, types. len ( ) ) ;
307- if sort != Sort :: No && cols. len ( ) != types. len ( ) {
308- // We can't check this condition for
309- // Sort::No, because some tests use strings
310- // with whitespace that look like extra
311- // columns. (Note that these tests never
312- // use any of the sorting options.)
313- bail ! (
314- "col len ({}) did not match declared col len ({})" ,
315- cols. len( ) ,
316- types. len( )
317- ) ;
303+ match self . mode {
304+ Mode :: Standard => {
305+ if !multiline {
306+ vals = vals. into_iter ( ) . map ( |val| val. replace ( '⏎' , "\n " ) ) . collect ( ) ;
318307 }
319- rows. push ( cols. into_iter ( ) . map ( |col| col. replace ( '␠' , " " ) ) . collect ( ) ) ;
320- }
321- if sort == Sort :: Row {
322- rows. sort ( ) ;
323308 }
324- vals = rows. into_iter ( ) . flatten ( ) . collect ( ) ;
325- if sort == Sort :: Value {
326- vals. sort ( ) ;
309+ Mode :: Cockroach => {
310+ let mut rows: Vec < Vec < String > > = vec ! [ ] ;
311+ for line in vals {
312+ let cols = split_cols ( & line, types. len ( ) ) ;
313+ if sort != Sort :: No && cols. len ( ) != types. len ( ) {
314+ // We can't check this condition for
315+ // Sort::No, because some tests use strings
316+ // with whitespace that look like extra
317+ // columns. (Note that these tests never
318+ // use any of the sorting options.)
319+ bail ! (
320+ "col len ({}) did not match declared col len ({})" ,
321+ cols. len( ) ,
322+ types. len( )
323+ ) ;
324+ }
325+ rows. push (
326+ cols. into_iter ( )
327+ . map ( |col| {
328+ let mut col = col. replace ( '␠' , " " ) ;
329+ if !multiline {
330+ col = col. replace ( '⏎' , "\n " ) ;
331+ }
332+ col
333+ } )
334+ . collect ( ) ,
335+ ) ;
336+ }
337+ if sort == Sort :: Row {
338+ rows. sort ( ) ;
339+ }
340+ vals = rows. into_iter ( ) . flatten ( ) . collect ( ) ;
341+ if sort == Sort :: Value {
342+ vals. sort ( ) ;
343+ }
327344 }
328345 }
329346 Output :: Values ( vals)
@@ -335,6 +352,7 @@ impl<'a> Parser<'a> {
335352 output : Ok ( QueryOutput {
336353 types,
337354 sort,
355+ multiline,
338356 label,
339357 column_names,
340358 mode : self . mode ,
0 commit comments