add unittest for load_opts.go
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
		
							parent
							
								
									4a52ce0ac2
								
							
						
					
					
						commit
						02058cc1f5
					
				|  | @ -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") | ||||||
|  | 
 | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue