1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

fix: fix failed unit test

This commit is contained in:
dudaodong
2023-12-11 15:45:02 +08:00
parent 96320069f4
commit 0b976e9a4c
4 changed files with 6 additions and 14 deletions

View File

@@ -223,7 +223,7 @@ func main() {
### <span id="RandSymbolChar">RandSymbolChar</span>
<p>生成给定长度的随机符号字符串. 符号字符包括: !@#$%^&*()_+-=[]{}|;':\",./<>?。</p>
<p>生成给定长度的随机符号字符串。</p>
<b>函数签名:</b>
@@ -231,7 +231,7 @@ func main() {
func RandSymbolChar(length int) string
```
<b>示例:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/Im6ZJxAykOm)</span></b>
<b>示例:<span style="float:right;display:inline-block;">[运行](https://go.dev/play/p/Im6ZJxAykOm)</span></b>
```go
package main
@@ -338,7 +338,7 @@ func main() {
func RandFloats(n int, min, max float64, precision int) []float64
```
<b>实例:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/I3yndUQ-rhh)</span></b>
<b>实例:<span style="float:right;display:inline-block;">[运行](https://go.dev/play/p/I3yndUQ-rhh)</span></b>
```go
package main

View File

@@ -223,7 +223,7 @@ func main() {
### <span id="RandSymbolChar">RandSymbolChar</span>
<p>Generate a random symbol char of specified length. Symbol chars: !@#$%^&*()_+-=[]{}|;':\",./<>?.</p>
<p>Generate a random symbol char of specified length.</p>
<b>Signature:</b>

View File

@@ -27,7 +27,7 @@ func TestCreateFile(t *testing.T) {
assert := internal.NewAssert(t, "TestCreateFile")
f := "./text.txt"
f := "./testdata/text.txt"
if CreateFile(f) {
file, err := os.Open(f)
assert.IsNil(err)

View File

@@ -14,12 +14,6 @@ func TestTryUnwrap(t *testing.T) {
assert := internal.NewAssert(t, "TestTryUnwrap")
assert.Equal(42, TryUnwrap(strconv.Atoi("42")))
}
func TestTryUnwrapFail(t *testing.T) {
t.Parallel()
assert := internal.NewAssert(t, "TestTryUnwrapFail")
_, err := strconv.Atoi("4o2")
defer func() {
@@ -76,8 +70,6 @@ func TestXError_Unwrap(t *testing.T) {
}
func TestXError_StackTrace(t *testing.T) {
// t.Parallel()
assert := internal.NewAssert(t, "TestXError_StackTrace")
err := New("error")
@@ -86,7 +78,7 @@ func TestXError_StackTrace(t *testing.T) {
assert.Equal(3, len(stacks))
assert.Equal("github.com/duke-git/lancet/v2/xerror.TestXError_StackTrace", stacks[0].Func)
assert.Equal(83, stacks[0].Line)
assert.Equal(75, stacks[0].Line)
assert.Equal(true, strings.Contains(stacks[0].File, "xerror_test.go"))
}