mirror of
https://github.com/labstack/echo.git
synced 2025-11-23 22:24:54 +02:00
tests: In Go 1.23 fs related errors have changed.
This commit is contained in:
@@ -245,19 +245,16 @@ func TestEcho_FileFS(t *testing.T) {
|
|||||||
|
|
||||||
func TestEcho_StaticPanic(t *testing.T) {
|
func TestEcho_StaticPanic(t *testing.T) {
|
||||||
var testCases = []struct {
|
var testCases = []struct {
|
||||||
name string
|
name string
|
||||||
givenRoot string
|
givenRoot string
|
||||||
expectError string
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "panics for ../",
|
name: "panics for ../",
|
||||||
givenRoot: "../assets",
|
givenRoot: "../assets",
|
||||||
expectError: "can not create sub FS, invalid root given, err: sub ../assets: invalid name",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "panics for /",
|
name: "panics for /",
|
||||||
givenRoot: "/assets",
|
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 := New()
|
||||||
e.Filesystem = os.DirFS("./")
|
e.Filesystem = os.DirFS("./")
|
||||||
|
|
||||||
assert.PanicsWithError(t, tc.expectError, func() {
|
assert.Panics(t, func() {
|
||||||
e.Static("../assets", tc.givenRoot)
|
e.Static("../assets", tc.givenRoot)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -75,19 +75,16 @@ func TestGroup_FileFS(t *testing.T) {
|
|||||||
|
|
||||||
func TestGroup_StaticPanic(t *testing.T) {
|
func TestGroup_StaticPanic(t *testing.T) {
|
||||||
var testCases = []struct {
|
var testCases = []struct {
|
||||||
name string
|
name string
|
||||||
givenRoot string
|
givenRoot string
|
||||||
expectError string
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "panics for ../",
|
name: "panics for ../",
|
||||||
givenRoot: "../images",
|
givenRoot: "../images",
|
||||||
expectError: "can not create sub FS, invalid root given, err: sub ../images: invalid name",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "panics for /",
|
name: "panics for /",
|
||||||
givenRoot: "/images",
|
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")
|
g := e.Group("/assets")
|
||||||
|
|
||||||
assert.PanicsWithError(t, tc.expectError, func() {
|
assert.Panics(t, func() {
|
||||||
g.Static("/images", tc.givenRoot)
|
g.Static("/images", tc.givenRoot)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user