5849898283
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
36 lines
547 B
Go
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() {}
|