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

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /pkgsrc/pkgtools/pkglint/files/Attic/licenses_test.go between version 1.6 and 1.23

version 1.6, 2016/12/13 00:58:07 version 1.23, 2019/04/20 17:43:24
Line 1 
Line 1 
 package main  package pkglint
   
 import (  import (
         check "gopkg.in/check.v1"          "gopkg.in/check.v1"
 )  )
   
 func (s *Suite) Test_parseLicenses(c *check.C) {  func (s *Suite) Test_LicenseChecker_Check(c *check.C) {
         c.Check(parseLicenses("gnu-gpl-v2"), check.DeepEquals, &LicenseCondition{Name: "gnu-gpl-v2"})          t := s.Init(c)
         c.Check(parseLicenses("AND artistic"), check.IsNil)  
 }  
   
 func (s *Suite) Test_checklineLicense(c *check.C) {          t.CreateFileLines("licenses/gnu-gpl-v2",
         s.Init(c)                  "The licenses for most software are designed to take away ...")
         s.CreateTmpFile("licenses/gnu-gpl-v2", "Most software \u2026")          mkline := t.NewMkLine("Makefile", 7, "LICENSE=dummy")
         mkline := NewMkLine(NewLine("Makefile", 7, "LICENSE=dummy", nil))  
         G.globalData.Pkgsrcdir = s.tmpdir  
         G.CurrentDir = s.tmpdir  
   
         licenseChecker := &LicenseChecker{mkline}          licenseChecker := LicenseChecker{nil, mkline}
         licenseChecker.Check("gpl-v2", opAssign)          licenseChecker.Check("gpl-v2", opAssign)
   
         c.Check(s.Output(), equals, "WARN: Makefile:7: License file ~/licenses/gpl-v2 does not exist.\n")          t.CheckOutputLines(
                   "WARN: Makefile:7: License file ~/licenses/gpl-v2 does not exist.")
   
         licenseChecker.Check("no-profit shareware", opAssign)          licenseChecker.Check("no-profit shareware", opAssign)
   
         c.Check(s.Output(), equals, "ERROR: Makefile:7: Parse error for license condition \"no-profit shareware\".\n")          t.CheckOutputLines(
                   "ERROR: Makefile:7: Parse error for license condition \"no-profit shareware\".")
   
         licenseChecker.Check("no-profit AND shareware", opAssign)          licenseChecker.Check("no-profit AND shareware", opAssign)
   
         c.Check(s.Output(), equals, ""+          t.CheckOutputLines(
                 "WARN: Makefile:7: License file ~/licenses/no-profit does not exist.\n"+                  "WARN: Makefile:7: License file ~/licenses/no-profit does not exist.",
                 "ERROR: Makefile:7: License \"no-profit\" must not be used.\n"+                  "ERROR: Makefile:7: License \"no-profit\" must not be used.",
                 "WARN: Makefile:7: License file ~/licenses/shareware does not exist.\n"+                  "WARN: Makefile:7: License file ~/licenses/shareware does not exist.",
                 "ERROR: Makefile:7: License \"shareware\" must not be used.\n")                  "ERROR: Makefile:7: License \"shareware\" must not be used.")
   
         licenseChecker.Check("gnu-gpl-v2", opAssign)          licenseChecker.Check("gnu-gpl-v2", opAssign)
   
         c.Check(s.Output(), equals, "")          t.CheckOutputEmpty()
   
         licenseChecker.Check("gnu-gpl-v2 AND gnu-gpl-v2 OR gnu-gpl-v2", opAssign)          licenseChecker.Check("gnu-gpl-v2 AND gnu-gpl-v2 OR gnu-gpl-v2", opAssign)
   
         c.Check(s.Output(), equals, "ERROR: Makefile:7: AND and OR operators in license conditions can only be combined using parentheses.\n")          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)          licenseChecker.Check("(gnu-gpl-v2 OR gnu-gpl-v2) AND gnu-gpl-v2", opAssign)
   
         c.Check(s.Output(), equals, "")          t.CheckOutputEmpty()
   }
   
   func (s *Suite) Test_LicenseChecker_checkName__LICENSE_FILE(c *check.C) {
           t := s.Init(c)
   
           t.SetUpPkgsrc()
           t.SetUpPackage("category/package",
                   "LICENSE=\tmy-license",
                   "",
                   "LICENSE_FILE=\tmy-license")
           t.CreateFileLines("category/package/my-license",
                   "An individual license file.")
   
           t.Main(t.File("category/package"))
   
           // 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.
           t.CheckOutputLines(
                   "Looks fine.")
 }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.23

CVSweb <webmaster@jp.NetBSD.org>