-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(debug/gdebug): incorrect package name handling in function Caller…
…Package (#3771)
- Loading branch information
Showing
3 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. | ||
// | ||
// This Source Code Form is subject to the terms of the MIT License. | ||
// If a copy of the MIT was not distributed with this file, | ||
// You can obtain one at https://github.com/gogf/gf. | ||
|
||
package gdebug | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_getPackageFromCallerFunction(t *testing.T) { | ||
dataMap := map[string]string{ | ||
"github.com/gogf/gf/v2/test/a": "github.com/gogf/gf/v2/test/a", | ||
"github.com/gogf/gf/v2/test/a.C": "github.com/gogf/gf/v2/test/a", | ||
"github.com/gogf/gf/v2/test/aa.C": "github.com/gogf/gf/v2/test/aa", | ||
"github.com/gogf/gf/v2/test/gtest.C": "github.com/gogf/gf/v2/test/gtest", | ||
} | ||
for functionName, packageName := range dataMap { | ||
if result := getPackageFromCallerFunction(functionName); result != packageName { | ||
t.Logf(`%s != %s`, result, packageName) | ||
t.Fail() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters