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
|
package main
import (
check "gopkg.in/check.v1"
)
func (s *Suite) TestCheckDirent_outside(c *check.C) {
s.CreateTmpFile(c, "empty", "")
CheckDirent(s.tmpdir)
c.Check(s.OutputCleanTmpdir(), equals, "ERROR: ~: Cannot determine the pkgsrc root directory for \"~\".\n")
}
func (s *Suite) TestCheckDirent(c *check.C) {
s.CreateTmpFile(c, "mk/bsd.pkg.mk", "")
s.CreateTmpFile(c, "category/package/Makefile", "")
s.CreateTmpFile(c, "category/Makefile", "")
s.CreateTmpFile(c, "Makefile", "")
G.globalData.Pkgsrcdir = s.tmpdir
CheckDirent(s.tmpdir)
c.Check(s.OutputCleanTmpdir(), equals, "ERROR: ~/Makefile: Must not be empty.\n")
CheckDirent(s.tmpdir + "/category")
c.Check(s.OutputCleanTmpdir(), equals, "ERROR: ~/category/Makefile: Must not be empty.\n")
CheckDirent(s.tmpdir + "/category/package")
c.Check(s.OutputCleanTmpdir(), equals, "ERROR: ~/category/package/Makefile: Must not be empty.\n")
CheckDirent(s.tmpdir + "/category/package/nonexistent")
c.Check(s.OutputCleanTmpdir(), equals, "ERROR: ~/category/package/nonexistent: No such file or directory.\n")
}
|