Using analysistest "want" with other comments

33 views
Skip to first unread message

Miki Tebeka

unread,
Nov 26, 2020, 1:31:45 PM11/26/20
to golang-nuts
Hi,

I wrote a tool  for validating regular expressions using golang.org/x/tools/go/analysis and want to test it using golang.org/x/tools/go/analysis/analysistest.

The problem is that the tool is using comments to indicates line to check, which doesn't work well with the "// want" comments used by analysistest.

You can see the tool at https://github.com/tebeka/recheck

The closest I got was using comments like:

    handleFunc(handler, "/users/{id:[0-9+}") // recheck:1 // want `missing closing ] in "[0-9+}\""`

But this now fails with 
    in 'want' comment: error parsing regexp: missing closing ]: `[a-zA-Z\""`

Any ideas how can I make this work?

Thanks,
Miki
Reply all
Reply to author
Forward
0 new messages