gitlab.com/evatix-go/core@v1.3.55/coretests/IsStrMsgNonWhiteSortedEqual.go (about)

     1  package coretests
     2  
     3  import (
     4  	"strings"
     5  
     6  	"gitlab.com/evatix-go/core/errcore"
     7  )
     8  
     9  func IsStrMsgNonWhiteSortedEqual(
    10  	isPrintOnFail bool,
    11  	actual string,
    12  	expectationMessageDef *errcore.ExpectationMessageDef,
    13  ) bool {
    14  	if expectationMessageDef.IsNonWhiteSort {
    15  		return isStrMsgNonWhiteSortedEqualInternal(
    16  			isPrintOnFail,
    17  			actual,
    18  			expectationMessageDef)
    19  	}
    20  
    21  	trimActual := strings.TrimSpace(actual)
    22  	trimExpected := expectationMessageDef.ExpectedStringTrim()
    23  	isEqual := trimActual == trimExpected
    24  	isFailed := !isEqual
    25  
    26  	expectationMessageDef.ActualProcessed = trimActual
    27  	expectationMessageDef.ExpectedProcessed = trimExpected
    28  	expectationMessageDef.PrintIfFailed(
    29  		isPrintOnFail,
    30  		isFailed,
    31  		actual)
    32  
    33  	return isEqual
    34  }