Skip to content

Commit 27c55f2

Browse files
committed
tests: In Go 1.23 fs related errors have changed.
1 parent a5612d8 commit 27c55f2

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

echo_fs_test.go

+7-10
Original file line numberDiff line numberDiff line change
@@ -245,19 +245,16 @@ func TestEcho_FileFS(t *testing.T) {
245245

246246
func TestEcho_StaticPanic(t *testing.T) {
247247
var testCases = []struct {
248-
name string
249-
givenRoot string
250-
expectError string
248+
name string
249+
givenRoot string
251250
}{
252251
{
253-
name: "panics for ../",
254-
givenRoot: "../assets",
255-
expectError: "can not create sub FS, invalid root given, err: sub ../assets: invalid name",
252+
name: "panics for ../",
253+
givenRoot: "../assets",
256254
},
257255
{
258-
name: "panics for /",
259-
givenRoot: "/assets",
260-
expectError: "can not create sub FS, invalid root given, err: sub /assets: invalid name",
256+
name: "panics for /",
257+
givenRoot: "/assets",
261258
},
262259
}
263260

@@ -266,7 +263,7 @@ func TestEcho_StaticPanic(t *testing.T) {
266263
e := New()
267264
e.Filesystem = os.DirFS("./")
268265

269-
assert.PanicsWithError(t, tc.expectError, func() {
266+
assert.Panics(t, func() {
270267
e.Static("../assets", tc.givenRoot)
271268
})
272269
})

group_fs_test.go

+7-10
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,16 @@ func TestGroup_FileFS(t *testing.T) {
7575

7676
func TestGroup_StaticPanic(t *testing.T) {
7777
var testCases = []struct {
78-
name string
79-
givenRoot string
80-
expectError string
78+
name string
79+
givenRoot string
8180
}{
8281
{
83-
name: "panics for ../",
84-
givenRoot: "../images",
85-
expectError: "can not create sub FS, invalid root given, err: sub ../images: invalid name",
82+
name: "panics for ../",
83+
givenRoot: "../images",
8684
},
8785
{
88-
name: "panics for /",
89-
givenRoot: "/images",
90-
expectError: "can not create sub FS, invalid root given, err: sub /images: invalid name",
86+
name: "panics for /",
87+
givenRoot: "/images",
9188
},
9289
}
9390

@@ -98,7 +95,7 @@ func TestGroup_StaticPanic(t *testing.T) {
9895

9996
g := e.Group("/assets")
10097

101-
assert.PanicsWithError(t, tc.expectError, func() {
98+
assert.Panics(t, func() {
10299
g.Static("/images", tc.givenRoot)
103100
})
104101
})

0 commit comments

Comments
 (0)