Skip to content

Commit

Permalink
Merge pull request #271 from nao1215/nchika/fix-and-update-library
Browse files Browse the repository at this point in the history
Update go.mod
  • Loading branch information
nao1215 authored Dec 29, 2024
2 parents 2019a28 + 49ad26a commit ea6f3cc
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 55 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/gosec.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/multi_ver_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.22"]
go-version: ["1.23"]
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
go: "1.20"
go: "1.23"

issues:
exclude-use-default: false
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[![WindowsUnitTest](https://github.com/nao1215/spectest/actions/workflows/windows_test.yml/badge.svg)](https://github.com/nao1215/spectest/actions/workflows/windows_test.yml)
[![UnitTestExampleCodes](https://github.com/nao1215/spectest/actions/workflows/test-examples.yml/badge.svg)](https://github.com/nao1215/spectest/actions/workflows/test-examples.yml)
[![reviewdog](https://github.com/nao1215/spectest/actions/workflows/reviewdog.yml/badge.svg)](https://github.com/nao1215/spectest/actions/workflows/reviewdog.yml)
[![Gosec](https://github.com/nao1215/spectest/actions/workflows/gosec.yml/badge.svg)](https://github.com/nao1215/spectest/actions/workflows/gosec.yml)
![Coverage](https://github.com/nao1215/octocovs-central-repo/blob/main//badges/nao1215/spectest/coverage.svg?raw=true)

## What is spectest?
Expand Down
14 changes: 8 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
module github.com/nao1215/spectest

go 1.22
go 1.23.2

toolchain go1.23.4

require (
github.com/PaesslerAG/jsonpath v0.1.1
github.com/PuerkitoBio/goquery v1.9.2
github.com/davecgh/go-spew v1.1.1
github.com/fatih/color v1.17.0
github.com/fatih/color v1.18.0
github.com/google/go-cmp v0.6.0
github.com/gorilla/websocket v1.5.3
github.com/n7olkachev/imgdiff v1.0.2
github.com/nao1215/diff v0.0.1
github.com/nao1215/gorky v0.2.1
github.com/nao1215/imaging v1.0.9
github.com/nao1215/markdown v0.6.0
github.com/nao1215/markdown v0.7.0
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
github.com/tenntenn/testtime v0.2.2
github.com/stretchr/testify v1.10.0
github.com/tenntenn/testtime v0.3.2
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
)
Expand All @@ -39,7 +41,7 @@ require (
golang.org/x/image v0.19.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/sys v0.25.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
Expand Down Expand Up @@ -45,8 +45,8 @@ github.com/nao1215/gorky v0.2.1 h1:kxXYhCNBbtGru9CCSYx+QC0JZfZJ1csY3uLbb5n2WKA=
github.com/nao1215/gorky v0.2.1/go.mod h1:fJNLiXzn3YkteARC8xghfHjkt+C5xtHOaRgmVnJEMOs=
github.com/nao1215/imaging v1.0.9 h1:N7Jj8ibGpWCbfwU9Ftn0Kbytdt06arMk/LwNerViOmc=
github.com/nao1215/imaging v1.0.9/go.mod h1:0BbOootvOGWLEEnPuUoM9HdvLCFtPoqZlAz+ASB/GB0=
github.com/nao1215/markdown v0.6.0 h1:kqhrC47K434YA1jMTUwJwSV/hla8ifN3NzehMEffI/E=
github.com/nao1215/markdown v0.6.0/go.mod h1:ObBhnNduWwPN+bu4dtv4JoLRt57ONla7l//03iHIVhY=
github.com/nao1215/markdown v0.7.0 h1:SCQkvdQXQuKJW8KaCsvBob8Afy4T4iJUAYIefWpHojE=
github.com/nao1215/markdown v0.7.0/go.mod h1:ObBhnNduWwPN+bu4dtv4JoLRt57ONla7l//03iHIVhY=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -61,10 +61,10 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tenntenn/testtime v0.2.2 h1:y6K00BUNg7cRE9WpkBX/Bn+WgmV5/a3hsw7xGNyF2p0=
github.com/tenntenn/testtime v0.2.2/go.mod h1:gXZpxnMoBEV+JZwooprQ65lIbR2Kzk5PpP/deHMn+Is=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tenntenn/testtime v0.3.2 h1:uF2DQUMXTYD5+x9I4KA3y0KrBUzzdW2B8YKVFg+boi0=
github.com/tenntenn/testtime v0.3.2/go.mod h1:BB9+OlVPhFkvYVoCeaOQjAO/i7m+YeR9HCzhefH9KRg=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
Expand Down Expand Up @@ -101,8 +101,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
Expand Down
10 changes: 5 additions & 5 deletions mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ func (r *MockResponse) FixedDelay(delay int64) *MockResponse {
}

// Times respond the given number of times
func (r *MockResponse) Times(times uint) *MockResponse {
func (r *MockResponse) Times(times int) *MockResponse {
r.mock.execCount.updateExpectCount(times)
return r
}
Expand Down Expand Up @@ -1293,18 +1293,18 @@ func (r *mockInteraction) GetRequestHost() string {
// execCount is used to track the number of times a mock has been executed.
type execCount struct {
// expect is the expected number of times the mock will be executed.
expect uint
expect int
// actual is the actual number of times the mock has been executed.
actual uint
actual int
}

// newExecCount creates a new execCount with the given expected number of executions.
func newExecCount(expect uint) *execCount {
func newExecCount(expect int) *execCount {
return &execCount{expect: expect}
}

// updateExpectCount updates the expected number of executions.
func (e *execCount) updateExpectCount(expect uint) {
func (e *execCount) updateExpectCount(expect int) {
e.expect = expect
}

Expand Down
16 changes: 4 additions & 12 deletions time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@ func TestIntervalDuration(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
interval := spectest.NewInterval()

if !testtime.SetTime(t, tt.fields.start) {
t.Fatal("failed to set start time")
}
testtime.SetTime(t, tt.fields.start)
interval.Start()

if !testtime.SetTime(t, tt.fields.end) {
t.Fatal("failed to set end time")
}
testtime.SetTime(t, tt.fields.end)
interval.End()

if interval.Duration() != tt.want {
Expand All @@ -64,15 +60,11 @@ func ExampleInterval_Duration() {
interval := spectest.NewInterval()

// Set started time. Usually, you don't need to set the time. You only call Start() method.
if !testtime.SetTime(t, time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC)) {
t.Fatal("failed to set start time")
}
testtime.SetTime(t, time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC))
interval.Start()

// Set finished time. Usually, you don't need to set the time. You only call End() method.
if !testtime.SetTime(t, time.Date(2023, 1, 1, 0, 0, 1, 0, time.UTC)) {
t.Fatal("failed to set end time")
}
testtime.SetTime(t, time.Date(2023, 1, 1, 0, 0, 1, 0, time.UTC))
interval.End()

fmt.Printf("duration=%f[s]", interval.Duration().Seconds())
Expand Down

0 comments on commit ea6f3cc

Please sign in to comment.