prompt stringlengths 183 7.33M | completion stringlengths 13 833k | __index_level_0__ int64 0 215k |
|---|---|---|
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
//go:generate go-enum --sql --marshal --file $GOFILE
package img
import (
"bytes"
"context"
"errors"
"fmt"
"image"
"io"
"github.c... | package img
import (
"bytes"
"context"
"errors"
"image"
"image/gif"
"image/jpeg"
"image/png"
"io"
"testing"
"github.com/spf13/afero"
"github.com/stretchr/testify/require"
"golang.org/x/image/bmp"
"golang.org/x/image/tiff"
)
func TestService_Resize(t *testing.T) {
testCases := map[string]struct {
opti... | 0 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package diskcache
import (
"context"
"crypto/sha1" //nolint:gosec
"encoding/hex"
"errors"
"fmt"
"io"
"os"
"path/filepath"
"sync"... | package diskcache
import (
"context"
"path/filepath"
"testing"
"github.com/spf13/afero"
"github.com/stretchr/testify/require"
)
func TestFileCache(t *testing.T) {
ctx := context.Background()
const (
key = "key"
value = "some text"
newValue = "new text"
cacheRoot = "/cach... | 1 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package rules
import (
"path/filepath"
"regexp"
"strings"
)
// Checker is a Rules checker.
type Checker interface {
Check(path strin... | package rules
import "testing"
func TestMatchHidden(t *testing.T) {
cases := map[string]bool{
"/": false,
"/src": false,
"/src/": false,
"/.circleci": true,
"/a/b/c/.docker.json": true,
".docker.json": true,
"Dockerfile": false,
... | 2 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/filebrowser/filebrowser/v2/rules"
"github... | package rules
import "testing"
func TestMatchHidden(t *testing.T) {
cases := map[string]bool{
"/": false,
"/src": false,
"/src/": false,
"/.circleci": true,
"/a/b/c/.docker.json": true,
".docker.json": true,
"Dockerfile": false,
... | 3 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
// Copyright 2015 Light Code Labs, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file ... | // Copyright 2015 Light Code Labs, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... | 4 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package http
import (
"bufio"
"io"
"log"
"net/http"
"os/exec"
"strings"
"time"
"github.com/gorilla/websocket"
"github.com/file... | // Copyright 2015 Light Code Labs, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... | 5 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package http
import (
"errors"
"net/http"
"net/url"
"path"
"path/filepath"
"strings"
"github.com/spf13/afero"
"golang.org/x/cryp... | package http
import (
"fmt"
"net/http"
"net/http/httptest"
"path/filepath"
"testing"
"github.com/asdine/storm/v3"
"github.com/spf13/afero"
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/filebrowser/filebrowser/v2/share"
"github.com/filebrowser/filebrowser/v2/storage/bolt"
"github.com/filebro... | 6 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package files
import (
"crypto/md5" //nolint:gosec
"crypto/sha1" //nolint:gosec
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"ha... | package fileutils
import "testing"
func TestCommonPrefix(t *testing.T) {
testCases := map[string]struct {
paths []string
want string
}{
"same lvl": {
paths: []string{
"/home/user/file1",
"/home/user/file2",
},
want: "/home/user",
},
"sub folder": {
paths: []string{
"/home/user/fol... | 7 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package fileutils
import (
"io"
"os"
"path"
"path/filepath"
"github.com/spf13/afero"
)
// MoveFile moves file from src to dst.
// ... | package fileutils
import "testing"
func TestCommonPrefix(t *testing.T) {
testCases := map[string]struct {
paths []string
want string
}{
"same lvl": {
paths: []string{
"/home/user/file1",
"/home/user/file2",
},
want: "/home/user",
},
"sub folder": {
paths: []string{
"/home/user/fol... | 8 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package auth
import (
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/filebrowser/filebrowser/v2/users"
)
// StorageBacke... | package users
// Interface is implemented by storage
var _ Store = &Storage{}
| 9 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package settings
import (
"github.com/filebrowser/filebrowser/v2/errors"
"github.com/filebrowser/filebrowser/v2/rules"
"github.com/fil... | package users
// Interface is implemented by storage
var _ Store = &Storage{}
| 10 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package share
import (
"time"
"github.com/filebrowser/filebrowser/v2/errors"
)
// StorageBackend is the interface to implement for a ... | package users
// Interface is implemented by storage
var _ Store = &Storage{}
| 11 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package storage
import (
"github.com/filebrowser/filebrowser/v2/auth"
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/fil... | package users
// Interface is implemented by storage
var _ Store = &Storage{}
| 12 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package users
import (
"sync"
"time"
"github.com/filebrowser/filebrowser/v2/errors"
)
// StorageBackend is the interface to implemen... | package users
// Interface is implemented by storage
var _ Store = &Storage{}
| 13 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package main
import (
"encoding/json"
"flag"
"fmt"
"html"
"io"
"io/ioutil"
"log"
"math/rand"
"net"
"net/http"
"sort"
"strconv... | package main
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/goccy/go-json"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/utils"
)
// go test -v -run=^$ -bench=Benchmark_Plaintext -benchmem -count=4
func Benchmark_Plaintext(b *testing.B) {
app := fiber... | 14 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package main
import (
"encoding/json"
"flag"
"fmt"
"html"
"io"
"io/ioutil"
"log"
"math/rand"
"net"
"net/http"
"sort"
"strconv... | package main
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/goccy/go-json"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/utils"
)
// go test -v -run=^$ -bench=Benchmark_Plaintext -benchmem -count=4
func Benchmark_Plaintext(b *testing.B) {
app := fiber... | 15 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package main
import (
"encoding/json"
"flag"
"fmt"
"html"
"io"
"io/ioutil"
"log"
"math/rand"
"net"
"net/http"
"sort"
"strconv... | package main
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/goccy/go-json"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/utils"
)
// go test -v -run=^$ -bench=Benchmark_Plaintext -benchmem -count=4
func Benchmark_Plaintext(b *testing.B) {
app := fiber... | 16 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package main
import (
"database/sql"
"encoding/json"
"flag"
"fmt"
"html/template"
"io/ioutil"
"log"
"math/rand"
"net/http"
"run... | package main
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/goccy/go-json"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/utils"
)
// go test -v -run=^$ -bench=Benchmark_Plaintext -benchmem -count=4
func Benchmark_Plaintext(b *testing.B) {
app := fiber... | 17 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package main
import (
"context"
"fmt"
"log"
"math/rand"
"os"
"runtime"
"sort"
"sync"
"github.com/goccy/go-json"
"github.com/go... | package main
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/goccy/go-json"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/utils"
)
// go test -v -run=^$ -bench=Benchmark_Plaintext -benchmem -count=4
func Benchmark_Plaintext(b *testing.B) {
app := fiber... | 18 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
package main
import (
"database/sql"
"encoding/json"
"flag"
"html/template"
"log"
"math/rand"
"net/http"
"sort"
"strconv"
"gol... | package main
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/goccy/go-json"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/utils"
)
// go test -v -run=^$ -bench=Benchmark_Plaintext -benchmem -count=4
func Benchmark_Plaintext(b *testing.B) {
app := fiber... | 19 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license tha... | package websocket
import (
"bytes"
"fmt"
"io"
"testing"
)
type nopCloser struct{ io.Writer }
func (nopCloser) Close() error { return nil }
func TestTruncWriter(t *testing.T) {
const data = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijlkmnopqrstuvwxyz987654321"
for n := 1; n <= 10; n++ {
var b bytes.Buffer
w := &t... | 20 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license tha... | // Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
import (
"bytes"
"compress/flate"
"math/rand"
"testing"
)
var preparedMessageTests = []struct {
messageType i... | 21 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
// Copyright 2019 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license tha... | // Copyright 2019 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
import (
"bytes"
"io"
"strings"
"testing"
)
func TestJoinMessages(t *testing.T) {
messages := []string{"a", "bc", "def",... | 22 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license tha... | // Copyright 2014 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
import (
"net/http"
"reflect"
"testing"
)
var equalASCIIFoldTests = []struct {
t, s string
eq bool
}{
{"WebSocket", "... | 23 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of
// this source code is governed by a BSD-style license that ... | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of
// this source code is governed by a BSD-style license that can be found in the
// LICENSE file.
// !appengine
package websocket
import (
"fmt"
"testing"
)
func maskBytesByByte(key [4]byte, pos int, b []byte) int {
for i := range b {
... | 24 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license tha... | // Copyright 2014 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
import (
"net/url"
"testing"
)
var hostPortNoPortTests = []struct {
u *url.URL
hostPort, hostNoPort st... | 25 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found ... | // Copyright 2014 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
import (
"net/url"
"testing"
)
var hostPortNoPortTests = []struct {
u *url.URL
hostPort, hostNoPort st... | 26 |
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries.
Code context:
//go:build ignore
// +build ignore
package main
import (
"flag"
"log"
"net/url"
"os"
"os/signal"
"sync"
"time"
"github.com/gori... | // Copyright 2014 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
import (
"net/url"
"testing"
)
var hostPortNoPortTests = []struct {
u *url.URL
hostPort, hostNoPort st... | 27 |
End of preview. Expand in Data Studio
- Downloads last month
- 35