github.com/true-sqn/fabric@v2.1.1+incompatible/internal/peer/version/version_test.go (about)

     1  /*
     2   Copyright Hitachi America, Ltd. 2017 All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package version
     8  
     9  import (
    10  	"testing"
    11  
    12  	"github.com/stretchr/testify/assert"
    13  )
    14  
    15  func TestCmd(t *testing.T) {
    16  	cmd := Cmd()
    17  	assert.NoError(t, cmd.Execute(), "expected version command to succeed")
    18  }
    19  
    20  func TestCmdWithTrailingArgs(t *testing.T) {
    21  	cmd := Cmd()
    22  	args := []string{"trailingargs"}
    23  	cmd.SetArgs(args)
    24  	assert.EqualError(t, cmd.Execute(), "trailing args detected")
    25  }