Skip to content

Commit

Permalink
fix: fix failed unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
duke-git committed Dec 11, 2023
1 parent 9632006 commit 0b976e9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
6 changes: 3 additions & 3 deletions docs/api/packages/random.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ func main() {

### <span id="RandSymbolChar">RandSymbolChar</span>

<p>生成给定长度的随机符号字符串. 符号字符包括: !@#$%^&*()_+-=[]{}|;':\",./<>?。</p>
<p>生成给定长度的随机符号字符串。</p>

<b>函数签名:</b>

```go
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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/en/api/packages/random.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion fileutil/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 1 addition & 9 deletions xerror/xerror_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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")
Expand All @@ -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"))
}

Expand Down

0 comments on commit 0b976e9

Please sign in to comment.