Skip to content

Commit

Permalink
Switch all import paths to pegomock/v3
Browse files Browse the repository at this point in the history
  • Loading branch information
petergtz committed May 3, 2023
1 parent 8ea8c53 commit f56fc82
Show file tree
Hide file tree
Showing 42 changed files with 75 additions and 74 deletions.
2 changes: 1 addition & 1 deletion dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"time"

"github.com/onsi/gomega/format"
"github.com/petergtz/pegomock/internal/verify"
"github.com/petergtz/pegomock/v3/internal/verify"
)

var GlobalFailHandler FailHandler
Expand Down
12 changes: 6 additions & 6 deletions dsl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import (
"testing"
"time"

. "github.com/petergtz/pegomock"
. "github.com/petergtz/pegomock/matchers"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v3/matchers"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"github.com/petergtz/pegomock"
"github.com/petergtz/pegomock/test_interface"
"github.com/petergtz/pegomock/v3"
"github.com/petergtz/pegomock/v3/test_interface"
)

var (
Expand Down Expand Up @@ -211,7 +211,7 @@ var _ = Describe("MockDisplay", func() {
})
})

Describe("https://github.com/petergtz/pegomock/issues/24", func() {
Describe("https://github.com/petergtz/pegomock/v3/issues/24", func() {
Context("Stubbing with nil value", func() {
It("does not panic when return type is interface{}", func() {
When(display.InterfaceReturnValue()).ThenReturn(nil)
Expand Down Expand Up @@ -359,7 +359,7 @@ var _ = Describe("MockDisplay", func() {

Context("Never calling Flash", func() {
It("succeeds during verification when using Never() and argument matchers", func() {
// https://github.com/petergtz/pegomock/issues/34
// https://github.com/petergtz/pegomock/v3/issues/34
Expect(func() { display.VerifyWasCalled(Never()).Flash(AnyString(), AnyInt()) }).NotTo(Panic())
})
})
Expand Down
4 changes: 2 additions & 2 deletions generate_test_mocks/gomock_reflect/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import (
"testing"

. "github.com/onsi/ginkgo/v2"
"github.com/petergtz/pegomock/pegomock/filehandling"
"github.com/petergtz/pegomock/v3/pegomock/filehandling"
)

func TestMockGeneration(t *testing.T) { RunSpecs(t, "Generating mocks with GoMock-reflect") }

var _ = It("Generate mocks", func() {
filehandling.GenerateMockFile(
[]string{"github.com/petergtz/pegomock/test_interface", "Display"},
[]string{"github.com/petergtz/pegomock/v3/test_interface", "Display"},
"../../mock_display_test.go", "MockDisplay", "pegomock_test",
"", false, os.Stdout, false, true, "")
})
2 changes: 1 addition & 1 deletion generate_test_mocks/gomock_source/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"

. "github.com/onsi/ginkgo/v2"
"github.com/petergtz/pegomock/pegomock/filehandling"
"github.com/petergtz/pegomock/v3/pegomock/filehandling"
)

func TestMockGeneration(t *testing.T) { RunSpecs(t, "Generating mocks with GoMock-source") }
Expand Down
4 changes: 2 additions & 2 deletions generate_test_mocks/xtools_go_loader/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"

. "github.com/onsi/ginkgo/v2"
"github.com/petergtz/pegomock/pegomock/filehandling"
"github.com/petergtz/pegomock/v3/pegomock/filehandling"
)

func TestMockGeneration(t *testing.T) {
Expand All @@ -28,7 +28,7 @@ func TestMockGeneration(t *testing.T) {

var _ = It("Generate mocks", func() {
filehandling.GenerateMockFile(
[]string{"github.com/petergtz/pegomock/test_interface", "Display"},
[]string{"github.com/petergtz/pegomock/v3/test_interface", "Display"},
"../../mock_display_test.go", "MockDisplay", "pegomock_test",
"", false, os.Stdout, true, true, "")
})
2 changes: 1 addition & 1 deletion ginkgo_compatible/in_order_context.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package mock

import "github.com/petergtz/pegomock"
import "github.com/petergtz/pegomock/v3"

type InOrderContext = pegomock.InOrderContext
2 changes: 1 addition & 1 deletion ginkgo_compatible/matchers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mock

import (
"github.com/petergtz/pegomock"
"github.com/petergtz/pegomock/v3"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion ginkgo_compatible/option.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mock

import (
"github.com/petergtz/pegomock"
"github.com/petergtz/pegomock/v3"
)

var OptionWithT = pegomock.WithT
2 changes: 1 addition & 1 deletion ginkgo_compatible/whenever.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mock

import (
"github.com/petergtz/pegomock"
"github.com/petergtz/pegomock/v3"
)

var Whenever = pegomock.When
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/petergtz/pegomock
module github.com/petergtz/pegomock/v3

go 1.18

Expand Down
4 changes: 2 additions & 2 deletions internal/generate_matchers/matcher_generation.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// Generate matchers:
//
// go generate github.com/petergtz/pegomock/internal/generate_matchers
// go generate github.com/petergtz/pegomock/v3/internal/generate_matchers

//go:generate go run matcher_generation.go
//go:generate go fmt ../../matcher_factories.go
Expand Down Expand Up @@ -127,7 +127,7 @@ func GenerateGinkgoMatchersFile() string {
contents := `package mock
import (
"github.com/petergtz/pegomock"
"github.com/petergtz/pegomock/v3"
)
var (`
Expand Down
3 changes: 2 additions & 1 deletion matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"reflect"

"github.com/petergtz/pegomock/internal/verify"
"sync"

"github.com/petergtz/pegomock/v3/internal/verify"
)

type EqMatcher struct {
Expand Down
2 changes: 1 addition & 1 deletion matchers/http_request.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/io_readcloser.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/map_of_http_file_to_http_file.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/map_of_int_to_int.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/map_of_string_to_empty_unnamed_struct.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/map_of_string_to_http_request.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/map_of_string_to_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/ptr_to_http_request.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/recv_chan_of_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/send_chan_of_error.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/slice_of_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchers/time_time.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions mockgen/mockgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ import (
"strings"
"unicode"

"github.com/petergtz/pegomock/mockgen/util"
"github.com/petergtz/pegomock/v3/mockgen/util"

"github.com/petergtz/pegomock/model"
"github.com/petergtz/pegomock/v3/model"
)

const mockFrameworkImportPath = "github.com/petergtz/pegomock"
const mockFrameworkImportPath = "github.com/petergtz/pegomock/v3"

func GenerateOutput(ast *model.Package, source, nameOut, packageOut, selfPackage string) ([]byte, map[string]string) {
g := generator{typesSet: make(map[string]string)}
Expand Down Expand Up @@ -436,7 +436,7 @@ func generateMatcherSourceCode(t model.Type, packageMap map[string]string) strin
package matchers
import (
"github.com/petergtz/pegomock"
"github.com/petergtz/pegomock/v3"
"reflect"%v
)
Expand Down
6 changes: 3 additions & 3 deletions mockgen/mockgen_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package mockgen_test

import (
"github.com/petergtz/pegomock/mockgen"
"github.com/petergtz/pegomock/modelgen/loader"
"github.com/petergtz/pegomock/v3/mockgen"
"github.com/petergtz/pegomock/v3/modelgen/loader"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -11,7 +11,7 @@ import (
var _ = Describe("Mockgen", func() {
Context("matcherSourceCodes", func() {
It("uses correct naming pattern with underscores for keys, and correct types etc. in source code", func() {
ast, e := loader.GenerateModel("github.com/petergtz/pegomock/test_interface", "Display")
ast, e := loader.GenerateModel("github.com/petergtz/pegomock/v3/test_interface", "Display")
Expect(e).NotTo(HaveOccurred())
_, matcherSourceCodes := mockgen.GenerateOutput(ast, "irrelevant", "MockDisplay", "test_package", "")

Expand Down
2 changes: 1 addition & 1 deletion mockgen/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
. "github.com/onsi/gomega"
"github.com/petergtz/pegomock/mockgen/util"
"github.com/petergtz/pegomock/v3/mockgen/util"
)

func TestUtil(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion modelgen/gomock/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"strconv"
"strings"

"github.com/petergtz/pegomock/model"
"github.com/petergtz/pegomock/v3/model"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions modelgen/gomock/reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"runtime"
"text/template"

"github.com/petergtz/pegomock/model"
"github.com/petergtz/pegomock/v3/model"
)

var (
Expand Down Expand Up @@ -120,8 +120,8 @@ import (
"path"
"reflect"
"github.com/petergtz/pegomock/model"
"github.com/petergtz/pegomock/modelgen/gomock"
"github.com/petergtz/pegomock/v3/model"
"github.com/petergtz/pegomock/v3/modelgen/gomock"
pkg_ {{printf "%q" .ImportPath}}
)
Expand Down
2 changes: 1 addition & 1 deletion modelgen/gomock/reflect_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"reflect"

"github.com/petergtz/pegomock/model"
"github.com/petergtz/pegomock/v3/model"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion modelgen/gomock/reflect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
. "github.com/onsi/gomega"
"github.com/petergtz/pegomock/modelgen/gomock"
"github.com/petergtz/pegomock/v3/modelgen/gomock"
)

func TestGomock(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion modelgen/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"go/ast"
"go/types"

"github.com/petergtz/pegomock/model"
"github.com/petergtz/pegomock/v3/model"
"golang.org/x/tools/go/loader"
)

Expand Down
2 changes: 1 addition & 1 deletion modelgen/loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

. "github.com/petergtz/pegomock/modelgen/loader"
. "github.com/petergtz/pegomock/v3/modelgen/loader"
)

var _ = Describe("Loader", func() {
Expand Down
Loading

0 comments on commit f56fc82

Please sign in to comment.