mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-09 03:49:27 +00:00
Start work on more sophisticated indent+wrap implementation
This commit is contained in:
parent
32804f01b2
commit
ef5f0025e1
2 changed files with 304 additions and 2 deletions
|
|
@ -1,26 +0,0 @@
|
|||
// License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
|
||||
|
||||
package cli
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFormatWithIndent(t *testing.T) {
|
||||
var output strings.Builder
|
||||
indent := "__"
|
||||
screen_width := 11
|
||||
|
||||
run := func(text string, expected ...string) {
|
||||
output.Reset()
|
||||
q := indent + strings.Join(expected, "\n"+indent) + "\n"
|
||||
format_with_indent(&output, text, indent, screen_width)
|
||||
if output.String() != q {
|
||||
t.Fatalf("expected != actual: %#v != %#v", q, output.String())
|
||||
}
|
||||
}
|
||||
run("testing \x1b[31mstyled\x1b[m", "testing ", "\x1b[31mstyled\x1b[m")
|
||||
run("testing\n\ntwo", "testing", "", "two")
|
||||
run("testing\n \ntwo", "testing", "", "two")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue