- Add daemon state persistence and stale resume file cleanup - Add TriggerPoll for WebSocket resume actions - Improve stream server with graceful shutdown and connection tracking - Add desktop notifications for download completion - Add media file organization with Movies/TV Shows detection - Improve usenet downloader with progress tracking and resume support - Add self-update package with GitHub release verification - Downgrade tablewriter to v0.0.5 (v1.x API breaking change)
46 lines
905 B
Go
46 lines
905 B
Go
package engine
|
|
|
|
import "testing"
|
|
|
|
func TestEscapePowerShell(t *testing.T) {
|
|
tests := []struct {
|
|
input string
|
|
want string
|
|
}{
|
|
{"hello", "hello"},
|
|
{"it's done", "it''s done"},
|
|
{"Tom's 'file'", "Tom''s ''file''"},
|
|
{"no quotes", "no quotes"},
|
|
{"", ""},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.input, func(t *testing.T) {
|
|
got := escapePowerShell(tt.input)
|
|
if got != tt.want {
|
|
t.Errorf("escapePowerShell(%q) = %q, want %q", tt.input, got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestEscapeAppleScript(t *testing.T) {
|
|
tests := []struct {
|
|
input string
|
|
want string
|
|
}{
|
|
{"hello", "hello"},
|
|
{`say "hi"`, `say \"hi\"`},
|
|
{`back\slash`, `back\\slash`},
|
|
{"", ""},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.input, func(t *testing.T) {
|
|
got := escapeAppleScript(tt.input)
|
|
if got != tt.want {
|
|
t.Errorf("escapeAppleScript(%q) = %q, want %q", tt.input, got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|