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

Side by Side Diff: client/flagpb/unmarshal_test.go

Issue 1935923002: client/flagpb: fix repeated bool without value (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « client/flagpb/unmarshal_test.desc ('k') | client/flagpb/unmarshal_test.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « client/flagpb/unmarshal_test.desc ('k') | client/flagpb/unmarshal_test.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698