Skip to content

Commit

Permalink
chore: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Aug 29, 2023
1 parent decd796 commit b9fa7e8
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions internal/lefthook/runner/prepare_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,84 +76,84 @@ func TestReplaceInChunks(t *testing.T) {
{
str: "echo {staged_files}",
templates: map[string]*template{
"{staged_files}": &template{
"{staged_files}": {
files: []string{"file1", "file2", "file3"},
cnt: 1,
},
},
maxlen: 300,
res: &run{
commands: [][]string{[]string{"echo", "file1", "file2", "file3"}},
commands: [][]string{{"echo", "file1", "file2", "file3"}},
files: []string{"file1", "file2", "file3"},
},
},
{
str: "echo {staged_files}",
templates: map[string]*template{
"{staged_files}": &template{
"{staged_files}": {
files: []string{"file1", "file2", "file3"},
cnt: 1,
},
},
maxlen: 10,
res: &run{
commands: [][]string{
[]string{"echo", "file1"},
[]string{"echo", "file2"},
[]string{"echo", "file3"},
{"echo", "file1"},
{"echo", "file2"},
{"echo", "file3"},
},
files: []string{"file1", "file2", "file3"},
},
},
{
str: "echo {files} && git add {files}",
templates: map[string]*template{
"{files}": &template{
"{files}": {
files: []string{"file1", "file2", "file3"},
cnt: 2,
},
},
maxlen: 49, // (49 - 17(len of command without templates)) / 2 = 16, but we need 17 (3 words + 2 spaces)
res: &run{
commands: [][]string{
[]string{"echo", "file1", "file2", "&&", "git", "add", "file1", "file2"},
[]string{"echo", "file3", "&&", "git", "add", "file3"},
{"echo", "file1", "file2", "&&", "git", "add", "file1", "file2"},
{"echo", "file3", "&&", "git", "add", "file3"},
},
files: []string{"file1", "file2", "file3"},
},
},
{
str: "echo {files} && git add {files}",
templates: map[string]*template{
"{files}": &template{
"{files}": {
files: []string{"file1", "file2", "file3"},
cnt: 2,
},
},
maxlen: 51,
res: &run{
commands: [][]string{
[]string{"echo", "file1", "file2", "file3", "&&", "git", "add", "file1", "file2", "file3"},
{"echo", "file1", "file2", "file3", "&&", "git", "add", "file1", "file2", "file3"},
},
files: []string{"file1", "file2", "file3"},
},
},
{
str: "echo {push_files} && git add {files}",
templates: map[string]*template{
"{push_files}": &template{
"{push_files}": {
files: []string{"push-file"},
cnt: 1,
},
"{files}": &template{
"{files}": {
files: []string{"file1", "file2"},
cnt: 1,
},
},
maxlen: 10,
res: &run{
commands: [][]string{
[]string{"echo", "push-file", "&&", "git", "add", "file1"},
{"echo", "push-file", "&&", "git", "add", "file1"},
},
files: []string{"push-file", "file1", "file2"},
},
Expand Down

0 comments on commit b9fa7e8

Please sign in to comment.