tools/go/analysis
Alan Donovan 71dfda0503 go/analysis/analysistest: support testing of facts
This change adds support for testing the facts produced by an Analyzer
using a similar mechanism to the way it checks for diagnostics.

A "// want ..." comment may now contain a mixture of expectations for
diagnostics and facts. Diagnostics are indicated by a string literal,
as before. Facts are indicated by name:"regexp" where name identifies
the object (declared on the same line) with which the fact is
associated.

  func neverReturns() { // want neverReturns:"noReturn"
       for {}
  }

Also:
- analysistest: report errors during package loading.
  (We don't yet have a way to test RunDespiteErrors Analyzers in the
  face of errors.)
- tests for Facts produced by findcall and pkgfacts.
  (Findcall now produces facts just for testing.)
- Add String method to various Fact types.
  Should the Fact interface have this method?

Change-Id: Ifa15fbd49d6ec3042b5fe9d3ebf22f4bdfdc8769
Reviewed-on: https://go-review.googlesource.com/139157
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-03 17:40:11 +00:00
..
analysistest go/analysis/analysistest: support testing of facts 2018-10-03 17:40:11 +00:00
cmd/analyze go/analysis/internal/checker: analysis driver based on go/packages 2018-09-26 01:25:07 +00:00
internal/checker go/analysis/analysistest: support testing of facts 2018-10-03 17:40:11 +00:00
multichecker go/analysis: add command-line help 2018-09-28 16:51:45 +00:00
passes go/analysis/analysistest: support testing of facts 2018-10-03 17:40:11 +00:00
singlechecker go/analysis: add command-line help 2018-09-28 16:51:45 +00:00
analysis.go go/analysis: add command-line help 2018-09-28 16:51:45 +00:00
validate.go go/analysis: revert UsesFacts to FactTypes 2018-09-27 16:40:32 +00:00