libgo: update to go1.9
[official-gcc.git] / libgo / go / os / exec / env_test.go
blobb5ac398c274db405b1e2144cb5d6dc3c0cabadfb
1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package exec
7 import (
8 "reflect"
9 "testing"
12 func TestDedupEnv(t *testing.T) {
13 tests := []struct {
14 noCase bool
15 in []string
16 want []string
19 noCase: true,
20 in: []string{"k1=v1", "k2=v2", "K1=v3"},
21 want: []string{"K1=v3", "k2=v2"},
24 noCase: false,
25 in: []string{"k1=v1", "K1=V2", "k1=v3"},
26 want: []string{"k1=v3", "K1=V2"},
29 in: []string{"=a", "=b", "foo", "bar"},
30 want: []string{"=b", "foo", "bar"},
33 for _, tt := range tests {
34 got := dedupEnvCase(tt.noCase, tt.in)
35 if !reflect.DeepEqual(got, tt.want) {
36 t.Errorf("Dedup(%v, %q) = %q; want %q", tt.noCase, tt.in, got, tt.want)