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

Annotation of pkgsrc/pkgtools/pkglint/files/licenses_test.go, Revision 1.11

1.1       rillig      1: package main
                      2:
                      3: import (
                      4:        check "gopkg.in/check.v1"
                      5: )
                      6:
1.4       rillig      7: func (s *Suite) Test_checklineLicense(c *check.C) {
1.10      rillig      8:        t := s.Init(c)
                      9:
                     10:        t.SetupFileLines("licenses/gnu-gpl-v2",
                     11:                "Most software \u2026")
                     12:        mkline := t.NewMkLine("Makefile", 7, "LICENSE=dummy")
                     13:        G.CurrentDir = t.TmpDir()
1.2       rillig     14:
1.5       rillig     15:        licenseChecker := &LicenseChecker{mkline}
                     16:        licenseChecker.Check("gpl-v2", opAssign)
1.2       rillig     17:
1.10      rillig     18:        t.CheckOutputLines(
1.8       rillig     19:                "WARN: Makefile:7: License file ~/licenses/gpl-v2 does not exist.")
1.2       rillig     20:
1.5       rillig     21:        licenseChecker.Check("no-profit shareware", opAssign)
                     22:
1.10      rillig     23:        t.CheckOutputLines(
1.8       rillig     24:                "ERROR: Makefile:7: Parse error for license condition \"no-profit shareware\".")
1.5       rillig     25:
                     26:        licenseChecker.Check("no-profit AND shareware", opAssign)
1.2       rillig     27:
1.10      rillig     28:        t.CheckOutputLines(
1.8       rillig     29:                "WARN: Makefile:7: License file ~/licenses/no-profit does not exist.",
                     30:                "ERROR: Makefile:7: License \"no-profit\" must not be used.",
                     31:                "WARN: Makefile:7: License file ~/licenses/shareware does not exist.",
                     32:                "ERROR: Makefile:7: License \"shareware\" must not be used.")
1.5       rillig     33:
                     34:        licenseChecker.Check("gnu-gpl-v2", opAssign)
                     35:
1.10      rillig     36:        t.CheckOutputEmpty()
1.5       rillig     37:
                     38:        licenseChecker.Check("gnu-gpl-v2 AND gnu-gpl-v2 OR gnu-gpl-v2", opAssign)
                     39:
1.10      rillig     40:        t.CheckOutputLines(
1.8       rillig     41:                "ERROR: Makefile:7: AND and OR operators in license conditions can only be combined using parentheses.")
1.2       rillig     42:
1.5       rillig     43:        licenseChecker.Check("(gnu-gpl-v2 OR gnu-gpl-v2) AND gnu-gpl-v2", opAssign)
1.2       rillig     44:
1.10      rillig     45:        t.CheckOutputEmpty()
1.2       rillig     46: }

CVSweb <webmaster@jp.NetBSD.org>