summaryrefslogtreecommitdiff
path: root/pkgtools/pkglint/files/toplevel_test.go
blob: d77eaeeb370439a1108e4ceb58a12beb67187e21 (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
package main

import "gopkg.in/check.v1"

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

	t.SetupFileLines("Makefile",
		MkRcsID,
		"",
		"SUBDIR+= x11",
		"SUBDIR+=\tarchivers",
		"SUBDIR+=\tccc",
		"SUBDIR+=\tccc",
		"#SUBDIR+=\tignoreme",
		"SUBDIR+=\tnonexisting", // This doesn't happen in practice, therefore no warning.
		"SUBDIR+=\tbbb")
	t.SetupFileLines("archivers/Makefile")
	t.SetupFileLines("bbb/Makefile")
	t.SetupFileLines("ccc/Makefile")
	t.SetupFileLines("x11/Makefile")
	G.globalData.InitVartypes()

	G.CurrentDir = t.TmpDir()
	CheckdirToplevel()

	t.CheckOutputLines(
		"WARN: ~/Makefile:3: Indentation should be a single tab character.",
		"ERROR: ~/Makefile:6: Each subdir must only appear once.",
		"WARN: ~/Makefile:7: \"ignoreme\" commented out without giving a reason.",
		"WARN: ~/Makefile:9: bbb should come before ccc")
}