Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: vpython/application/flag_test.go

Issue 2937123003: [vpython] Fix flag parsing bug with "--". (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« vpython/application/flag.go ('K') | « vpython/application/flag.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The LUCI Authors. All rights reserved. 1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package application 5 package application
6 6
7 import ( 7 import (
8 "flag" 8 "flag"
9 "fmt" 9 "fmt"
10 "testing" 10 "testing"
(...skipping 30 matching lines...) Expand all
41 []string{"-i", "-log-level", "debug"}, 41 []string{"-i", "-log-level", "debug"},
42 []string{}, 42 []string{},
43 []string{"-i", "-log-level", "debug"}, 43 []string{"-i", "-log-level", "debug"},
44 }, 44 },
45 45
46 { 46 {
47 []string{"-log-level", "--", "ohai"}, 47 []string{"-log-level", "--", "ohai"},
48 []string{"-log-level"}, 48 []string{"-log-level"},
49 []string{"--", "ohai"}, 49 []string{"--", "ohai"},
50 }, 50 },
51
52 {
53 []string{"--log-level", "debug", "-d", "--", "sc ript"},
54 []string{"--log-level", "debug"},
55 []string{"-d", "--", "script"},
56 },
51 } { 57 } {
52 Convey(fmt.Sprintf(`Flags %v are split into %v and %v`, tc.args, tc.self, tc.extra), func() { 58 Convey(fmt.Sprintf(`Flags %v are split into %v and %v`, tc.args, tc.self, tc.extra), func() {
53 self, extra := extractFlagsForSet(tc.args, fs) 59 self, extra := extractFlagsForSet(tc.args, fs)
54 So(self, ShouldResemble, tc.self) 60 So(self, ShouldResemble, tc.self)
55 So(extra, ShouldResemble, tc.extra) 61 So(extra, ShouldResemble, tc.extra)
56 }) 62 })
57 } 63 }
58 }) 64 })
59 } 65 }
OLDNEW
« vpython/application/flag.go ('K') | « vpython/application/flag.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698