[BACK]Return to licenses_test.go CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / pkgtools / pkglint / files

File: [cvs.NetBSD.org] / pkgsrc / pkgtools / pkglint / files / licenses_test.go (download)

Revision 1.26, Wed Nov 27 22:10:07 2019 UTC (4 months ago) by rillig
Branch: MAIN
Changes since 1.25: +16 -8 lines

pkgtools/pkglint: update to 19.3.11

Changes since 19.3.10:

The check for buildlink3.mk files that are included conditionally in one
place and unconditionally in another place have been refined. Now they
also work in cases that do not involve any variables, such as when the
condition is a mere exists(filename).

References to variables that use parentheses instead of the usual braces
produce a warning now, even if pkglint cannot fix them automatically.
This affects only a few instances where more than one such variable
reference appeared in a single line.

The --log-verbose command line option has been removed since it does not
have any practical use other than improving the performance during
pkglint development itself. Because of that it hadn't even been
mentioned in the manual page.

Warnings for missing license files now report the path to the license
file relative to the line where the warning occurs, like everywhere

package pkglint

import (

func (s *Suite) Test_LicenseChecker_Check(c *check.C) {
	t := s.Init(c)

		"The licenses for most software are designed to take away ...")

	test := func(licenseValue string, diagnostics ...string) {
		mklines := t.SetUpFileMkLines("Makefile",

		mklines.ForEach(func(mkline *MkLine) {
			(&LicenseChecker{mklines, mkline}).Check(mkline.Value(), opAssign)


		"WARN: ~/Makefile:1: License file licenses/gpl-v2 does not exist.")

	test("no-profit shareware",
		"ERROR: ~/Makefile:1: Parse error for license condition \"no-profit shareware\".")

	test("no-profit AND shareware",
		"WARN: ~/Makefile:1: License file licenses/no-profit does not exist.",
		"ERROR: ~/Makefile:1: License \"no-profit\" must not be used.",
		"WARN: ~/Makefile:1: License file licenses/shareware does not exist.",
		"ERROR: ~/Makefile:1: License \"shareware\" must not be used.")


	test("gnu-gpl-v2 AND gnu-gpl-v2 OR gnu-gpl-v2",
		"ERROR: ~/Makefile:1: AND and OR operators in license conditions "+
			"can only be combined using parentheses.")

	test("gnu-gpl-v2 AND (gnu-gpl-v2) OR gnu-gpl-v2",
		"ERROR: ~/Makefile:1: AND and OR operators in license conditions "+
			"can only be combined using parentheses.")

	test("(gnu-gpl-v2 OR gnu-gpl-v2) AND gnu-gpl-v2",

	test("gnu-gpl-v2 OR (gnu-gpl-v2 AND gnu-gpl-v2)",

func (s *Suite) Test_LicenseChecker_checkName__LICENSE_FILE(c *check.C) {
	t := s.Init(c)

		"An individual license file.")


	// There is no warning about the unusual file name in the package directory.
	// If it were not mentioned in LICENSE_FILE, the file named my-license
	// would be warned about.
		"Looks fine.")