...

Package testutils

import "github.com/bazelbuild/buildtools/testutils"
Overview
Index

Overview ▾

Package testutils provides some useful helpers for buildozer/buildifer tests.

func Diff

func Diff(b1, b2 []byte) ([]byte, error)

Diff returns the output of running diff on b1 and b2.

func FindTests

func FindTests(t *testing.T, directory, pattern string) ([]string, func())

FindTests finds all files matching the given pattern. It changes the working directory to `directory`, and returns a function to call to change back to the current directory. This allows tests to assert on alias finding between absolute and relative labels.

func Tdiff

func Tdiff(t *testing.T, a, b []byte)

Tdiff logs the Diff output to t.Error.