Commit e28692f0 authored by Robert Griesemer's avatar Robert Griesemer

- converted tabwriter to new naming scheme

R=r
OCL=22870
CL=22870
parent f4babf69
...@@ -13,34 +13,34 @@ import ( ...@@ -13,34 +13,34 @@ import (
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Basic ByteArray support // Basic byteArray support
type ByteArray struct { type byteArray struct {
a []byte; a []byte;
} }
func (b *ByteArray) Init(initial_size int) { func (b *byteArray) Init(initial_size int) {
b.a = make([]byte, initial_size)[0 : 0]; b.a = make([]byte, initial_size)[0 : 0];
} }
func (b *ByteArray) Len() int { func (b *byteArray) Len() int {
return len(b.a); return len(b.a);
} }
func (b *ByteArray) Clear() { func (b *byteArray) clear() {
b.a = b.a[0 : 0]; b.a = b.a[0 : 0];
} }
func (b *ByteArray) Slice(i, j int) []byte { func (b *byteArray) slice(i, j int) []byte {
return b.a[i : j]; // BUG should really be &b.a[i : j] return b.a[i : j]; // BUG should really be &b.a[i : j]
} }
func (b *ByteArray) Append(s []byte) { func (b *byteArray) append(s []byte) {
a := b.a; a := b.a;
n := len(a); n := len(a);
m := n + len(s); m := n + len(s);
...@@ -105,7 +105,7 @@ export type Writer struct { ...@@ -105,7 +105,7 @@ export type Writer struct {
// current state // current state
html_char byte; // terminating char of html tag/entity, or 0 ('>', ';', or 0) html_char byte; // terminating char of html tag/entity, or 0 ('>', ';', or 0)
buf ByteArray; // collected text w/o tabs and newlines buf byteArray; // collected text w/o tabs and newlines
size int; // size of incomplete cell in bytes size int; // size of incomplete cell in bytes
width int; // width of incomplete cell in runes up to buf[pos] w/o ignored sections width int; // width of incomplete cell in runes up to buf[pos] w/o ignored sections
pos int; // buffer position up to which width of incomplete cell has been computed pos int; // buffer position up to which width of incomplete cell has been computed
...@@ -138,7 +138,7 @@ export type Writer struct { ...@@ -138,7 +138,7 @@ export type Writer struct {
// buf start of incomplete cell pos // buf start of incomplete cell pos
func (b *Writer) AddLine() { func (b *Writer) addLine() {
b.lines_size.Push(array.NewIntArray(0)); b.lines_size.Push(array.NewIntArray(0));
b.lines_width.Push(array.NewIntArray(0)); b.lines_width.Push(array.NewIntArray(0));
} }
...@@ -164,13 +164,13 @@ func (b *Writer) Init(writer io.Write, cellwidth, padding int, padchar byte, ali ...@@ -164,13 +164,13 @@ func (b *Writer) Init(writer io.Write, cellwidth, padding int, padchar byte, ali
b.lines_size.Init(0); b.lines_size.Init(0);
b.lines_width.Init(0); b.lines_width.Init(0);
b.widths.Init(0); b.widths.Init(0);
b.AddLine(); // the very first line b.addLine(); // the very first line
return b; return b;
} }
func (b *Writer) Line(i int) (*array.IntArray, *array.IntArray) { func (b *Writer) line(i int) (*array.IntArray, *array.IntArray) {
return return
b.lines_size.At(i).(*array.IntArray), b.lines_size.At(i).(*array.IntArray),
b.lines_width.At(i).(*array.IntArray); b.lines_width.At(i).(*array.IntArray);
...@@ -178,14 +178,14 @@ func (b *Writer) Line(i int) (*array.IntArray, *array.IntArray) { ...@@ -178,14 +178,14 @@ func (b *Writer) Line(i int) (*array.IntArray, *array.IntArray) {
// debugging support // debugging support
func (b *Writer) Dump() { func (b *Writer) dump() {
pos := 0; pos := 0;
for i := 0; i < b.lines_size.Len(); i++ { for i := 0; i < b.lines_size.Len(); i++ {
line_size, line_width := b.Line(i); line_size, line_width := b.line(i);
print("(", i, ") "); print("(", i, ") ");
for j := 0; j < line_size.Len(); j++ { for j := 0; j < line_size.Len(); j++ {
s := line_size.At(j); s := line_size.At(j);
print("[", string(b.buf.Slice(pos, pos + s)), "]"); print("[", string(b.buf.slice(pos, pos + s)), "]");
pos += s; pos += s;
} }
print("\n"); print("\n");
...@@ -194,7 +194,7 @@ func (b *Writer) Dump() { ...@@ -194,7 +194,7 @@ func (b *Writer) Dump() {
} }
func (b *Writer) Write0(buf []byte) *os.Error { func (b *Writer) write0(buf []byte) *os.Error {
n, err := b.writer.Write(buf); n, err := b.writer.Write(buf);
if n != len(buf) && err == nil { if n != len(buf) && err == nil {
err = os.EIO; err = os.EIO;
...@@ -203,9 +203,9 @@ func (b *Writer) Write0(buf []byte) *os.Error { ...@@ -203,9 +203,9 @@ func (b *Writer) Write0(buf []byte) *os.Error {
} }
var Newline = []byte{'\n'} var newline = []byte{'\n'}
func (b *Writer) WritePadding(textw, cellw int) (err *os.Error) { func (b *Writer) writePadding(textw, cellw int) (err *os.Error) {
if b.padbytes[0] == '\t' { if b.padbytes[0] == '\t' {
// make cell width a multiple of cellwidth // make cell width a multiple of cellwidth
cellw = ((cellw + b.cellwidth - 1) / b.cellwidth) * b.cellwidth; cellw = ((cellw + b.cellwidth - 1) / b.cellwidth) * b.cellwidth;
...@@ -221,34 +221,34 @@ func (b *Writer) WritePadding(textw, cellw int) (err *os.Error) { ...@@ -221,34 +221,34 @@ func (b *Writer) WritePadding(textw, cellw int) (err *os.Error) {
} }
for n > len(b.padbytes) { for n > len(b.padbytes) {
err = b.Write0(b.padbytes); err = b.write0(b.padbytes);
if err != nil { if err != nil {
goto exit; goto exit;
} }
n -= len(b.padbytes); n -= len(b.padbytes);
} }
err = b.Write0(b.padbytes[0 : n]); err = b.write0(b.padbytes[0 : n]);
exit: exit:
return err; return err;
} }
func (b *Writer) WriteLines(pos0 int, line0, line1 int) (pos int, err *os.Error) { func (b *Writer) writeLines(pos0 int, line0, line1 int) (pos int, err *os.Error) {
pos = pos0; pos = pos0;
for i := line0; i < line1; i++ { for i := line0; i < line1; i++ {
line_size, line_width := b.Line(i); line_size, line_width := b.line(i);
for j := 0; j < line_size.Len(); j++ { for j := 0; j < line_size.Len(); j++ {
s, w := line_size.At(j), line_width.At(j); s, w := line_size.At(j), line_width.At(j);
if b.align_left { if b.align_left {
err = b.Write0(b.buf.Slice(pos, pos + s)); err = b.write0(b.buf.slice(pos, pos + s));
if err != nil { if err != nil {
goto exit; goto exit;
} }
pos += s; pos += s;
if j < b.widths.Len() { if j < b.widths.Len() {
err = b.WritePadding(w, b.widths.At(j)); err = b.writePadding(w, b.widths.At(j));
if err != nil { if err != nil {
goto exit; goto exit;
} }
...@@ -257,12 +257,12 @@ func (b *Writer) WriteLines(pos0 int, line0, line1 int) (pos int, err *os.Error) ...@@ -257,12 +257,12 @@ func (b *Writer) WriteLines(pos0 int, line0, line1 int) (pos int, err *os.Error)
} else { // align right } else { // align right
if j < b.widths.Len() { if j < b.widths.Len() {
err = b.WritePadding(w, b.widths.At(j)); err = b.writePadding(w, b.widths.At(j));
if err != nil { if err != nil {
goto exit; goto exit;
} }
} }
err = b.Write0(b.buf.Slice(pos, pos + s)); err = b.write0(b.buf.slice(pos, pos + s));
if err != nil { if err != nil {
goto exit; goto exit;
} }
...@@ -273,11 +273,11 @@ func (b *Writer) WriteLines(pos0 int, line0, line1 int) (pos int, err *os.Error) ...@@ -273,11 +273,11 @@ func (b *Writer) WriteLines(pos0 int, line0, line1 int) (pos int, err *os.Error)
if i+1 == b.lines_size.Len() { if i+1 == b.lines_size.Len() {
// last buffered line - we don't have a newline, so just write // last buffered line - we don't have a newline, so just write
// any outstanding buffered data // any outstanding buffered data
err = b.Write0(b.buf.Slice(pos, pos + b.size)); err = b.write0(b.buf.slice(pos, pos + b.size));
pos += b.size; pos += b.size;
} else { } else {
// not the last line - write newline // not the last line - write newline
err = b.Write0(Newline); err = b.write0(newline);
} }
if err != nil { if err != nil {
goto exit; goto exit;
...@@ -289,19 +289,19 @@ exit: ...@@ -289,19 +289,19 @@ exit:
} }
func (b *Writer) Format(pos0 int, line0, line1 int) (pos int, err *os.Error) { func (b *Writer) format(pos0 int, line0, line1 int) (pos int, err *os.Error) {
pos = pos0; pos = pos0;
column := b.widths.Len(); column := b.widths.Len();
last := line0; last := line0;
for this := line0; this < line1; this++ { for this := line0; this < line1; this++ {
line_size, line_width := b.Line(this); line_size, line_width := b.line(this);
if column < line_size.Len() - 1 { if column < line_size.Len() - 1 {
// cell exists in this column // cell exists in this column
// (note that the last cell per line is ignored) // (note that the last cell per line is ignored)
// print unprinted lines until beginning of block // print unprinted lines until beginning of block
pos, err = b.WriteLines(pos, last, this); pos, err = b.writeLines(pos, last, this);
if err != nil { if err != nil {
goto exit; goto exit;
} }
...@@ -310,7 +310,7 @@ func (b *Writer) Format(pos0 int, line0, line1 int) (pos int, err *os.Error) { ...@@ -310,7 +310,7 @@ func (b *Writer) Format(pos0 int, line0, line1 int) (pos int, err *os.Error) {
// column block begin // column block begin
width := b.cellwidth; // minimal width width := b.cellwidth; // minimal width
for ; this < line1; this++ { for ; this < line1; this++ {
line_size, line_width = b.Line(this); line_size, line_width = b.line(this);
if column < line_size.Len() - 1 { if column < line_size.Len() - 1 {
// cell exists in this column => update width // cell exists in this column => update width
w := line_width.At(column) + b.padding; w := line_width.At(column) + b.padding;
...@@ -326,34 +326,34 @@ func (b *Writer) Format(pos0 int, line0, line1 int) (pos int, err *os.Error) { ...@@ -326,34 +326,34 @@ func (b *Writer) Format(pos0 int, line0, line1 int) (pos int, err *os.Error) {
// format and print all columns to the right of this column // format and print all columns to the right of this column
// (we know the widths of this column and all columns to the left) // (we know the widths of this column and all columns to the left)
b.widths.Push(width); b.widths.Push(width);
pos, err = b.Format(pos, last, this); pos, err = b.format(pos, last, this);
b.widths.Pop(); b.widths.Pop();
last = this; last = this;
} }
} }
// print unprinted lines until end // print unprinted lines until end
pos, err = b.WriteLines(pos, last, line1); pos, err = b.writeLines(pos, last, line1);
exit: exit:
return pos, err; return pos, err;
} }
/* export */ func (b *Writer) Flush() *os.Error { func (b *Writer) Flush() *os.Error {
dummy, err := b.Format(0, 0, b.lines_size.Len()); dummy, err := b.format(0, 0, b.lines_size.Len());
// reset (even in the presence of errors) // reset (even in the presence of errors)
b.buf.Clear(); b.buf.clear();
b.size, b.width = 0, 0; b.size, b.width = 0, 0;
b.pos = 0; b.pos = 0;
b.lines_size.Init(0); b.lines_size.Init(0);
b.lines_width.Init(0); b.lines_width.Init(0);
b.AddLine(); b.addLine();
return err; return err;
} }
func UnicodeLen(buf []byte) int { func unicodeLen(buf []byte) int {
l := 0; l := 0;
for i := 0; i < len(buf); { for i := 0; i < len(buf); {
if buf[i] < utf8.RuneSelf { if buf[i] < utf8.RuneSelf {
...@@ -368,8 +368,8 @@ func UnicodeLen(buf []byte) int { ...@@ -368,8 +368,8 @@ func UnicodeLen(buf []byte) int {
} }
func (b *Writer) Append(buf []byte) { func (b *Writer) append(buf []byte) {
b.buf.Append(buf); b.buf.append(buf);
b.size += len(buf); b.size += len(buf);
} }
...@@ -385,23 +385,23 @@ func (b *Writer) Append(buf []byte) { ...@@ -385,23 +385,23 @@ func (b *Writer) Append(buf []byte) {
// outside html tag/entity // outside html tag/entity
switch ch { switch ch {
case '\t', '\n': case '\t', '\n':
b.Append(buf[i0 : i]); b.append(buf[i0 : i]);
i0 = i + 1; // exclude ch from (next) cell i0 = i + 1; // exclude ch from (next) cell
b.width += UnicodeLen(b.buf.Slice(b.pos, b.buf.Len())); b.width += unicodeLen(b.buf.slice(b.pos, b.buf.Len()));
b.pos = b.buf.Len(); b.pos = b.buf.Len();
// terminate cell // terminate cell
last_size, last_width := b.Line(b.lines_size.Len() - 1); last_size, last_width := b.line(b.lines_size.Len() - 1);
last_size.Push(b.size); last_size.Push(b.size);
last_width.Push(b.width); last_width.Push(b.width);
b.size, b.width = 0, 0; b.size, b.width = 0, 0;
if ch == '\n' { if ch == '\n' {
b.AddLine(); b.addLine();
if last_size.Len() == 1 { if last_size.Len() == 1 {
// The previous line has only one cell which does not have // The previous line has only one cell which does not have
// an impact on the formatting of the following lines (the // an impact on the formatting of the following lines (the
// last cell per line is ignored by Format), thus we can // last cell per line is ignored by format()), thus we can
// flush the Writer contents. // flush the Writer contents.
err = b.Flush(); err = b.Flush();
if err != nil { if err != nil {
...@@ -412,9 +412,9 @@ func (b *Writer) Append(buf []byte) { ...@@ -412,9 +412,9 @@ func (b *Writer) Append(buf []byte) {
case '<', '&': case '<', '&':
if b.filter_html { if b.filter_html {
b.Append(buf[i0 : i]); b.append(buf[i0 : i]);
i0 = i; i0 = i;
b.width += UnicodeLen(b.buf.Slice(b.pos, b.buf.Len())); b.width += unicodeLen(b.buf.slice(b.pos, b.buf.Len()));
b.pos = -1; // preventative - should not be used (will cause index out of bounds) b.pos = -1; // preventative - should not be used (will cause index out of bounds)
if ch == '<' { if ch == '<' {
b.html_char = '>'; b.html_char = '>';
...@@ -428,7 +428,7 @@ func (b *Writer) Append(buf []byte) { ...@@ -428,7 +428,7 @@ func (b *Writer) Append(buf []byte) {
// inside html tag/entity // inside html tag/entity
if ch == b.html_char { if ch == b.html_char {
// reached the end of tag/entity // reached the end of tag/entity
b.Append(buf[i0 : i + 1]); b.append(buf[i0 : i + 1]);
i0 = i + 1; i0 = i + 1;
if b.html_char == ';' { if b.html_char == ';' {
b.width++; // count as one char b.width++; // count as one char
...@@ -440,7 +440,7 @@ func (b *Writer) Append(buf []byte) { ...@@ -440,7 +440,7 @@ func (b *Writer) Append(buf []byte) {
} }
// append leftover text // append leftover text
b.Append(buf[i0 : n]); b.append(buf[i0 : n]);
return n, nil; return n, nil;
} }
......
...@@ -12,22 +12,22 @@ import ( ...@@ -12,22 +12,22 @@ import (
) )
type Buffer struct { type buffer struct {
a []byte; a []byte;
} }
func (b *Buffer) Init(n int) { func (b *buffer) init(n int) {
b.a = make([]byte, n)[0 : 0]; b.a = make([]byte, n)[0 : 0];
} }
func (b *Buffer) Clear() { func (b *buffer) clear() {
b.a = b.a[0 : 0]; b.a = b.a[0 : 0];
} }
func (b *Buffer) Write(buf []byte) (written int, err *os.Error) { func (b *buffer) Write(buf []byte) (written int, err *os.Error) {
n := len(b.a); n := len(b.a);
m := len(buf); m := len(buf);
if n + m <= cap(b.a) { if n + m <= cap(b.a) {
...@@ -42,12 +42,12 @@ func (b *Buffer) Write(buf []byte) (written int, err *os.Error) { ...@@ -42,12 +42,12 @@ func (b *Buffer) Write(buf []byte) (written int, err *os.Error) {
} }
func (b *Buffer) String() string { func (b *buffer) String() string {
return string(b.a); return string(b.a);
} }
func Write(t *testing.T, w *tabwriter.Writer, src string) { func write(t *testing.T, w *tabwriter.Writer, src string) {
written, err := io.WriteString(w, src); written, err := io.WriteString(w, src);
if err != nil { if err != nil {
t.Errorf("--- src:\n%s\n--- write error: %v\n", src, err); t.Errorf("--- src:\n%s\n--- write error: %v\n", src, err);
...@@ -58,7 +58,7 @@ func Write(t *testing.T, w *tabwriter.Writer, src string) { ...@@ -58,7 +58,7 @@ func Write(t *testing.T, w *tabwriter.Writer, src string) {
} }
func Verify(t *testing.T, w *tabwriter.Writer, b *Buffer, src, expected string) { func verify(t *testing.T, w *tabwriter.Writer, b *buffer, src, expected string) {
err := w.Flush(); err := w.Flush();
if err != nil { if err != nil {
t.Errorf("--- src:\n%s\n--- flush error: %v\n", src, err); t.Errorf("--- src:\n%s\n--- flush error: %v\n", src, err);
...@@ -71,142 +71,142 @@ func Verify(t *testing.T, w *tabwriter.Writer, b *Buffer, src, expected string) ...@@ -71,142 +71,142 @@ func Verify(t *testing.T, w *tabwriter.Writer, b *Buffer, src, expected string)
} }
func Check(t *testing.T, tabwidth, padding int, padchar byte, align_left, filter_html bool, src, expected string) { func check(t *testing.T, tabwidth, padding int, padchar byte, align_left, filter_html bool, src, expected string) {
var b Buffer; var b buffer;
b.Init(1000); b.init(1000);
var w tabwriter.Writer; var w tabwriter.Writer;
w.Init(&b, tabwidth, padding, padchar, align_left, filter_html); w.Init(&b, tabwidth, padding, padchar, align_left, filter_html);
// write all at once // write all at once
b.Clear(); b.clear();
Write(t, &w, src); write(t, &w, src);
Verify(t, &w, &b, src, expected); verify(t, &w, &b, src, expected);
// write byte-by-byte // write byte-by-byte
b.Clear(); b.clear();
for i := 0; i < len(src); i++ { for i := 0; i < len(src); i++ {
Write(t, &w, src[i : i+1]); write(t, &w, src[i : i+1]);
} }
Verify(t, &w, &b, src, expected); verify(t, &w, &b, src, expected);
// write using Fibonacci slice sizes // write using Fibonacci slice sizes
b.Clear(); b.clear();
for i, d := 0, 0; i < len(src); { for i, d := 0, 0; i < len(src); {
Write(t, &w, src[i : i+d]); write(t, &w, src[i : i+d]);
i, d = i+d, d+1; i, d = i+d, d+1;
if i+d > len(src) { if i+d > len(src) {
d = len(src) - i; d = len(src) - i;
} }
} }
Verify(t, &w, &b, src, expected); verify(t, &w, &b, src, expected);
} }
export func Test(t *testing.T) { export func Test(t *testing.T) {
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"", "",
"" ""
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"\n\n\n", "\n\n\n",
"\n\n\n" "\n\n\n"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"a\nb\nc", "a\nb\nc",
"a\nb\nc" "a\nb\nc"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"\t", // '\t' terminates an empty cell on last line - nothing to print "\t", // '\t' terminates an empty cell on last line - nothing to print
"" ""
); );
Check( check(
t, 8, 1, '.', false, false, t, 8, 1, '.', false, false,
"\t", // '\t' terminates an empty cell on last line - nothing to print "\t", // '\t' terminates an empty cell on last line - nothing to print
"" ""
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"*\t*", "*\t*",
"**" "**"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"*\t*\n", "*\t*\n",
"*.......*\n" "*.......*\n"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"*\t*\t", "*\t*\t",
"*.......*" "*.......*"
); );
Check( check(
t, 8, 1, '.', false, false, t, 8, 1, '.', false, false,
"*\t*\t", "*\t*\t",
".......**" ".......**"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"\t\n", "\t\n",
"........\n" "........\n"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"a) foo", "a) foo",
"a) foo" "a) foo"
); );
Check( check(
t, 8, 1, ' ', true, false, t, 8, 1, ' ', true, false,
"b) foo\tbar", // "bar" is not in any cell - not formatted, just flushed "b) foo\tbar", // "bar" is not in any cell - not formatted, just flushed
"b) foobar" "b) foobar"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"c) foo\tbar\t", "c) foo\tbar\t",
"c) foo..bar" "c) foo..bar"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"d) foo\tbar\n", "d) foo\tbar\n",
"d) foo..bar\n" "d) foo..bar\n"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"e) foo\tbar\t\n", "e) foo\tbar\t\n",
"e) foo..bar.....\n" "e) foo..bar.....\n"
); );
Check( check(
t, 8, 1, '.', true, true, t, 8, 1, '.', true, true,
"e) f&lt;o\t<b>bar</b>\t\n", "e) f&lt;o\t<b>bar</b>\t\n",
"e) f&lt;o..<b>bar</b>.....\n" "e) f&lt;o..<b>bar</b>.....\n"
); );
Check( check(
t, 8, 1, '*', true, false, t, 8, 1, '*', true, false,
"Hello, world!\n", "Hello, world!\n",
"Hello, world!\n" "Hello, world!\n"
); );
Check( check(
t, 0, 0, '.', true, false, t, 0, 0, '.', true, false,
"1\t2\t3\t4\n" "1\t2\t3\t4\n"
"11\t222\t3333\t44444\n", "11\t222\t3333\t44444\n",
...@@ -215,19 +215,19 @@ export func Test(t *testing.T) { ...@@ -215,19 +215,19 @@ export func Test(t *testing.T) {
"11222333344444\n" "11222333344444\n"
); );
Check( check(
t, 5, 0, '.', true, false, t, 5, 0, '.', true, false,
"1\t2\t3\t4\n", "1\t2\t3\t4\n",
"1....2....3....4\n" "1....2....3....4\n"
); );
Check( check(
t, 5, 0, '.', true, false, t, 5, 0, '.', true, false,
"1\t2\t3\t4\t\n", "1\t2\t3\t4\t\n",
"1....2....3....4....\n" "1....2....3....4....\n"
); );
Check( check(
t, 8, 1, '.', true, false, t, 8, 1, '.', true, false,
"本\tb\tc\n" "本\tb\tc\n"
"aa\t\u672c\u672c\u672c\tcccc\tddddd\n" "aa\t\u672c\u672c\u672c\tcccc\tddddd\n"
...@@ -238,7 +238,7 @@ export func Test(t *testing.T) { ...@@ -238,7 +238,7 @@ export func Test(t *testing.T) {
"aaa.....bbbb\n" "aaa.....bbbb\n"
); );
Check( check(
t, 8, 1, ' ', false, false, t, 8, 1, ' ', false, false,
"a\tè\tc\t\n" "a\tè\tc\t\n"
"aa\tèèè\tcccc\tddddd\t\n" "aa\tèèè\tcccc\tddddd\t\n"
...@@ -249,7 +249,7 @@ export func Test(t *testing.T) { ...@@ -249,7 +249,7 @@ export func Test(t *testing.T) {
" aaa èèèè\n" " aaa èèèè\n"
); );
Check( check(
t, 2, 0, ' ', true, false, t, 2, 0, ' ', true, false,
"a\tb\tc\n" "a\tb\tc\n"
"aa\tbbb\tcccc\n" "aa\tbbb\tcccc\n"
...@@ -260,7 +260,7 @@ export func Test(t *testing.T) { ...@@ -260,7 +260,7 @@ export func Test(t *testing.T) {
"aaabbbb\n" "aaabbbb\n"
); );
Check( check(
t, 8, 1, '_', true, false, t, 8, 1, '_', true, false,
"a\tb\tc\n" "a\tb\tc\n"
"aa\tbbb\tcccc\n" "aa\tbbb\tcccc\n"
...@@ -271,7 +271,7 @@ export func Test(t *testing.T) { ...@@ -271,7 +271,7 @@ export func Test(t *testing.T) {
"aaa_____bbbb\n" "aaa_____bbbb\n"
); );
Check( check(
t, 4, 1, '-', true, false, t, 4, 1, '-', true, false,
"4444\t日本語\t22\t1\t333\n" "4444\t日本語\t22\t1\t333\n"
"999999999\t22\n" "999999999\t22\n"
...@@ -290,7 +290,7 @@ export func Test(t *testing.T) { ...@@ -290,7 +290,7 @@ export func Test(t *testing.T) {
"1------1------999999999-0000000000\n" "1------1------999999999-0000000000\n"
); );
Check( check(
t, 4, 3, '.', true, false, t, 4, 3, '.', true, false,
"4444\t333\t22\t1\t333\n" "4444\t333\t22\t1\t333\n"
"999999999\t22\n" "999999999\t22\n"
...@@ -309,7 +309,7 @@ export func Test(t *testing.T) { ...@@ -309,7 +309,7 @@ export func Test(t *testing.T) {
"1........1........999999999...0000000000\n" "1........1........999999999...0000000000\n"
); );
Check( check(
t, 8, 1, '\t', true, true, t, 8, 1, '\t', true, true,
"4444\t333\t22\t1\t333\n" "4444\t333\t22\t1\t333\n"
"999999999\t22\n" "999999999\t22\n"
...@@ -328,7 +328,7 @@ export func Test(t *testing.T) { ...@@ -328,7 +328,7 @@ export func Test(t *testing.T) {
"1\t1\t<font color=red attr=日本語>999999999</font>\t0000000000\n" "1\t1\t<font color=red attr=日本語>999999999</font>\t0000000000\n"
); );
Check( check(
t, 0, 2, ' ', false, false, t, 0, 2, ' ', false, false,
".0\t.3\t2.4\t-5.1\t\n" ".0\t.3\t2.4\t-5.1\t\n"
"23.0\t12345678.9\t2.4\t-989.4\t\n" "23.0\t12345678.9\t2.4\t-989.4\t\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment