go-hep.org/x/hep@v0.38.1/groot/internal/genroot/genroot_test.go (about) 1 // Copyright ©2020 The go-hep 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 genroot 6 7 import "testing" 8 9 func TestExtractYear(t *testing.T) { 10 for _, tc := range []struct { 11 fname string 12 year int 13 }{ 14 { 15 fname: "./genroot.go", 16 year: 2018, 17 }, 18 { 19 fname: "./genroot_test.go", 20 year: 2020, 21 }, 22 { 23 fname: "../../cmd/root-gen-rfunc/testdata/func1_golden.txt", 24 year: gopherYear, 25 }, 26 } { 27 t.Run(tc.fname, func(t *testing.T) { 28 year := ExtractYear(tc.fname) 29 if year != tc.year { 30 t.Fatalf("invalid year: got=%d, want=%d", year, tc.year) 31 } 32 }) 33 } 34 }