pkgsrc-ng/pkgtools/pkglint/files/category_test.go
2016-11-18 22:39:22 +01:00

54 lines
2.1 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
check "gopkg.in/check.v1"
)
func (s *Suite) Test_CheckdirCategory_totally_broken(c *check.C) {
G.globalData.InitVartypes()
s.CreateTmpFile(c, "archivers/Makefile", ""+
"# $\n"+
"SUBDIR+=pkg1\n"+
"SUBDIR+=\u0020aaaaa\n"+
"SUBDIR-=unknown #doesnt work\n"+
"\n"+
".include \"../mk/category.mk\"\n")
G.CurrentDir = s.tmpdir + "/archivers"
CheckdirCategory()
c.Check(s.Output(), equals, ""+
"ERROR: ~/archivers/Makefile:1: Expected \"# $"+"NetBSD$\".\n"+
"WARN: ~/archivers/Makefile:4: Line contains invalid characters (U+2019).\n"+
"WARN: ~/archivers/Makefile:4: SUBDIR- is defined but not used. Spelling mistake?\n"+
"ERROR: ~/archivers/Makefile:6: \"../mk/category.mk\" does not exist.\n"+
"ERROR: ~/archivers/Makefile:2: COMMENT= line expected.\n"+
"WARN: ~/archivers/Makefile:2: Indentation should be a single tab character.\n"+
"WARN: ~/archivers/Makefile:3: Indentation should be a single tab character.\n"+
"WARN: ~/archivers/Makefile:3: \"aaaaa\" should come before \"pkg1\".\n"+
"ERROR: ~/archivers/Makefile:4: SUBDIR+= line or empty line expected.\n"+
"ERROR: ~/archivers/Makefile:2: \"pkg1\" exists in the Makefile, but not in the file system.\n"+
"ERROR: ~/archivers/Makefile:3: \"aaaaa\" exists in the Makefile, but not in the file system.\n"+
"WARN: ~/archivers/Makefile:4: This line should contain the following text: .include \"../mk/misc/category.mk\"\n"+
"ERROR: ~/archivers/Makefile:4: The file should end here.\n")
}
func (s *Suite) Test_CheckdirCategory_invalid_comment(c *check.C) {
G.globalData.InitVartypes()
s.CreateTmpFile(c, "archivers/Makefile", ""+
"# $"+"NetBSD$\n"+
"COMMENT=\t\\Make $$$$ fast\"\n"+
"\n"+
"SUBDIR+=\tpackage\n"+
"\n"+
".include \"../mk/misc/category.mk\"\n")
s.CreateTmpFile(c, "archivers/package/Makefile", "# dummy\n")
s.CreateTmpFile(c, "mk/misc/category.mk", "# dummy\n")
G.CurrentDir = s.tmpdir + "/archivers"
G.CurPkgsrcdir = ".."
CheckdirCategory()
c.Check(s.Output(), equals, "WARN: ~/archivers/Makefile:2: COMMENT contains invalid characters (U+005C U+0024 U+0024 U+0024 U+0024 U+0022).\n")
}