| 1 | package mainscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.13 testing/" |
| 5 | ) |
| 6 | |
| 7 | type parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest# struct { |
| 8 | inputscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#input. string |
| 9 | splitscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#split. []string |
| 10 | okscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#ok. bool |
| 11 | } |
| 12 | |
| 13 | var parseCmdTestsscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTests. = []parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{ |
| 14 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 w2`, []string{`w1`, `w2`}, true}, |
| 15 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 w2 w3`, []string{`w1`, `w2`, `w3`}, true}, |
| 16 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 'w2 w3'`, []string{`w1`, `'w2 w3'`}, true}, |
| 17 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 "w2 w3"`, []string{`w1`, `"w2 w3"`}, true}, |
| 18 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 "w2 w3"`, []string{`w1`, `"w2 w3"`}, true}, |
| 19 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 'w2 w3'`, []string{`w1`, `'w2 w3'`}, true}, |
| 20 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1"w2 w3"`, []string{`w1"w2 w3"`}, true}, |
| 21 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1'w2 w3'`, []string{`w1'w2 w3'`}, true}, |
| 22 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1"w2 'w3"`, []string{`w1"w2 'w3"`}, true}, |
| 23 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1'w2 "w3'`, []string{`w1'w2 "w3'`}, true}, |
| 24 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`"w1 w2" "w3"`, []string{`"w1 w2"`, `"w3"`}, true}, |
| 25 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`'w1 w2' "w3"`, []string{`'w1 w2'`, `"w3"`}, true}, |
| 26 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`'w1 \'w2' "w3"`, []string{`'w1 \'w2'`, `"w3"`}, true}, |
| 27 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`'w1 \'w2 "w3"`, []string{}, false}, |
| 28 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 'w2 w3'"`, []string{}, false}, |
| 29 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 "w2 w3"'`, []string{}, false}, |
| 30 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 ' "w2 w3"`, []string{}, false}, |
| 31 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 " 'w2 w3'`, []string{}, false}, |
| 32 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1"w2 w3""`, []string{}, false}, |
| 33 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1'w2 w3''`, []string{}, false}, |
| 34 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1"w2 'w3""`, []string{}, false}, |
| 35 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1'w2 "w3''`, []string{}, false}, |
| 36 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`"w1 w2" "w3"'`, []string{}, false}, |
| 37 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`'w1 w2' "w3"'`, []string{}, false}, |
| 38 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1,"w2 w3"`, []string{`w1`, `,`, `"w2 w3"`}, true}, |
| 39 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1,'w2 w3'`, []string{`w1`, `,`, `'w2 w3'`}, true}, |
| 40 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 , "w2 w3"`, []string{`w1`, `,`, `"w2 w3"`}, true}, |
| 41 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 , 'w2 w3'`, []string{`w1`, `,`, `'w2 w3'`}, true}, |
| 42 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1, "w2 w3"`, []string{`w1`, `,`, `"w2 w3"`}, true}, |
| 43 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1, 'w2 w3'`, []string{`w1`, `,`, `'w2 w3'`}, true}, |
| 44 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 ,"w2 w3"`, []string{`w1`, `,`, `"w2 w3"`}, true}, |
| 45 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1 ,'w2 w3'`, []string{`w1`, `,`, `'w2 w3'`}, true}, |
| 46 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1"w2, w3"`, []string{`w1"w2, w3"`}, true}, |
| 47 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1'w2, w3'`, []string{`w1'w2, w3'`}, true}, |
| 48 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1"w2, 'w3"`, []string{`w1"w2, 'w3"`}, true}, |
| 49 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`w1'w2, "w3'`, []string{`w1'w2, "w3'`}, true}, |
| 50 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`"w1, w2" "w3"`, []string{`"w1, w2"`, `"w3"`}, true}, |
| 51 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`'w1, w2' "w3"`, []string{`'w1, w2'`, `"w3"`}, true}, |
| 52 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`'w1, \'w2' "w3"`, []string{`'w1, \'w2'`, `"w3"`}, true}, |
| 53 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`h1, .article-teaser, .article-content`, []string{ |
| 54 | `h1`, `,`, `.article-teaser`, `,`, `.article-content`, |
| 55 | }, true}, |
| 56 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`h1 ,.article-teaser ,.article-content`, []string{ |
| 57 | `h1`, `,`, `.article-teaser`, `,`, `.article-content`, |
| 58 | }, true}, |
| 59 | parseCmdTestscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#{`h1 , .article-teaser , .article-content`, []string{ |
| 60 | `h1`, `,`, `.article-teaser`, `,`, `.article-content`, |
| 61 | }, true}, |
| 62 | } |
| 63 | |
| 64 | func sliceEqscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/sliceEq().(s1, s2 []string) bool { |
| 65 | if len(s1) != len(s2) { |
| 66 | return false |
| 67 | } |
| 68 | for i := range s1 { |
| 69 | if s1[i] != s2[i] { |
| 70 | return false |
| 71 | } |
| 72 | } |
| 73 | return true |
| 74 | } |
| 75 | |
| 76 | func TestParseCommandsscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/TestParseCommands().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 77 | for _, test := range parseCmdTestsscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTests. { |
| 78 | parsed, err := ParseCommandsscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/ParseCommands().(test.inputscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#input.) |
| 79 | if test.okscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#ok. != (err == nil) { |
| 80 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("`%s`: should have cause error? %v", test.inputscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#input., !test.okscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#ok.) |
| 81 | } else if !sliceEqscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/sliceEq().(test.splitscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#split., parsed) { |
| 82 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("`%s`: `%s`: `%s`", test.inputscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#input., test.splitscip-go gomod github.com/ericchiang/pup . `github.com/ericchiang/pup`/parseCmdTest#split., parsed) |
| 83 | } |
| 84 | } |
| 85 | } |