golang.org/x/build@v0.0.0-20240506185731-218518f32b70/devapp/release_test.go (about) 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. 4 5 package main 6 7 import "testing" 8 9 func TestTitleDir(t *testing.T) { 10 testcases := []struct { 11 title string 12 dirs []string 13 }{ 14 {"no title dir", nil}, 15 {" cmd/compile , cmd/go: do awesome things", []string{"cmd/compile", "cmd/go"}}, 16 {"cmd/compile: cleanup MOVaddr code generation", []string{"cmd/compile"}}, 17 {`cmd/asm, cmd/internal/obj/s390x, math: add "test under mask" instructions`, 18 []string{"cmd/asm", "cmd/internal/obj/s390x", "math"}}, 19 } 20 for _, tc := range testcases { 21 r := titleDirs(tc.title) 22 if len(r) != len(tc.dirs) { 23 t.Fatalf("titleDirs(%q) = %v (%d); want %d length", tc.title, r, len(r), len(tc.dirs)) 24 } 25 for i := range tc.dirs { 26 if r[i] != tc.dirs[i] { 27 t.Errorf("titleDirs[%d](%v) != tc.dirs[%d](%q)", i, r[i], i, tc.dirs[i]) 28 } 29 } 30 } 31 }