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

Unified Diff: perf/go/types/types_test.go

Issue 880483003: Add types.MatchesWithIngores(). (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « perf/go/types/types.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: perf/go/types/types_test.go
diff --git a/perf/go/types/types_test.go b/perf/go/types/types_test.go
index 3a130728f1d29b7dd2acc291245e24deba45bb14..2cab1234f71626a9483f816f19a6f6d951ebc16b 100644
--- a/perf/go/types/types_test.go
+++ b/perf/go/types/types_test.go
@@ -1,6 +1,7 @@
package types
import (
+ "net/url"
"testing"
"skia.googlesource.com/buildbot.git/perf/go/config"
@@ -325,3 +326,68 @@ func TestTileTrim(t *testing.T) {
t.Errorf("Failed to raise error on Trim(0, config.TILE_SIZE+1).")
}
}
+
+func TestMatchesWithIgnore(t *testing.T) {
+ tr := NewPerfTrace()
+ tr.Params_["p1"] = "v1"
+ tr.Params_["p2"] = "v2"
+
+ testCases := []struct {
+ q url.Values
+ ignore []url.Values
+ want bool
+ }{
+ // Empty case.
+ {
+ q: url.Values{},
+ ignore: []url.Values{},
+ want: true,
+ },
+ // Only ignore.
+ {
+ q: url.Values{},
+ ignore: []url.Values{
+ url.Values{},
+ url.Values{"p2": []string{"v2"}},
+ },
+ want: false,
+ },
+ // Not match query.
+ {
+ q: url.Values{"p1": []string{"bad"}},
+ ignore: []url.Values{},
+ want: false,
+ },
+ // Match query, fail to match ignore.
+ {
+ q: url.Values{"p1": []string{"v1"}},
+ ignore: []url.Values{
+ url.Values{"p1": []string{"bad"}},
+ },
+ want: true,
+ },
+ // Match query, and match ignore.
+ {
+ q: url.Values{"p1": []string{"v1"}},
+ ignore: []url.Values{
+ url.Values{"p1": []string{"v1"}},
+ },
+ want: false,
+ },
+ // Match query, and match one of many ignores.
+ {
+ q: url.Values{"p1": []string{"v1"}},
+ ignore: []url.Values{
+ url.Values{},
+ url.Values{"p1": []string{"v1"}},
+ },
+ want: false,
+ },
+ }
+
+ for _, tc := range testCases {
+ if got, want := MatchesWithIgnores(tr, tc.q, tc.ignore...), tc.want; got != want {
+ t.Errorf("MatchesWithIgnores(%v, %v, %v): Got %v Want %v", tr, tc.q, tc.ignore, got, want)
+ }
+ }
+}
« no previous file with comments | « perf/go/types/types.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698