Skip to content

Commit fce67b8

Browse files
committed
Refactor rules handling in tests to remove leading/trailing whitespace; ensure expected outputs are correctly formatted
1 parent d3b430a commit fce67b8

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

cmd/generate/context_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ messages:
3636
expectError: false,
3737
expectedFields: map[string]interface{}{
3838
"intent": "",
39-
"rules": "",
39+
"rules": []string{},
4040
"inverseRules": "",
4141
},
4242
},
@@ -57,7 +57,7 @@ messages:
5757
expectError: false,
5858
expectedFields: map[string]interface{}{
5959
"intent": "",
60-
"rules": "",
60+
"rules": []string{},
6161
},
6262
},
6363
{

cmd/generate/parser_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ func TestParseRules(t *testing.T) {
479479
{
480480
name: "rules with leading and trailing whitespace",
481481
input: " 1. Always validate input \n 2. Handle errors gracefully ",
482-
expected: []string{"Always validate input ", " 2. Handle errors gracefully"},
482+
expected: []string{"Always validate input ", "Handle errors gracefully"},
483483
},
484484
{
485485
name: "decimal numbered rules (not matched by regex)",
@@ -504,7 +504,7 @@ func TestParseRules(t *testing.T) {
504504
{
505505
name: "rules starting with whitespace",
506506
input: " 1. Indented rule\n\t2. Tab indented rule",
507-
expected: []string{"Indented rule", "\t2. Tab indented rule"},
507+
expected: []string{"Indented rule", "Tab indented rule"},
508508
},
509509
}
510510

0 commit comments

Comments
 (0)