@@ -27,9 +27,22 @@ func TestParseUriTemplateSuccess(t *testing.T) {
2727 input string
2828 want * api.PathTemplate
2929 }{
30- {"locations/global/firewallPolicies" , api .NewPathTemplate ().WithLiteral ("locations" ).WithLiteral ("global" ).WithLiteral ("firewallPolicies" )},
31- {"locations/global/operations/{operation}" , api .NewPathTemplate ().WithLiteral ("locations" ).WithLiteral ("global" ).WithLiteral ("operations" ).WithVariable (api .NewPathVariable ("operation" ))},
32- {"projects/{project}/zones/{zone}/{parentName}/reservationSubBlocks" , api .NewPathTemplate ().WithLiteral ("projects" ).WithVariable (api .NewPathVariable ("project" )).WithLiteral ("zones" ).WithVariable (api .NewPathVariable ("zone" )).WithVariable (api .NewPathVariable ("parentName" )).WithLiteral ("reservationSubBlocks" )},
30+ {"locations/global/firewallPolicies" , api .NewPathTemplate ().
31+ WithLiteral ("locations" ).
32+ WithLiteral ("global" ).
33+ WithLiteral ("firewallPolicies" )},
34+ {"locations/global/operations/{operation}" , api .NewPathTemplate ().
35+ WithLiteral ("locations" ).
36+ WithLiteral ("global" ).
37+ WithLiteral ("operations" ).
38+ WithVariableNamed ("operation" )},
39+ {"projects/{project}/zones/{zone}/{parentName}/reservationSubBlocks" , api .NewPathTemplate ().
40+ WithLiteral ("projects" ).
41+ WithVariableNamed ("project" ).
42+ WithLiteral ("zones" ).
43+ WithVariableNamed ("zone" ).
44+ WithVariableNamed ("parentName" ).
45+ WithLiteral ("reservationSubBlocks" )},
3346 } {
3447 got , err := ParseUriTemplate (test .input )
3548 if err != nil {
@@ -77,7 +90,7 @@ func TestParseExpression(t *testing.T) {
7790 t .Errorf ("expected a successful parse with input=%s, err=%v" , test .input , err )
7891 continue
7992 }
80- if diff := cmp .Diff (& api.PathSegment {Variable : api .NewPathVariable (test .want )}, gotSegment ); diff != "" {
93+ if diff := cmp .Diff (& api.PathSegment {Variable : api .NewPathVariable (test .want ). WithMatch () }, gotSegment ); diff != "" {
8194 t .Errorf ("mismatch [%s] (-want, +got):\n %s" , test .input , diff )
8295 }
8396 if len (test .want )+ 2 != gotWidth {
0 commit comments