21
21
var _ = Suite(&S{})
24
// Bazaar can't hold subtle mode differences, so we enforce
25
// them here to run more interesting checks below.
30
{"hooks/install", 0751},
32
{"src/hello.c", 0614},
34
for _, m := range modes {
35
err := os.Chmod(filepath.Join(repoDir("dummy"), m.path), m.mode)
23
42
func checkDummy(c *C, f charm.Charm, path string) {
24
43
c.Assert(f.Revision(), Equals, 1)
25
44
c.Assert(f.Meta().Name, Equals, "dummy")
27
46
switch f := f.(type) {
28
47
case *charm.Bundle:
29
48
c.Assert(f.Path, Equals, path)
31
51
c.Assert(f.Path, Equals, path)
32
_, err := os.Stat(filepath.Join(path, "src", "hello.c"))
52
if path == repoDir("dummy") {
53
break // Don't test original Bazaar content.
56
info, err := os.Stat(filepath.Join(path, "src", "hello.c"))
58
c.Assert(info.Mode()&0777, Equals, os.FileMode(0644))
59
c.Assert(info.Mode()&os.ModeType, Equals, os.FileMode(0))
61
info, err = os.Stat(filepath.Join(path, "hooks", "install"))
63
c.Assert(info.Mode()&0777, Equals, os.FileMode(0755))
64
c.Assert(info.Mode()&os.ModeType, Equals, os.FileMode(0))
66
info, err = os.Stat(filepath.Join(path, "empty"))
68
c.Assert(info.Mode()&0777, Equals, os.FileMode(0755))
70
target, err := os.Readlink(filepath.Join(path, "hooks", "symlink"))
72
c.Assert(target, Equals, "../target")