pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/pkgtools/pkglint
Module Name: pkgsrc
Committed By: rillig
Date: Sat Jan 1 12:44:25 UTC 2022
Modified Files:
pkgsrc/pkgtools/pkglint: Makefile
pkgsrc/pkgtools/pkglint/files: autofix_test.go check_test.go
files_test.go lineslexer_test.go mkassignchecker.go mkline_test.go
mklinechecker_test.go mklineparser_test.go mklines_test.go
mkparser_test.go mkshparser_test.go mkshwalker_test.go
mktokenslexer_test.go package_test.go pkglint.go pkglint_test.go
pkgsrc.go pkgsrc_test.go plist_test.go scope_test.go shell_test.go
shtokenizer_test.go tools_test.go util_test.go var_test.go
varalignblock_test.go vardefs.go vartype.go vartype_test.go
vartypecheck.go vartypecheck_test.go
Log Message:
pkgtools/pkglint: update to 21.4.1
Changes since 21.4.0:
Running 'pkglint doc/CHANGES-2021' now warns about issues for this
single file. Previously, it was necessary to specify '-Cglobal' as
well, but then pkglint also warned about issues in all other CHANGES
files.
Pkglint no longer warns about the characters '!' and '@' in
GO_MODULES_FILES, since these are legitimate. Fixes PR pkg/56595.
Small cleanups in the pkglint testing infrastructure.
To generate a diff of this commit:
cvs rdiff -u -r1.706 -r1.707 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.42 -r1.43 pkgsrc/pkgtools/pkglint/files/autofix_test.go
cvs rdiff -u -r1.77 -r1.78 pkgsrc/pkgtools/pkglint/files/check_test.go
cvs rdiff -u -r1.33 -r1.34 pkgsrc/pkgtools/pkglint/files/files_test.go
cvs rdiff -u -r1.3 -r1.4 pkgsrc/pkgtools/pkglint/files/lineslexer_test.go
cvs rdiff -u -r1.11 -r1.12 pkgsrc/pkgtools/pkglint/files/mkassignchecker.go
cvs rdiff -u -r1.83 -r1.84 pkgsrc/pkgtools/pkglint/files/mkline_test.go \
pkgsrc/pkgtools/pkglint/files/pkglint.go
cvs rdiff -u -r1.65 -r1.66 \
pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go \
pkgsrc/pkgtools/pkglint/files/pkgsrc.go
cvs rdiff -u -r1.13 -r1.14 pkgsrc/pkgtools/pkglint/files/mklineparser_test.go
cvs rdiff -u -r1.66 -r1.67 pkgsrc/pkgtools/pkglint/files/mklines_test.go
cvs rdiff -u -r1.41 -r1.42 pkgsrc/pkgtools/pkglint/files/mkparser_test.go
cvs rdiff -u -r1.24 -r1.25 pkgsrc/pkgtools/pkglint/files/mkshparser_test.go
cvs rdiff -u -r1.12 -r1.13 pkgsrc/pkgtools/pkglint/files/mkshwalker_test.go
cvs rdiff -u -r1.6 -r1.7 pkgsrc/pkgtools/pkglint/files/mktokenslexer_test.go
cvs rdiff -u -r1.88 -r1.89 pkgsrc/pkgtools/pkglint/files/package_test.go
cvs rdiff -u -r1.71 -r1.72 pkgsrc/pkgtools/pkglint/files/pkglint_test.go
cvs rdiff -u -r1.54 -r1.55 pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go
cvs rdiff -u -r1.53 -r1.54 pkgsrc/pkgtools/pkglint/files/plist_test.go \
pkgsrc/pkgtools/pkglint/files/vartype.go
cvs rdiff -u -r1.2 -r1.3 pkgsrc/pkgtools/pkglint/files/scope_test.go
cvs rdiff -u -r1.72 -r1.73 pkgsrc/pkgtools/pkglint/files/shell_test.go
cvs rdiff -u -r1.26 -r1.27 pkgsrc/pkgtools/pkglint/files/shtokenizer_test.go \
pkgsrc/pkgtools/pkglint/files/tools_test.go
cvs rdiff -u -r1.56 -r1.57 pkgsrc/pkgtools/pkglint/files/util_test.go
cvs rdiff -u -r1.8 -r1.9 pkgsrc/pkgtools/pkglint/files/var_test.go
cvs rdiff -u -r1.17 -r1.18 \
pkgsrc/pkgtools/pkglint/files/varalignblock_test.go
cvs rdiff -u -r1.103 -r1.104 pkgsrc/pkgtools/pkglint/files/vardefs.go
cvs rdiff -u -r1.27 -r1.28 pkgsrc/pkgtools/pkglint/files/vartype_test.go
cvs rdiff -u -r1.99 -r1.100 pkgsrc/pkgtools/pkglint/files/vartypecheck.go
cvs rdiff -u -r1.90 -r1.91 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/pkgtools/pkglint/Makefile
diff -u pkgsrc/pkgtools/pkglint/Makefile:1.706 pkgsrc/pkgtools/pkglint/Makefile:1.707
--- pkgsrc/pkgtools/pkglint/Makefile:1.706 Sun Dec 26 16:56:47 2021
+++ pkgsrc/pkgtools/pkglint/Makefile Sat Jan 1 12:44:24 2022
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.706 2021/12/26 16:56:47 rillig Exp $
+# $NetBSD: Makefile,v 1.707 2022/01/01 12:44:24 rillig Exp $
-PKGNAME= pkglint-21.4.0
+PKGNAME= pkglint-21.4.1
CATEGORIES= pkgtools
DISTNAME= tools
MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/}
Index: pkgsrc/pkgtools/pkglint/files/autofix_test.go
diff -u pkgsrc/pkgtools/pkglint/files/autofix_test.go:1.42 pkgsrc/pkgtools/pkglint/files/autofix_test.go:1.43
--- pkgsrc/pkgtools/pkglint/files/autofix_test.go:1.42 Sun Jun 6 07:41:34 2021
+++ pkgsrc/pkgtools/pkglint/files/autofix_test.go Sat Jan 1 12:44:24 2022
@@ -84,7 +84,7 @@ func (s *Suite) Test_Autofix__multiple_f
line := t.NewLine("filename", 1, "original")
- c.Check(line.fix, check.IsNil)
+ t.CheckNil(line.fix)
t.CheckDeepEquals(line.raw, newRawLines("original\n"))
{
@@ -94,7 +94,6 @@ func (s *Suite) Test_Autofix__multiple_f
fix.Apply()
}
- c.Check(line.fix, check.NotNil)
t.CheckDeepEquals(line.raw, newRawLines("original\n"))
t.CheckDeepEquals(line.fix.texts, []string{"lriginao\n"})
t.CheckOutputLines(
@@ -107,7 +106,6 @@ func (s *Suite) Test_Autofix__multiple_f
fix.Apply()
}
- c.Check(line.fix, check.NotNil)
t.CheckDeepEquals(line.raw, newRawLines("original\n"))
t.CheckDeepEquals(line.fix.texts, []string{"lruginao\n"})
t.CheckEquals(line.RawText(0), "lruginao")
@@ -121,7 +119,6 @@ func (s *Suite) Test_Autofix__multiple_f
fix.Apply()
}
- c.Check(line.fix, check.NotNil)
t.CheckDeepEquals(line.raw, newRawLines("original\n"))
t.CheckDeepEquals(line.fix.texts, []string{"middle\n"})
t.CheckOutputLines(
@@ -362,7 +359,8 @@ func (s *Suite) Test_NewAutofix(c *check
fix := NewAutofix(line)
fix2 := NewAutofix(line)
- t.Check(fix2, check.Not(check.Equals), fix)
+ t.CheckEquals(fix2 == fix, false)
+ t.CheckDeepEquals(fix2, fix)
}
func (s *Suite) Test_Autofix_Errorf(c *check.C) {
@@ -1380,7 +1378,7 @@ func (s *Suite) Test_SaveAutofixChanges_
// As long as the file is kept open, it cannot be overwritten or deleted.
openFile, err := os.OpenFile(t.File("subdir/file.txt").String(), 0, 0666)
defer func() { assertNil(openFile.Close(), "") }()
- c.Check(err, check.IsNil)
+ t.CheckNil(err)
fix := lines.Lines[0].Autofix()
fix.Warnf("Should start with an uppercase letter.")
@@ -1406,8 +1404,8 @@ func (s *Suite) Test_SaveAutofixChanges_
lines := t.SetUpFileLines("file.txt",
"line 1")
- c.Check(os.RemoveAll(t.File("file.txt").String()), check.IsNil)
- c.Check(os.MkdirAll(t.File("file.txt").String(), 0777), check.IsNil)
+ t.CheckNil(os.RemoveAll(t.File("file.txt").String()))
+ t.CheckNil(os.MkdirAll(t.File("file.txt").String(), 0777))
fix := lines.Lines[0].Autofix()
fix.Warnf("Should start with an uppercase letter.")
Index: pkgsrc/pkgtools/pkglint/files/check_test.go
diff -u pkgsrc/pkgtools/pkglint/files/check_test.go:1.77 pkgsrc/pkgtools/pkglint/files/check_test.go:1.78
--- pkgsrc/pkgtools/pkglint/files/check_test.go:1.77 Thu Oct 28 20:15:25 2021
+++ pkgsrc/pkgtools/pkglint/files/check_test.go Sat Jan 1 12:44:24 2022
@@ -272,7 +272,7 @@ func (t *Tester) SetUpType(varname strin
// Make sure that registering the type succeeds.
// This is necessary for BtUnknown and guessed types.
vartype := G.Pkgsrc.VariableType(nil, varname)
- t.c.Assert(vartype.basicType, check.Equals, basicType)
+ t.AssertEquals(vartype.basicType, basicType)
}
// SetUpFileLines creates a temporary file and writes the given lines to it.
@@ -544,11 +544,8 @@ func (t *Tester) CreateFileLines(filenam
}
abs := t.File(filename)
- err := os.MkdirAll(abs.Dir().String(), 0777)
- t.c.Assert(err, check.IsNil)
-
- err = abs.WriteString(content.String())
- t.c.Assert(err, check.IsNil)
+ t.AssertNil(os.MkdirAll(abs.Dir().String(), 0777))
+ t.AssertNil(abs.WriteString(content.String()))
G.fileCache.Evict(abs)
@@ -681,8 +678,7 @@ func (t *Tester) Chdir(dirname RelPath)
// The file or directory must exist.
func (t *Tester) Remove(filename RelPath) {
abs := t.File(filename)
- err := os.Remove(abs.String())
- t.c.Assert(err, check.IsNil)
+ t.AssertNil(os.Remove(abs.String()))
G.fileCache.Evict(abs)
}
@@ -859,6 +855,18 @@ func (t *Tester) Main(args ...string) in
return G.Main(&t.stdout, &t.stderr, argv)
}
+func (t *Tester) AssertNil(obj interface{}) {
+ t.c.Assert(obj, check.IsNil)
+}
+
+func (t *Tester) AssertNotNil(obj interface{}) {
+ t.c.Assert(obj, check.NotNil)
+}
+
+func (t *Tester) AssertEquals(actual, expected interface{}) {
+ t.c.Assert(actual, check.Equals, expected)
+}
+
// Check delegates a check to the check.Check function.
// Thereby, there is no need to distinguish between c.Check and t.Check
// in the test code.
@@ -866,6 +874,14 @@ func (t *Tester) Check(obj interface{},
return t.c.Check(obj, checker, args...)
}
+func (t *Tester) CheckNil(obj interface{}) bool {
+ return t.c.Check(obj, check.IsNil)
+}
+
+func (t *Tester) CheckNotNil(obj interface{}) bool {
+ return t.c.Check(obj, check.NotNil)
+}
+
func (t *Tester) CheckEquals(actual interface{}, expected interface{}) bool {
return t.c.Check(actual, check.Equals, expected)
}
@@ -884,6 +900,10 @@ func (t *Tester) CheckDeepEqualsf(actual
check.Commentf(format, args...))
}
+func (t *Tester) CheckLen(obj interface{}, expected int) bool {
+ return t.c.Check(obj, check.HasLen, expected)
+}
+
// InternalErrorf reports a consistency error in the tests.
func (t *Tester) InternalErrorf(format string, args ...interface{}) {
// It is not possible to panic here since check.v1 would then
@@ -1284,7 +1304,7 @@ func (t *Tester) DisableTracing() {
// they equal the given lines.
func (t *Tester) CheckFileLines(filename RelPath, lines ...string) {
content, err := t.File(filename).ReadString()
- t.c.Assert(err, check.IsNil)
+ t.AssertNil(err)
actualLines := strings.Split(content, "\n")
actualLines = actualLines[:len(actualLines)-1]
t.CheckDeepEquals(emptyToNil(actualLines), emptyToNil(lines))
Index: pkgsrc/pkgtools/pkglint/files/files_test.go
diff -u pkgsrc/pkgtools/pkglint/files/files_test.go:1.33 pkgsrc/pkgtools/pkglint/files/files_test.go:1.34
--- pkgsrc/pkgtools/pkglint/files/files_test.go:1.33 Fri Jun 25 14:15:01 2021
+++ pkgsrc/pkgtools/pkglint/files/files_test.go Sat Jan 1 12:44:24 2022
@@ -25,31 +25,35 @@ func (s *Suite) Test_Load(c *check.C) {
t := s.Init(c)
nonexistent := t.File("nonexistent")
- empty := t.CreateFileLines("empty")
+ empty := t.CreateFileLines("empty",
+ nil...)
oneLiner := t.CreateFileLines("one-liner",
"hello, world")
- t.Check(Load(nonexistent, 0), check.IsNil)
- t.Check(Load(empty, 0).Lines, check.HasLen, 0)
+ t.CheckNil(Load(nonexistent, 0))
+ t.CheckLen(Load(empty, 0).Lines, 0)
t.CheckEquals(Load(oneLiner, 0).Lines[0].Text, "hello, world")
t.CheckOutputEmpty()
- t.Check(Load(nonexistent, LogErrors), check.IsNil)
- t.Check(Load(empty, LogErrors).Lines, check.HasLen, 0)
+ t.CheckNil(Load(nonexistent, LogErrors))
+ t.CheckLen(Load(empty, LogErrors).Lines, 0)
t.CheckEquals(Load(oneLiner, LogErrors).Lines[0].Text, "hello, world")
t.CheckOutputLines(
"ERROR: ~/nonexistent: Cannot be read.")
- t.Check(Load(nonexistent, NotEmpty), check.IsNil)
- t.Check(Load(empty, NotEmpty), check.IsNil)
+ t.CheckNil(Load(nonexistent, NotEmpty))
+ t.CheckNil(Load(empty, NotEmpty))
t.CheckEquals(Load(oneLiner, NotEmpty).Lines[0].Text, "hello, world")
+ // Specifying NotEmpty only makes sense when combined with LogErrors
+ // or with MustSucceed. On its own, NotEmpty returns nil in error
+ // cases, which is indistinguishable from an empty slice.
t.CheckOutputEmpty()
- t.Check(Load(nonexistent, NotEmpty|LogErrors), check.IsNil)
- t.Check(Load(empty, NotEmpty|LogErrors), check.IsNil)
+ t.CheckNil(Load(nonexistent, NotEmpty|LogErrors))
+ t.CheckNil(Load(empty, NotEmpty|LogErrors))
t.CheckEquals(Load(oneLiner, NotEmpty|LogErrors).Lines[0].Text, "hello, world")
t.CheckOutputLines(
Index: pkgsrc/pkgtools/pkglint/files/lineslexer_test.go
diff -u pkgsrc/pkgtools/pkglint/files/lineslexer_test.go:1.3 pkgsrc/pkgtools/pkglint/files/lineslexer_test.go:1.4
--- pkgsrc/pkgtools/pkglint/files/lineslexer_test.go:1.3 Sun Jun 7 15:49:23 2020
+++ pkgsrc/pkgtools/pkglint/files/lineslexer_test.go Sat Jan 1 12:44:24 2022
@@ -95,12 +95,12 @@ func (s *Suite) Test_LinesLexer_NextRege
llex := NewLinesLexer(lines)
- t.Check(llex.NextRegexp(`not found`), check.IsNil)
+ t.CheckNil(llex.NextRegexp(`not found`))
t.CheckDeepEquals(llex.NextRegexp(`ne..`), []string{"ne 1"})
t.CheckEquals(llex.EOF(), true)
- t.Check(llex.NextRegexp(`^`), check.IsNil)
+ t.CheckNil(llex.NextRegexp(`^`))
}
func (s *Suite) Test_LinesLexer_SkipRegexp(c *check.C) {
@@ -235,7 +235,7 @@ func (s *Suite) Test_LinesLexer_next(c *
llex.next()
- t.Check(llex.line, check.IsNil)
+ t.CheckNil(llex.line)
}
func (s *Suite) Test_NewMkLinesLexer(c *check.C) {
Index: pkgsrc/pkgtools/pkglint/files/mkassignchecker.go
diff -u pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.11 pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.12
--- pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.11 Sat Aug 14 09:46:11 2021
+++ pkgsrc/pkgtools/pkglint/files/mkassignchecker.go Sat Jan 1 12:44:24 2022
@@ -645,8 +645,11 @@ func (ck *MkAssignChecker) checkRightVar
}
}
-// checkVaruseShell is very similar to checkRightVaruse, they just differ
-// in the way they determine isWordPart.
+// checkVaruseShell checks that in a variable assignment, each variable
+// expression on the right-hand side of the assignment operator has the
+// correct data type and quoting.
+//
+// See checkRightVaruse for non-shell variables.
func (ck *MkAssignChecker) checkVaruseShell(vartype *Vartype, time VucTime) {
if trace.Tracing {
defer trace.Call(vartype, time)()
Index: pkgsrc/pkgtools/pkglint/files/mkline_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mkline_test.go:1.83 pkgsrc/pkgtools/pkglint/files/mkline_test.go:1.84
--- pkgsrc/pkgtools/pkglint/files/mkline_test.go:1.83 Sat Aug 14 08:19:49 2021
+++ pkgsrc/pkgtools/pkglint/files/mkline_test.go Sat Jan 1 12:44:24 2022
@@ -154,7 +154,7 @@ func (s *Suite) Test_MkLine_ConditionalV
mkline := t.NewMkLine("Makefile", 45, ".include \"../../category/package/buildlink3.mk\"")
- c.Check(mkline.ConditionalVars(), check.HasLen, 0)
+ t.CheckLen(mkline.ConditionalVars(), 0)
mkline.SetConditionalVars([]string{"OPSYS"})
@@ -166,7 +166,7 @@ func (s *Suite) Test_MkLine_Tokenize__co
mkline := t.NewMkLine("filename.mk", 123, "#VAR=\tvalue ${VAR} suffix text")
- t.Check(mkline.Tokenize(mkline.Value(), false), check.HasLen, 3)
+ t.CheckLen(mkline.Tokenize(mkline.Value(), false), 3)
}
func (s *Suite) Test_MkLine_ValueSplit(c *check.C) {
@@ -380,13 +380,13 @@ func (s *Suite) Test_MkLine_ValueTokens_
tokens, rest := mkline.ValueTokens()
- t.Check(tokens, check.IsNil)
+ t.CheckNil(tokens)
t.CheckEquals(rest, "$")
// Returns the same values, this time from the cache.
tokens, rest = mkline.ValueTokens()
- t.Check(tokens, check.IsNil)
+ t.CheckNil(tokens)
t.CheckEquals(rest, "$")
}
@@ -1410,7 +1410,7 @@ func (s *Suite) Test_Indentation(c *chec
ind.Pop()
- c.Check(ind.Varnames(), check.HasLen, 0)
+ t.CheckLen(ind.Varnames(), 0)
t.CheckEquals(ind.IsConditional(), false)
t.CheckEquals(ind.String(), "[]")
}
@@ -1455,7 +1455,7 @@ func (s *Suite) Test_Indentation_String(
mklines.ForEach(func(mkline *MkLine) {
if mkline.IsComment() {
t.CheckEquals(mklines.indentation.IsConditional(), true)
- t.Check(mklines.indentation.Varnames(), check.IsNil)
+ t.CheckNil(mklines.indentation.Varnames())
str = mklines.indentation.String()
}
})
Index: pkgsrc/pkgtools/pkglint/files/pkglint.go
diff -u pkgsrc/pkgtools/pkglint/files/pkglint.go:1.83 pkgsrc/pkgtools/pkglint/files/pkglint.go:1.84
--- pkgsrc/pkgtools/pkglint/files/pkglint.go:1.83 Sat Oct 9 08:33:09 2021
+++ pkgsrc/pkgtools/pkglint/files/pkglint.go Sat Jan 1 12:44:25 2022
@@ -640,7 +640,7 @@ func (p *Pkglint) checkReg(filename Curr
case basename.HasPrefixText("CHANGES-"):
// This only checks the file but doesn't register the changes globally.
- _ = p.Pkgsrc.loadDocChangesFromFile(filename)
+ _ = p.Pkgsrc.loadDocChangesFromFile(filename, true)
case filename.Dir().HasBase("files"):
// Skip files directly in the files/ directory, but not those further down.
Index: pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go:1.65 pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go:1.66
--- pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go:1.65 Fri Jun 25 14:15:01 2021
+++ pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go Sat Jan 1 12:44:25 2022
@@ -203,7 +203,7 @@ func (s *Suite) Test_MkLineChecker_check
// Since COMMENT is defined in vardefs.go its type is certain instead of guessed.
vartype := G.Pkgsrc.VariableType(nil, "COMMENT")
- c.Assert(vartype, check.NotNil)
+ t.AssertNotNil(vartype)
t.CheckEquals(vartype.basicType.name, "Comment")
t.CheckEquals(vartype.IsGuessed(), false)
t.CheckEquals(vartype.IsList(), false)
Index: pkgsrc/pkgtools/pkglint/files/pkgsrc.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.65 pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.66
--- pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.65 Sat Nov 13 21:20:59 2021
+++ pkgsrc/pkgtools/pkglint/files/pkgsrc.go Sat Jan 1 12:44:25 2022
@@ -166,7 +166,7 @@ func (src *Pkgsrc) loadDocChanges() {
src.LastChange = make(map[PkgsrcPath]*Change)
for _, filename := range filenames {
- changes := src.loadDocChangesFromFile(docDir.JoinNoClean(filename))
+ changes := src.loadDocChangesFromFile(docDir.JoinNoClean(filename), false)
for _, change := range changes {
src.LastChange[change.Pkgpath] = change
if change.Action == Renamed || change.Action == Moved {
@@ -178,9 +178,9 @@ func (src *Pkgsrc) loadDocChanges() {
src.checkRemovedAfterLastFreeze()
}
-func (src *Pkgsrc) loadDocChangesFromFile(filename CurrPath) []*Change {
+func (src *Pkgsrc) loadDocChangesFromFile(filename CurrPath, direct bool) []*Change {
- warn := G.CheckGlobal && !G.Wip
+ warn := direct || G.CheckGlobal && !G.Wip
// Each date in the file should be from the same year as the filename says.
// This check has been added in 2018.
@@ -189,7 +189,7 @@ func (src *Pkgsrc) loadDocChangesFromFil
if _, yyyy := match1(filename.Base().String(), `-(\d\d\d\d)$`); yyyy >= "2018" {
year = yyyy
}
- thorough := G.CheckGlobal || year >= "2020" // For performance reasons
+ thorough := direct || G.CheckGlobal || year >= "2020" // For performance reasons
latest := make(map[PkgsrcPath]*Change)
Index: pkgsrc/pkgtools/pkglint/files/mklineparser_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mklineparser_test.go:1.13 pkgsrc/pkgtools/pkglint/files/mklineparser_test.go:1.14
--- pkgsrc/pkgtools/pkglint/files/mklineparser_test.go:1.13 Fri Jun 25 14:15:01 2021
+++ pkgsrc/pkgtools/pkglint/files/mklineparser_test.go Sat Jan 1 12:44:25 2022
@@ -536,7 +536,7 @@ func (s *Suite) Test_MkLineParser_parseD
parser := NewMkLineParser()
splitResult := parser.split(line, input, true)
mkline := parser.parseDirective(line, splitResult)
- if !c.Check(mkline, check.NotNil) {
+ if !t.CheckNotNil(mkline) {
return
}
Index: pkgsrc/pkgtools/pkglint/files/mklines_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mklines_test.go:1.66 pkgsrc/pkgtools/pkglint/files/mklines_test.go:1.67
--- pkgsrc/pkgtools/pkglint/files/mklines_test.go:1.66 Sat Aug 14 08:19:49 2021
+++ pkgsrc/pkgtools/pkglint/files/mklines_test.go Sat Jan 1 12:44:25 2022
@@ -516,7 +516,7 @@ func (s *Suite) Test_MkLines_collectUsed
mklines.collectUsedVariables()
- t.Check(mklines.allVars.vs, check.HasLen, 1)
+ t.CheckLen(mklines.allVars.vs, 1)
t.CheckEquals(mklines.allVars.create("VAR").used, mkline)
t.CheckEquals(mklines.allVars.FirstUse("VAR"), mkline)
}
@@ -1481,7 +1481,7 @@ func (s *Suite) Test_MkLines_ExpandLoopV
t.CheckDeepEquals(files, strings.Split("abcdefgh", ""))
t.CheckDeepEquals(ranks, strings.Split("12345678", ""))
- t.Check(diagonals, check.HasLen, 0)
+ t.CheckLen(diagonals, 0)
}
func (s *Suite) Test_MkLines_ExpandLoopVar__multi(c *check.C) {
@@ -1506,8 +1506,8 @@ func (s *Suite) Test_MkLines_ExpandLoopV
})
// As of June 2019, multi-variable .for loops are not yet implemented.
- t.Check(keys, check.HasLen, 0)
- t.Check(values, check.HasLen, 0)
+ t.CheckLen(keys, 0)
+ t.CheckLen(values, 0)
}
func (s *Suite) Test_MkLines_ExpandLoopVar__malformed_for(c *check.C) {
@@ -1527,5 +1527,5 @@ func (s *Suite) Test_MkLines_ExpandLoopV
}
})
- t.Check(values, check.HasLen, 0)
+ t.CheckLen(values, 0)
}
Index: pkgsrc/pkgtools/pkglint/files/mkparser_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mkparser_test.go:1.41 pkgsrc/pkgtools/pkglint/files/mkparser_test.go:1.42
--- pkgsrc/pkgtools/pkglint/files/mkparser_test.go:1.41 Wed Jul 1 13:17:41 2020
+++ pkgsrc/pkgtools/pkglint/files/mkparser_test.go Sat Jan 1 12:44:25 2022
@@ -378,7 +378,7 @@ func (s *Suite) Test_MkParser_Dependency
testRest := func(pattern string, expected DependencyPattern, rest string) {
parser := NewMkParser(nil, pattern)
dp := parser.DependencyPattern()
- if c.Check(dp, check.NotNil) {
+ if t.CheckNotNil(dp) {
t.CheckEquals(*dp, expected)
t.CheckEquals(parser.Rest(), rest)
}
@@ -387,7 +387,7 @@ func (s *Suite) Test_MkParser_Dependency
testNil := func(pattern string) {
parser := NewMkParser(nil, pattern)
dp := parser.DependencyPattern()
- if c.Check(dp, check.IsNil) {
+ if t.CheckNil(dp) {
t.CheckEquals(parser.Rest(), pattern)
}
}
Index: pkgsrc/pkgtools/pkglint/files/mkshparser_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mkshparser_test.go:1.24 pkgsrc/pkgtools/pkglint/files/mkshparser_test.go:1.25
--- pkgsrc/pkgtools/pkglint/files/mkshparser_test.go:1.24 Sat Feb 15 13:48:40 2020
+++ pkgsrc/pkgtools/pkglint/files/mkshparser_test.go Sat Jan 1 12:44:25 2022
@@ -731,13 +731,11 @@ func (s *ShSuite) test(program string, e
zeroMeansSuccess := parser.Parse(lexer)
- c := s.c
-
if t.CheckEquals(zeroMeansSuccess, 0) && t.CheckEquals(lexer.error, "") {
if !t.CheckDeepEquals(lexer.result, expected) {
actualJSON, actualErr := json.MarshalIndent(lexer.result, "", " ")
expectedJSON, expectedErr := json.MarshalIndent(expected, "", " ")
- if c.Check(actualErr, check.IsNil) && c.Check(expectedErr, check.IsNil) {
+ if t.CheckNil(actualErr) && t.CheckNil(expectedErr) {
t.CheckDeepEquals(string(actualJSON), string(expectedJSON))
}
}
Index: pkgsrc/pkgtools/pkglint/files/mkshwalker_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mkshwalker_test.go:1.12 pkgsrc/pkgtools/pkglint/files/mkshwalker_test.go:1.13
--- pkgsrc/pkgtools/pkglint/files/mkshwalker_test.go:1.12 Sat Jan 4 19:53:14 2020
+++ pkgsrc/pkgtools/pkglint/files/mkshwalker_test.go Sat Jan 1 12:44:25 2022
@@ -49,7 +49,7 @@ func (s *Suite) Test_MkShWalker_Walk(c *
line := t.NewLine("filename.mk", 1, "")
list, err := parseShellProgram(line, program)
- if !c.Check(err, check.IsNil) || !c.Check(list, check.NotNil) {
+ if !t.CheckNil(err) || !t.CheckNotNil(list) {
return
}
Index: pkgsrc/pkgtools/pkglint/files/mktokenslexer_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mktokenslexer_test.go:1.6 pkgsrc/pkgtools/pkglint/files/mktokenslexer_test.go:1.7
--- pkgsrc/pkgtools/pkglint/files/mktokenslexer_test.go:1.6 Wed Jul 1 13:17:41 2020
+++ pkgsrc/pkgtools/pkglint/files/mktokenslexer_test.go Sat Jan 1 12:44:25 2022
@@ -186,7 +186,7 @@ func (s *Suite) Test_MkTokensLexer_NextV
t.CheckDeepEquals(lexer.NextVarUse(), tokens[0])
t.CheckDeepEquals(lexer.NextVarUse(), tokens[1])
t.CheckDeepEquals(lexer.NextVarUse(), tokens[2])
- t.Check(lexer.NextVarUse(), check.IsNil)
+ t.CheckNil(lexer.NextVarUse())
}
func (s *Suite) Test_MkTokensLexer_NextVarUse__varuse_when_plain_text(c *check.C) {
@@ -195,11 +195,11 @@ func (s *Suite) Test_MkTokensLexer_NextV
lexer := NewMkTokensLexer(b.Tokens(b.TextToken("text")))
- t.Check(lexer.NextVarUse(), check.IsNil)
+ t.CheckNil(lexer.NextVarUse())
t.CheckEquals(lexer.NextString("te"), "te")
- t.Check(lexer.NextVarUse(), check.IsNil)
+ t.CheckNil(lexer.NextVarUse())
t.CheckEquals(lexer.NextString("xt"), "xt")
- t.Check(lexer.NextVarUse(), check.IsNil)
+ t.CheckNil(lexer.NextVarUse())
}
func (s *Suite) Test_MkTokensLexer_NextVarUse__peek_after_varuse(c *check.C) {
@@ -246,7 +246,7 @@ func (s *Suite) Test_MkTokensLexer_NextV
t.CheckEquals(lexer.SkipString("text2"), false)
// Just for covering the "Varuse != nil" branch in MkTokensLexer.NextVarUse.
- t.Check(lexer.NextVarUse(), check.IsNil)
+ t.CheckNil(lexer.NextVarUse())
// The string is still not found since the next token is only consumed
// by the NextVarUse above if it is indeed a VarUse.
Index: pkgsrc/pkgtools/pkglint/files/package_test.go
diff -u pkgsrc/pkgtools/pkglint/files/package_test.go:1.88 pkgsrc/pkgtools/pkglint/files/package_test.go:1.89
--- pkgsrc/pkgtools/pkglint/files/package_test.go:1.88 Thu Oct 28 20:15:25 2021
+++ pkgsrc/pkgtools/pkglint/files/package_test.go Sat Jan 1 12:44:25 2022
@@ -548,7 +548,7 @@ func (s *Suite) Test_Package_loadBuildli
t.CheckOutputEmpty()
seenPkgbase := pkg.seenPkgbase
- t.Check(seenPkgbase.seen, check.HasLen, 2)
+ t.CheckLen(seenPkgbase.seen, 2)
t.CheckEquals(seenPkgbase.Seen("lib"), true)
t.CheckEquals(seenPkgbase.Seen("package"), true)
}
Index: pkgsrc/pkgtools/pkglint/files/pkglint_test.go
diff -u pkgsrc/pkgtools/pkglint/files/pkglint_test.go:1.71 pkgsrc/pkgtools/pkglint/files/pkglint_test.go:1.72
--- pkgsrc/pkgtools/pkglint/files/pkglint_test.go:1.71 Thu Oct 28 20:15:25 2021
+++ pkgsrc/pkgtools/pkglint/files/pkglint_test.go Sat Jan 1 12:44:25 2022
@@ -15,9 +15,9 @@ func (s *Suite) Test_Pkglint_Main(c *che
t := s.Init(c)
out, err := os.Create(t.CreateFileLines("out").String())
- c.Check(err, check.IsNil)
+ t.CheckNil(err)
outProfiling, err := os.Create(t.CreateFileLines("out.profiling").String())
- c.Check(err, check.IsNil)
+ t.CheckNil(err)
t.SetUpPackage("category/package")
t.Chdir("category/package")
@@ -31,8 +31,8 @@ func (s *Suite) Test_Pkglint_Main(c *che
runMain(out, "pkglint", ".")
runMain(outProfiling, "pkglint", "--profiling", ".")
- c.Check(out.Close(), check.IsNil)
- c.Check(outProfiling.Close(), check.IsNil)
+ t.CheckNil(out.Close())
+ t.CheckNil(outProfiling.Close())
t.CheckOutputEmpty() // Because all output is redirected.
t.CheckFileLines("../../out", // See the t.Chdir above.
@@ -293,9 +293,11 @@ func (s *Suite) Test_Pkglint_Main__autof
//
// See https://github.com/rillig/gobco for the tool to measure the branch coverage.
func (s *Suite) Test_Pkglint_Main__realistic(c *check.C) {
+ t := s.Init(c)
+
if cwd := os.Getenv("PKGLINT_TESTDIR"); cwd != "" {
err := os.Chdir(cwd)
- c.Assert(err, check.IsNil)
+ t.AssertNil(err)
}
cmdline := os.Getenv("PKGLINT_TESTCMDLINE")
@@ -317,7 +319,7 @@ func (s *Suite) Test_Pkglint_Main__profi
t.CheckEquals(NewCurrPath("pkglint.pprof").IsFile(), true)
err := os.Remove("pkglint.pprof")
- c.Check(err, check.IsNil)
+ t.CheckNil(err)
// Everything but the first few lines of output is not easily testable
// or not interesting enough, since that info includes the exact timing
@@ -1077,14 +1079,14 @@ func (s *Suite) Test_Pkglint_checkReg__r
src := filepath.ToSlash(pathname)
dst := strings.Replace(src, "category/package", "wip/package", 1)
data, e := ioutil.ReadFile(src)
- c.Check(e, check.IsNil)
+ t.CheckNil(e)
_ = os.MkdirAll(path.Dir(dst), 0700)
e = ioutil.WriteFile(dst, data, 0600)
- c.Check(e, check.IsNil)
+ t.CheckNil(e)
}
return err
})
- c.Check(err, check.IsNil)
+ t.CheckNil(err)
t.SetUpPkgsrc()
t.Chdir(".")
@@ -1286,7 +1288,7 @@ func (s *Suite) Test_Pkglint_checkExecut
// execute-bit. The only relevant permissions bit is whether a
// file is readonly or not.
st, err := filename.Lstat()
- if t.Check(err, check.IsNil) {
+ if t.CheckNil(err) {
t.CheckEquals(st.Mode()&0111, os.FileMode(0))
}
}
Index: pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.54 pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.55
--- pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.54 Sat Oct 9 08:33:09 2021
+++ pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go Sat Jan 1 12:44:25 2022
@@ -140,7 +140,6 @@ func (s *Suite) Test_Pkgsrc_loadDocChang
func (s *Suite) Test_Pkgsrc_loadDocChangesFromFile(c *check.C) {
t := s.Init(c)
- t.SetUpCommandLine("-Cglobal", "-Wall")
t.CreateFileLines("doc/CHANGES-2018",
"\tAdded category/package version 1.0 [author1 2015-01-01]", // Wrong year
"\tUpdated category/package to 1.5 [author2 2018-01-02]",
@@ -161,7 +160,7 @@ func (s *Suite) Test_Pkgsrc_loadDocChang
"",
"Normal paragraph.")
- changes := G.Pkgsrc.loadDocChangesFromFile(t.File("doc/CHANGES-2018"))
+ changes := G.Pkgsrc.loadDocChangesFromFile(t.File("doc/CHANGES-2018"), true)
t.CheckDeepEquals(
changes, []*Change{
@@ -201,7 +200,7 @@ func (s *Suite) Test_Pkgsrc_loadDocChang
t := s.Init(c)
t.ExpectFatal(
- func() { G.Pkgsrc.loadDocChangesFromFile(t.File("doc/CHANGES-2018")) },
+ func() { G.Pkgsrc.loadDocChangesFromFile(t.File("doc/CHANGES-2018"), false) },
"FATAL: ~/doc/CHANGES-2018: Cannot be read.")
}
@@ -354,7 +353,6 @@ func (s *Suite) Test_Pkgsrc_loadDocChang
func (s *Suite) Test_Pkgsrc_checkChangeVersion(c *check.C) {
t := s.Init(c)
- t.SetUpCommandLine("-Cglobal", "-Wall")
t.CreateFileLines("doc/CHANGES-2020",
"\tAdded category/package version 1.0 [author1 2020-01-01]",
"\tAdded category/package version 1.0 [author1 2020-01-01]",
@@ -366,7 +364,7 @@ func (s *Suite) Test_Pkgsrc_checkChangeV
"\tMoved category/package to other/renamed [author1 2020-01-01]")
t.Chdir("doc")
- G.Pkgsrc.loadDocChangesFromFile("CHANGES-2020")
+ G.Pkgsrc.loadDocChangesFromFile("CHANGES-2020", true)
// In line 3 there is no warning about the repeated addition since
// the multi-packages (Lua, PHP, Python) may add a package in
@@ -380,7 +378,6 @@ func (s *Suite) Test_Pkgsrc_checkChangeV
func (s *Suite) Test_Pkgsrc_checkChangeVersionNumber(c *check.C) {
t := s.Init(c)
- t.SetUpCommandLine("-Cglobal", "-Wall")
t.CreateFileLines("doc/CHANGES-2020",
"\tAdded category/package version v1 [author1 2020-01-01]",
"\tUpdated category/package to v2 [author1 2020-01-01]",
@@ -388,7 +385,7 @@ func (s *Suite) Test_Pkgsrc_checkChangeV
"\tUpdated category/package to 2020/03 [author1 2020-01-01]")
t.Chdir("doc")
- G.Pkgsrc.loadDocChangesFromFile("CHANGES-2020")
+ G.Pkgsrc.loadDocChangesFromFile("CHANGES-2020", true)
t.CheckOutputLines(
"WARN: CHANGES-2020:1: Version number \"v1\" should start with a digit.",
@@ -950,7 +947,7 @@ func (s *Suite) Test_Pkgsrc_loadUntypedV
}
added := func(varname string, basicType *BasicType) {
vartype := G.Pkgsrc.VariableType(nil, "CHECK_FILES_SKIP")
- if t.Check(vartype, check.NotNil) {
+ if t.CheckNotNil(vartype) {
t.CheckEquals(vartype.basicType, BtPathPattern)
}
}
@@ -1145,7 +1142,7 @@ func (s *Suite) Test_Pkgsrc_ListVersions
G.Testing = false
versions := G.Pkgsrc.ListVersions("databases", `^postgresql[0-9]+`, "$0", false)
- t.Check(versions, check.HasLen, 0)
+ t.CheckLen(versions, 0)
}
func (s *Suite) Test_Pkgsrc_ListVersions__no_basedir(c *check.C) {
@@ -1153,7 +1150,7 @@ func (s *Suite) Test_Pkgsrc_ListVersions
versions := G.Pkgsrc.ListVersions("lang", `^python[0-9]+$`, "../../lang/$0", true)
- c.Check(versions, check.HasLen, 0)
+ t.CheckLen(versions, 0)
t.CheckOutputLines(
"ERROR: ~/lang: Cannot find package versions of \"^python[0-9]+$\".")
}
@@ -1165,7 +1162,7 @@ func (s *Suite) Test_Pkgsrc_ListVersions
versions := G.Pkgsrc.ListVersions("lang", `^python[0-9]+$`, "../../lang/$0", true)
- c.Check(versions, check.HasLen, 0)
+ t.CheckLen(versions, 0)
t.CheckOutputLines(
"ERROR: ~/lang: Cannot find package versions of \"^python[0-9]+$\".")
}
@@ -1177,13 +1174,13 @@ func (s *Suite) Test_Pkgsrc_ListVersions
versions := G.Pkgsrc.ListVersions("lang", `^python[0-9]+$`, "../../lang/$0", true)
- c.Check(versions, check.HasLen, 0)
+ t.CheckLen(versions, 0)
t.CheckOutputLines(
"ERROR: ~/lang: Cannot find package versions of \"^python[0-9]+$\".")
versions2 := G.Pkgsrc.ListVersions("lang", `^python[0-9]+$`, "../../lang/$0", true)
- c.Check(versions2, check.HasLen, 0)
+ t.CheckLen(versions2, 0)
t.CheckOutputEmpty() // No repeated error message
}
@@ -1209,9 +1206,9 @@ func (s *Suite) Test_Pkgsrc_VariableType
test := func(varname string, vartype string) {
actualType := G.Pkgsrc.VariableType(nil, varname)
if vartype == "" {
- c.Check(actualType, check.IsNil)
+ t.CheckNil(actualType)
} else {
- if c.Check(actualType, check.NotNil) {
+ if t.CheckNotNil(actualType) {
t.CheckEquals(actualType.String(), vartype)
}
}
@@ -1240,12 +1237,12 @@ func (s *Suite) Test_Pkgsrc_VariableType
t1 := G.Pkgsrc.VariableType(nil, "FONT_DIRS")
- c.Assert(t1, check.NotNil)
+ t.AssertNotNil(t1)
t.CheckEquals(t1.String(), "PathPattern (list, guessed)")
t2 := G.Pkgsrc.VariableType(nil, "FONT_DIRS.ttf")
- c.Assert(t2, check.NotNil)
+ t.AssertNotNil(t2)
t.CheckEquals(t2.String(), "PathPattern (list, guessed)")
}
@@ -1273,15 +1270,15 @@ func (s *Suite) Test_Pkgsrc_VariableType
t.Main("-Wall", "category/package")
- if typ := G.Pkgsrc.VariableType(nil, "PKGSRC_MAKE_ENV"); c.Check(typ, check.NotNil) {
+ if typ := G.Pkgsrc.VariableType(nil, "PKGSRC_MAKE_ENV"); t.CheckNotNil(typ) {
t.CheckEquals(typ.String(), "ShellWord (list, guessed)")
}
- if typ := G.Pkgsrc.VariableType(nil, "CPPPATH"); c.Check(typ, check.NotNil) {
+ if typ := G.Pkgsrc.VariableType(nil, "CPPPATH"); t.CheckNotNil(typ) {
t.CheckEquals(typ.String(), "Pathlist (guessed)")
}
- if typ := G.Pkgsrc.VariableType(nil, "OSNAME.Other"); c.Check(typ, check.NotNil) {
+ if typ := G.Pkgsrc.VariableType(nil, "OSNAME.Other"); t.CheckNotNil(typ) {
t.CheckEquals(typ.String(), "Unknown")
}
Index: pkgsrc/pkgtools/pkglint/files/plist_test.go
diff -u pkgsrc/pkgtools/pkglint/files/plist_test.go:1.53 pkgsrc/pkgtools/pkglint/files/plist_test.go:1.54
--- pkgsrc/pkgtools/pkglint/files/plist_test.go:1.53 Sat Aug 14 09:46:11 2021
+++ pkgsrc/pkgtools/pkglint/files/plist_test.go Sat Jan 1 12:44:25 2022
@@ -425,8 +425,8 @@ func (s *Suite) Test_NewPlistChecker(c *
ck := NewPlistChecker(pkg)
t.CheckEquals(ck.pkg, pkg)
- t.Check(ck.allDirs, check.NotNil)
- t.Check(ck.allFiles, check.NotNil)
+ t.CheckNotNil(ck.allDirs)
+ t.CheckNotNil(ck.allFiles)
}
func (s *Suite) Test_PlistChecker_Load__common_end(c *check.C) {
@@ -450,12 +450,12 @@ func (s *Suite) Test_PlistChecker_Load__
// The corresponding PLIST.common is loaded if possible.
// Its lines are not appended to plistLines since they
// are checked separately.
- t.Check(plistLines, check.HasLen, 2)
+ t.CheckLen(plistLines, 2)
// But the files and directories from PLIST.common are registered,
// to check for duplicates and to make these lists available to
// the package being checked, for cross-validation.
- t.Check(ck.allFiles["bin/plist"], check.IsNil)
+ t.CheckNil(ck.allFiles["bin/plist"])
t.CheckEquals(
ck.allFiles["bin/plist_common"].Line.String(),
"PLIST.common:2: bin/plist_common")
@@ -491,16 +491,16 @@ func (s *Suite) Test_PlistChecker_newLin
// The invalid condition in line 4 is silently skipped when the
// lines are parsed. The actual check happens later.
- t.Check(plistLines, check.HasLen, 4)
+ t.CheckLen(plistLines, 4)
t.CheckEquals(plistLines[0].text, "bin/program")
t.CheckEquals(plistLines[1].text, "bin/conditional")
t.CheckEquals(plistLines[2].text, "/bin/conditional-absolute")
t.CheckEquals(plistLines[3].text, "${PLIST.mod:Q}invalid")
- t.Check(plistLines[0].conditions, check.HasLen, 0)
+ t.CheckLen(plistLines[0].conditions, 0)
t.CheckDeepEquals(plistLines[1].conditions, []string{"PLIST.cond"})
t.CheckDeepEquals(plistLines[2].conditions, []string{"PLIST.abs", "PLIST.abs2"})
- t.Check(plistLines[3].conditions, check.HasLen, 0)
+ t.CheckLen(plistLines[3].conditions, 0)
}
func (s *Suite) Test_PlistChecker_collectFilesAndDirs(c *check.C) {
@@ -548,7 +548,7 @@ func (s *Suite) Test_PlistChecker_collec
ck.collectDirective(&PlistLine{line, nil, line.Text})
t.CheckDeepEquals(keys(ck.allDirs), dirs)
- t.Check(keys(ck.allFiles), check.HasLen, 0)
+ t.CheckLen(keys(ck.allFiles), 0)
}
test("@exec ${MKDIR} %D/a/b/c",
@@ -1522,7 +1522,7 @@ func (s *Suite) Test_plistLineSorter_Sor
sorter2 := NewPlistLineSorter((&PlistChecker{nil, nil, nil, "", Once{}, false}).
newLines(NewLines(lines.Filename, cleanedLines)))
- c.Check(sorter2.unsortable, check.IsNil)
+ t.CheckNil(sorter2.unsortable)
sorter2.Sort()
@@ -1602,9 +1602,11 @@ func (s *Suite) Test_PlistRank_MoreGener
}
func (s *Suite) Test_NewPlistLines(c *check.C) {
+ t := s.Init(c)
+
lines := NewPlistLines()
- c.Check(lines.all, check.NotNil)
+ t.CheckNotNil(lines.all)
}
func (s *Suite) Test_PlistLines_Add(c *check.C) {
Index: pkgsrc/pkgtools/pkglint/files/vartype.go
diff -u pkgsrc/pkgtools/pkglint/files/vartype.go:1.53 pkgsrc/pkgtools/pkglint/files/vartype.go:1.54
--- pkgsrc/pkgtools/pkglint/files/vartype.go:1.53 Sun Aug 8 22:04:15 2021
+++ pkgsrc/pkgtools/pkglint/files/vartype.go Sat Jan 1 12:44:25 2022
@@ -434,6 +434,7 @@ var (
BtFileMode = &BasicType{"FileMode", (*VartypeCheck).FileMode}
BtGccReqd = &BasicType{"GccReqd", (*VartypeCheck).GccReqd}
BtGitTag = &BasicType{"GitTag", (*VartypeCheck).GitTag}
+ BtGoModuleFile = &BasicType{"GoModuleFile", (*VartypeCheck).GoModuleFile}
BtHomepage = &BasicType{"Homepage", (*VartypeCheck).Homepage}
BtIdentifierDirect = &BasicType{"Identifier", (*VartypeCheck).IdentifierDirect}
BtIdentifierIndirect = &BasicType{"Identifier", (*VartypeCheck).IdentifierIndirect}
Index: pkgsrc/pkgtools/pkglint/files/scope_test.go
diff -u pkgsrc/pkgtools/pkglint/files/scope_test.go:1.2 pkgsrc/pkgtools/pkglint/files/scope_test.go:1.3
--- pkgsrc/pkgtools/pkglint/files/scope_test.go:1.2 Sat Jun 20 07:00:44 2020
+++ pkgsrc/pkgtools/pkglint/files/scope_test.go Sat Jan 1 12:44:25 2022
@@ -22,8 +22,8 @@ func (s *Suite) Test_Scope__commented_va
scope.Define("VAR", mkline)
t.CheckEquals(scope.IsDefined("VAR"), false)
- t.Check(scope.FirstDefinition("VAR"), check.IsNil)
- t.Check(scope.LastDefinition("VAR"), check.IsNil)
+ t.CheckNil(scope.FirstDefinition("VAR"))
+ t.CheckNil(scope.LastDefinition("VAR"))
t.CheckEquals(scope.Mentioned("VAR"), mkline)
t.CheckEquals(scope.Commented("VAR"), mkline)
@@ -39,9 +39,9 @@ func (s *Suite) Test_NewScope(c *check.C
scope := NewScope()
- t.Check(scope.names, check.IsNil)
- t.Check(scope.vs, check.NotNil)
- t.Check(scope.vs, check.HasLen, 0)
+ t.CheckNil(scope.names)
+ t.CheckNotNil(scope.vs)
+ t.CheckLen(scope.vs, 0)
}
func (s *Suite) Test_Scope_varnames(c *check.C) {
@@ -50,7 +50,7 @@ func (s *Suite) Test_Scope_varnames(c *c
scope := NewScope()
mkline := t.NewMkLine("filename.mk", 3, "DEFINED=\t${USED}")
- t.Check(scope.varnames(), check.IsNil)
+ t.CheckNil(scope.varnames())
scope.Define("DEFINED", mkline)
scope.Use("USED", mkline, VucRunTime)
@@ -120,9 +120,9 @@ func (s *Suite) Test_Scope_def(c *check.
scope.def("VAR.param", mkline)
- t.Check(scope.FirstDefinition("VAR"), check.IsNil)
+ t.CheckNil(scope.FirstDefinition("VAR"))
t.CheckEquals(scope.FirstDefinition("VAR.param"), mkline)
- t.Check(scope.FirstDefinition("VAR.*"), check.IsNil)
+ t.CheckNil(scope.FirstDefinition("VAR.*"))
}
func (s *Suite) Test_Scope_Fallback(c *check.C) {
@@ -166,7 +166,7 @@ func (s *Suite) Test_Scope_Mentioned(c *
t.CheckEquals(scope.Mentioned("VAR"), assigned)
t.CheckEquals(scope.Mentioned("COMMENTED"), commented)
t.CheckEquals(scope.Mentioned("DOCUMENTED"), documented)
- t.Check(scope.Mentioned("UNKNOWN"), check.IsNil)
+ t.CheckNil(scope.Mentioned("UNKNOWN"))
}
func (s *Suite) Test_Scope_IsDefined(c *check.C) {
@@ -247,9 +247,9 @@ func (s *Suite) Test_Scope_FirstDefiniti
// and the calling code typically assumes a variable definition.
// These sneaky variables with implicit definition are an edge
// case that only few people actually know. It's better that way.
- t.Check(scope.FirstDefinition("SNEAKY"), check.IsNil)
+ t.CheckNil(scope.FirstDefinition("SNEAKY"))
- t.Check(scope.FirstDefinition("USED"), check.IsNil)
+ t.CheckNil(scope.FirstDefinition("USED"))
t.CheckOutputLines(
"ERROR: fname.mk:4: Assignment modifiers like \":=\" " +
@@ -268,8 +268,8 @@ func (s *Suite) Test_Scope_LastDefinitio
scope.Use("USED", mkline4, VucRunTime)
t.CheckEquals(scope.LastDefinition("VAR"), mkline4)
- t.Check(scope.LastDefinition("UNDEFINED"), check.IsNil)
- t.Check(scope.LastDefinition("USED"), check.IsNil)
+ t.CheckNil(scope.LastDefinition("UNDEFINED"))
+ t.CheckNil(scope.LastDefinition("USED"))
}
func (s *Suite) Test_Scope_Commented(c *check.C) {
@@ -286,11 +286,11 @@ func (s *Suite) Test_Scope_Commented(c *
scope.Define("DOCUMENTED", documented)
scope.Use("USED", used, VucRunTime)
- t.Check(scope.Commented("VAR"), check.IsNil)
+ t.CheckNil(scope.Commented("VAR"))
t.CheckEquals(scope.Commented("COMMENTED"), commented)
- t.Check(scope.Commented("DOCUMENTED"), check.IsNil)
- t.Check(scope.Commented("UNKNOWN"), check.IsNil)
- t.Check(scope.Commented("USED"), check.IsNil)
+ t.CheckNil(scope.Commented("DOCUMENTED"))
+ t.CheckNil(scope.Commented("UNKNOWN"))
+ t.CheckNil(scope.Commented("USED"))
}
func (s *Suite) Test_Scope_FirstUse(c *check.C) {
@@ -305,7 +305,7 @@ func (s *Suite) Test_Scope_FirstUse(c *c
scope := mklines.allVars
t.CheckEquals(scope.FirstUse("USED"), mklines.mklines[1])
- t.Check(scope.FirstUse("UNUSED"), check.IsNil)
+ t.CheckNil(scope.FirstUse("UNUSED"))
t.CheckOutputLines(
"WARN: file.mk:2: VAR1 is defined but not used.",
@@ -393,7 +393,7 @@ func (s *Suite) Test_Scope_DefineAll(c *
dst := NewScope()
dst.DefineAll(&src)
- c.Check(dst.vs, check.HasLen, 0)
+ t.CheckLen(dst.vs, 0)
src.Define("VAR", t.NewMkLine("file.mk", 1, "VAR=value"))
dst.DefineAll(&src)
Index: pkgsrc/pkgtools/pkglint/files/shell_test.go
diff -u pkgsrc/pkgtools/pkglint/files/shell_test.go:1.72 pkgsrc/pkgtools/pkglint/files/shell_test.go:1.73
--- pkgsrc/pkgtools/pkglint/files/shell_test.go:1.72 Sat Aug 14 09:46:11 2021
+++ pkgsrc/pkgtools/pkglint/files/shell_test.go Sat Jan 1 12:44:25 2022
@@ -2019,7 +2019,7 @@ func (s *Suite) Test_splitIntoShellToken
line := t.NewLine("filename.mk", 1, "")
words, rest := splitIntoShellTokens(line, text)
- c.Check(words, check.IsNil)
+ t.CheckNil(words)
t.CheckEquals(rest, "\"")
}
Index: pkgsrc/pkgtools/pkglint/files/shtokenizer_test.go
diff -u pkgsrc/pkgtools/pkglint/files/shtokenizer_test.go:1.26 pkgsrc/pkgtools/pkglint/files/shtokenizer_test.go:1.27
--- pkgsrc/pkgtools/pkglint/files/shtokenizer_test.go:1.26 Wed Jul 1 13:17:41 2020
+++ pkgsrc/pkgtools/pkglint/files/shtokenizer_test.go Sat Jan 1 12:44:25 2022
@@ -679,7 +679,7 @@ func (s *Suite) Test_ShTokenizer_ShToken
testNil := func(str string) {
line := t.NewLine("testNil.mk", 1, "")
p := NewShTokenizer(line, str)
- c.Check(p.ShToken(), check.IsNil)
+ t.CheckNil(p.ShToken())
t.CheckEquals(p.Rest(), "")
t.CheckOutputEmpty()
}
Index: pkgsrc/pkgtools/pkglint/files/tools_test.go
diff -u pkgsrc/pkgtools/pkglint/files/tools_test.go:1.26 pkgsrc/pkgtools/pkglint/files/tools_test.go:1.27
--- pkgsrc/pkgtools/pkglint/files/tools_test.go:1.26 Sat Aug 14 08:19:49 2021
+++ pkgsrc/pkgtools/pkglint/files/tools_test.go Sat Jan 1 12:44:25 2022
@@ -530,9 +530,9 @@ func (s *Suite) Test_Tools_Define__inval
mkline := t.NewMkLine("dummy.mk", 123, "DUMMY=\tvalue")
reg := NewTools()
- t.Check(reg.Define("tool_name", "", mkline), check.IsNil)
- t.Check(reg.Define("tool:dependency", "", mkline), check.IsNil)
- t.Check(reg.Define("tool:build", "", mkline), check.IsNil)
+ t.CheckNil(reg.Define("tool_name", "", mkline))
+ t.CheckNil(reg.Define("tool:dependency", "", mkline))
+ t.CheckNil(reg.Define("tool:build", "", mkline))
// As of October 2018, the underscore is not used in any tool name.
// If there should ever be such a case, just use a different character for testing.
@@ -541,7 +541,7 @@ func (s *Suite) Test_Tools_Define__inval
"ERROR: dummy.mk:123: Invalid tool name \"tool:dependency\".",
"ERROR: dummy.mk:123: Invalid tool name \"tool:build\".")
- t.Check(reg.byName, check.HasLen, 0)
+ t.CheckLen(reg.byName, 0)
}
func (s *Suite) Test_Tools_Trace__coverage(c *check.C) {
@@ -593,7 +593,7 @@ func (s *Suite) Test_Tools_ParseToolLine
".endfor")
mklines.collectVariables(false, true)
- t.Check(mklines.Tools.byName, check.HasLen, 1)
+ t.CheckLen(mklines.Tools.byName, 1)
t.CheckEquals(mklines.Tools.ByName("tool").String(), "tool:::Nowhere:abc")
t.CheckOutputEmpty()
@@ -641,7 +641,7 @@ func (s *Suite) Test_Tools_parseUseTools
"USE_TOOLS+=\tunknown unknown unknown")
t.FinishSetUp()
- t.Check(G.Pkgsrc.Tools.ByName("unknown"), check.IsNil)
+ t.CheckNil(G.Pkgsrc.Tools.ByName("unknown"))
t.CheckOutputEmpty()
}
Index: pkgsrc/pkgtools/pkglint/files/util_test.go
diff -u pkgsrc/pkgtools/pkglint/files/util_test.go:1.56 pkgsrc/pkgtools/pkglint/files/util_test.go:1.57
--- pkgsrc/pkgtools/pkglint/files/util_test.go:1.56 Fri Jun 25 14:15:01 2021
+++ pkgsrc/pkgtools/pkglint/files/util_test.go Sat Jan 1 12:44:25 2022
@@ -191,7 +191,7 @@ func (s *Suite) Test_getSubdirs(c *check
t.CreateFileLines("subdir/file")
t.CreateFileLines("empty/file")
- c.Check(os.Remove(t.File("empty/file").String()), check.IsNil)
+ t.CheckNil(os.Remove(t.File("empty/file").String()))
t.CheckDeepEquals(getSubdirs(t.File(".")), []RelPath{"subdir"})
}
@@ -229,10 +229,10 @@ func (s *Suite) Test_isLocallyModified(c
modTime := time.Unix(1136239445, 0).UTC()
err := os.Chtimes(unmodified.String(), modTime, modTime)
- c.Check(err, check.IsNil)
+ t.CheckNil(err)
st, err := os.Lstat(unmodified.String())
- c.Check(err, check.IsNil)
+ t.CheckNil(err)
// Make sure that the file system has second precision and accuracy.
t.CheckDeepEquals(st.ModTime().UTC(), modTime)
@@ -400,7 +400,7 @@ func (s *Suite) Test__regex_ReplaceFirst
m, rest := G.res.ReplaceFirst("a+b+c+d", `(\w)(.)(\w)`, "X")
- c.Assert(m, check.NotNil)
+ t.AssertNotNil(m)
t.CheckDeepEquals(m, []string{"a+b", "a", "+", "b"})
t.CheckEquals(rest, "X+c+d")
}
@@ -566,47 +566,47 @@ func (s *Suite) Test_FileCache(c *check.
MkCvsID,
"# line 2")
- c.Check(cache.Get("Makefile", 0), check.IsNil)
+ t.CheckNil(cache.Get("Makefile", 0))
t.CheckEquals(cache.hits, 0)
t.CheckEquals(cache.misses, 1)
cache.Put("Makefile", 0, lines)
- c.Check(cache.Get("Makefile", MustSucceed|LogErrors), check.IsNil) // Wrong LoadOptions.
+ t.CheckNil(cache.Get("Makefile", MustSucceed|LogErrors)) // Wrong LoadOptions.
linesFromCache := cache.Get("Makefile", 0)
t.CheckEquals(linesFromCache.Filename, NewCurrPath("Makefile"))
- c.Check(linesFromCache.Lines, check.HasLen, 2)
+ t.CheckLen(linesFromCache.Lines, 2)
t.CheckEquals(linesFromCache.Lines[0].Filename(), NewCurrPath("Makefile"))
// Cache keys are normalized using path.Clean.
linesFromCache2 := cache.Get("./Makefile", 0)
t.CheckEquals(linesFromCache2.Filename, NewCurrPath("./Makefile"))
- c.Check(linesFromCache2.Lines, check.HasLen, 2)
+ t.CheckLen(linesFromCache2.Lines, 2)
t.CheckEquals(linesFromCache2.Lines[0].Filename(), NewCurrPath("./Makefile"))
cache.Put("file1.mk", 0, lines)
cache.Put("file2.mk", 0, lines)
// Now the cache is full. All three entries can be retrieved.
- c.Check(cache.Get("Makefile", 0), check.NotNil)
- c.Check(cache.Get("file1.mk", 0), check.NotNil)
- c.Check(cache.Get("file2.mk", 0), check.NotNil)
+ t.CheckNotNil(cache.Get("Makefile", 0))
+ t.CheckNotNil(cache.Get("file1.mk", 0))
+ t.CheckNotNil(cache.Get("file2.mk", 0))
// Adding another entry removes all entries with minimum count,
// which currently are file1.mk and file2.mk.
// Makefile is still in the cache because it was accessed once.
cache.Put("file3.mk", 0, lines)
- c.Check(cache.Get("Makefile", 0), check.NotNil)
- c.Check(cache.Get("file1.mk", 0), check.IsNil)
- c.Check(cache.Get("file2.mk", 0), check.IsNil)
- c.Check(cache.Get("file3.mk", 0), check.NotNil)
+ t.CheckNotNil(cache.Get("Makefile", 0))
+ t.CheckNil(cache.Get("file1.mk", 0))
+ t.CheckNil(cache.Get("file2.mk", 0))
+ t.CheckNotNil(cache.Get("file3.mk", 0))
cache.Evict("Makefile")
- c.Check(cache.Get("Makefile", 0), check.IsNil)
- c.Check(cache.table, check.HasLen, 1)
- c.Check(cache.mapping, check.HasLen, 1)
+ t.CheckNil(cache.Get("Makefile", 0))
+ t.CheckLen(cache.table, 1)
+ t.CheckLen(cache.mapping, 1)
t.CheckEquals(cache.hits, 7)
t.CheckEquals(cache.misses, 5)
@@ -692,9 +692,9 @@ func (s *Suite) Test_FileCache_Evict__so
cache.Evict("filename5.mk")
- t.Check(cache.table, check.HasLen, 9)
- t.Check(cache.Get("filename5.mk", 0), check.IsNil)
- t.Check(cache.Get("filename6.mk", 0), check.NotNil)
+ t.CheckLen(cache.table, 9)
+ t.CheckNil(cache.Get("filename5.mk", 0))
+ t.CheckNotNil(cache.Get("filename6.mk", 0))
}
func (s *Suite) Test_bmakeHelp(c *check.C) {
@@ -918,7 +918,7 @@ func (s *Suite) Test_LazyStringBuilder_W
sb.WriteByte('d')
t.CheckEquals(sb.String(), "word")
- c.Check(sb.buf, check.IsNil)
+ t.CheckNil(sb.buf)
}
func (s *Suite) Test_LazyStringBuilder_WriteByte__longer_than_expected(c *check.C) {
@@ -943,13 +943,13 @@ func (s *Suite) Test_LazyStringBuilder_W
sb.WriteByte('o')
t.CheckEquals(sb.String(), "wo")
- c.Check(sb.buf, check.IsNil)
+ t.CheckNil(sb.buf)
sb.WriteByte('r')
sb.WriteByte('d')
t.CheckEquals(sb.String(), "word")
- c.Check(sb.buf, check.IsNil)
+ t.CheckNil(sb.buf)
}
func (s *Suite) Test_LazyStringBuilder_WriteByte__other_than_expected(c *check.C) {
Index: pkgsrc/pkgtools/pkglint/files/var_test.go
diff -u pkgsrc/pkgtools/pkglint/files/var_test.go:1.8 pkgsrc/pkgtools/pkglint/files/var_test.go:1.9
--- pkgsrc/pkgtools/pkglint/files/var_test.go:1.8 Fri Jun 12 19:14:45 2020
+++ pkgsrc/pkgtools/pkglint/files/var_test.go Sat Jan 1 12:44:25 2022
@@ -8,7 +8,7 @@ func (s *Suite) Test_Var_ConditionalVars
v := NewVar("VARNAME")
t.CheckEquals(v.IsConditional(), false)
- t.Check(v.ConditionalVars(), check.IsNil)
+ t.CheckNil(v.ConditionalVars())
v.Write(t.NewMkLine("write.mk", 123, "VARNAME=\tconditional"), true, "OPSYS")
@@ -27,7 +27,7 @@ func (s *Suite) Test_Var_Refs(c *check.C
v := NewVar("VAR")
- t.Check(v.Refs(), check.IsNil)
+ t.CheckNil(v.Refs())
// The referenced variables are taken from the mkline.
// They don't need to be passed separately.
@@ -95,7 +95,7 @@ func (s *Suite) Test_Var_ConstantValue__
v := NewVar("VARNAME")
- t.Check(v.ConditionalVars(), check.IsNil)
+ t.CheckNil(v.ConditionalVars())
v.Write(t.NewMkLine("write.mk", 123, "VARNAME=\tconditional"), true, "OPSYS")
@@ -298,7 +298,7 @@ func (s *Suite) Test_Var_ReadLocations(c
v := NewVar("VAR")
- t.Check(v.ReadLocations(), check.IsNil)
+ t.CheckNil(v.ReadLocations())
mkline123 := t.NewMkLine("read.mk", 123, "OTHER=\t${VAR}")
v.Read(mkline123)
@@ -319,7 +319,7 @@ func (s *Suite) Test_Var_WriteLocations(
v := NewVar("VAR")
- t.Check(v.WriteLocations(), check.IsNil)
+ t.CheckNil(v.WriteLocations())
mkline123 := t.NewMkLine("write.mk", 123, "VAR=\tvalue")
v.Write(mkline123, false)
Index: pkgsrc/pkgtools/pkglint/files/varalignblock_test.go
diff -u pkgsrc/pkgtools/pkglint/files/varalignblock_test.go:1.17 pkgsrc/pkgtools/pkglint/files/varalignblock_test.go:1.18
--- pkgsrc/pkgtools/pkglint/files/varalignblock_test.go:1.17 Sat Mar 20 23:32:43 2021
+++ pkgsrc/pkgtools/pkglint/files/varalignblock_test.go Sat Jan 1 12:44:25 2022
@@ -3468,7 +3468,7 @@ func (s *Suite) Test_varalignMkLine_righ
block.Process(mkline)
})
- t.Check(block.mkinfos, check.HasLen, 1)
+ t.CheckLen(block.mkinfos, 1)
for _, mkinfo := range block.mkinfos {
actualCommon, actualMargin := mkinfo.rightMargin()
t.CheckDeepEquals(
Index: pkgsrc/pkgtools/pkglint/files/vardefs.go
diff -u pkgsrc/pkgtools/pkglint/files/vardefs.go:1.103 pkgsrc/pkgtools/pkglint/files/vardefs.go:1.104
--- pkgsrc/pkgtools/pkglint/files/vardefs.go:1.103 Sat Oct 9 08:33:09 2021
+++ pkgsrc/pkgtools/pkglint/files/vardefs.go Sat Jan 1 12:44:25 2022
@@ -1249,6 +1249,7 @@ func (reg *VarTypeRegistry) Init(src *Pk
reg.pkg("GNU_CONFIGURE_MANDIR", BtPathname)
reg.pkg("GNU_CONFIGURE_PREFIX", BtPathname)
reg.pkg("GOPATH", BtPathname)
+ reg.pkglist("GO_MODULE_FILES", BtGoModuleFile)
reg.pkgload("HAS_CONFIGURE", BtYes)
reg.pkglist("HEADER_TEMPLATES", BtPathname)
reg.pkg("HOMEPAGE", BtHomepage)
Index: pkgsrc/pkgtools/pkglint/files/vartype_test.go
diff -u pkgsrc/pkgtools/pkglint/files/vartype_test.go:1.27 pkgsrc/pkgtools/pkglint/files/vartype_test.go:1.28
--- pkgsrc/pkgtools/pkglint/files/vartype_test.go:1.27 Sun Jun 7 15:49:23 2020
+++ pkgsrc/pkgtools/pkglint/files/vartype_test.go Sat Jan 1 12:44:25 2022
@@ -54,14 +54,14 @@ func (s *Suite) Test_Vartype_EffectivePe
t.SetUpVartypes()
- if typ := G.Pkgsrc.vartypes.Canon("PREFIX"); c.Check(typ, check.NotNil) {
+ if typ := G.Pkgsrc.vartypes.Canon("PREFIX"); t.CheckNotNil(typ) {
t.CheckEquals(typ.basicType.name, "Pathname")
t.CheckDeepEquals(typ.aclEntries, []ACLEntry{NewACLEntry("*", aclpUse)})
t.CheckEquals(typ.EffectivePermissions("Makefile"), aclpUse)
t.CheckEquals(typ.EffectivePermissions("buildlink3.mk"), aclpUse)
}
- if typ := G.Pkgsrc.vartypes.Canon("EXTRACT_OPTS"); c.Check(typ, check.NotNil) {
+ if typ := G.Pkgsrc.vartypes.Canon("EXTRACT_OPTS"); t.CheckNotNil(typ) {
t.CheckEquals(typ.basicType.name, "ShellWord")
t.CheckEquals(typ.EffectivePermissions("Makefile"), aclpAllWrite|aclpUse)
t.CheckEquals(typ.EffectivePermissions("options.mk"), aclpAllWrite|aclpUse)
Index: pkgsrc/pkgtools/pkglint/files/vartypecheck.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.99 pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.100
--- pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.99 Sat Oct 9 08:33:09 2021
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck.go Sat Jan 1 12:44:25 2022
@@ -219,7 +219,7 @@ func (cv *VartypeCheck) CFlag() {
func (cv *VartypeCheck) Comment() {
value := cv.Value
- // See pkgtools/url2pkg/files/url2pkg.pl, keyword "COMMENT".
+ // See pkgtools/url2pkg/files/url2pkg.py, keyword 'COMMENT'.
if value == "TODO: Short description of the package" {
cv.Errorf("COMMENT must be set.")
}
@@ -703,6 +703,17 @@ func (cv *VartypeCheck) GitTag() {
}
}
+func (cv *VartypeCheck) GoModuleFile() {
+ tag := cv.ValueNoVar
+
+ valid := textproc.NewByteSet("!0-9@A-Za-z-+._/")
+ invalid := invalidCharacters(tag, valid)
+ if invalid != "" {
+ cv.Warnf("Invalid characters %q in Go modules filename.", invalid)
+ return
+ }
+}
+
func (cv *VartypeCheck) Homepage() {
cv.URL()
Index: pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.90 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.91
--- pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.90 Sat Oct 9 08:33:09 2021
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go Sat Jan 1 12:44:25 2022
@@ -1162,6 +1162,18 @@ func (s *Suite) Test_VartypeCheck_GitTag
"WARN: filename.mk:11: Invalid characters \": ;\" in Git tag.")
}
+func (s *Suite) Test_VartypeCheck_GoModuleFile(c *check.C) {
+ vt := NewVartypeCheckTester(s.Init(c), BtGoModuleFile)
+
+ vt.Varname("GO_MODULE_FILES")
+ vt.Values(
+ "github.com/!azure/azure-pipeline-go/@v/v0.1.8.mod",
+ "github.com/<org>/<proj>",
+ )
+ vt.Output(
+ "WARN: filename.mk:2: Invalid characters \"< > < >\" in Go modules filename.")
+}
+
func (s *Suite) Test_VartypeCheck_Homepage(c *check.C) {
t := s.Init(c)
vt := NewVartypeCheckTester(t, BtHomepage)
Home |
Main Index |
Thread Index |
Old Index