nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: MarvinJWendt/testza
Pull request #80 (2022-02-14 10:30:12)

Added more tests for capturing output


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff167d5..39c836f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,9 @@
 <a name="unreleased"></a>
 ## [Unreleased]
 
+### Test
+- **capture:** added more tests for output capturing
+
 
 <a name="v0.2.14"></a>
 ## [v0.2.14] - 2022-01-16
diff --git a/README.md b/README.md
index eeeb560..5f6a276 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
 </a>
 
 <a href="https://codecov.io/gh/MarvinJWendt/testza">
-<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-3130-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
+<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-3138-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
 </a>
   
 <a href="https://pkg.go.dev/github.com/MarvinJWendt/testza" target="_blank">


Test patch:
diff --git a/capture_test.go b/capture_test.go
index f7dfaf1..3e03b44 100644
--- a/capture_test.go
+++ b/capture_test.go
@@ -20,6 +20,7 @@ func TestCaptureStdout(t *testing.T) {
 	}{
 		{args: args{capture: func(w io.Writer) error { fmt.Print("Hello, World!"); return nil }}, want: "Hello, World!"},
 		{args: args{capture: func(w io.Writer) error { fmt.Print(" Hello, World! "); return nil }}, want: " Hello, World! "},
+		{args: args{capture: func(w io.Writer) error { fmt.Fprint(w, "Hello, World!"); return nil }}, want: "Hello, World!"},
 		{args: args{capture: func(w io.Writer) error { fmt.Print("H\ne\nl\nl\nl\no\n\n\n\nWorld!"); return nil }}, want: "H\ne\nl\nl\nl\no\n\n\n\nWorld!"},
 		{args: args{capture: func(w io.Writer) error { fmt.Println("Hello, World!"); return nil }}, want: "Hello, World!\n"},
 		{args: args{capture: func(w io.Writer) error { fmt.Println("Hello, \nWorld!"); return nil }}, want: "Hello, \nWorld!\n"},
@@ -44,6 +45,7 @@ func TestCaptureStderr(t *testing.T) {
 	}{
 		{args: args{capture: func(w io.Writer) error { fmt.Fprint(os.Stderr, "Hello, World!"); return nil }}, want: "Hello, World!"},
 		{args: args{capture: func(w io.Writer) error { fmt.Fprint(os.Stderr, " Hello, World! "); return nil }}, want: " Hello, World! "},
+		{args: args{capture: func(w io.Writer) error { fmt.Fprint(w, "Hello, World!"); return nil }}, want: "Hello, World!"},
 		{args: args{capture: func(w io.Writer) error { fmt.Fprint(os.Stderr, "H\ne\nl\nl\nl\no\n\n\n\nWorld!"); return nil }}, want: "H\ne\nl\nl\nl\no\n\n\n\nWorld!"},
 		{args: args{capture: func(w io.Writer) error { fmt.Fprintln(os.Stderr, "Hello, World!"); return nil }}, want: "Hello, World!\n"},
 		{args: args{capture: func(w io.Writer) error { fmt.Fprintln(os.Stderr, "Hello, \nWorld!"); return nil }}, want: "Hello, \nWorld!\n"},
Repository: MarvinJWendt/testza
Pull request #106 (2022-04-03 23:26:22)

Moved docs from `doc.go` to `testza.go`
Moved docs from `doc.go` to `testza.go`


Patch:
diff --git a/README.md b/README.md
index b43e58f..2320dd2 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
 </a>
 
 <a href="https://codecov.io/gh/MarvinJWendt/testza">
-<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-3158-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
+<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-3156-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
 </a>
   
 <a href="https://pkg.go.dev/github.com/MarvinJWendt/testza" target="_blank">
diff --git a/doc.go b/doc.go
deleted file mode 100644
index ab1fdc0..0000000
--- a/doc.go
+++ /dev/null
@@ -1,4 +0,0 @@
-/*
-Package testza is a full-featured testing framework for Go. It integrates with the default test runner, so you can use it with the standard `go test` tool. Testza contains easy to use methods, like assertions, output capturing, mocking, and much more.
-*/
-package testza


Test patch:
diff --git a/testza.go b/testza.go
index 9f10a3c..58d6b42 100644
--- a/testza.go
+++ b/testza.go
@@ -1,3 +1,6 @@
+/*
+Package testza is a full-featured testing framework for Go. It integrates with the default test runner, so you can use it with the standard `go test` tool. Testza contains easy to use methods, like assertions, output capturing, mocking, and much more.
+*/
 package testza
 
 import (
Repository: MarvinJWendt/testza
Pull request #159 (2022-04-10 13:23:57)

Added `FuzzUtilDistinctSet`


Patch:
diff --git a/README.md b/README.md
index 809b78e..fc03738 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
 </a>
 
 <a href="https://codecov.io/gh/MarvinJWendt/testza">
-<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-2993-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
+<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-3004-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
 </a>
   
 <a href="https://pkg.go.dev/github.com/MarvinJWendt/testza" target="_blank">


Test patch:
diff --git a/fuzz_test.go b/fuzz_test.go
index 0fabe55..c1a0864 100644
--- a/fuzz_test.go
+++ b/fuzz_test.go
@@ -55,6 +55,11 @@ func TestFuzzUtilLimitSet(t *testing.T) {
 	}
 }
 
+func TestFuzzUtilDistinctSet(t *testing.T) {
+	AssertEqual(t, FuzzUtilDistinctSet([]string{"A", "B", "B", "A", "C"}), []string{"A", "B", "C"})
+	AssertEqual(t, FuzzUtilDistinctSet([]int{1, 2, 2, 1, 3}), []int{1, 2, 3})
+}
+
 //endregion
 
 //region FuzzString
Repository: MarvinJWendt/testza
Pull request #162 (2022-04-25 09:31:38)

added `FuzzUtilMergeSets`


Patch:
diff --git a/README.md b/README.md
index fc03738..cb6aff9 100644
--- a/README.md
+++ b/README.md
@@ -232,6 +232,7 @@ testza.FuzzStringRunTests(t, emailAddresses, func(t *testing.T, index int, str s
 
   - [FuzzUtilDistinctSet](https://github.com/MarvinJWendt/testza#FuzzUtilDistinctSet)
   - [FuzzUtilLimitSet](https://github.com/MarvinJWendt/testza#FuzzUtilLimitSet)
+  - [FuzzUtilMergeSets](https://github.com/MarvinJWendt/testza#FuzzUtilMergeSets)
   - [FuzzUtilModifySet](https://github.com/MarvinJWendt/testza#FuzzUtilModifySet)
   - [FuzzUtilRunTests](https://github.com/MarvinJWendt/testza#FuzzUtilRunTests)
 </td>
@@ -1443,6 +1444,19 @@ Example:
 
     limitedSet := testza.FuzzUtilLimitSet(testza.FuzzStringFull(), 10)
 
+#### FuzzUtilMergeSets
+
+```go
+func FuzzUtilMergeSets[setType any](sets ...[]setType) (merged []setType)
+```
+
+FuzzUtilMergeSets merges multiple test sets into one. All test sets must
+have the same type.
+
+Example:
+
+    mergedSet := testza.FuzzUtilMergeSets(testza.FuzzIntGenerateRandomNegative(3, 0), testza.FuzzIntGenerateRandomPositive(2, 0))
+
 #### FuzzUtilModifySet
 
 ```go
diff --git a/fuzz-utils.go b/fuzz-utils.go
index 43bd79f..fb5bcfd 100644
--- a/fuzz-utils.go
+++ b/fuzz-utils.go
@@ -7,6 +7,19 @@ import (
 	"github.com/MarvinJWendt/testza/internal"
 )
 
+// FuzzUtilMergeSets merges multiple test sets into one.
+// All test sets must have the same type.
+//
+// Example:
+//  mergedSet := testza.FuzzUtilMergeSets(testza.FuzzIntGenerateRandomNegative(3, 0), testza.FuzzIntGenerateRandomPositive(2, 0))
+func FuzzUtilMergeSets[setType any](sets ...[]setType) (merged []setType) {
+	for _, set := range sets {
+		merged = append(merged, set...)
+	}
+
+	return merged
+}
+
 // FuzzUtilRunTests runs a test for every value in a testset.
 // You can use the value as input parameter for your functions, to sanity test against many different cases.
 // This ensures that your functions have a correct error handling and enables you to test against hunderts of cases easily.


Test patch:
diff --git a/fuzz_test.go b/fuzz_test.go
index c1a0864..2860db0 100644
--- a/fuzz_test.go
+++ b/fuzz_test.go
@@ -10,6 +10,23 @@ import (
 )
 
 //region FuzzUtil
+
+func TestFuzzUtilMergeSets(t *testing.T) {
+	t.Run("String", func(t *testing.T) {
+		set1 := []string{"A", "B", "C"}
+		set2 := []string{"D", "E", "F"}
+		expected := []string{"A", "B", "C", "D", "E", "F"}
+		AssertEqual(t, expected, FuzzUtilMergeSets(set1, set2))
+	})
+
+	t.Run("Int", func(t *testing.T) {
+		set1 := []int{1, 2, 3}
+		set2 := []int{4, 5, 6}
+		expected := []int{1, 2, 3, 4, 5, 6}
+		AssertEqual(t, expected, FuzzUtilMergeSets(set1, set2))
+	})
+}
+
 func TestFuzzUtilModifySet(t *testing.T) {
 	t.Run("String Slice", func(t *testing.T) {
 		slice := []string{"Hello", "World", "TeSt"}
Repository: Masterminds/semver
Pull request #106 (2019-08-29 20:23:47)

Fix handling prerelease when sorting alphanum and num


Patch:
diff --git a/version.go b/version.go
index d2676dd..5aa2e44 100644
--- a/version.go
+++ b/version.go
@@ -547,10 +547,14 @@ func comparePrePart(s, o string) int {
 	}
 
 	// When comparing strings "99" is greater than "103". To handle
-	// cases like this we need to detect numbers and compare them.
-
-	oi, n1 := strconv.ParseInt(o, 10, 64)
-	si, n2 := strconv.ParseInt(s, 10, 64)
+	// cases like this we need to detect numbers and compare them. According
+	// to the semver spec, numbers are always positive. If there is a - at the
+	// start like -99 this is to be evaluated as an alphanum. numbers always
+	// have precedence over alphanum. Parsing as Uints because negative numbers
+	// are ignored.
+
+	oi, n1 := strconv.ParseUint(o, 10, 64)
+	si, n2 := strconv.ParseUint(s, 10, 64)
 
 	// The case where both are strings compare the strings
 	if n1 != nil && n2 != nil {


Test patch:
diff --git a/version_test.go b/version_test.go
index c0361aa..b44e305 100644
--- a/version_test.go
+++ b/version_test.go
@@ -14,6 +14,7 @@ func TestNewVersion(t *testing.T) {
 		{"1.2.3", false},
 		{"1.2.3-alpha.01", true},
 		{"1.2.3+test.01", false},
+		{"1.2.3-alpha.-1", false},
 		{"v1.2.3", true},
 		{"1.0", true},
 		{"v1.0", true},
@@ -59,6 +60,7 @@ func TestCoerceNewVersion(t *testing.T) {
 		{"1.2.3", false},
 		{"1.2.3-alpha.01", true},
 		{"1.2.3+test.01", false},
+		{"1.2.3-alpha.-1", false},
 		{"v1.2.3", false},
 		{"1.0", false},
 		{"v1.0", false},
@@ -210,6 +212,9 @@ func TestCompare(t *testing.T) {
 		{"4.2-beta.2", "4.2-beta", 1},
 		{"4.2-beta.foo", "4.2-beta", 1},
 		{"1.2+bar", "1.2+baz", 0},
+		{"1.0.0-beta.4", "1.0.0-beta.-2", -1},
+		{"1.0.0-beta.-2", "1.0.0-beta.-3", -1},
+		{"1.0.0-beta.-3", "1.0.0-beta.5", 1},
 	}
 
 	for _, tc := range tests {
Repository: Masterminds/semver
Pull request #131 (2019-10-21 17:56:23)

Add support for SQL
implement the `driver.Valuer` and `sql.Scanner` interfaces to support using `Version` type as a database field

- `sql.Scanner`: https://golang.org/pkg/database/sql/#Scanner
- `driver.Valuer`: https://golang.org/pkg/database/sql/driver/#Valuer


Patch:
diff --git a/version.go b/version.go
index 1bb95f2..d6b9cda 100644
--- a/version.go
+++ b/version.go
@@ -2,6 +2,7 @@ package semver
 
 import (
 	"bytes"
+	"database/sql/driver"
 	"encoding/json"
 	"errors"
 	"fmt"
@@ -435,6 +436,28 @@ func (v Version) MarshalJSON() ([]byte, error) {
 	return json.Marshal(v.String())
 }
 
+// Scan implements the SQL.Scanner interface.
+func (v *Version) Scan(value interface{}) error {
+	var s string
+	s, _ = value.(string)
+	temp, err := NewVersion(s)
+	if err != nil {
+		return err
+	}
+	v.major = temp.major
+	v.minor = temp.minor
+	v.patch = temp.patch
+	v.pre = temp.pre
+	v.metadata = temp.metadata
+	v.original = temp.original
+	return nil
+}
+
+// Value implements the Driver.Valuer interface.
+func (v Version) Value() (driver.Value, error) {
+	return v.String(), nil
+}
+
 func compareSegment(v, o uint64) int {
 	if v < o {
 		return -1


Test patch:
diff --git a/version_test.go b/version_test.go
index d3f925e..0f690f4 100644
--- a/version_test.go
+++ b/version_test.go
@@ -1,6 +1,7 @@
 package semver
 
 import (
+	"database/sql"
 	"encoding/json"
 	"fmt"
 	"testing"
@@ -541,6 +542,41 @@ func TestJsonUnmarshal(t *testing.T) {
 	}
 }
 
+func TestSQLScanner(t *testing.T) {
+	sVer := "1.1.1"
+	x, err := StrictNewVersion(sVer)
+	if err != nil {
+		t.Errorf("Error creating version: %s", err)
+	}
+	var s sql.Scanner = x
+	var out *Version
+	var ok bool
+	if out, ok = s.(*Version); !ok {
+		t.Errorf("Error expected Version type, got=%T want=%T", s, Version{})
+	}
+	got := out.String()
+	want := sVer
+	if got != want {
+		t.Errorf("Error sql scanner unexpected scan content: got=%q want=%q", got, want)
+	}
+}
+
+func TestDriverValuer(t *testing.T) {
+	sVer := "1.1.1"
+	x, err := StrictNewVersion(sVer)
+	if err != nil {
+		t.Errorf("Error creating version: %s", err)
+	}
+	got, err := x.Value()
+	if err != nil {
+		t.Fatalf("Error getting value, got %v", err)
+	}
+	want := sVer
+	if got != want {
+		t.Errorf("Error driver valuer unexpected value content: got=%q want=%q", got, want)
+	}
+}
+
 func TestValidatePrerelease(t *testing.T) {
 	tests := []struct {
 		pre      string
Repository: Masterminds/semver
Pull request #181 (2022-08-03 07:13:58)

Add minor version check for caret (^) when minor version in constraint is 0(zero)
This PR aims to fix https://github.com/Masterminds/semver/issues/180
 
Please take a look when you can 😄 


Patch:
diff --git a/.golangci.yml b/.golangci.yml
index fdbdf14..c87d1c4 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -4,23 +4,27 @@ run:
 linters:
   disable-all: true
   enable:
+    - misspell
+    - structcheck
+    - govet
+    - staticcheck
     - deadcode
-    - dupl
     - errcheck
-    - gofmt
-    - goimports
-    - golint
-    - gosimple
-    - govet
+    - varcheck
+    - unparam
     - ineffassign
-    - misspell
     - nakedret
-    - structcheck
+    - gocyclo
+    - dupl
+    - goimports
+    - revive
+    - gosec
+    - gosimple
+    - typecheck
     - unused
-    - varcheck
 
 linters-settings:
   gofmt:
     simplify: true
   dupl:
-    threshold: 400
+    threshold: 600
diff --git a/constraints.go b/constraints.go
index 547613f..b7dd045 100644
--- a/constraints.go
+++ b/constraints.go
@@ -534,6 +534,10 @@ func constraintCaret(v *Version, c *constraint) (bool, error) {
 		}
 		return false, fmt.Errorf("%s does not have same minor version as %s. Expected minor versions to match when constraint major version is 0", v, c.orig)
 	}
+	// ^ when the minor is 0 and minor > 0 is =0.0.z
+	if c.con.Minor() == 0 && v.Minor() > 0 {
+		return false, fmt.Errorf("%s does not have same minor version as %s", v, c.orig)
+	}
 
 	// At this point the major is 0 and the minor is 0 and not dirty. The patch
 	// is not dirty so we need to check if they are equal. If they are not equal


Test patch:
diff --git a/constraints_test.go b/constraints_test.go
index 0504399..6a75a16 100644
--- a/constraints_test.go
+++ b/constraints_test.go
@@ -362,6 +362,8 @@ func TestConstraintsCheck(t *testing.T) {
 		{"^1.x", "1.1.1-beta1", false},
 		{"^1.1.2-alpha", "1.2.1-beta1", true},
 		{"^1.2.x-alpha", "1.1.1-beta1", false},
+		{"^0.0.1", "0.0.1", true},
+		{"^0.0.1", "0.3.1", false},
 		{"~*", "2.1.1", true},
 		{"~1", "2.1.1", false},
 		{"~1", "1.3.5", true},
@@ -598,7 +600,7 @@ func TestConstraintsValidate(t *testing.T) {
 		{"^1.x", "2.1.1", "2.1.1 does not have same major version as 1.x"},
 		{"^0.2", "0.3.0", "0.3.0 does not have same minor version as 0.2. Expected minor versions to match when constraint major version is 0"},
 		{"^0.2", "0.1.1", "0.1.1 is less than 0.2"},
-		{"^0.0.3", "0.1.1", "0.1.1 does not equal 0.0.3. Expect version and constraint to equal when major and minor versions are 0"},
+		{"^0.0.3", "0.1.1", "0.1.1 does not have same minor version as 0.0.3"},
 		{"^0.0.3", "0.0.4", "0.0.4 does not equal 0.0.3. Expect version and constraint to equal when major and minor versions are 0"},
 		{"^0.0.3", "0.0.2", "0.0.2 is less than 0.0.3"},
 		{"~1", "2.1.2", "2.1.2 does not have same major version as 1"},
Repository: Masterminds/semver
Pull request #213 (2023-07-28 10:08:56)

feat: nil version equality
This changes the Equal method to return true for 2 nil values and false if any one of the values is nil. Previously passing a nil value would have resulted in a panic.



Patch:
diff --git a/version.go b/version.go
index 7c4bed3..3acbe5b 100644
--- a/version.go
+++ b/version.go
@@ -390,6 +390,12 @@ func (v *Version) GreaterThan(o *Version) bool {
 // Note, versions can be equal with different metadata since metadata
 // is not considered part of the comparable version.
 func (v *Version) Equal(o *Version) bool {
+	if v == o {
+		return true
+	}
+	if v == nil || o == nil {
+		return false
+	}
 	return v.Compare(o) == 0
 }
 


Test patch:
diff --git a/version_test.go b/version_test.go
index 16156dd..be8f609 100644
--- a/version_test.go
+++ b/version_test.go
@@ -343,28 +343,21 @@ func TestGreaterThan(t *testing.T) {
 
 func TestEqual(t *testing.T) {
 	tests := []struct {
-		v1       string
-		v2       string
+		v1       *Version
+		v2       *Version
 		expected bool
 	}{
-		{"1.2.3", "1.5.1", false},
-		{"2.2.3", "1.5.1", false},
-		{"3.2-beta", "3.2-beta", true},
-		{"3.2-beta+foo", "3.2-beta+bar", true},
+		{MustParse("1.2.3"), MustParse("1.5.1"), false},
+		{MustParse("2.2.3"), MustParse("1.5.1"), false},
+		{MustParse("3.2-beta"), MustParse("3.2-beta"), true},
+		{MustParse("3.2-beta+foo"), MustParse("3.2-beta+bar"), true},
+		{nil, nil, true},
+		{nil, MustParse("1.2.3"), false},
+		{MustParse("1.2.3"), nil, false},
 	}
 
 	for _, tc := range tests {
-		v1, err := NewVersion(tc.v1)
-		if err != nil {
-			t.Errorf("Error parsing version: %s", err)
-		}
-
-		v2, err := NewVersion(tc.v2)
-		if err != nil {
-			t.Errorf("Error parsing version: %s", err)
-		}
-
-		a := v1.Equal(v2)
+		a := tc.v1.Equal(tc.v2)
 		e := tc.expected
 		if a != e {
 			t.Errorf(
Repository: exadel-inc/esl
Pull request #66 (2021-02-24 13:16:46)

fix: format utility support for multiple replacements


Patch:
diff --git a/src/modules/esl-utils/misc/format.ts b/src/modules/esl-utils/misc/format.ts
index d1cebdd2d..3c1a2402f 100644
--- a/src/modules/esl-utils/misc/format.ts
+++ b/src/modules/esl-utils/misc/format.ts
@@ -40,7 +40,7 @@ export function evaluate(str: string, defaultValue?: any): any {
 
 /** Replace '{key}' patterns in the string from the source object */
 export function format(str: string, source: Record<string, any>) {
-  return str.replace(/{([\w.]+)}/, (match, key) => {
+  return str.replace(/{([\w.]+)}/g, (match, key) => {
     const val = get(source, key);
     return val === undefined ? match : val;
   });


Test patch:
diff --git a/src/modules/esl-utils/misc/test/format.test.ts b/src/modules/esl-utils/misc/test/format.test.ts
index 16b0bc5a4..83337a8ad 100644
--- a/src/modules/esl-utils/misc/test/format.test.ts
+++ b/src/modules/esl-utils/misc/test/format.test.ts
@@ -59,12 +59,15 @@ describe('misc/format helper tests', () => {
     expect(throwError).toBe(true);
     expect(evaluate('{', 'no')).toBe('no');
   });
-  describe('compile', () => {
+
+  describe('format', () => {
     test.each([
       ['abc', {}, 'abc'],
       ['abc{val}', {val: 'd'}, 'abcd'],
       ['{a.b.c}', {a: {b: {c: 'hi'}}}, 'hi'],
       ['{a}', {}, '{a}'],
+      ['{a} - {b} - {c}', {a: 1, b: 2, c: 3}, '1 - 2 - 3'],
+      ['{a.b}{b.c}', {a: {b: 'h'}, b: {c: 'i'}}, 'hi'],
     ])('\'%s\' using %p to \'%s\'', (tmp: string, source: any, res: string) => {
       expect(format(tmp, source)).toBe(res);
     });
Repository: exadel-inc/esl
Pull request #67 (2021-02-24 13:29:10)

fix: memoize context for class member decoration
Fix memoize decorator


Patch:
diff --git a/src/modules/esl-utils/decorators/memoize.ts b/src/modules/esl-utils/decorators/memoize.ts
index 41885be0d..75d7612d0 100644
--- a/src/modules/esl-utils/decorators/memoize.ts
+++ b/src/modules/esl-utils/decorators/memoize.ts
@@ -10,16 +10,30 @@ export function memoize<H extends MemoHashFn>(hashFn: H): MethodTypedDecorator<(
  */
 export function memoize(hashFn: MemoHashFn = defaultArgsHashFn) {
   return function (target: any, prop: string, descriptor: TypedPropertyDescriptor<any>) {
+    const isPrototype = Object.hasOwnProperty.call(target, 'constructor');
     if (descriptor && typeof descriptor.value === 'function') {
-      descriptor.value = memoizeFn(descriptor.value, hashFn);
+      descriptor.value = isPrototype ?
+        memoizeMember(descriptor.value, prop, false, hashFn) :
+        memoizeFn(descriptor.value, hashFn);
     } else if (descriptor && typeof descriptor.get === 'function') {
-      descriptor.get = memoizeFn(descriptor.get, hashFn);
+      descriptor.get = isPrototype ?
+        memoizeMember(descriptor.get, prop, true, hashFn) :
+        memoizeFn(descriptor.get, hashFn);
     } else {
       throw new TypeError('Only get accessors or class methods can be decorated via @memoize');
     }
   };
 }
 
+/** Cache memo function in the current context on call */
+function memoizeMember(originalMethod: any, prop: string, isGetter: boolean, hashFn: MemoHashFn) {
+  return function (this: any, ...args: any[]): any {
+    const memo = memoizeFn(originalMethod, hashFn);
+    Object.defineProperty(this, prop, isGetter ? { get: memo } : { value: memo });
+    return memo.apply(this, args);
+  };
+}
+
 /**
  * Clear memoization cache for passed target and property.
  * Accepts not own properties.


Test patch:
diff --git a/src/modules/esl-utils/decorators/test/memoize.test.ts b/src/modules/esl-utils/decorators/test/memoize.test.ts
index a77328716..261468147 100644
--- a/src/modules/esl-utils/decorators/test/memoize.test.ts
+++ b/src/modules/esl-utils/decorators/test/memoize.test.ts
@@ -89,6 +89,36 @@ describe('common @memoize decorator test', () => {
     });
   });
 
+  describe('cashed result instance check', () => {
+    class A {}
+
+    class TestClass {
+      @memoize() get test() { return new A(); }
+
+      @memoize()
+      static get test() { return new A() }
+    }
+
+    const instance1 = new TestClass();
+    const instance2 = new TestClass();
+
+    test('accessor', () => {
+      const res1 = instance1.test;
+      const res2 = instance1.test;
+      const res3 = instance2.test;
+
+      expect(res1).toBe(res2);
+      expect(res1).not.toBe(res3);
+    });
+
+    test('static accessor', () => {
+      const res1 = TestClass.test;
+      const res2 = TestClass.test;
+
+      expect(res1).toBe(res2);
+    });
+  });
+
   test('deprecated target',  () => {
     expect(function() {
       class TestClass {