version 1.15, 2018/09/05 17:56:22 |
version 1.18, 2018/12/02 01:57:48 |
|
|
"gopkg.in/check.v1" |
"gopkg.in/check.v1" |
) |
) |
|
|
func (s *Suite) Test_checklineLicense(c *check.C) { |
func (s *Suite) Test_LicenseChecker_Check(c *check.C) { |
t := s.Init(c) |
t := s.Init(c) |
|
|
t.SetupFileLines("licenses/gnu-gpl-v2", |
t.CreateFileLines("licenses/gnu-gpl-v2", |
"Most software \u2026") |
"The licenses for most software are designed to take away ...") |
mkline := t.NewMkLine("Makefile", 7, "LICENSE=dummy") |
mkline := t.NewMkLine("Makefile", 7, "LICENSE=dummy") |
|
|
licenseChecker := &LicenseChecker{mkline} |
licenseChecker := LicenseChecker{mkline} |
licenseChecker.Check("gpl-v2", opAssign) |
licenseChecker.Check("gpl-v2", opAssign) |
|
|
t.CheckOutputLines( |
t.CheckOutputLines( |
Line 44 func (s *Suite) Test_checklineLicense(c |
|
Line 44 func (s *Suite) Test_checklineLicense(c |
|
t.CheckOutputEmpty() |
t.CheckOutputEmpty() |
} |
} |
|
|
func (s *Suite) Test_checkToplevelUnusedLicenses(c *check.C) { |
func (s *Suite) Test_LicenseChecker_checkName__LICENSE_FILE(c *check.C) { |
t := s.Init(c) |
t := s.Init(c) |
|
|
t.SetupPkgsrc() |
t.SetupPkgsrc() |
t.SetupFileLines("mk/misc/category.mk") |
t.SetupPackage("category/package", |
t.SetupFileLines("licenses/2-clause-bsd") |
"LICENSE=\tmy-license", |
t.SetupFileLines("licenses/gnu-gpl-v3") |
|
|
|
t.SetupFileLines("Makefile", |
|
MkRcsID, |
|
"SUBDIR+=\tcategory") |
|
|
|
t.SetupFileLines("category/Makefile", |
|
MkRcsID, |
|
"COMMENT=\tExample category", |
|
"", |
"", |
"SUBDIR+=\tpackage", |
"LICENSE_FILE=\tmy-license") |
"", |
t.CreateFileLines("category/package/my-license", |
".include \"../mk/misc/category.mk\"") |
|
|
|
t.SetupFileLines("category/package/Makefile", |
|
MkRcsID, |
|
"CATEGORIES=\tcategory", |
|
"", |
|
"COMMENT=Example package", |
|
"LICENSE=\t2-clause-bsd", |
|
"NO_CHECKSUM=\tyes") |
|
t.SetupFileLines("category/package/PLIST", |
|
PlistRcsID, |
|
"bin/program") |
|
|
|
G.Main("pkglint", "-r", "-Cglobal", t.File(".")) |
|
|
|
t.CheckOutputLines( |
|
"WARN: ~/licenses/gnu-gpl-v2: This license seems to be unused.", // Added by Tester.SetupPkgsrc |
|
"WARN: ~/licenses/gnu-gpl-v3: This license seems to be unused.", |
|
"0 errors and 2 warnings found.") |
|
} |
|
|
|
func (s *Suite) Test_LicenseChecker_checkLicenseName__LICENSE_FILE(c *check.C) { |
|
t := s.Init(c) |
|
|
|
t.SetupPkgsrc() |
|
t.SetupCommandLine("-Wno-space") |
|
t.SetupFileLines("category/package/DESCR", |
|
"Package description") |
|
t.SetupFileMkLines("category/package/Makefile", |
|
MkRcsID, |
|
"", |
|
"CATEGORIES= chinese", |
|
"", |
|
"COMMENT= Useful tools", |
|
"LICENSE= my-license", |
|
"", |
|
"LICENSE_FILE= my-license", |
|
"NO_CHECKSUM= yes", |
|
"", |
|
".include \"../../mk/bsd.pkg.mk\"") |
|
t.SetupFileLines("category/package/PLIST", |
|
PlistRcsID, |
|
"bin/program") |
|
t.SetupFileLines("category/package/my-license", |
|
"An individual license file.") |
"An individual license file.") |
|
|
G.Main("pkglint", t.File("category/package")) |
G.Main("pkglint", t.File("category/package")) |
Line 113 func (s *Suite) Test_LicenseChecker_chec |
|
Line 60 func (s *Suite) Test_LicenseChecker_chec |
|
// FIXME: It should be allowed to place a license file directly into |
// FIXME: It should be allowed to place a license file directly into |
// the package directory. |
// the package directory. |
t.CheckOutputLines( |
t.CheckOutputLines( |
"WARN: ~/category/package/my-license: Unexpected file found.", "0 errors and 1 warning found.") |
"WARN: ~/category/package/my-license: Unexpected file found.", |
|
"0 errors and 1 warning found.") |
} |
} |