Black Lives Matter. Support the Equal Justice Initiative.

Source file src/cmd/go/internal/str/str_test.go

Documentation: cmd/go/internal/str

     1  // Copyright 2020 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.
     4  
     5  package str
     6  
     7  import "testing"
     8  
     9  var foldDupTests = []struct {
    10  	list   []string
    11  	f1, f2 string
    12  }{
    13  	{StringList("math/rand", "math/big"), "", ""},
    14  	{StringList("math", "strings"), "", ""},
    15  	{StringList("strings"), "", ""},
    16  	{StringList("strings", "strings"), "strings", "strings"},
    17  	{StringList("Rand", "rand", "math", "math/rand", "math/Rand"), "Rand", "rand"},
    18  }
    19  
    20  func TestFoldDup(t *testing.T) {
    21  	for _, tt := range foldDupTests {
    22  		f1, f2 := FoldDup(tt.list)
    23  		if f1 != tt.f1 || f2 != tt.f2 {
    24  			t.Errorf("foldDup(%q) = %q, %q, want %q, %q", tt.list, f1, f2, tt.f1, tt.f2)
    25  		}
    26  	}
    27  }
    28  

View as plain text