1
0
mirror of https://github.com/labstack/echo.git synced 2025-09-16 09:16:29 +02:00

tests: In Go 1.23 fs related errors have changed.

This commit is contained in:
toimtoimtoim
2024-08-15 14:13:58 +03:00
committed by Martti T.
parent a5612d83d0
commit 27c55f2189
2 changed files with 14 additions and 20 deletions

View File

@@ -247,17 +247,14 @@ func TestEcho_StaticPanic(t *testing.T) {
var testCases = []struct {
name string
givenRoot string
expectError string
}{
{
name: "panics for ../",
givenRoot: "../assets",
expectError: "can not create sub FS, invalid root given, err: sub ../assets: invalid name",
},
{
name: "panics for /",
givenRoot: "/assets",
expectError: "can not create sub FS, invalid root given, err: sub /assets: invalid name",
},
}
@@ -266,7 +263,7 @@ func TestEcho_StaticPanic(t *testing.T) {
e := New()
e.Filesystem = os.DirFS("./")
assert.PanicsWithError(t, tc.expectError, func() {
assert.Panics(t, func() {
e.Static("../assets", tc.givenRoot)
})
})

View File

@@ -77,17 +77,14 @@ func TestGroup_StaticPanic(t *testing.T) {
var testCases = []struct {
name string
givenRoot string
expectError string
}{
{
name: "panics for ../",
givenRoot: "../images",
expectError: "can not create sub FS, invalid root given, err: sub ../images: invalid name",
},
{
name: "panics for /",
givenRoot: "/images",
expectError: "can not create sub FS, invalid root given, err: sub /images: invalid name",
},
}
@@ -98,7 +95,7 @@ func TestGroup_StaticPanic(t *testing.T) {
g := e.Group("/assets")
assert.PanicsWithError(t, tc.expectError, func() {
assert.Panics(t, func() {
g.Static("/images", tc.givenRoot)
})
})