Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
LGTM On Mon, Mar 11, 2013 at 5:00 PM, <dave@cheney.net> wrote: > Reviewers: golang-dev1, > > Message: > Hello golang-dev@googlegroups.com, > > I'd like you to review this change to > https://code.google.com/p/go > > > Description: > net/http: add tests for ParseHTTPVersion > > Please review this at https://codereview.appspot.**com/7739043/<https://codereview.appspot.com/7739... > > Affected files: > M src/pkg/net/http/request_test.**go > > > Index: src/pkg/net/http/request_test.**go > ==============================**==============================**======= > --- a/src/pkg/net/http/request_**test.go > +++ b/src/pkg/net/http/request_**test.go > @@ -267,6 +267,38 @@ > } > } > > +var parseHTTPVersionTests = []struct { > + vers string > + major, minor int > + ok bool > +}{ > + {"HTTP/0.9", 0, 9, true}, > + {"HTTP/1.0", 1, 0, true}, > + {"HTTP/1.1", 1, 1, true}, > + {"HTTP/3.14", 3, 14, true}, > + > + {"HTTP", 0, 0, false}, > + {"HTTP/one.one", 0, 0, false}, > + {"HTTP/1.1/", 0, 0, false}, > + {"HTTP/-1,0", 0, 0, false}, > + {"HTTP/0,-1", 0, 0, false}, > + {"HTTP/", 0, 0, false}, > + {"HTTP/1,1", 0, 0, false}, > +} > + > +func TestParseHTTPVersion(t *testing.T) { > + for _, tt := range parseHTTPVersionTests { > + major, minor, ok := ParseHTTPVersion(tt.vers) > + if ok != tt.ok || major != tt.major || minor != tt.minor { > + type version struct { > + major, minor int > + ok bool > + } > + t.Errorf("failed to parse %q, expected: %#v, got > %#v", tt.vers, version{tt.major, tt.minor, tt.ok}, version{major, minor, > ok}) > + } > + } > +} > + > type logWrites struct { > t *testing.T > dst *[]string > > > -- > > ---You received this message because you are subscribed to the Google > Groups "golang-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-dev+unsubscribe@**googlegroups.com<golang-dev%2Bunsubscribe@googlegrou... > . > For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/o... > . > > >
*** Submitted as https://code.google.com/p/go/source/detail?r=3fecf13bd2fe *** net/http: add tests for ParseHTTPVersion R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/7739043