github.com/iotexproject/iotex-core@v1.14.1-rc1/pkg/util/fileutil/fileutil_test.go (about)

     1  // Copyright (c) 2022 IoTeX Foundation
     2  // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
     3  // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
     4  // This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
     5  
     6  package fileutil
     7  
     8  import (
     9  	"testing"
    10  
    11  	// "github.com/pkg/errors"
    12  	"github.com/stretchr/testify/require"
    13  )
    14  
    15  func TestFileExists(t *testing.T) {
    16  	t.Run("valid file path", func(t *testing.T) {
    17  		isFileExists := FileExists("./fileutil.go")
    18  		require.True(t, isFileExists)
    19  	})
    20  
    21  	t.Run("invalid file path", func(t *testing.T) {
    22  		isFileExists := FileExists("")
    23  		require.False(t, isFileExists)
    24  	})
    25  }