gitlab.com/evatix-go/core@v1.3.55/tests/integratedtests/chmodhelpertests/RwxCompileValue_test.go (about) 1 package chmodhelpertests 2 3 import ( 4 "fmt" 5 "log" 6 "testing" 7 8 "github.com/smartystreets/goconvey/convey" 9 "gitlab.com/evatix-go/core/chmodhelper" 10 "gitlab.com/evatix-go/core/tests/testwrappers/chmodhelpertestwrappers" 11 ) 12 13 func Test_RwxCompileValue(t *testing.T) { 14 for _, testCase := range chmodhelpertestwrappers.RwxCompileValueTestCases { 15 // Arrange 16 existingRwxWrapper, _ := 17 chmodhelper.ParseRwxOwnerGroupOtherToRwxVariableWrapper( 18 &testCase.Existing) 19 expectedVariableWrapper, _ := 20 chmodhelper.ParseRwxOwnerGroupOtherToRwxVariableWrapper( 21 &testCase.Expected) 22 existing := testCase.Existing.ToString(false) 23 input := testCase.Input.ToString(false) 24 expected := testCase.Expected.ToString(false) 25 expectedFullRwx := expectedVariableWrapper. 26 ToCompileFixedPtr(). 27 ToFullRwxValueString() 28 29 header := fmt.Sprintf( 30 "Existing [%s] Applied by [%s] should result [%s]", 31 existing, 32 input, 33 expected) 34 35 // Act 36 actualVarWrapper, _ := 37 chmodhelper.ParseRwxOwnerGroupOtherToRwxVariableWrapper( 38 &testCase.Input) 39 actualRwxWrapper := actualVarWrapper. 40 ToCompileWrapper(existingRwxWrapper.ToCompileFixedPtr()) 41 actualFullRwx := actualRwxWrapper.ToFullRwxValueString() 42 43 // Assert 44 convey.Convey(header, t, func() { 45 if actualFullRwx != expectedFullRwx { 46 log.Println(header) 47 } 48 49 convey.So(actualFullRwx, convey.ShouldEqual, expectedFullRwx) 50 }) 51 } 52 }