OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package flagpb | 5 package flagpb |
6 | 6 |
7 import ( | 7 import ( |
8 "io/ioutil" | 8 "io/ioutil" |
9 "testing" | 9 "testing" |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 }) | 87 }) |
88 Convey("bool", func() { | 88 Convey("bool", func() { |
89 Convey("without value", func() { | 89 Convey("without value", func() { |
90 So(unmarshalOK("M1", "-b"), ShouldResemble, msg(
"b", true)) | 90 So(unmarshalOK("M1", "-b"), ShouldResemble, msg(
"b", true)) |
91 | 91 |
92 So(unmarshalOK("M1", "-b", "-s", "x"), ShouldRes
emble, msg( | 92 So(unmarshalOK("M1", "-b", "-s", "x"), ShouldRes
emble, msg( |
93 "b", true, | 93 "b", true, |
94 "s", "x", | 94 "s", "x", |
95 )) | 95 )) |
96 }) | 96 }) |
| 97 Convey("without value, repeated", func() { |
| 98 So(unmarshalOK("M1", "-rb=false", "-rb"), Should
Resemble, msg("rb", repeated(false, true))) |
| 99 }) |
97 Convey("with value", func() { | 100 Convey("with value", func() { |
98 So(unmarshalOK("M1", "-b=true"), ShouldResemble,
msg("b", true)) | 101 So(unmarshalOK("M1", "-b=true"), ShouldResemble,
msg("b", true)) |
99 So(unmarshalOK("M1", "-b=false"), ShouldResemble
, msg("b", false)) | 102 So(unmarshalOK("M1", "-b=false"), ShouldResemble
, msg("b", false)) |
100 }) | 103 }) |
101 }) | 104 }) |
102 Convey("bytes", func() { | 105 Convey("bytes", func() { |
103 Convey("next arg", func() { | 106 Convey("next arg", func() { |
104 So(unmarshalOK("M1", "-bb", "6869"), ShouldResem
ble, msg("bb", []byte("hi"))) | 107 So(unmarshalOK("M1", "-bb", "6869"), ShouldResem
ble, msg("bb", []byte("hi"))) |
105 }) | 108 }) |
106 Convey("equals sign", func() { | 109 Convey("equals sign", func() { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 }) | 186 }) |
184 Convey("reports meaningful error", func() { | 187 Convey("reports meaningful error", func() { |
185 err := unmarshalErr("M3", "-m1.s", "x",
"-m1.s", "y") | 188 err := unmarshalErr("M3", "-m1.s", "x",
"-m1.s", "y") |
186 So(err, ShouldErrLike, `-m1.s: value is
already set`) | 189 So(err, ShouldErrLike, `-m1.s: value is
already set`) |
187 So(err, ShouldErrLike, `insert -m1`) | 190 So(err, ShouldErrLike, `insert -m1`) |
188 }) | 191 }) |
189 }) | 192 }) |
190 }) | 193 }) |
191 }) | 194 }) |
192 } | 195 } |
OLD | NEW |