Skip to content

Commit

Permalink
ruleguard: add TODO error test for local funcs (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
quasilyte committed Nov 7, 2021
1 parent e090d72 commit 3fd1468
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ruleguard/ruleguard_error_test.go
Expand Up @@ -282,6 +282,18 @@ func TestParseRuleError(t *testing.T) {
`f := func(x int) bool { return x == 0 }; m.Match("($x)").Where(f(1+1)).Report("")`,
`\Qunsupported/too complex x argument`,
},

// TODO: error line should be associated with `f` function,
// not with Where() location where it's inlined.
{
`
f := func(v dsl.Var) bool { return v.Object.Is("abc") }
m.Match("($x)").
Where(f(m["x"])).
Report("")
`,
`\Qrules.go:8: abc is not a valid go/types object name`,
},
}

for _, test := range tests {
Expand Down

0 comments on commit 3fd1468

Please sign in to comment.