2020-06-08 03:29:51 +03:00
|
|
|
package columnwriter_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"testing"
|
2021-08-17 13:06:32 +03:00
|
|
|
|
|
|
|
"github.com/wader/fq/internal/columnwriter"
|
2020-06-08 03:29:51 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestColumnWriter(t *testing.T) {
|
|
|
|
cw := columnwriter.New(os.Stdout, []int{3, 4})
|
|
|
|
|
|
|
|
fmt.Fprintln(cw.Columns[0], "aaaaa")
|
|
|
|
fmt.Fprintln(cw.Columns[0], "bb")
|
|
|
|
fmt.Fprint(cw.Columns[0], "cc")
|
|
|
|
|
|
|
|
fmt.Fprintln(cw.Columns[1], "11111")
|
|
|
|
fmt.Fprintln(cw.Columns[1], "22")
|
|
|
|
fmt.Fprintln(cw.Columns[1], "33")
|
|
|
|
|
|
|
|
cw.Flush()
|
|
|
|
|
|
|
|
fmt.Fprintln(cw.Columns[1], "aaaaa")
|
|
|
|
fmt.Fprintln(cw.Columns[1], "bb")
|
|
|
|
fmt.Fprint(cw.Columns[1], "cc")
|
|
|
|
|
|
|
|
fmt.Fprintln(cw.Columns[0], "11111")
|
|
|
|
fmt.Fprintln(cw.Columns[0], "22")
|
|
|
|
fmt.Fprintln(cw.Columns[0], "33")
|
|
|
|
|
|
|
|
cw.Flush()
|
|
|
|
}
|