mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-06-05 10:52:27 +00:00
*: rework the test tools, so no dep is ignored
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
588282d9ad
commit
f32ba81c5e
39 changed files with 2551 additions and 37 deletions
35
test/cli-test/main.go
Normal file
35
test/cli-test/main.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
green := color.New(color.FgGreen).SprintFunc()
|
||||
red := color.New(color.FgRed).SprintFunc()
|
||||
|
||||
failed := 0
|
||||
for _, arg := range flag.Args() {
|
||||
cmd := exec.Command("bash", arg)
|
||||
if os.Getenv("TMPDIR") != "" {
|
||||
cmd.Env = append(cmd.Env, "TMPDIR="+os.Getenv("TMPDIR"))
|
||||
}
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
failed++
|
||||
fmt.Fprintf(os.Stderr, red("FAILED: %s\n"), arg)
|
||||
}
|
||||
}
|
||||
if failed > 0 {
|
||||
fmt.Fprintf(os.Stderr, red("%d FAILED tests\n"), failed)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Fprintf(os.Stdout, green("SUCCESS: no cli tests failed\n"))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue