github.com/easysoft/zendata@v0.0.0-20240513203326-705bd5a7fd67/cmd/test/command/cmd_help_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/easysoft/zendata/cmd/test/consts"
     7  	testHelper "github.com/easysoft/zendata/cmd/test/helper"
     8  	logUtils "github.com/easysoft/zendata/pkg/utils/log"
     9  	"github.com/ozontech/allure-go/pkg/framework/provider"
    10  	"github.com/ozontech/allure-go/pkg/framework/suite"
    11  )
    12  
    13  func TestHelpCmd(t *testing.T) {
    14  	suite.RunSuite(t, new(HelpCmdSuite))
    15  }
    16  
    17  type HelpCmdSuite struct {
    18  	suite.Suite
    19  }
    20  
    21  func (s *HelpCmdSuite) BeforeEach(t provider.T) {
    22  	testHelper.PreCase()
    23  	t.AddSubSuite("HelpCmd")
    24  }
    25  func (s *HelpCmdSuite) AfterEach(t provider.T) {
    26  	testHelper.PostCase()
    27  }
    28  
    29  func (s *HelpCmdSuite) TestPrintSample(t provider.T) {
    30  	t.ID("0")
    31  
    32  	logUtils.PrintExample()
    33  
    34  	out := consts.Buf.String()
    35  
    36  	t.Require().Contains(out, "语法说明", "check sample content")
    37  }
    38  
    39  func (s *HelpCmdSuite) TestPrintUsage(t provider.T) {
    40  	t.ID("0")
    41  
    42  	logUtils.PrintUsage()
    43  
    44  	out := consts.Buf.String()
    45  
    46  	t.Require().Contains(out, "数据生成工具", "check usage content")
    47  }