Skip to content

Commit

Permalink
test: more comments in helpers.go (#366)
Browse files Browse the repository at this point in the history
I had left this commit with some additional comments out of #364 by
mistake.
  • Loading branch information
Daniel McCarney authored and zakird committed Jan 19, 2020
1 parent 2cce203 commit cc90ed6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ import (
// `testdata/` and not absolute file paths.
//
// Important: TestLint is only appropriate for unit tests. It will panic if the
// lintName is not known or if the testCertFilename can not be loaded.
// lintName is not known or if the testCertFilename can not be loaded, or if the
// lint result is nil.
func TestLint(lintName string, testCertFilename string) *lint.LintResult {
return TestLintCert(lintName, ReadTestCert(testCertFilename))
}

// TestLintCert executes a lint with the given name against an already parsed
// certificate. This is useful when a unit test reads a certificate from disk
// and then mutates it in some way before trying to lint it.
//
// Important: TestLintCert is only appropriate for unit tests. It will panic if
// the lintName is not known or if the lint result is nil.
func TestLintCert(lintName string, cert *x509.Certificate) *lint.LintResult {
// NOTE(@cpu): Once the `lint.Lints` is not exported this will have to be
// NOTE(@cpu): Once `lint.Lints` is not exported this will have to be
// changed, likely to use a function like `lint.LintByName`. For now use the
// exported map directly to consolidate access to this one function instead of
// many individual lint unit tests.
Expand Down

0 comments on commit cc90ed6

Please sign in to comment.