Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
groot: add support for extracting copyright year from code templates
- Loading branch information
Showing
8 changed files
with
104 additions
and
21 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
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
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
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,34 @@ | ||
// Copyright ©2020 The go-hep 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 genroot | ||
|
||
import "testing" | ||
|
||
func TestExtractYear(t *testing.T) { | ||
for _, tc := range []struct { | ||
fname string | ||
year int | ||
}{ | ||
{ | ||
fname: "./genroot.go", | ||
year: 2018, | ||
}, | ||
{ | ||
fname: "./genroot_test.go", | ||
year: 2020, | ||
}, | ||
{ | ||
fname: "../../cmd/root-gen-rfunc/testdata/func1_golden.txt", | ||
year: 2020, | ||
}, | ||
} { | ||
t.Run(tc.fname, func(t *testing.T) { | ||
year := ExtractYear(tc.fname) | ||
if year != tc.year { | ||
t.Fatalf("invalid year: got=%d, want=%d", year, tc.year) | ||
} | ||
}) | ||
} | ||
} |
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