Skip to content

Commit

Permalink
Ensure to align process width
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Nov 1, 2020
1 parent 029ae74 commit 310087c
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
16 changes: 16 additions & 0 deletions process/pidfile_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package process

import "testing"

func Test_guessUnixHomeDir(t *testing.T) {
tests := []struct {
name string
want string
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
})
}
}
63 changes: 63 additions & 0 deletions process/process_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package process

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestPad(t *testing.T) {
tests := []struct {
name string
s string
total int
want string
}{
{
name: "larger than total",
s: "abc",
total: 2,
want: "abc",
},
{
name: "smaller than total",
s: "abc",
total: 5,
want: "abc ",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := pad(tt.s, tt.total)
assert.Equal(t, tt.want, got)
})
}
}

func TestMax(t *testing.T) {
tests := []struct {
name string
i int
j int
want int
}{
{
name: "j is larger",
i: 1,
j: 2,
want: 2,
},
{
name: "i is larger",
i: 2,
j: 1,
want: 2,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := max(tt.i, tt.j)
assert.Equal(t, tt.want, got)
})
}
}

0 comments on commit 310087c

Please sign in to comment.