gau

package module
v0.0.0-...-6310ca4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 2 Imported by: 0

README

gau

Golang ArchUnit (gau) Test Framework enables you to test your application's architecture using Go's build-in unit-testing capabilities.

An example rule could look like this:

func TestSimple(t *testing.T) {
	Packages(t, "github.com/datosh/gau/tests/...").That().
		ResideIn("github.com/datosh/gau/tests/dependona").
		Should().DirectlyDependOn("github.com/datosh/gau/tests/a")
}

Credit

Ideas

  • Support checking of not using specific functions / classes of packages, e.g., "do not use fmt.Prinln", but some logging library instead.

Open Problems

  • Is Method Chaining really the best way for golang? How do we communicate errors? Fail on last call? Return nil?

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Packages

func Packages(t *testing.T, pkgs ...string) *gau

Types

type PkgGraph

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

func NewPkgGraph

func NewPkgGraph() *PkgGraph

func (*PkgGraph) AddNode

func (p *PkgGraph) AddNode(pkgPath string)

func (*PkgGraph) GetNode

func (p *PkgGraph) GetNode(pkgPath string) *PkgNode

func (*PkgGraph) Load

func (p *PkgGraph) Load(pkg string) error

func (*PkgGraph) Roots

func (p *PkgGraph) Roots() []*PkgNode

func (*PkgGraph) Size

func (p *PkgGraph) Size() int

type PkgNode

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

func NewPkgNode

func NewPkgNode(pkgPath string) *PkgNode

func (*PkgNode) DependOn

func (p *PkgNode) DependOn(other *PkgNode)

func (*PkgNode) IsDependedOnBy

func (p *PkgNode) IsDependedOnBy(pkgName string) bool

func (*PkgNode) IsDependingOn

func (p *PkgNode) IsDependingOn(pkgName string) bool

func (*PkgNode) IsIndirectlyDependingOn

func (p *PkgNode) IsIndirectlyDependingOn(pkgName string) bool

Directories

Path Synopsis
tests
a
b

Jump to

Keyboard shortcuts

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