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) }
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) }
func (s *BuildTestSuite) TestExcludeDynamicFalseIfNoSnapignore(c *C) { basedir := c.MkDir() c.Check(snaptest.ShouldExcludeDynamic(basedir, "foo"), Equals, false) }