From 02058cc1f59f3f4ee0e7608a9fdd78ad8f04674e Mon Sep 17 00:00:00 2001 From: yxxhero Date: Sun, 3 Apr 2022 18:02:51 +0800 Subject: [PATCH] add unittest for load_opts.go Signed-off-by: yxxhero --- pkg/app/load_opts_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pkg/app/load_opts_test.go diff --git a/pkg/app/load_opts_test.go b/pkg/app/load_opts_test.go new file mode 100644 index 00000000..da97011c --- /dev/null +++ b/pkg/app/load_opts_test.go @@ -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") + +}