| 1 | package shquotscip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.16 testing/" |
| 5 | ) |
| 6 | |
| 7 | func TestWindowsArgvscip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/TestWindowsArgv().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 8 | tests := []qTestscip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/qTest#{ |
| 9 | { |
| 10 | []string{}, |
| 11 | "", |
| 12 | }, |
| 13 | { |
| 14 | []string{"cmd.exe"}, |
| 15 | `"cmd.exe"`, |
| 16 | }, |
| 17 | { |
| 18 | []string{`echo`, `hello`}, |
| 19 | `"echo" hello`, |
| 20 | }, |
| 21 | { |
| 22 | []string{`echo`, ``}, |
| 23 | `"echo" ""`, |
| 24 | }, |
| 25 | { |
| 26 | []string{`echo`, `hello world`}, |
| 27 | `"echo" "hello world"`, |
| 28 | }, |
| 29 | { |
| 30 | []string{`echo`, `hello\ world`}, |
| 31 | `"echo" "hello\ world"`, |
| 32 | }, |
| 33 | { |
| 34 | []string{`echo`, `hello world\`}, |
| 35 | `"echo" "hello world\\"`, |
| 36 | }, |
| 37 | { |
| 38 | []string{`echo`, `hello world\\`}, |
| 39 | `"echo" "hello world\\\\"`, |
| 40 | }, |
| 41 | { |
| 42 | []string{`echo`, `hello world\"`}, |
| 43 | `"echo" "hello world\\\""`, |
| 44 | }, |
| 45 | { |
| 46 | []string{`echo`, `hello "world"`}, |
| 47 | `"echo" "hello \"world\""`, |
| 48 | }, |
| 49 | { |
| 50 | []string{`"hello" world`, `hello "world"`}, |
| 51 | `"hello world" "hello \"world\""`, |
| 52 | }, |
| 53 | } |
| 54 | |
| 55 | runTestsscip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/runTests().(t, tests, WindowsArgvscip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/WindowsArgv().) |
| 56 | } |
| 57 | |
| 58 | func TestWindowsCmdExescip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/TestWindowsCmdExe().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) { |
| 59 | tests := []qTestscip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/qTest#{ |
| 60 | { |
| 61 | []string{}, |
| 62 | "", |
| 63 | }, |
| 64 | { |
| 65 | []string{"cmd.exe"}, |
| 66 | `^"cmd.exe^"`, |
| 67 | }, |
| 68 | { |
| 69 | []string{`echo`, `hello`}, |
| 70 | `^"echo^" hello`, |
| 71 | }, |
| 72 | { |
| 73 | []string{`echo`, `hello world`}, |
| 74 | `^"echo^" ^"hello world^"`, |
| 75 | }, |
| 76 | { |
| 77 | []string{`echo`, `hello\ world`}, |
| 78 | `^"echo^" ^"hello\ world^"`, |
| 79 | }, |
| 80 | { |
| 81 | []string{`echo`, `hello world\`}, |
| 82 | `^"echo^" ^"hello world\\^"`, |
| 83 | }, |
| 84 | { |
| 85 | []string{`echo`, `hello world\\`}, |
| 86 | `^"echo^" ^"hello world\\\\^"`, |
| 87 | }, |
| 88 | { |
| 89 | []string{`echo`, `hello world\"`}, |
| 90 | `^"echo^" ^"hello world\\\^"^"`, |
| 91 | }, |
| 92 | { |
| 93 | []string{`echo`, "hello\nworld"}, |
| 94 | "^\"echo^\" ^\"hello^\n\nworld^\"", |
| 95 | }, |
| 96 | { |
| 97 | []string{`echo`, `hello "world"`}, |
| 98 | `^"echo^" ^"hello \^"world\^"^"`, |
| 99 | }, |
| 100 | { |
| 101 | []string{`type`, `foo`, `|`, `sort`}, |
| 102 | `^"type^" foo ^| sort`, |
| 103 | }, |
| 104 | { |
| 105 | []string{`type`, `foo`, `&`, `sort`}, |
| 106 | `^"type^" foo ^& sort`, |
| 107 | }, |
| 108 | { |
| 109 | []string{`hello`, `(world)`}, |
| 110 | `^"hello^" ^(world^)`, |
| 111 | }, |
| 112 | { |
| 113 | []string{`echo`, `hello`, `>foo.txt`}, |
| 114 | `^"echo^" hello ^>foo.txt`, |
| 115 | }, |
| 116 | { |
| 117 | []string{`echo`, `^2`}, |
| 118 | `^"echo^" ^^2`, |
| 119 | }, |
| 120 | { |
| 121 | []string{`echo`, `^^`}, |
| 122 | `^"echo^" ^^^^`, |
| 123 | }, |
| 124 | { |
| 125 | []string{`echo`, `^"`}, |
| 126 | `^"echo^" ^"^^\^"^"`, |
| 127 | }, |
| 128 | } |
| 129 | |
| 130 | runTestsscip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/runTests().(t, tests, WindowsCmdExescip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/WindowsCmdExe().(WindowsArgvscip-go gomod github.com/apparentlymart/go-shquot . `github.com/apparentlymart/go-shquot/shquot`/WindowsArgv().)) |
| 131 | } |