Skip to content

Commit f9441ec

Browse files
committed
Support windows filepath
1 parent 505f19f commit f9441ec

File tree

1 file changed

+5
-3
lines changed
  • instrumentation/github.com/astaxie/beego/otelbeego/test

1 file changed

+5
-3
lines changed

instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"net/http"
2222
"net/http/httptest"
2323
"os"
24+
"path/filepath"
2425
"strings"
2526
"testing"
2627
"time"
@@ -241,19 +242,20 @@ func TestRender(t *testing.T) {
241242
beego.SetTemplateFSFunc(func() http.FileSystem {
242243
return &assetfs.AssetFS{
243244
Asset: func(path string) ([]byte, error) {
244-
if path == tplName {
245+
if _, f := filepath.Split(path); f == tplName {
245246
return []byte(htmlStr), nil
246247
}
247248
return nil, os.ErrNotExist
248249
},
249250
AssetDir: func(path string) ([]string, error) {
250-
if path == "" {
251+
switch path {
252+
case "", `\`:
251253
return []string{tplName}, nil
252254
}
253255
return nil, os.ErrNotExist
254256
},
255257
AssetInfo: func(path string) (os.FileInfo, error) {
256-
if path == tplName {
258+
if _, f := filepath.Split(path); f == tplName {
257259
return &assetfs.FakeFile{
258260
Path: path,
259261
Len: int64(len(htmlStr)),

0 commit comments

Comments
 (0)