tools: Remove error return value from query.Parse()

It was always nil

Bug: dawn:1342
Change-Id: I7bc623bba1cbc65e6b91dee7af9bc6b096174605
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85803
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Ben Clayton 2022-04-05 17:08:25 +00:00 committed by Dawn LUCI CQ
parent 7ee6bf3dda
commit 3a279a84e7
2 changed files with 6 additions and 16 deletions

View File

@ -17,12 +17,12 @@
// The full query syntax is described at: // The full query syntax is described at:
// https://github.com/gpuweb/cts/blob/main/docs/terms.md#queries // https://github.com/gpuweb/cts/blob/main/docs/terms.md#queries
// //
// Note that this package supports a superset of the official CTS query syntax, // Note that this package supports a superset of the official CTS query syntax,
// as this package permits parsing and printing of queries that do not end in a // as this package permits parsing and printing of queries that do not end in a
// wildcard, whereas the CTS requires that all queries end in wildcards unless // wildcard, whereas the CTS requires that all queries end in wildcards unless
// they identify a specific test. // they identify a specific test.
// For example, the following queries are considered valid by this package, but // For example, the following queries are considered valid by this package, but
// would be rejected by the CTS: // would be rejected by the CTS:
// `suite`, `suite:file`, `suite:file,file`, `suite:file,file:test`. // `suite`, `suite:file`, `suite:file,file`, `suite:file,file:test`.
// //
// This relaxation is intentional as the Query type is used for constructing and // This relaxation is intentional as the Query type is used for constructing and
@ -95,7 +95,7 @@ const (
) )
// Parse parses a query string // Parse parses a query string
func Parse(s string) (Query, error) { func Parse(s string) Query {
parts := strings.Split(s, TargetDelimiter) parts := strings.Split(s, TargetDelimiter)
q := Query{} q := Query{}
switch len(parts) { switch len(parts) {
@ -111,7 +111,7 @@ func Parse(s string) (Query, error) {
case 1: case 1:
q.Suite = parts[0] q.Suite = parts[0]
} }
return q, nil return q
} }
// AppendFiles returns a new query with the strings appended to the 'files' // AppendFiles returns a new query with the strings appended to the 'files'

View File

@ -23,13 +23,7 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
) )
func Q(name string) query.Query { var Q = query.Parse
q, err := query.Parse(name)
if err != nil {
panic(err)
}
return q
}
func TestTargetFormat(t *testing.T) { func TestTargetFormat(t *testing.T) {
type Test struct { type Test struct {
@ -590,11 +584,7 @@ func TestParsePrint(t *testing.T) {
}, },
}, },
} { } {
parsed, err := query.Parse(test.in) parsed := query.Parse(test.in)
if err != nil {
t.Errorf("query.Parse('%v') returned %v", test.in, err)
continue
}
if diff := cmp.Diff(test.expect, parsed); diff != "" { if diff := cmp.Diff(test.expect, parsed); diff != "" {
t.Errorf("query.Parse('%v')\n%v", test.in, diff) t.Errorf("query.Parse('%v')\n%v", test.in, diff)
} }