From 1bc154448b21eacf3071cd012ed2d978aadb892e Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Wed, 21 Jan 2026 14:18:06 +0200 Subject: internal/frontend: fix typo in test name Change-Id: Iae258bc0e0fe9a1ff9f0326f6bfcc4530c61b8d4 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/737900 Reviewed-by: Ethan Lee Reviewed-by: Nicholas Husin Auto-Submit: Nicholas Husin LUCI-TryBot-Result: Go LUCI Reviewed-by: Nicholas Husin TryBot-Bypass: Nicholas Husin --- internal/frontend/experiments_test.go | 42 +++++++++++++++++++++++++++++++++++ internal/frontend/experments_test.go | 42 ----------------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 internal/frontend/experiments_test.go delete mode 100644 internal/frontend/experments_test.go diff --git a/internal/frontend/experiments_test.go b/internal/frontend/experiments_test.go new file mode 100644 index 00000000..cb28013e --- /dev/null +++ b/internal/frontend/experiments_test.go @@ -0,0 +1,42 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package frontend + +import ( + "context" + "sort" + "testing" + + "github.com/google/go-cmp/cmp" + "golang.org/x/pkgsite/internal/experiment" +) + +func TestNewContextFromExps(t *testing.T) { + for _, test := range []struct { + mods []string + want []string + }{ + { + mods: []string{"c", "a", "b"}, + want: []string{"a", "b", "c"}, + }, + { + mods: []string{"d", "a"}, + want: []string{"a", "b", "c", "d"}, + }, + { + mods: []string{"d", "!b", "!a", "c"}, + want: []string{"c", "d"}, + }, + } { + ctx := experiment.NewContext(context.Background(), "a", "b", "c") + ctx = newContextFromExps(ctx, test.mods) + got := experiment.FromContext(ctx).Active() + sort.Strings(got) + if !cmp.Equal(got, test.want) { + t.Errorf("mods=%v:\ngot %v\nwant %v", test.mods, got, test.want) + } + } +} diff --git a/internal/frontend/experments_test.go b/internal/frontend/experments_test.go deleted file mode 100644 index cb28013e..00000000 --- a/internal/frontend/experments_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package frontend - -import ( - "context" - "sort" - "testing" - - "github.com/google/go-cmp/cmp" - "golang.org/x/pkgsite/internal/experiment" -) - -func TestNewContextFromExps(t *testing.T) { - for _, test := range []struct { - mods []string - want []string - }{ - { - mods: []string{"c", "a", "b"}, - want: []string{"a", "b", "c"}, - }, - { - mods: []string{"d", "a"}, - want: []string{"a", "b", "c", "d"}, - }, - { - mods: []string{"d", "!b", "!a", "c"}, - want: []string{"c", "d"}, - }, - } { - ctx := experiment.NewContext(context.Background(), "a", "b", "c") - ctx = newContextFromExps(ctx, test.mods) - got := experiment.FromContext(ctx).Active() - sort.Strings(got) - if !cmp.Equal(got, test.want) { - t.Errorf("mods=%v:\ngot %v\nwant %v", test.mods, got, test.want) - } - } -} -- cgit v1.3