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 | //go:build go1.18 |
6 | // +build go1.18 |
7 | |
8 | package copyright |
9 | |
10 | import ( |
11 | "os" |
12 | "path/filepath" |
13 | "strings" |
14 | "testing" |
15 | ) |
16 | |
17 | func TestToolsCopyright(t *testing.T) { |
18 | cwd, err := os.Getwd() |
19 | if err != nil { |
20 | t.Fatal(err) |
21 | } |
22 | tools := filepath.Dir(cwd) |
23 | if !strings.HasSuffix(filepath.Base(tools), "tools") { |
24 | t.Fatalf("current working directory is %s, expected tools", tools) |
25 | } |
26 | files, err := checkCopyright(tools) |
27 | if err != nil { |
28 | t.Fatal(err) |
29 | } |
30 | if len(files) > 0 { |
31 | t.Errorf("The following files are missing copyright notices:\n%s", strings.Join(files, "\n")) |
32 | } |
33 | } |
34 |
Members