1
0
mirror of https://github.com/rclone/rclone.git synced 2025-10-06 05:47:10 +02:00
Files
rclone/cmd/serve/sftp/connection_test.go
Nick Craig-Wood d67aa9cc7b build: make rclone compile with GOOS=wasip1 GOARCH=wasm #7831
This now compiles but the link doesn't work because of

https://github.com/golang/go/issues/64856
2025-07-09 10:53:03 +01:00

26 lines
513 B
Go

//go:build !plan9 && !wasm
package sftp
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestShellEscape(t *testing.T) {
for i, test := range []struct {
unescaped, escaped string
}{
{"", ""},
{"/this/is/harmless", "/this/is/harmless"},
{"$(rm -rf /)", "\\$\\(rm\\ -rf\\ /\\)"},
{"/test/\n", "/test/'\n'"},
{":\"'", ":\\\"\\'"},
} {
got := shellUnEscape(test.escaped)
assert.Equal(t, test.unescaped, got, fmt.Sprintf("Test %d unescaped = %q", i, test.unescaped))
}
}