Skip to content

Commit

Permalink
chore: 更新 assert 至 v4
Browse files Browse the repository at this point in the history
  • Loading branch information
caixw committed Feb 28, 2024
1 parent 0b32b36 commit 8988f8c
Show file tree
Hide file tree
Showing 31 changed files with 77 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
go: ['1.18.x', '1.21.x']
go: ['1.18.x', '1.22.x']

steps:

Expand All @@ -20,7 +20,7 @@ jobs:
git config --global core.eol lf
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v4
Expand Down
4 changes: 2 additions & 2 deletions gb11643/gb11643.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

// Package gb11643 解析身分证详情
Expand Down Expand Up @@ -34,8 +36,6 @@ type GB11643 struct {
}

// Parse 分析身份证信息
//
// 不作正确性检测,如有需求,请使用 is.GB11643
func Parse(bs string) (*GB11643, error) {
if !IsValid([]byte(bs)) {
return nil, ErrInvalidFormat
Expand Down
4 changes: 3 additions & 1 deletion gb11643/gb11643_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package gb11643
Expand All @@ -6,7 +8,7 @@ import (
"testing"
"time"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestParse(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions gb11643/valid.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package gb11643
Expand Down
6 changes: 4 additions & 2 deletions gb11643/valid_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package gb11643
Expand All @@ -6,13 +8,13 @@ import (
"math"
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

// 计算各个数值位对应的系数值。
func getWeight() []int {
l := 17
ret := make([]int, 17, 17)
ret := make([]int, 17)
for i := 0; i < l; i++ {
k := int(math.Pow(2, float64((l - i)))) // k值足够大,不能用byte保存
ret[i] = k % 11
Expand Down
2 changes: 2 additions & 0 deletions gb32100/gb32100.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

// Package gb32100 统一信用代码校验
Expand Down
4 changes: 3 additions & 1 deletion gb32100/gb32100_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package gb32100

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

var validData = []string{
Expand Down
2 changes: 2 additions & 0 deletions gb32100/valid.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package gb32100
Expand Down
4 changes: 3 additions & 1 deletion gb32100/valid_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package gb32100

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestCodes(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/issue9/filter
go 1.18

require (
github.com/issue9/assert/v3 v3.1.0
github.com/issue9/sliceutil v0.15.0
github.com/issue9/assert/v4 v4.1.1
github.com/issue9/sliceutil v0.15.1
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/issue9/assert/v3 v3.1.0 h1:oxLFXS7QnBKI4lB31pRoYO96yErkWAJtR7iv+LNjAPg=
github.com/issue9/assert/v3 v3.1.0/go.mod h1:yft/uaskRpwQTyBT3n1zRl91SR1wNlO4fLZHzOa4bdM=
github.com/issue9/sliceutil v0.15.0 h1:E6Xnl3FY5h0ZGNzyx1VEFAfGdParaq/BkX1QQR0uFwI=
github.com/issue9/sliceutil v0.15.0/go.mod h1:n9meV7AamDhmehOBuV4GrxW3yw7O1cZmLx3Xizg1bps=
github.com/issue9/assert/v4 v4.1.1 h1:OhPE8SB8n/qZCNGLQa+6MQtr/B3oON0JAVj68k8jJlc=
github.com/issue9/assert/v4 v4.1.1/go.mod h1:v7qDRXi7AsaZZNh8eAK2rkLJg5/clztqQGA1DRv9Lv4=
github.com/issue9/sliceutil v0.15.1 h1:mV1VlQSO5E8sh2ab6pypLg7TdgGZlDb30E8quli01xY=
github.com/issue9/sliceutil v0.15.1/go.mod h1:ldun6sT4/bOJxuMtOXhtc6P7GCwE7L+avV86HNks7qk=
2 changes: 2 additions & 0 deletions internal/isbn/isbn.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package isbn
Expand Down
4 changes: 3 additions & 1 deletion internal/isbn/isbn_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package isbn

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestEraseMinus(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions internal/strength/strength.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package strength
Expand Down
4 changes: 3 additions & 1 deletion internal/strength/strength_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package strength

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestStrength(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions luhn/luhn.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

// Package [luhn] 模 10 校验算法
Expand Down
4 changes: 3 additions & 1 deletion luhn/luhn_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package luhn

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestIsValid(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions sanitizer/sanitizer.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

// Package sanitizer 内容修正工具
Expand Down
4 changes: 3 additions & 1 deletion sanitizer/sanitizer_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package sanitizer

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestSanitizers(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions validator/bench_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator
Expand Down
2 changes: 2 additions & 0 deletions validator/number.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator
Expand Down
4 changes: 3 additions & 1 deletion validator/number_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator
Expand All @@ -6,7 +8,7 @@ import (
"math"
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestRange(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions validator/regexp.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator
Expand Down
4 changes: 3 additions & 1 deletion validator/regexp_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestCNPhone(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions validator/slice.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator
Expand Down
4 changes: 3 additions & 1 deletion validator/slice_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

type object struct {
Expand Down
2 changes: 2 additions & 0 deletions validator/string.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator
Expand Down
4 changes: 3 additions & 1 deletion validator/string_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestHexColor(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions validator/validator.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

// Package validator 符合 [web.filter] 的验证器
Expand Down
4 changes: 3 additions & 1 deletion validator/validator_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2022-2024 caixw
//
// SPDX-License-Identifier: MIT

package validator

import (
"testing"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func TestNot(t *testing.T) {
Expand Down

0 comments on commit 8988f8c

Please sign in to comment.