rules

package
v0.0.0-...-46d7da7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoGoroutine

type NoGoroutine struct{}

NoGoroutine requires that go f(x, y, z) is not allowed.

func NewNoGoroutine

func NewNoGoroutine() *NoGoroutine

NewNoGoroutine creates and returns a NoGoroutine object.

func (*NoGoroutine) Check

func (lr *NoGoroutine) Check(aNode ast.Node, fs *token.FileSet, lrp *checker.Report)

Check verifies if aNode is not goroutine. If verification fails lrp creates new report.

func (*NoGoroutine) GetID

func (lr *NoGoroutine) GetID() string

GetID returns no_goroutine_rule.

type NoShort

type NoShort struct{}

NoShort requires that testing.Short() is not allowed.

func NewNoShort

func NewNoShort() *NoShort

NewNoShort creates and returns a NoShort object.

func (*NoShort) Check

func (lr *NoShort) Check(aNode ast.Node, fs *token.FileSet, lrp *checker.Report)

Check verifies if aNode is not testing.Short(). If verification lrp creates new report.

func (*NoShort) GetID

func (lr *NoShort) GetID() string

GetID returns no_short_rule.

type NoSleep

type NoSleep struct{}

NoSleep requires that time.Sleep() is not allowed.

func NewNoSleep

func NewNoSleep() *NoSleep

NewNoSleep creates and returns a NoSleep object.

func (*NoSleep) Check

func (lr *NoSleep) Check(aNode ast.Node, fs *token.FileSet, lrp *checker.Report)

Check verifies if aNode is not time.Sleep. If verification fails lrp creates a new report.

func (*NoSleep) GetID

func (lr *NoSleep) GetID() string

GetID returns no_sleep_rule.

type ShortSkip

type ShortSkip struct{}

ShortSkip requires that a test function should have one of these pattern. Pattern 1

func TestA(t *testing.T) {
  if !testing.Short() {
   ...
  }
}

Pattern 2

func TestB(t *testing.T) {
  if testing.Short() {
    t.Skip("xxx")
  }
  ...
}

func NewSkipByShort

func NewSkipByShort() *ShortSkip

NewSkipByShort creates and returns a ShortSkip object.

func (*ShortSkip) Check

func (lr *ShortSkip) Check(aNode ast.Node, fs *token.FileSet, lrp *checker.Report)

Check verifies if aNode is a valid t.Skip(). If verification fails lrp creates a new report. There are two examples for valid t.Skip(). case 1:

func Testxxx(t *testing.T) {
	if !testing.Short() {
	...
	}
}

case 2:

func Testxxx(t *testing.T) {
	if testing.Short() {
		t.Skip("xxx")
	}
	...
}

func (*ShortSkip) GetID

func (lr *ShortSkip) GetID() string

GetID returns skip_by_short_rule.

type SkipIssue

type SkipIssue struct {
	// contains filtered or unexported fields
}

SkipIssue requires that a `t.Skip()` call in test function should contain url to a issue. This helps to keep tracking of the issue that causes a test to be skipped. For example, this is a valid call, t.Skip("https://github.com/istio/istio/issues/6012") t.SkipNow() and t.Skipf() are not allowed.

func NewSkipByIssue

func NewSkipByIssue() *SkipIssue

NewSkipByIssue creates and returns a SkipIssue object.

func (*SkipIssue) Check

func (lr *SkipIssue) Check(aNode ast.Node, fs *token.FileSet, lrp *checker.Report)

Check returns verifies if aNode is a valid t.Skip(), or aNode is not t.Skip(), t.SkipNow(), and t.Skipf(). If verification fails lrp creates a new report. This is an example for valid call t.Skip("https://github.com/istio/istio/issues/6012") These calls are not valid: t.Skip("https://istio.io/"), t.SkipNow(), t.Skipf("https://istio.io/%d", x).

func (*SkipIssue) GetID

func (lr *SkipIssue) GetID() string

GetID returns skip_by_issue_rule.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL