blob: 5ae52eb1fcdf77cf7bf02bda0877414d1bc2ee40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
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()
}
|