-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy golang.org/x/build/envutil.Dedup locally to avoid pulling in all of x/build. Commands run: go mod init go mod edit -go=1.11 go mod tidy go list -m all go test ./... Updates golang/go#30228 Change-Id: I0fc24565c08a73db067daf080b46f4aa82a63c41 Reviewed-on: https://go-review.googlesource.com/c/dl/+/167703 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
- Loading branch information
Bryan C. Mills
committed
Mar 14, 2019
1 parent
0c1e558
commit bf15437
Showing
3 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module golang.org/dl | ||
|
||
go 1.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2019 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 version | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestDedupEnv(t *testing.T) { | ||
tests := []struct { | ||
noCase bool | ||
in []string | ||
want []string | ||
}{ | ||
{ | ||
noCase: true, | ||
in: []string{"k1=v1", "k2=v2", "K1=v3"}, | ||
want: []string{"K1=v3", "k2=v2"}, | ||
}, | ||
{ | ||
noCase: false, | ||
in: []string{"k1=v1", "K1=V2", "k1=v3"}, | ||
want: []string{"k1=v3", "K1=V2"}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
got := dedupEnv(tt.noCase, tt.in) | ||
if !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("Dedup(%v, %q) = %q; want %q", tt.noCase, tt.in, got, tt.want) | ||
} | ||
} | ||
} |