mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-05 08:16:55 +08:00
Rewrite shell cmd parser
This commit is contained in:
18
pkg/shell/shell_test.go
Normal file
18
pkg/shell/shell_test.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestQuoteSplit(t *testing.T) {
|
||||
s := `
|
||||
python "-c" 'import time
|
||||
print("time", time.time())'
|
||||
`
|
||||
require.Equal(t, []string{"python", "-c", "import time\nprint(\"time\", time.time())"}, QuoteSplit(s))
|
||||
|
||||
s = `ffmpeg -i video="0" -i "DeckLink SDI (2)"`
|
||||
require.Equal(t, []string{"ffmpeg", "-i", "video=\"0\"", "-i", "DeckLink SDI (2)"}, QuoteSplit(s))
|
||||
}
|
Reference in New Issue
Block a user