Skip to content

Commit

Permalink
[cleanup] pkg: Format files with "gofmt -s".
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaq committed Mar 31, 2020
1 parent a70c2a3 commit 3cd90d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions pkg/edit/complete/complete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ func TestComplete(t *testing.T) {
externals: []string{"ls", "make"},
specials: []string{"if", "for"},
variables: map[string][]string{
"": []string{"foo", "bar", "fn~", "ns:"},
"ns1:": []string{"lorem"},
"ns2:": []string{"ipsum"},
"": {"foo", "bar", "fn~", "ns:"},
"ns1:": {"lorem"},
"ns2:": {"ipsum"},
},
namespaces: []string{"ns1:", "ns2:"},
},
Expand Down
34 changes: 17 additions & 17 deletions pkg/ui/text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ var partitionTests = tt.Table{
{red("lorem"), blue("f")}, {blue("oobar")}}),
Args(text2, 11).Rets([]Text{text2, nil}),

Args(text1, 1, 2).Rets([]Text{Text{red("l")}, Text{red("o")}, Text{red("rem")}}),
Args(text1, 1, 2).Rets([]Text{{red("l")}, {red("o")}, {red("rem")}}),
Args(text1, 1, 2, 3, 4).Rets([]Text{
Text{red("l")}, Text{red("o")}, Text{red("r")}, Text{red("e")}, Text{red("m")}}),
{red("l")}, {red("o")}, {red("r")}, {red("e")}, {red("m")}}),
Args(text2, 2, 4, 6).Rets([]Text{
Text{red("lo")}, Text{red("re")},
Text{red("m"), blue("f")}, Text{blue("oobar")}}),
{red("lo")}, {red("re")},
{red("m"), blue("f")}, {blue("oobar")}}),
Args(text2, 6, 8).Rets([]Text{
Text{red("lorem"), blue("f")}, Text{blue("oo")}, Text{blue("bar")}}),
{red("lorem"), blue("f")}, {blue("oo")}, {blue("bar")}}),
}

func TestPartition(t *testing.T) {
Expand Down Expand Up @@ -82,31 +82,31 @@ func TestCountLines(t *testing.T) {
func TestSplitByRune(t *testing.T) {
tt.Test(t, tt.Fn("Text.SplitByRune", Text.SplitByRune), tt.Table{
Args(Text{}, '\n').Rets([]Text(nil)),
Args(Text{red("lorem")}, '\n').Rets([]Text{Text{red("lorem")}}),
Args(Text{red("lorem")}, '\n').Rets([]Text{{red("lorem")}}),
Args(Text{red("lorem"), blue("ipsum"), red("dolar")}, '\n').Rets(
[]Text{
Text{red("lorem"), blue("ipsum"), red("dolar")},
{red("lorem"), blue("ipsum"), red("dolar")},
}),
Args(Text{red("lo\nrem")}, '\n').Rets([]Text{
Text{red("lo")}, Text{red("rem")},
{red("lo")}, {red("rem")},
}),
Args(Text{red("lo\nrem"), blue("ipsum")}, '\n').Rets(
[]Text{
Text{red("lo")},
Text{red("rem"), blue("ipsum")},
{red("lo")},
{red("rem"), blue("ipsum")},
}),
Args(Text{red("lo\nrem"), blue("ip\nsum")}, '\n').Rets(
[]Text{
Text{red("lo")},
Text{red("rem"), blue("ip")},
Text{blue("sum")},
{red("lo")},
{red("rem"), blue("ip")},
{blue("sum")},
}),
Args(Text{red("lo\nrem"), blue("ip\ns\num"), red("dolar")}, '\n').Rets(
[]Text{
Text{red("lo")},
Text{red("rem"), blue("ip")},
Text{blue("s")},
Text{blue("um"), red("dolar")},
{red("lo")},
{red("rem"), blue("ip")},
{blue("s")},
{blue("um"), red("dolar")},
}),
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/text_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func toRuns(s string) []run {

func bytesForFirstNRunes(s string, n int) int {
k := 0
for i, _ := range s {
for i := range s {
if k == n {
return i
}
Expand Down

0 comments on commit 3cd90d7

Please sign in to comment.