Skip to content

Commit da99412

Browse files
coderabbitai[bot]CodeRabbit
authored andcommitted
fix: apply CodeRabbit auto-fixes
Fixed 2 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
1 parent e90dfa6 commit da99412

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

internal/transformations/testdata/normalisePathWin.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,12 @@
222222
"input" : "//",
223223
"name" : "normalisePathWin",
224224
"type" : "tfn"
225+
},
226+
{
227+
"output" : "foo/bar",
228+
"ret" : 1,
229+
"input" : "foo\\bar",
230+
"name" : "normalisePathWin",
231+
"type" : "tfn"
225232
}
226233
]

internal/transformations/transformations_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,23 @@ func TestTransformations(t *testing.T) {
5656
// Cannot use t.Skip for TinyGo support
5757
return
5858
}
59-
out, _, err := trans(data.Input)
59+
out, changed, err := trans(data.Input)
6060
if err != nil {
6161
t.Error(err)
6262
}
6363
if out != data.Output {
6464
t.Errorf("Transformation %s:\nInput: %s\nExpected: %v\nGot: %v\nExpected String: %s\nGot String: %s",
6565
data.Name, data.Input, []byte(data.Output), []byte(out), data.Output, out)
6666
}
67+
// Only check the changed return value for normalisePath and normalisePathWin
68+
// where the ret field reliably indicates whether the path was modified
69+
if data.Name == "normalisePath" || data.Name == "normalisePathWin" {
70+
expectedChanged := data.Ret != 0
71+
if changed != expectedChanged {
72+
t.Errorf("Transformation %s:\nInput: %s\nExpected changed: %v\nGot changed: %v",
73+
data.Name, data.Input, expectedChanged, changed)
74+
}
75+
}
6776
})
6877
}
6978
}

0 commit comments

Comments
 (0)