Skip to content

Commit a7bc38f

Browse files
committed
test: add more tests
1 parent 0dc5fc5 commit a7bc38f

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

pipeline_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,27 @@ func TestDiffWithSpacesInFilenames(t *testing.T) {
144144
assert.Equal(t, want, got)
145145
}
146146

147+
func TestDiffSingleFile(t *testing.T) {
148+
want := []string{
149+
"services/foo/serverless.yml",
150+
}
151+
152+
got, err := diff(`printf 'services/foo/serverless.yml'`)
153+
assert.NoError(t, err)
154+
assert.Equal(t, want, got)
155+
}
156+
157+
func TestDiffWithSpacesInFilenamesSingleFile(t *testing.T) {
158+
want := []string{
159+
"directory/File Name With Spaces.md",
160+
}
161+
162+
// printf produces newline-separated output, just like git diff --name-only
163+
got, err := diff(`printf 'directory/File Name With Spaces.md'`)
164+
assert.NoError(t, err)
165+
assert.Equal(t, want, got)
166+
}
167+
147168
func TestStepsToTriggerWithEmojiPaths(t *testing.T) {
148169
watch := []WatchConfig{
149170
{

0 commit comments

Comments
 (0)