Merge pull request #11 from yxxhero/add_unittest_for_apptest

add unittest for load_opts.go
This commit is contained in:
Yusuke Kuoka 2022-04-05 08:50:11 +09:00 committed by GitHub
commit 4480ec2cdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

23
pkg/app/load_opts_test.go Normal file
View File

@ -0,0 +1,23 @@
package app
import (
"testing"
"github.com/stretchr/testify/require"
)
// TestLoadOptsDeepCopy tests the DeepCopy function for LoadOpts struct.
func TestLoadOptsDeepCopy(t *testing.T) {
lOld := LoadOpts{
Selectors: []string{"test"},
RetainValuesFiles: true,
CalleePath: "test",
Reverse: true,
Filter: true,
}
lNew := lOld.DeepCopy()
// Check that the new struct is not the same as the old one.
require.Equal(t, lOld, lNew, "DeepCopy should return a copy of the LoadOpts struct")
}