Skip to content

Commit 644f7db

Browse files
committed
Add more tests
1 parent d22d933 commit 644f7db

9 files changed

Lines changed: 836 additions & 0 deletions

File tree

cmd/playlist_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package cmd
2+
3+
import "testing"
4+
5+
func TestShellQuote(t *testing.T) {
6+
tests := []struct {
7+
input, want string
8+
}{
9+
{"simple", "'simple'"},
10+
{"with space", "'with space'"},
11+
{"it's", `'it'\''s'`},
12+
{"", "''"},
13+
{"a'b'c", `'a'\''b'\''c'`},
14+
{`back\slash`, `'back\slash'`},
15+
{`"double"`, `'"double"'`},
16+
}
17+
for _, tt := range tests {
18+
got := shellQuote(tt.input)
19+
if got != tt.want {
20+
t.Errorf("shellQuote(%q) = %q, want %q", tt.input, got, tt.want)
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)