[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.11, Sat Mar 24 14:32:49 2018 UTC (2 years ago) by rillig
Branch: MAIN
CVS Tags: pkgsrc-2018Q1-base, pkgsrc-2018Q1
Changes since 1.10: +0 -1 lines

Update pkglint to 5.5.7

Changes since 5.5.6:

* When pkglint warns about files that are accidentally executable, it
  offers to fix the file permissions.

* Warn about ${HOMEPAGE:=repository/}, since the := modifier should
  only be used with MASTER_SITES.

* When the distinfo file is missing, suggest setting NO_CHECKSUM.

* Several refactorings.

package main

import (
	check "gopkg.in/check.v1"
)

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

	t.SetupFileLines("licenses/gnu-gpl-v2",
		"Most software \u2026")
	mkline := t.NewMkLine("Makefile", 7, "LICENSE=dummy")
	G.CurrentDir = t.TmpDir()

	licenseChecker := &LicenseChecker{mkline}
	licenseChecker.Check("gpl-v2", opAssign)

	t.CheckOutputLines(
		"WARN: Makefile:7: License file ~/licenses/gpl-v2 does not exist.")

	licenseChecker.Check("no-profit shareware", opAssign)

	t.CheckOutputLines(
		"ERROR: Makefile:7: Parse error for license condition \"no-profit shareware\".")

	licenseChecker.Check("no-profit AND shareware", opAssign)

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

	licenseChecker.Check("gnu-gpl-v2", opAssign)

	t.CheckOutputEmpty()

	licenseChecker.Check("gnu-gpl-v2 AND gnu-gpl-v2 OR gnu-gpl-v2", opAssign)

	t.CheckOutputLines(
		"ERROR: Makefile:7: AND and OR operators in license conditions can only be combined using parentheses.")

	licenseChecker.Check("(gnu-gpl-v2 OR gnu-gpl-v2) AND gnu-gpl-v2", opAssign)

	t.CheckOutputEmpty()
}