nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: golang/mock
Pull request #61 (2017-02-02 03:30:41)

Fix Do method for variadic functions
Without this fix, using the `Do` method on a variadic function will cause a panic, because not all of the arguments will be propagated to the action function:

```
$ go test ./sample
--- FAIL: TestVariadicFunction (0.00s)
panic: reflect: Call using zero Value argument [recovered]
	panic: reflect: Call using zero Value argument [recovered]
	panic: reflect: Call using zero Value argument
...
github.com/golang/mock/gomock.(*Controller).Finish(0xc4200d57a0)
	/gopath/src/github.com/golang/mock/gomock/controller.go:149 +0x320
...
github.com/golang/mock/gomock.(*Call).call.func1()
	/gopath/src/github.com/golang/mock/gomock/call.go:234 +0x6a
...
FAIL	github.com/golang/mock/sample	0.013s
```

Cc: @iderdik, @chr0n1x

googlebot: Thanks for your pull request.  It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: **Please visit <https://cla.developers.google.com/> to sign.**

Once you've signed, please reply here (e.g. `I signed it!`) and we'll verify.  Thanks.

---

- If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address.  Check [your existing CLA data](https://cla.developers.google.com/clas) and verify that your [email is set on your git commits](https://help.github.com/articles/setting-your-email-in-git/).
- If you signed the CLA as a corporation, please let us know the company's name.

<!-- need_sender_cla -->
msabramo: I signed it!
googlebot: CLAs look good, thanks!

<!-- ok -->

Patch:
diff --git a/gomock/call.go b/gomock/call.go
index c560197..035aa75 100644
--- a/gomock/call.go
+++ b/gomock/call.go
@@ -223,7 +223,7 @@ func (c *Call) call(args []interface{}) (rets []interface{}, action func()) {
 	if c.doFunc.IsValid() {
 		doArgs := make([]reflect.Value, len(args))
 		ft := c.doFunc.Type()
-		for i := 0; i < ft.NumIn(); i++ {
+		for i := 0; i < len(args); i++ {
 			if args[i] != nil {
 				doArgs[i] = reflect.ValueOf(args[i])
 			} else {


Test patch:
diff --git a/sample/user_test.go b/sample/user_test.go
index 5e97962..c8c3864 100644
--- a/sample/user_test.go
+++ b/sample/user_test.go
@@ -63,6 +63,25 @@ func TestRemember(t *testing.T) {
 	user.Remember(mockIndex, []string{"nil-key"}, []interface{}{nil})
 }
 
+func TestVariadicFunction(t *testing.T) {
+	ctrl := gomock.NewController(t)
+	defer ctrl.Finish()
+
+	mockIndex := mock_user.NewMockIndex(ctrl)
+	m := mockIndex.EXPECT().Ellip("%d", 0, 1, 1, 2, 3)
+	m.Do(func(format string, nums ...int) {
+		sum := 0
+		for _, value := range nums {
+			sum += value
+		}
+		if sum != 7 {
+			t.Errorf("Expected 7, got %d", sum)
+		}
+	})
+
+	mockIndex.Ellip("%d", 0, 1, 1, 2, 3)
+}
+
 func TestGrabPointer(t *testing.T) {
 	ctrl := gomock.NewController(t)
 	defer ctrl.Finish()
Repository: xataio/client-ts
Pull request #12 (2022-03-01 11:06:20)

Throw error with mandatory options
If the parameters are not set or the env variables are ``undefined``﻿, the  client gives a message that fetch expects and absolute url, instead adding a more meaningful error message.

Since it's a public facing API we should do this validations, in case the SDK is used from JavaScript instead of TS.


Patch:
diff --git a/client/src/index.ts b/client/src/index.ts
index 74849096..d3b1d56f 100644
--- a/client/src/index.ts
+++ b/client/src/index.ts
@@ -304,13 +304,14 @@ export class RestRepository<T> extends Repository<T> {
   }
 
   async request(method: string, path: string, body?: unknown) {
-    const { databaseURL } = this.client.options;
+    const { databaseURL, apiKey } = this.client.options;
+
     const resp: Response = await this.fetch(`${databaseURL}${path}`, {
       method,
       headers: {
         Accept: '*/*',
         'Content-Type': 'application/json',
-        Authorization: `Bearer ${this.client.options.apiKey}`
+        Authorization: `Bearer ${apiKey}`
       },
       body: JSON.stringify(body)
     });
@@ -406,6 +407,10 @@ export class BaseClient<D extends Record<string, Repository<any>>> {
   db!: D;
 
   constructor(options: XataClientOptions, links: Links) {
+    if (!options.databaseURL || !options.apiKey) {
+      throw new Error('Options databaseURL and apiKey are required');
+    }
+
     this.options = options;
     this.links = links;
   }
diff --git a/package.json b/package.json
index c7bdf514..2589cc41 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
   "main": "index.js",
   "scripts": {
     "test": "jest",
+    "test:watch": "jest --watch",
     "prepare": "husky install",
     "build-example": "cd codegen && npm run example-ts && npm run example-js"
   },


Test patch:
diff --git a/client/src/index.test.ts b/client/src/index.test.ts
index 6754409f..ef79552f 100644
--- a/client/src/index.test.ts
+++ b/client/src/index.test.ts
@@ -16,6 +16,21 @@ interface User extends XataRecord {
 
 const users = new RestRepository<User>(client, 'users');
 
+describe('client', () => {
+  test('api key option is set', () => {
+    const client = new BaseClient({ apiKey: 'apiKey', databaseURL: 'url' }, {});
+    expect(client.options.apiKey).toBe('apiKey');
+    expect(client.options.databaseURL).toBe('url');
+  });
+
+  test('throws if mandatory options are missing', () => {
+    // @ts-expect-error Options are mandatory in TypeScript
+    expect(() => new BaseClient({ apiKey: null, databaseURL: null }, {})).toThrow(
+      'Options databaseURL and apiKey are required'
+    );
+  });
+});
+
 describe('request', () => {
   test('builds the right arguments for a GET request', async () => {
     fetch.mockReset().mockImplementation(() => {
Repository: google/go-flow-levee
Pull request #295 (2021-04-07 21:54:25)

Rename internal/pkg/levee package name
The package name for files in `internal/pkg/levee` should be `levee` to match the directory name. (Currently, the package is named `internal`, for no apparent reason.)

- [x] Running against a large codebase such as [Kubernetes](https://github.com/kubernetes/kubernetes) does not error out. (See [DEVELOPING.md](https://github.com/google/go-flow-levee/blob/master/DEVELOPING.md) for instructions on how to do that.)
- (N/A) [ ] Appropriate changes to README are included in PR



Patch:
diff --git a/internal/pkg/levee/levee.go b/internal/pkg/levee/levee.go
index 6ac3fa0..26adb7e 100644
--- a/internal/pkg/levee/levee.go
+++ b/internal/pkg/levee/levee.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package internal
+package levee
 
 import (
 	"fmt"
diff --git a/pkg/levee/levee.go b/pkg/levee/levee.go
index 84690f3..ab644bd 100644
--- a/pkg/levee/levee.go
+++ b/pkg/levee/levee.go
@@ -15,7 +15,7 @@
 // Package levee exports the levee Analyzer.
 package levee
 
-import internal "github.com/google/go-flow-levee/internal/pkg/levee"
+import "github.com/google/go-flow-levee/internal/pkg/levee"
 
 // Analyzer reports instances of source data reaching a sink.
-var Analyzer = internal.Analyzer
+var Analyzer = levee.Analyzer


Test patch:
diff --git a/internal/pkg/levee/levee_test.go b/internal/pkg/levee/levee_test.go
index 3e680a1..22363cf 100644
--- a/internal/pkg/levee/levee_test.go
+++ b/internal/pkg/levee/levee_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package internal
+package levee
 
 import (
 	"flag"