Files
Bjarne Øverli 644f7db6de
Release / build (amd64, darwin, macos-latest) (push) Has been cancelled
Release / build (amd64, linux, ubuntu-latest) (push) Has been cancelled
Release / build (amd64, windows, windows-latest) (push) Has been cancelled
Release / build (arm64, darwin, macos-latest) (push) Has been cancelled
Release / build (arm64, linux, ubuntu-latest) (push) Has been cancelled
Release / release (push) Has been cancelled
Release / update-homebrew (push) Has been cancelled
Add more tests
2026-04-03 14:41:37 +02:00

24 lines
466 B
Go

package cmd
import "testing"
func TestShellQuote(t *testing.T) {
tests := []struct {
input, want string
}{
{"simple", "'simple'"},
{"with space", "'with space'"},
{"it's", `'it'\''s'`},
{"", "''"},
{"a'b'c", `'a'\''b'\''c'`},
{`back\slash`, `'back\slash'`},
{`"double"`, `'"double"'`},
}
for _, tt := range tests {
got := shellQuote(tt.input)
if got != tt.want {
t.Errorf("shellQuote(%q) = %q, want %q", tt.input, got, tt.want)
}
}
}