From d8dffcd92cf1534c2c7334814a73616f2fefcdc3 Mon Sep 17 00:00:00 2001 From: Viktor Alenkov Date: Tue, 14 Nov 2023 00:04:19 +0300 Subject: [PATCH] 1. Refactoring 2. Updating dependency versions --- .gitignore | 1 + .golangci.yml | 3 + Makefile | 4 +- {matchers => errors}/errors.go | 4 +- go.mod | 2 +- go.sum | 4 +- internal/converter/converter.go | 30 ++++ internal/converter/converter_suite_test.go | 14 ++ internal/converter/converter_test.go | 47 ++++++ internal/converter/test-data/data.go | 23 +++ .../matchers}/be_equivalent_to_matcher.go | 26 ++-- .../be_equivalent_to_matcher_suite_test.go | 2 +- .../matchers/be_equivalent_to_matcher_test.go | 129 +++++++++++++++++ matchers.go | 5 +- matchers/be_equivalent_to_matcher_test.go | 137 ------------------ matchers_suite_test.go | 14 ++ matchers_test.go | 37 +++++ 17 files changed, 317 insertions(+), 165 deletions(-) rename {matchers => errors}/errors.go (74%) create mode 100644 internal/converter/converter.go create mode 100644 internal/converter/converter_suite_test.go create mode 100644 internal/converter/converter_test.go create mode 100644 internal/converter/test-data/data.go rename {matchers => internal/matchers}/be_equivalent_to_matcher.go (53%) rename {matchers => internal/matchers}/be_equivalent_to_matcher_suite_test.go (81%) create mode 100644 internal/matchers/be_equivalent_to_matcher_test.go delete mode 100644 matchers/be_equivalent_to_matcher_test.go create mode 100644 matchers_suite_test.go create mode 100644 matchers_test.go diff --git a/.gitignore b/.gitignore index 8abbc98..70b36e5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ tmp.* # Go bin/ junit-report.xml +coverage.html .coverage.out .coverage-*.out diff --git a/.golangci.yml b/.golangci.yml index 4a8e9d7..9e93423 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -57,6 +57,9 @@ linters: # - interfacebloat linters-settings: + gomnd: + ignored-files: + - 'internal/converter/test-data/data\.go$' varnamelen: ignore-type-assert-ok: true ignore-map-index-ok: true diff --git a/Makefile b/Makefile index 18e855a..61b9095 100644 --- a/Makefile +++ b/Makefile @@ -26,11 +26,11 @@ go-lint: go-dependencies ginkgolinter ./... go vet -vettool=$$(go env GOPATH)/bin/shadow ./... -#go-test: go-dependencies go-lint -go-test: go-dependencies +go-test: go-dependencies go-lint gosec ./... ginkgo -r -race --cover --coverprofile=.coverage-ginkgo.out --junit-report=junit-report.xml ./... go tool cover -func=.coverage-ginkgo.out -o=.coverage.out + go tool cover -html=.coverage-ginkgo.out -o=coverage.html cat .coverage.out go-all-tests: go-dependencies go-generate go-lint go-test diff --git a/matchers/errors.go b/errors/errors.go similarity index 74% rename from matchers/errors.go rename to errors/errors.go index 94141b5..89798f8 100644 --- a/matchers/errors.go +++ b/errors/errors.go @@ -1,9 +1,9 @@ -package matchers +package errors import "errors" var ( - ErrActualNotBeNil = errors.New("actual must not be nil") + ErrNotBeNil = errors.New("must not be nil") ErrFailedConvertStringToDecimal = errors.New("DecimalBeEquivalentToMatcher failed to convert string to Decimal") ErrNotSupportedValue = errors.New("DecimalBeEquivalentToMatcher matcher expects a Decimal or string") ) diff --git a/go.mod b/go.mod index d0bb06b..a66e2fd 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/itbasis/gdecimal go 1.20 require ( - github.com/onsi/ginkgo/v2 v2.13.0 + github.com/onsi/ginkgo/v2 v2.13.1 github.com/onsi/gomega v1.30.0 github.com/shopspring/decimal v1.3.1 ) diff --git a/go.sum b/go.sum index 26fec8c..00e3af0 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ 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/google/pprof v0.0.0-20231101202521-4ca4178f5c7a h1:fEBsGL/sjAuJrgah5XqmmYsTLzJp/TO9Lhy39gkverk= github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= -github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/ginkgo/v2 v2.13.1 h1:LNGfMbR2OVGBfXjvRZIZ2YCTQdGKtPLvuI1rMCCj3OU= +github.com/onsi/ginkgo/v2 v2.13.1/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/internal/converter/converter.go b/internal/converter/converter.go new file mode 100644 index 0000000..9b40418 --- /dev/null +++ b/internal/converter/converter.go @@ -0,0 +1,30 @@ +package converter + +import ( + "errors" + + gdecimalErrors "github.com/itbasis/gdecimal/errors" + "github.com/shopspring/decimal" +) + +func ToDecimal(value interface{}) (decimal.Decimal, error) { + if value == nil { + return decimal.Decimal{}, gdecimalErrors.ErrNotBeNil + } + + if d, ok := value.(decimal.Decimal); ok { + return d, nil + } + + if s, ok := value.(string); ok { + d, err := decimal.NewFromString(s) //nolint:varnamelen + + if err != nil { + return d, errors.Join(err, gdecimalErrors.ErrFailedConvertStringToDecimal) + } + + return d, nil + } + + return decimal.Decimal{}, gdecimalErrors.ErrNotSupportedValue +} diff --git a/internal/converter/converter_suite_test.go b/internal/converter/converter_suite_test.go new file mode 100644 index 0000000..b506522 --- /dev/null +++ b/internal/converter/converter_suite_test.go @@ -0,0 +1,14 @@ +package converter_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" //nolint:revive + . "github.com/onsi/gomega" //nolint:revive +) + +func TestConverter(t *testing.T) { + RegisterFailHandler(Fail) + + RunSpecs(t, "Converter Suite") +} diff --git a/internal/converter/converter_test.go b/internal/converter/converter_test.go new file mode 100644 index 0000000..9fce6b7 --- /dev/null +++ b/internal/converter/converter_test.go @@ -0,0 +1,47 @@ +package converter_test + +import ( + gdecimalErrors "github.com/itbasis/gdecimal/errors" + "github.com/itbasis/gdecimal/internal/converter" + converterTestData "github.com/itbasis/gdecimal/internal/converter/test-data" + . "github.com/onsi/ginkgo/v2" //nolint:revive + . "github.com/onsi/gomega" //nolint:revive + "github.com/shopspring/decimal" +) + +var _ = Describe( + "asserting on nil", func() { + Ω(converter.ToDecimal(nil)).Error().To(MatchError(gdecimalErrors.ErrNotBeNil)) + }, +) + +var _ = Describe( + "asserting on Decimal", func() { + Ω(converter.ToDecimal(decimal.Decimal{})).To(Equal(decimal.Decimal{})) + }, +) + +var _ = Describe( + "asserting on string", func() { + DescribeTable( + "passed", func(value string, expect decimal.Decimal) { + Ω(converter.ToDecimal(value)).To(Equal(expect)) + }, + converterTestData.AssertingOnStringPassedEntries, + ) + + DescribeTable( + "failure", func(value string) { + Ω(converter.ToDecimal(value)).Error().To(MatchError(gdecimalErrors.ErrFailedConvertStringToDecimal)) + }, + converterTestData.AssertingOnStringFailureEntries, + ) + }, +) + +var _ = DescribeTable( + "asserting on another", func(value interface{}) { + Ω(converter.ToDecimal(value)).Error().To(MatchError(gdecimalErrors.ErrNotSupportedValue)) + }, + converterTestData.AssertingOnAnotherEntries, +) diff --git a/internal/converter/test-data/data.go b/internal/converter/test-data/data.go new file mode 100644 index 0000000..512a796 --- /dev/null +++ b/internal/converter/test-data/data.go @@ -0,0 +1,23 @@ +package testdata + +import ( + . "github.com/onsi/ginkgo/v2" //nolint:revive + "github.com/shopspring/decimal" +) + +var AssertingOnStringPassedEntries = []TableEntry{ + Entry(nil, "1", decimal.NewFromInt(1)), + Entry(nil, "-1", decimal.NewFromInt(-1)), + Entry(nil, "1.0", decimal.New(10, -1)), + Entry(nil, "01", decimal.NewFromInt(1)), +} +var AssertingOnStringFailureEntries = []TableEntry{ + Entry(nil, ""), + Entry(nil, " 2"), + Entry(nil, "2 "), + Entry(nil, "2,0"), +} +var AssertingOnAnotherEntries = []TableEntry{ + Entry(nil, 1.0), + Entry(nil, -1.0), +} diff --git a/matchers/be_equivalent_to_matcher.go b/internal/matchers/be_equivalent_to_matcher.go similarity index 53% rename from matchers/be_equivalent_to_matcher.go rename to internal/matchers/be_equivalent_to_matcher.go index ed546b7..499c799 100644 --- a/matchers/be_equivalent_to_matcher.go +++ b/internal/matchers/be_equivalent_to_matcher.go @@ -1,34 +1,26 @@ package matchers import ( + "github.com/itbasis/gdecimal/internal/converter" "github.com/onsi/gomega/format" - - "github.com/shopspring/decimal" ) type BeEquivalentToMatcher struct { - Expected decimal.Decimal + Expected interface{} } func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, err error) { - if actual == nil { - return false, ErrActualNotBeNil - } - - if actualDecimal, ok := actual.(decimal.Decimal); ok { - return actualDecimal.Equal(matcher.Expected), nil + actualDecimal, errActual := converter.ToDecimal(actual) + if errActual != nil { + return false, errActual //nolint:wrapcheck } - if s, ok := actual.(string); ok { - actualDecimal, err := decimal.NewFromString(s) - if err != nil { - return false, ErrFailedConvertStringToDecimal - } - - return actualDecimal.Equal(matcher.Expected), nil + expectedDecimal, errExpected := converter.ToDecimal(matcher.Expected) + if errExpected != nil { + return false, errExpected //nolint:wrapcheck } - return false, ErrNotSupportedValue + return actualDecimal.Equal(expectedDecimal), nil } func (matcher *BeEquivalentToMatcher) FailureMessage(actual interface{}) (message string) { diff --git a/matchers/be_equivalent_to_matcher_suite_test.go b/internal/matchers/be_equivalent_to_matcher_suite_test.go similarity index 81% rename from matchers/be_equivalent_to_matcher_suite_test.go rename to internal/matchers/be_equivalent_to_matcher_suite_test.go index f99fb52..bba7f42 100644 --- a/matchers/be_equivalent_to_matcher_suite_test.go +++ b/internal/matchers/be_equivalent_to_matcher_suite_test.go @@ -10,5 +10,5 @@ import ( func TestDecimalBeEquivalentToMatcher(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "DecimalBeEquivalentToMatcher Suite") + RunSpecs(t, "Matchers Suite") } diff --git a/internal/matchers/be_equivalent_to_matcher_test.go b/internal/matchers/be_equivalent_to_matcher_test.go new file mode 100644 index 0000000..3831819 --- /dev/null +++ b/internal/matchers/be_equivalent_to_matcher_test.go @@ -0,0 +1,129 @@ +package matchers_test + +import ( + "fmt" + + gdecimalErrors "github.com/itbasis/gdecimal/errors" + converterTestData "github.com/itbasis/gdecimal/internal/converter/test-data" + "github.com/itbasis/gdecimal/internal/matchers" + . "github.com/onsi/ginkgo/v2" //nolint:revive + . "github.com/onsi/gomega" //nolint:revive + "github.com/shopspring/decimal" +) + +var _ = Describe( + "asserting on nil", func() { + success, err := (&matchers.BeEquivalentToMatcher{Expected: decimal.NewFromInt(1)}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }, +) + +var _ = DescribeTable( + "passed matchers", func(expected decimal.Decimal, actual interface{}) { + Ω((&matchers.BeEquivalentToMatcher{Expected: expected}).Match(actual)).Should(BeTrue()) + }, + Entry(nil, decimal.NewFromInt(1), decimal.NewFromInt(1)), + Entry(nil, decimal.New(1, 1), decimal.New(1, 1)), + Entry(nil, decimal.New(1, 0), decimal.RequireFromString("1")), + Entry(nil, decimal.New(1, 1), decimal.RequireFromString("10")), + Entry(nil, decimal.New(11, -1), decimal.RequireFromString("1.1")), + Entry(nil, decimal.NewFromInt(1), "1"), + Entry(nil, decimal.New(1, 1), "10"), + Entry(nil, decimal.New(11, 1), "110"), + Entry(nil, decimal.New(11, -1), "1.1"), +) + +var _ = DescribeTable( + "passed matchers (Not)", func(expected decimal.Decimal, actual interface{}) { + Ω((&matchers.BeEquivalentToMatcher{Expected: expected}).Match(actual)).ShouldNot(BeTrue()) + }, + Entry(nil, decimal.NewFromInt(1), decimal.NewFromInt(2)), + Entry(nil, decimal.New(1, 1), decimal.New(1, 2)), + Entry(nil, decimal.New(1, 1), decimal.New(2, 1)), + Entry(nil, decimal.NewFromInt(1), "2"), + Entry(nil, decimal.New(1, 1), "1"), + Entry(nil, decimal.New(1, 1), "20"), + Entry(nil, decimal.New(1, 1), "1.1"), +) + +var _ = DescribeTable( + "should use the matcher's failure", + func(expected, actual interface{}, expectedValue, actualValue string) { + matcher := &matchers.BeEquivalentToMatcher{Expected: expected} + Ω(matcher.Match(actual)).Should(BeFalse()) + }, + Entry( + nil, + decimal.NewFromInt(10), + decimal.NewFromInt(1), + "{neg: false, abs: [10]},\n exp: 0,\n }", + "{neg: false, abs: [1]},\n exp: 0,\n }", + ), + Entry( + nil, + decimal.New(11, -1), + decimal.NewFromInt(11), + "{neg: false, abs: [11]},\n exp: -1,\n }", + "{neg: false, abs: [11]},\n exp: 0,\n }", + ), +) + +var _ = DescribeTable( + "should use the matcher's failure messages", + func(expected, actual interface{}, expectedValue string) { + matcher := &matchers.BeEquivalentToMatcher{Expected: expected} + Ω(matcher.FailureMessage(actual)).Should( + Equal( + fmt.Sprintf( + "Expected\n : %s\nto be equivalent to\n : {\n value: %s", + actual, + expectedValue, + ), + ), + ) + + Ω(matcher.NegatedFailureMessage(actual)).Should( + Equal( + fmt.Sprintf( + "Expected\n : %s\nnot to be equivalent to\n : {\n value: %s", + actual, + expectedValue, + ), + ), + ) + }, + Entry( + nil, + decimal.NewFromInt(10), + "1", + "{neg: false, abs: [10]},\n exp: 0,\n }", + ), + Entry( + nil, + decimal.New(11, -1), + "11", + "{neg: false, abs: [11]},\n exp: -1,\n }", + ), +) + +var _ = Describe( + "asserting failed convert", func() { + DescribeTable( + "actual on failure string", func(value string) { + success, err := (&matchers.BeEquivalentToMatcher{Expected: decimal.Decimal{}}).Match(value) + Ω(success).To(BeFalse()) + Ω(err).Should(MatchError(gdecimalErrors.ErrFailedConvertStringToDecimal)) + }, + converterTestData.AssertingOnStringFailureEntries, + ) + DescribeTable( + "expected on failure string", func(value string) { + success, err := (&matchers.BeEquivalentToMatcher{Expected: value}).Match(decimal.Decimal{}) + Ω(success).To(BeFalse()) + Ω(err).Should(MatchError(gdecimalErrors.ErrFailedConvertStringToDecimal)) + }, + converterTestData.AssertingOnStringFailureEntries, + ) + }, +) diff --git a/matchers.go b/matchers.go index 27951d8..1b37e7b 100644 --- a/matchers.go +++ b/matchers.go @@ -1,10 +1,9 @@ package gdecimal import ( - "github.com/itbasis/gdecimal/matchers" - "github.com/shopspring/decimal" + "github.com/itbasis/gdecimal/internal/matchers" ) -func BeDecimalEquivalentTo(expect decimal.Decimal) *matchers.BeEquivalentToMatcher { +func BeDecimalEquivalentTo(expect interface{}) *matchers.BeEquivalentToMatcher { return &matchers.BeEquivalentToMatcher{Expected: expect} } diff --git a/matchers/be_equivalent_to_matcher_test.go b/matchers/be_equivalent_to_matcher_test.go deleted file mode 100644 index 4654d0e..0000000 --- a/matchers/be_equivalent_to_matcher_test.go +++ /dev/null @@ -1,137 +0,0 @@ -package matchers_test - -import ( - "fmt" - - . "github.com/itbasis/gdecimal" //nolint:revive - "github.com/itbasis/gdecimal/matchers" - . "github.com/onsi/ginkgo/v2" //nolint:revive - . "github.com/onsi/gomega" //nolint:revive - "github.com/shopspring/decimal" -) - -var _ = Describe( - "asserting on nil", func() { - success, err := (&matchers.BeEquivalentToMatcher{Expected: decimal.NewFromInt(1)}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }, -) - -var _ = Describe( - "asserting on Decimal", func() { - DescribeTable( - "passed matchers", func(expected decimal.Decimal, actual interface{}) { - Ω((&matchers.BeEquivalentToMatcher{Expected: expected}).Match(actual)).Should(BeTrue()) - }, - Entry(nil, decimal.NewFromInt(1), decimal.NewFromInt(1)), - Entry(nil, decimal.New(1, 1), decimal.New(1, 1)), - Entry(nil, decimal.New(1, 0), decimal.RequireFromString("1")), - Entry(nil, decimal.New(1, 1), decimal.RequireFromString("10")), - Entry(nil, decimal.New(11, -1), decimal.RequireFromString("1.1")), - ) - - DescribeTable( - "passed matchers (Not)", func(expected decimal.Decimal, actual interface{}) { - Ω((&matchers.BeEquivalentToMatcher{Expected: expected}).Match(actual)).ShouldNot(BeTrue()) - }, - Entry(nil, decimal.NewFromInt(1), decimal.NewFromInt(2)), - Entry(nil, decimal.New(1, 1), decimal.New(1, 2)), - Entry(nil, decimal.New(1, 1), decimal.New(2, 1)), - ) - - DescribeTable( - "should use the matcher's failure message (as Decimal)", - func(expected decimal.Decimal, actual interface{}, expectedValue, actualValue string) { - expectedErr := fmt.Sprintf( - "Expected\n : {\n value: %s\nto be equivalent to\n : {\n value: %s", - actualValue, - expectedValue, - ) - - err := InterceptGomegaFailure( - func() { - Ω(actual).Should(BeDecimalEquivalentTo(expected)) - }, - ) - Ω(err.Error()).Should(Equal(expectedErr)) - - matcher := &matchers.BeEquivalentToMatcher{Expected: expected} - Ω(matcher.Match(actual)).Should(BeFalse()) - Ω(matcher.FailureMessage(actual)).Should(Equal(expectedErr)) - }, - Entry( - nil, - decimal.NewFromInt(10), - decimal.NewFromInt(1), - "{neg: false, abs: [10]},\n exp: 0,\n }", - "{neg: false, abs: [1]},\n exp: 0,\n }", - ), - Entry( - nil, - decimal.New(11, -1), - decimal.NewFromInt(11), - "{neg: false, abs: [11]},\n exp: -1,\n }", - "{neg: false, abs: [11]},\n exp: 0,\n }", - ), - ) - }, -) - -var _ = Describe( - "asserting on string", func() { - DescribeTable( - "passed matchers", func(expected decimal.Decimal, actual interface{}) { - Ω((&matchers.BeEquivalentToMatcher{Expected: expected}).Match(actual)).Should(BeTrue()) - }, - Entry(nil, decimal.NewFromInt(1), "1"), - Entry(nil, decimal.New(1, 1), "10"), - Entry(nil, decimal.New(11, 1), "110"), - Entry(nil, decimal.New(11, -1), "1.1"), - ) - - DescribeTable( - "passed matchers (Not)", func(expected decimal.Decimal, actual interface{}) { - Ω((&matchers.BeEquivalentToMatcher{Expected: expected}).Match(actual)).ShouldNot(BeTrue()) - }, - Entry(nil, decimal.NewFromInt(1), "2"), - Entry(nil, decimal.New(1, 1), "1"), - Entry(nil, decimal.New(1, 1), "20"), - Entry(nil, decimal.New(1, 1), "1.1"), - ) - - DescribeTable( - "should use the matcher's failure message", - func(expected decimal.Decimal, actual interface{}, expectedValue string) { - expectedErr := fmt.Sprintf( - "Expected\n : %s\nto be equivalent to\n : {\n value: %s", - actual, - expectedValue, - ) - - err := InterceptGomegaFailure( - func() { - Ω(actual).Should(BeDecimalEquivalentTo(expected)) - }, - ) - Ω(err.Error()).Should(Equal(expectedErr)) - - matcher := &matchers.BeEquivalentToMatcher{Expected: expected} - Ω(matcher.Match(actual)).Should(BeFalse()) - Ω(matcher.FailureMessage(actual)).Should(Equal(expectedErr)) - }, - Entry( - nil, - decimal.NewFromInt(10), - "1", - "{neg: false, abs: [10]},\n exp: 0,\n }", - ), - Entry( - nil, - decimal.New(11, -1), - "11", - "{neg: false, abs: [11]},\n exp: -1,\n }", - ), - ) - }, -) diff --git a/matchers_suite_test.go b/matchers_suite_test.go new file mode 100644 index 0000000..e2b3189 --- /dev/null +++ b/matchers_suite_test.go @@ -0,0 +1,14 @@ +package gdecimal_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" //nolint:revive + . "github.com/onsi/gomega" //nolint:revive +) + +func TestConverter(t *testing.T) { + RegisterFailHandler(Fail) + + RunSpecs(t, "gdecimal Suite") +} diff --git a/matchers_test.go b/matchers_test.go new file mode 100644 index 0000000..b587503 --- /dev/null +++ b/matchers_test.go @@ -0,0 +1,37 @@ +package gdecimal_test + +import ( + "github.com/itbasis/gdecimal" + "github.com/itbasis/gdecimal/errors" + . "github.com/onsi/ginkgo/v2" //nolint:revive + . "github.com/onsi/gomega" //nolint:revive + "github.com/shopspring/decimal" +) + +var _ = Describe( + "asserting on nil", func() { + It( + "actual is nil", func() { + Ω( + InterceptGomegaFailure( + func() { + Ω(nil).To(gdecimal.BeDecimalEquivalentTo(decimal.Decimal{})) + }, + ), + ).Error().To(Equal(errors.ErrNotBeNil)) + }, + ) + + It( + "expected is nil", func() { + Ω( + InterceptGomegaFailure( + func() { + Ω(decimal.Decimal{}).To(gdecimal.BeDecimalEquivalentTo(nil)) + }, + ), + ).Error().To(Equal(errors.ErrNotBeNil)) + }, + ) + }, +)