Skip to content

Commit

Permalink
Remove check for deprecated variables outside pkgsrc
Browse files Browse the repository at this point in the history
  • Loading branch information
rillig committed Dec 22, 2024
1 parent cb2d4e5 commit 64b2d26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
12 changes: 3 additions & 9 deletions v23/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,17 @@ type Project interface {
}

type NetBSDProject struct {
deprecated map[string]string
types VarTypeRegistry
types VarTypeRegistry
}

func NewNetBSDProject() *NetBSDProject {
return &NetBSDProject{
map[string]string{},
NewVarTypeRegistry(),
}
}

func (p NetBSDProject) Deprecated(varname string) string {
deprecated := p.deprecated
if instead := deprecated[varname]; instead != "" {
return instead
}
return deprecated[varnameCanon(varname)]
func (p NetBSDProject) Deprecated(string) string {
return ""
}

func (p NetBSDProject) Types() *VarTypeRegistry {
Expand Down
12 changes: 4 additions & 8 deletions v23/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,21 @@ func (s *Suite) Test_NewNetBSDProject(c *check.C) {

project := NewNetBSDProject()

t.CheckNotNil(project.deprecated)
t.CheckEquals(0, len(project.deprecated))
t.CheckEquals(project.Types().IsDefinedCanon("PKGNAME"), false)
}

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

project := NewNetBSDProject()
project.deprecated["DEPRECATED"] = "Use NEW_AND_SHINY instead."
G.Project = project
G.Pkgsrc = nil
G.Project = NewNetBSDProject()
mklines := t.NewMkLines("filename.mk",
MkCvsID,
"DEPRECATED=\t${DEPRECATED}")

mklines.Check()

t.CheckOutputLines(
"WARN: filename.mk:2: Definition of DEPRECATED is deprecated. Use NEW_AND_SHINY instead.",
"WARN: filename.mk:2: Use of \"DEPRECATED\" is deprecated. Use NEW_AND_SHINY instead.")
t.CheckOutputEmpty()
}

func (s *Suite) Test_NetBSDProject_Types(c *check.C) {
Expand Down

0 comments on commit 64b2d26

Please sign in to comment.