[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.7

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.6       rillig      8:        s.Init(c)
                      9:        s.CreateTmpFile("licenses/gnu-gpl-v2", "Most software \u2026")
1.2       rillig     10:        mkline := NewMkLine(NewLine("Makefile", 7, "LICENSE=dummy", nil))
                     11:        G.globalData.Pkgsrcdir = s.tmpdir
                     12:        G.CurrentDir = s.tmpdir
                     13:
1.5       rillig     14:        licenseChecker := &LicenseChecker{mkline}
                     15:        licenseChecker.Check("gpl-v2", opAssign)
1.2       rillig     16:
1.3       rillig     17:        c.Check(s.Output(), equals, "WARN: Makefile:7: License file ~/licenses/gpl-v2 does not exist.\n")
1.2       rillig     18:
1.5       rillig     19:        licenseChecker.Check("no-profit shareware", opAssign)
                     20:
                     21:        c.Check(s.Output(), equals, "ERROR: Makefile:7: Parse error for license condition \"no-profit shareware\".\n")
                     22:
                     23:        licenseChecker.Check("no-profit AND shareware", opAssign)
1.2       rillig     24:
1.3       rillig     25:        c.Check(s.Output(), equals, ""+
1.2       rillig     26:                "WARN: Makefile:7: License file ~/licenses/no-profit does not exist.\n"+
1.5       rillig     27:                "ERROR: Makefile:7: License \"no-profit\" must not be used.\n"+
1.2       rillig     28:                "WARN: Makefile:7: License file ~/licenses/shareware does not exist.\n"+
1.5       rillig     29:                "ERROR: Makefile:7: License \"shareware\" must not be used.\n")
                     30:
                     31:        licenseChecker.Check("gnu-gpl-v2", opAssign)
                     32:
                     33:        c.Check(s.Output(), equals, "")
                     34:
                     35:        licenseChecker.Check("gnu-gpl-v2 AND gnu-gpl-v2 OR gnu-gpl-v2", opAssign)
                     36:
                     37:        c.Check(s.Output(), equals, "ERROR: Makefile:7: AND and OR operators in license conditions can only be combined using parentheses.\n")
1.2       rillig     38:
1.5       rillig     39:        licenseChecker.Check("(gnu-gpl-v2 OR gnu-gpl-v2) AND gnu-gpl-v2", opAssign)
1.2       rillig     40:
                     41:        c.Check(s.Output(), equals, "")
                     42: }

CVSweb <webmaster@jp.NetBSD.org>