Exemplo n.º 1
0
func (s *BuildTestSuite) TestExcludeDynamicWeirdRegexps(c *C) {
	basedir := c.MkDir()
	c.Assert(ioutil.WriteFile(filepath.Join(basedir, ".snapignore"), []byte("*hello\n"), 0644), IsNil)
	// note "*hello" is not a valid regexp, so will be taken literally (not globbed!)
	c.Check(snaptest.ShouldExcludeDynamic(basedir, "ahello"), Equals, false)
	c.Check(snaptest.ShouldExcludeDynamic(basedir, "*hello"), Equals, true)
}
Exemplo n.º 2
0
func (s *BuildTestSuite) TestExcludeDynamicWorksIfSnapignore(c *C) {
	basedir := c.MkDir()
	c.Assert(ioutil.WriteFile(filepath.Join(basedir, ".snapignore"), []byte("foo\nb.r\n"), 0644), IsNil)
	c.Check(snaptest.ShouldExcludeDynamic(basedir, "foo"), Equals, true)
	c.Check(snaptest.ShouldExcludeDynamic(basedir, "bar"), Equals, true)
	c.Check(snaptest.ShouldExcludeDynamic(basedir, "bzr"), Equals, true)
	c.Check(snaptest.ShouldExcludeDynamic(basedir, "baz"), Equals, false)
}
Exemplo n.º 3
0
func (s *BuildTestSuite) TestExcludeDynamicFalseIfNoSnapignore(c *C) {
	basedir := c.MkDir()
	c.Check(snaptest.ShouldExcludeDynamic(basedir, "foo"), Equals, false)
}