Files
cameradar/vendor/github.com/magefile/mage/mg/deps_internal_test.go
T
Brendan LE GLAUNEC 5849898283 Cameradar 3.0.0: Uses ullaakut/nmap, runs faster, removed legacy code (#188)
Unit tests functional and coverage back to 100%

Add more routes to dictionary, add more credentials, add default port 5554, rename cameradar logs ENV variable, improve unit test readability, remove tmp file
2019-01-22 21:16:16 +01:00

36 lines
547 B
Go

package mg
import (
"bytes"
"log"
"os"
"strings"
"testing"
)
func TestDepsLogging(t *testing.T) {
os.Setenv("MAGEFILE_VERBOSE", "1")
defer os.Unsetenv("MAGEFILE_VERBOSE")
buf := &bytes.Buffer{}
defaultLogger := logger
logger = log.New(buf, "", 0)
defer func() { logger = defaultLogger }()
foo()
if strings.Count(buf.String(), "Running dependency: github.com/magefile/mage/mg.baz") != 1 {
t.Fatalf("expected one baz to be logged, but got\n%s", buf)
}
}
func foo() {
Deps(bar, baz)
}
func bar() {
Deps(baz)
}
func baz() {}