github.com/codingeasygo/util@v0.0.0-20231206062002-1ce2f004b7d9/xdebug/tester.go (about)

     1  package xdebug
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  )
     7  
     8  type CaseTester map[int]int
     9  
    10  func (c CaseTester) Run(message ...string) bool {
    11  	c[-1]++
    12  	ok := c[c[-1]] > 0 || c[0] > 0
    13  	m := ""
    14  	if len(message) > 0 {
    15  		m = fmt.Sprintf("(%v)", strings.Join(message, " "))
    16  	}
    17  	if ok {
    18  		fmt.Printf("\n\n\n>>Case%v %v is starting\n", m, c[-1])
    19  	} else {
    20  		fmt.Printf("\n\n\n>>Case%v %v is skipped\n", m, c[-1])
    21  	}
    22  	return ok
    23  }