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

     1  package coretests
     2  
     3  import (
     4  	"strings"
     5  
     6  	"gitlab.com/evatix-go/core/errcore"
     7  )
     8  
     9  func isStrMsgNonWhiteSortedEqualInternal(
    10  	isPrintOnFail bool,
    11  	actual string,
    12  	expectationMessageDef *errcore.ExpectationMessageDef,
    13  ) bool {
    14  	actualSortedDefault := GetMessageToSorted(
    15  		false,
    16  		strings.TrimSpace(actual),
    17  		commonJoiner)
    18  
    19  	expectedSortedDefault := GetMessageToSorted(
    20  		false,
    21  		expectationMessageDef.ExpectedStringTrim(),
    22  		commonJoiner)
    23  
    24  	isEqual := actualSortedDefault == expectedSortedDefault
    25  	isFailed := !isEqual
    26  
    27  	// Exception case for mutation, because test updates it
    28  	expectationMessageDef.ActualProcessed = actualSortedDefault
    29  	expectationMessageDef.ExpectedProcessed = expectedSortedDefault
    30  	expectationMessageDef.PrintIfFailed(
    31  		isPrintOnFail,
    32  		isFailed,
    33  		actual)
    34  
    35  	return isEqual
    36  }