gitee.com/h79/goutils@v1.22.10/common/system/daemon_test.go (about)

     1  package system
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func Back(args []string, opts ...ArgOptionFunc) []string {
     8  	opt := ArgOption{
     9  		Id:   0,
    10  		Args: args,
    11  	}
    12  	for i := range opts {
    13  		opts[i](&opt)
    14  	}
    15  	return opt.Args
    16  }
    17  
    18  func TestDaemon(t *testing.T) {
    19  	var args = []string{"test", "-1", "-2", "-3", "xx"}
    20  	xx := Back(args, func(arg *ArgOption) {
    21  		arg.Args = StripArgs(arg.Args, "-3")
    22  	})
    23  	t.Logf("xx: %v", xx)
    24  	t.Logf("old: %v", args)
    25  }