Skip to content

Commit 7d70ce0

Browse files
committed
Update test cases
1 parent b1df156 commit 7d70ce0

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

hooks/jsonnet-fmt-hook/main_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ func normalizeDiff(diff string) string {
1616
reSpaces := regexp.MustCompile(`\s+`)
1717

1818
normDiff := strings.TrimSpace(diff)
19-
normDiff = reSpaces.ReplaceAllString(normDiff, " ")
19+
normDiff = strings.ReplaceAll(diff, "\n", " ")
2020
normDiff = reAnsiEscape.ReplaceAllString(normDiff, "")
21+
normDiff = reSpaces.ReplaceAllString(normDiff, " ")
2122
return strings.ToLower(normDiff)
2223
}
2324

@@ -38,6 +39,10 @@ func TestHasTestOpt(t *testing.T) {
3839
opts: []string{"test", "hoge"},
3940
want: false,
4041
},
42+
{
43+
opts: []string{"-t"},
44+
want: false,
45+
},
4146
}
4247

4348
for _, param := range params {
@@ -116,9 +121,10 @@ func TestExecJsonnetFmt(t *testing.T) {
116121
text: `...
117122
metadata: {
118123
name: name,
119-
namespace: namespace, // missing the trailing comma
124+
namespace: namespace,
120125
},
121-
}`,
126+
}
127+
... `,
122128
numInsert: 1,
123129
numDelete: 0,
124130
},

testutil/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var (
1515
kind: 'SubNamespace',
1616
metadata: {
1717
name: name,
18-
namespace: namespace // missing the trailing comma
18+
namespace: namespace
1919
},
2020
}
2121
`)

0 commit comments

Comments
 (0)