summaryrefslogtreecommitdiff
path: root/pkgtools/pkglint/files/pkglint_test.go
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2016-01-24 02:03:28 +0000
committerrillig <rillig@pkgsrc.org>2016-01-24 02:03:28 +0000
commit0266c6a3eb8f13ec76f8898b54fbbb07d29a3765 (patch)
treee8b82cbcfa5652b0a34e58c6360d6b08a81dc2f2 /pkgtools/pkglint/files/pkglint_test.go
parent76261a694b8285a897a28fe10960b0e43c0f1aa3 (diff)
downloadpkgsrc-0266c6a3eb8f13ec76f8898b54fbbb07d29a3765.tar.gz
Updated pkglint to 5.3.2
Changes since 5.3.1: Alignment of variable values is no longer checked by single line, but by the complete block (e.g. SUBST_*). Pkglint now checks that all variables belonging to a block are indented consistently, so that their values are aligned nicely. Since pkglint does not report warnings, but only notes, and since it can fix them automatically, the burden on the package developers will be very low. Especially, since these notes are only printed when pkglint is called with the -Wspace or -Wall options. Also, pkglint supports running its unit tests now.
Diffstat (limited to 'pkgtools/pkglint/files/pkglint_test.go')
-rw-r--r--pkgtools/pkglint/files/pkglint_test.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/pkgtools/pkglint/files/pkglint_test.go b/pkgtools/pkglint/files/pkglint_test.go
index 675b4e49666..8df1aa903cd 100644
--- a/pkgtools/pkglint/files/pkglint_test.go
+++ b/pkgtools/pkglint/files/pkglint_test.go
@@ -85,34 +85,34 @@ func (s *Suite) TestChecklineRcsid(c *check.C) {
}
func (s *Suite) TestMatchVarassign(c *check.C) {
- checkVarassign := func(text string, ck check.Checker, varname, op, value, comment string) {
+ checkVarassign := func(text string, ck check.Checker, varname, op, align, value, comment string) {
type va struct {
- varname, op, value, comment string
+ varname, op, align, value, comment string
}
- expected := va{varname, op, value, comment}
- am, avarname, aop, avalue, acomment := MatchVarassign(text)
+ expected := va{varname, op, align, value, comment}
+ am, avarname, aop, aalign, avalue, acomment := MatchVarassign(text)
if !am {
c.Errorf("Text %q doesn’t match variable assignment", text)
return
}
- actual := va{avarname, aop, avalue, acomment}
+ actual := va{avarname, aop, aalign, avalue, acomment}
c.Check(actual, ck, expected)
}
checkNotVarassign := func(text string) {
- m, _, _, _, _ := MatchVarassign(text)
+ m, _, _, _, _, _ := MatchVarassign(text)
if m {
c.Errorf("Text %q matches variable assignment, but shouldn’t.", text)
}
}
- checkVarassign("C++=c11", equals, "C+", "+=", "c11", "")
- checkVarassign("V=v", equals, "V", "=", "v", "")
- checkVarassign("VAR=#comment", equals, "VAR", "=", "", "#comment")
- checkVarassign("VAR=\\#comment", equals, "VAR", "=", "#comment", "")
- checkVarassign("VAR=\\\\\\##comment", equals, "VAR", "=", "\\\\#", "#comment")
- checkVarassign("VAR=\\", equals, "VAR", "=", "\\", "")
- checkVarassign("VAR += value", equals, "VAR", "+=", "value", "")
- checkVarassign(" VAR=value", equals, "VAR", "=", "value", "")
+ checkVarassign("C++=c11", equals, "C+", "+=", "C++=", "c11", "")
+ checkVarassign("V=v", equals, "V", "=", "V=", "v", "")
+ checkVarassign("VAR=#comment", equals, "VAR", "=", "VAR=", "", "#comment")
+ checkVarassign("VAR=\\#comment", equals, "VAR", "=", "VAR=", "#comment", "")
+ checkVarassign("VAR=\\\\\\##comment", equals, "VAR", "=", "VAR=", "\\\\#", "#comment")
+ checkVarassign("VAR=\\", equals, "VAR", "=", "VAR=", "\\", "")
+ checkVarassign("VAR += value", equals, "VAR", "+=", "VAR += ", "value", "")
+ checkVarassign(" VAR=value", equals, "VAR", "=", " VAR=", "value", "")
checkNotVarassign("\tVAR=value")
checkNotVarassign("?=value")
checkNotVarassign("<=value")