@@ -946,8 +946,8 @@ func TestBreakLongExpression(t *testing.T) {
946946
947947 // Verify that joined lines equal normalized original (whitespace differences allowed)
948948 joined := strings .Join (lines , " " )
949- originalNorm := NormalizeExpressionForComparison ( tt .expression )
950- joinedNorm := NormalizeExpressionForComparison ( joined )
949+ originalNorm := strings . Join ( strings . Fields ( tt .expression ), " " )
950+ joinedNorm := strings . Join ( strings . Fields ( joined ), " " )
951951
952952 if joinedNorm != originalNorm {
953953 t .Errorf ("Joined lines don't match original expression\n Original: %s\n Joined: %s" , originalNorm , joinedNorm )
@@ -985,8 +985,8 @@ func TestBreakAtParentheses(t *testing.T) {
985985
986986 // Verify that joined lines equal normalized original
987987 joined := strings .Join (lines , " " )
988- originalNorm := NormalizeExpressionForComparison ( tt .expression )
989- joinedNorm := NormalizeExpressionForComparison ( joined )
988+ originalNorm := strings . Join ( strings . Fields ( tt .expression ), " " )
989+ joinedNorm := strings . Join ( strings . Fields ( joined ), " " )
990990
991991 if joinedNorm != originalNorm {
992992 t .Errorf ("Joined lines don't match original expression\n Original: %s\n Joined: %s" , originalNorm , joinedNorm )
@@ -995,48 +995,6 @@ func TestBreakAtParentheses(t *testing.T) {
995995 }
996996}
997997
998- // TestNormalizeExpressionForComparison tests the expression normalization function
999- func TestNormalizeExpressionForComparison (t * testing.T ) {
1000- tests := []struct {
1001- name string
1002- input string
1003- expected string
1004- }{
1005- {
1006- name : "single line with extra spaces" ,
1007- input : "github.event_name == 'issues' || github.event.action == 'opened'" ,
1008- expected : "github.event_name == 'issues' || github.event.action == 'opened'" ,
1009- },
1010- {
1011- name : "multiline expression" ,
1012- input : `github.event_name == 'issues' ||
1013- github.event_name == 'pull_request' ||
1014- github.event.action == 'opened'` ,
1015- expected : "github.event_name == 'issues' || github.event_name == 'pull_request' || github.event.action == 'opened'" ,
1016- },
1017- {
1018- name : "expression with mixed whitespace" ,
1019- input : `github.event_name == 'issues' ||
1020- github.event_name == 'pull_request'` ,
1021- expected : "github.event_name == 'issues' || github.event_name == 'pull_request'" ,
1022- },
1023- {
1024- name : "expression with leading/trailing whitespace" ,
1025- input : " github.event_name == 'issues' " ,
1026- expected : "github.event_name == 'issues'" ,
1027- },
1028- }
1029-
1030- for _ , tt := range tests {
1031- t .Run (tt .name , func (t * testing.T ) {
1032- result := NormalizeExpressionForComparison (tt .input )
1033- if result != tt .expected {
1034- t .Errorf ("NormalizeExpressionForComparison() = '%s', expected '%s'" , result , tt .expected )
1035- }
1036- })
1037- }
1038- }
1039-
1040998// TestMultilineExpressionEquivalence tests that multiline expressions are equivalent to single-line expressions
1041999func TestMultilineExpressionEquivalence (t * testing.T ) {
10421000 tests := []struct {
@@ -1079,8 +1037,8 @@ github.event_name == 'issue_comment' ||
10791037
10801038 for _ , tt := range tests {
10811039 t .Run (tt .name , func (t * testing.T ) {
1082- singleNorm := NormalizeExpressionForComparison ( tt .singleLine )
1083- multiNorm := NormalizeExpressionForComparison ( tt .multiLine )
1040+ singleNorm := strings . Join ( strings . Fields ( tt .singleLine ), " " )
1041+ multiNorm := strings . Join ( strings . Fields ( tt .multiLine ), " " )
10841042
10851043 isEqual := singleNorm == multiNorm
10861044 if isEqual != tt .shouldBeEqual {
@@ -1134,8 +1092,8 @@ func TestLongExpressionBreakingDetailed(t *testing.T) {
11341092
11351093 // Most importantly: verify equivalence
11361094 joined := strings .Join (lines , " " )
1137- originalNorm := NormalizeExpressionForComparison ( tt .expression )
1138- joinedNorm := NormalizeExpressionForComparison ( joined )
1095+ originalNorm := strings . Join ( strings . Fields ( tt .expression ), " " )
1096+ joinedNorm := strings . Join ( strings . Fields ( joined ), " " )
11391097
11401098 if joinedNorm != originalNorm {
11411099 t .Errorf ("Broken expression is not equivalent to original\n Original: %s\n Broken: %s\n Joined: %s\n Original normalized: %s\n Joined normalized: %s" ,
@@ -1175,8 +1133,8 @@ func TestExpressionBreakingWithQuotes(t *testing.T) {
11751133
11761134 // Verify that quotes are preserved and no breaking happens inside quoted strings
11771135 joined := strings .Join (lines , " " )
1178- originalNorm := NormalizeExpressionForComparison ( tt .expression )
1179- joinedNorm := NormalizeExpressionForComparison ( joined )
1136+ originalNorm := strings . Join ( strings . Fields ( tt .expression ), " " )
1137+ joinedNorm := strings . Join ( strings . Fields ( joined ), " " )
11801138
11811139 if joinedNorm != originalNorm {
11821140 t .Errorf ("Expression with quotes not preserved correctly\n Original: %s\n Joined: %s" , originalNorm , joinedNorm )
0 commit comments