From 5e3bcc042822bb428b77d74eb7e02d1ad9e33b72 Mon Sep 17 00:00:00 2001 From: toimtoimtoim Date: Thu, 15 Aug 2024 14:13:58 +0300 Subject: [PATCH] tests: In Go 1.23 fs related errors have changed. --- echo_fs_test.go | 17 +++++++---------- group_fs_test.go | 17 +++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/echo_fs_test.go b/echo_fs_test.go index e882a0682..ab8faa7fa 100644 --- a/echo_fs_test.go +++ b/echo_fs_test.go @@ -245,19 +245,16 @@ func TestEcho_FileFS(t *testing.T) { func TestEcho_StaticPanic(t *testing.T) { var testCases = []struct { - name string - givenRoot string - expectError string + name string + givenRoot 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", }, { - name: "panics for /", - givenRoot: "/assets", - expectError: "can not create sub FS, invalid root given, err: sub /assets: invalid name", + name: "panics for /", + givenRoot: "/assets", }, } @@ -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) }) }) diff --git a/group_fs_test.go b/group_fs_test.go index 8bcd547d1..caa200940 100644 --- a/group_fs_test.go +++ b/group_fs_test.go @@ -75,19 +75,16 @@ func TestGroup_FileFS(t *testing.T) { func TestGroup_StaticPanic(t *testing.T) { var testCases = []struct { - name string - givenRoot string - expectError string + name string + givenRoot 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", }, { - name: "panics for /", - givenRoot: "/images", - expectError: "can not create sub FS, invalid root given, err: sub /images: invalid name", + name: "panics for /", + givenRoot: "/images", }, } @@ -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) }) })