[
  {
    "path": ".ci.gofmt.sh",
    "content": "#!/usr/bin/env bash\n\nif [ -n \"$(gofmt -l .)\" ]; then\n  echo \"Go code is not formatted:\"\n  gofmt -d .\n  exit 1\nfi\n\ngo generate ./...\nif [ -n \"$(git status -s -uno)\" ]; then\n  echo \"Go generate output does not match commit.\"\n  echo \"Did you forget to run go generate ./... ?\"\n  exit 1\nfi\n"
  },
  {
    "path": ".ci.gogenerate.sh",
    "content": "#!/usr/bin/env bash\n\n# If GOMOD is defined we are running with Go Modules enabled, either\n# automatically or via the GO111MODULE=on environment variable. Codegen only\n# works with modules, so skip generation if modules is not in use.\nif [[ -z \"$(go env GOMOD)\" ]]; then\n  echo \"Skipping go generate because modules not enabled and required\"\n  exit 0\nfi\n\ngo generate ./...\nif [ -n \"$(git diff)\" ]; then\n  echo \"Go generate had not been run\"\n  git diff\n  exit 1\nfi\n"
  },
  {
    "path": ".ci.govet.sh",
    "content": "#!/usr/bin/env bash\n\nset -e\n\ngo vet ./...\n"
  },
  {
    "path": ".ci.readme.fmt.sh",
    "content": "#!/usr/bin/env bash\n\n# Verify that the code snippets in README.md are formatted.\n# The tool https://github.com/hougesen/mdsf is used.\n\nif [ -n \"$(mdsf verify --config .mdsf.json --log-level error README.md 2>&1)\" ]; then\n  echo \"Go code in the README.md is not formatted.\"\n  echo \"Did you forget to run 'mdsf format --config .mdsf.json README.md'?\"\n  mdsf format --config .mdsf.json README.md\n  git diff\n  exit 1\nfi\n"
  },
  {
    "path": ".gitattributes",
    "content": "# This file is used to configure Git attributes for the repository.\n# It is particularly useful for managing how generated code is treated in pull requests.\n# For more information, see:\n# https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github\n\n# Code for assertions and requirements is generated automatically by _codegen.\n# This also updates code comments and code examples in the documentation.\n# These comments and examples must be reviewed when they change,\n# since updates to the generated code comments may not always be correct.\nassert/*.go  linguist-generated=false\nrequire/*.go linguist-generated=false\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Format to report a bug\ntitle: ''\nlabels: bug\nassignees: ''\n\n---\n\n<!-- If this is a question, consider using the discussion section of this repo -->\n<!-- Here: https://github.com/stretchr/testify/discussions/new?category=q-a -->\n\n## Description\n<!-- A detailed description of the bug -->\n\n## Step To Reproduce\n<!-- Steps or code snippet to reproduce the behavior -->\n\n## Expected behavior\n<!-- A clear and concise description of what you expected to happen -->\n\n## Actual behavior\n<!-- What testify does -->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Propose a new feature\ntitle: ''\nlabels: enhancement\nassignees: ''\n\n---\n\n<!-- If this is a question, consider using the discussion section of this repo -->\n<!-- Here: https://github.com/stretchr/testify/discussions/new?category=q-a -->\n\n## Description\n<!-- A clear and concise description of what feature you are proposing -->\n\n## Proposed solution\n<!-- Optionally a suggested implementation -->\n\n## Use case\n<!-- What is the motivation? What workarounds have you used? -->\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n- package-ecosystem: gomod\n  directory: /\n  schedule:\n    interval: daily\n- package-ecosystem: github-actions\n  directory: /\n  schedule:\n    interval: daily\n"
  },
  {
    "path": ".github/pull_request_template.md",
    "content": "## Summary\n<!-- High-level, one sentence summary of what this PR accomplishes -->\n\n## Changes\n<!-- * Description of change 1 -->\n<!-- * Description of change 2 -->\n<!-- ... -->\n\n## Motivation\n<!-- Why were the changes necessary. -->\n\n<!-- ## Example usage (if applicable) -->\n\n## Related issues\n<!-- Put `Closes #XXXX` for each issue number this PR fixes/closes -->\n"
  },
  {
    "path": ".github/workflows/main.yml",
    "content": "name: All builds\non: [push, pull_request]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        go_version:\n          - stable\n          - oldstable\n    steps:\n      - uses: actions/checkout@v5\n      - name: Setup Go\n        uses: actions/setup-go@v6\n        with:\n          go-version: ${{ matrix.go_version }}\n      - run: npm install -g mdsf-cli\n      - run: ./.ci.gogenerate.sh\n      - run: ./.ci.gofmt.sh\n      - run: ./.ci.readme.fmt.sh\n      - run: ./.ci.govet.sh\n      - run: go test -v -race ./...\n  test:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        go_version:\n          - \"1.17\"\n          - \"1.18\"\n          - \"1.19\"\n          - \"1.20\"\n          - \"1.21\"\n          - \"1.22\"\n          - \"1.23\"\n          - \"1.24\"\n    steps:\n      - uses: actions/checkout@v5\n      - name: Setup Go\n        uses: actions/setup-go@v6\n        with:\n          go-version: ${{ matrix.go_version }}\n      - run: go test -v -race ./...\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Create release from new tag\n\n# this flow will be run only when new tags are pushed that match our pattern\non:\n  push:\n    tags:\n      - \"v[0-9]+.[0-9]+.[0-9]+\"\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v5\n\n      - name: Create GitHub release from tag\n        uses: softprops/action-gh-release@v2\n        with:\n          generate_release_notes: true\n"
  },
  {
    "path": ".gitignore",
    "content": "# Compiled Object files, Static and Dynamic libs (Shared Objects)\n*.o\n*.a\n*.so\n\n# Folders\n_obj\n_test\n\n# Architecture specific extensions/prefixes\n*.[568vq]\n[568vq].out\n\n*.cgo1.go\n*.cgo2.c\n_cgo_defun.c\n_cgo_gotypes.go\n_cgo_export.*\n\n_testmain.go\n\n*.exe\n\n.DS_Store\n\n# Output of \"go test -c\"\n/assert/assert.test\n/require/require.test\n/suite/suite.test\n/mock/mock.test\n"
  },
  {
    "path": ".mdsf.json",
    "content": "{\n  \"$schema\": \"https://raw.githubusercontent.com/hougesen/mdsf/main/schemas/v0.8.2/mdsf.schema.json\",\n  \"format_finished_document\": false,\n  \"languages\": {\n    \"go\": [\n      [\n        \"gofmt\",\n        \"goimports\"\n      ]\n    ]\n  }\n}\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to Testify\n\nSo you'd like to contribute to Testify? First of all, thank you! Testify is widely used, so each\ncontribution has a significant impact within the Golang community! Below you'll find everything you\nneed to know to get up to speed on the project.\n\n## Philosophy\n\nThe Testify maintainers generally attempt to follow widely accepted practices within the Golang\ncommunity. That being said, the first priority is always to make sure that the package is useful to\nthe community. A few general guidelines are listed here:\n\n*Keep it simple (whenever practical)* - Try not to expand the API unless the new surface area\nprovides meaningful benefits. For example, don't add functions because they might be useful to\nsomeone, someday. Add what is useful to specific users, today.\n\n*Ease of use is paramount* - This means good documentation and package organization. It also means\nthat we should try hard to use meaningful, descriptive function names, avoid breaking the API\nunnecessarily, and try not to surprise the user.\n\n*Quality isn't an afterthought* - Testify is a testing library, so it seems reasonable that we\nshould have a decent test suite. This is doubly important because a bug in Testify doesn't just mean\na bug in our users' code, it means a bug in our users' tests, which means a potentially unnoticed\nand hard-to-find bug in our users' code.\n\n## Pull Requests\n\nWe welcome pull requests! Please include the following in the description:\n\n  * Motivation, why your change is important or helpful\n  * Example usage (if applicable)\n  * Whether you intend to add / change behavior or fix a bug\n\nPlease be aware that the maintainers may ask for changes. This isn't a commentary on the quality of\nyour idea or your code. Testify is the result of many contributions from many individuals, so we\nneed to enforce certain practices and patterns to keep the package easy for others to understand.\nEssentially, we recognize that there are often many good ways to do a given thing, but we have to\npick one and stick with it.\n\nSee `MAINTAINERS.md` for a list of users who can approve / merge your changes.\n\n## Issues\n\nIf you find a bug or think of a useful feature you'd like to see added to Testify, the best thing\nyou can do is make the necessary changes and open a pull request (see above). If that isn't an\noption, or if you'd like to discuss your change before you write the code, open an issue!\n\nPlease provide enough context in the issue description that other members of the community can\neasily understand what it is that you'd like to see.\n\n"
  },
  {
    "path": "EMERITUS.md",
    "content": "# Emeritus\n\nWe would like to acknowledge previous testify maintainers and their huge contributions to our collective success:\n\n  * @tylerb\n  * @matryer\n  * @glesica\n  * @ernesto-jimenez\n  * @mvdkleijn\n  * @georgelesica-wf\n  * @bencampbell-wf\n\nWe thank these members for their service to this community.\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "MAINTAINERS.md",
    "content": "# Testify Maintainers\n\nThe individuals listed below are active in the project and have the ability to approve and merge\npull requests.\n\n  * @boyan-soubachov\n  * @dolmen\n  * @MovieStoreGuy\n  * @brackendawson\n  * @ccoVeille\n\n## Approvers\n\nThe individuals listed below are active in the project and have the ability to approve pull\nrequests.\n\n  * @arjunmahishi\n"
  },
  {
    "path": "README.md",
    "content": "Testify - Thou Shalt Write Tests\n================================\n\n> [!NOTE]\n> Testify is being maintained at v1, no breaking changes will be accepted in this repo.  \n> [See discussion about v2](https://github.com/stretchr/testify/discussions/1560).\n\n[![Build Status](https://github.com/stretchr/testify/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/stretchr/testify/actions/workflows/main.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/stretchr/testify)](https://goreportcard.com/report/github.com/stretchr/testify) [![PkgGoDev](https://pkg.go.dev/badge/github.com/stretchr/testify)](https://pkg.go.dev/github.com/stretchr/testify)\n\nGo code (golang) set of packages that provide many tools for testifying that your code will behave as you intend.\n\nFeatures include:\n\n  * [Easy assertions](#assert-package)\n  * [Mocking](#mock-package)\n  * [Testing suite interfaces and functions](#suite-package)\n\nGet started:\n\n  * Install testify with [one line of code](#installation), or [update it with another](#staying-up-to-date)\n  * For an introduction to writing test code in Go, see https://go.dev/doc/code#Testing\n  * Check out the API Documentation https://pkg.go.dev/github.com/stretchr/testify\n  * Use [testifylint](https://github.com/Antonboom/testifylint) (via [golangci-lint](https://golangci-lint.run/)) to avoid common mistakes\n  * A little about [Test-Driven Development (TDD)](https://en.wikipedia.org/wiki/Test-driven_development)\n\n[`assert`](https://pkg.go.dev/github.com/stretchr/testify/assert \"API documentation\") package\n-------------------------------------------------------------------------------------------\n\nThe `assert` package provides some helpful methods that allow you to write better test code in Go.\n\n  * Prints friendly, easy to read failure descriptions\n  * Allows for very readable code\n  * Optionally annotate each assertion with a message\n\nSee it in action:\n\n```go\npackage yours\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestSomething(t *testing.T) {\n\t// assert equality\n\tassert.Equal(t, 123, 123, \"they should be equal\")\n\n\t// assert inequality\n\tassert.NotEqual(t, 123, 456, \"they should not be equal\")\n\n\t// assert for nil (good for errors)\n\tassert.Nil(t, object)\n\n\t// assert for not nil (good when you expect something)\n\tif assert.NotNil(t, object) {\n\t\t// now we know that object isn't nil, we are safe to make\n\t\t// further assertions without causing any errors\n\t\tassert.Equal(t, \"Something\", object.Value)\n\t}\n}\n```\n\n  * Every assert func takes the `testing.T` object as the first argument.  This is how it writes the errors out through the normal `go test` capabilities.\n  * Every assert func returns a bool indicating whether the assertion was successful or not, this is useful for if you want to go on making further assertions under certain conditions.\n\nif you assert many times, use the below:\n\n```go\npackage yours\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestSomething(t *testing.T) {\n\tassert := assert.New(t)\n\n\t// assert equality\n\tassert.Equal(123, 123, \"they should be equal\")\n\n\t// assert inequality\n\tassert.NotEqual(123, 456, \"they should not be equal\")\n\n\t// assert for nil (good for errors)\n\tassert.Nil(object)\n\n\t// assert for not nil (good when you expect something)\n\tif assert.NotNil(object) {\n\t\t// now we know that object isn't nil, we are safe to make\n\t\t// further assertions without causing any errors\n\t\tassert.Equal(\"Something\", object.Value)\n\t}\n}\n```\n\n[`require`](https://pkg.go.dev/github.com/stretchr/testify/require \"API documentation\") package\n---------------------------------------------------------------------------------------------\n\nThe `require` package provides same global functions as the `assert` package, but instead of returning a boolean result they terminate current test.\nThese functions must be called from the goroutine running the test or benchmark function, not from other goroutines created during the test.\nOtherwise race conditions may occur.\n\nSee [t.FailNow](https://pkg.go.dev/testing#T.FailNow) for details.\n\n[`mock`](https://pkg.go.dev/github.com/stretchr/testify/mock \"API documentation\") package\n----------------------------------------------------------------------------------------\n\nThe `mock` package provides a mechanism for easily writing mock objects that can be used in place of real objects when writing test code.\n\nAn example test function that tests a piece of code that relies on an external object `testObj`, can set up expectations (testify) and assert that they indeed happened:\n\n```go\npackage yours\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/mock\"\n)\n\n/*\n  Test objects\n*/\n\n// MyMockedObject is a mocked object that implements an interface\n// that describes an object that the code I am testing relies on.\ntype MyMockedObject struct {\n\tmock.Mock\n}\n\n// DoSomething is a method on MyMockedObject that implements some interface\n// and just records the activity, and returns what the Mock object tells it to.\n//\n// In the real object, this method would do something useful, but since this\n// is a mocked object - we're just going to stub it out.\n//\n// NOTE: This method is not being tested here, code that uses this object is.\nfunc (m *MyMockedObject) DoSomething(number int) (bool, error) {\n\targs := m.Called(number)\n\treturn args.Bool(0), args.Error(1)\n}\n\n/*\n  Actual test functions\n*/\n\n// TestSomething is an example of how to use our test object to\n// make assertions about some target code we are testing.\nfunc TestSomething(t *testing.T) {\n\t// create an instance of our test object\n\ttestObj := new(MyMockedObject)\n\n\t// set up expectations\n\ttestObj.On(\"DoSomething\", 123).Return(true, nil)\n\n\t// call the code we are testing\n\ttargetFuncThatDoesSomethingWithObj(testObj)\n\n\t// assert that the expectations were met\n\ttestObj.AssertExpectations(t)\n}\n\n// TestSomethingWithPlaceholder is a second example of how to use our test object to\n// make assertions about some target code we are testing.\n// This time using a placeholder. Placeholders might be used when the\n// data being passed in is normally dynamically generated and cannot be\n// predicted beforehand (eg. containing hashes that are time sensitive)\nfunc TestSomethingWithPlaceholder(t *testing.T) {\n\t// create an instance of our test object\n\ttestObj := new(MyMockedObject)\n\n\t// set up expectations with a placeholder in the argument list\n\ttestObj.On(\"DoSomething\", mock.Anything).Return(true, nil)\n\n\t// call the code we are testing\n\ttargetFuncThatDoesSomethingWithObj(testObj)\n\n\t// assert that the expectations were met\n\ttestObj.AssertExpectations(t)\n\n}\n\n// TestSomethingElse2 is a third example that shows how you can use\n// the Unset method to cleanup handlers and then add new ones.\nfunc TestSomethingElse2(t *testing.T) {\n\t// create an instance of our test object\n\ttestObj := new(MyMockedObject)\n\n\t// set up expectations with a placeholder in the argument list\n\tmockCall := testObj.On(\"DoSomething\", mock.Anything).Return(true, nil)\n\n\t// call the code we are testing\n\ttargetFuncThatDoesSomethingWithObj(testObj)\n\n\t// assert that the expectations were met\n\ttestObj.AssertExpectations(t)\n\n\t// remove the handler now so we can add another one that takes precedence\n\tmockCall.Unset()\n\n\t// return false now instead of true\n\ttestObj.On(\"DoSomething\", mock.Anything).Return(false, nil)\n\n\ttestObj.AssertExpectations(t)\n}\n```\n\nFor more information on how to write mock code, check out the [API documentation for the `mock` package](https://pkg.go.dev/github.com/stretchr/testify/mock).\n\nYou can use the [mockery tool](https://vektra.github.io/mockery/latest/) to autogenerate the mock code against an interface as well, making using mocks much quicker.\n\n[`suite`](https://pkg.go.dev/github.com/stretchr/testify/suite \"API documentation\") package\n-----------------------------------------------------------------------------------------\n> [!WARNING]\n> The suite package does not support parallel tests. See [#934](https://github.com/stretchr/testify/issues/934).\n\nThe `suite` package provides functionality that you might be used to from more common object-oriented languages.  With it, you can build a testing suite as a struct, build setup/teardown methods and testing methods on your struct, and run them with 'go test' as per normal.\n\nAn example suite is shown below:\n\n```go\n// Basic imports\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/suite\"\n)\n\n// Define the suite, and absorb the built-in basic suite\n// functionality from testify - including a T() method which\n// returns the current testing context\ntype ExampleTestSuite struct {\n\tsuite.Suite\n\tVariableThatShouldStartAtFive int\n}\n\n// Make sure that VariableThatShouldStartAtFive is set to five\n// before each test\nfunc (suite *ExampleTestSuite) SetupTest() {\n\tsuite.VariableThatShouldStartAtFive = 5\n}\n\n// All methods that begin with \"Test\" are run as tests within a\n// suite.\nfunc (suite *ExampleTestSuite) TestExample() {\n\tassert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive)\n}\n\n// In order for 'go test' to run this suite, we need to create\n// a normal test function and pass our suite to suite.Run\nfunc TestExampleTestSuite(t *testing.T) {\n\tsuite.Run(t, new(ExampleTestSuite))\n}\n```\n\nFor a more complete example, using all of the functionality provided by the suite package, look at our [example testing suite](https://github.com/stretchr/testify/blob/master/suite/suite_test.go)\n\nFor more information on writing suites, check out the [API documentation for the `suite` package](https://pkg.go.dev/github.com/stretchr/testify/suite).\n\n`Suite` object has assertion methods:\n\n```go\n// Basic imports\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/suite\"\n)\n\n// Define the suite, and absorb the built-in basic suite\n// functionality from testify - including assertion methods.\ntype ExampleTestSuite struct {\n\tsuite.Suite\n\tVariableThatShouldStartAtFive int\n}\n\n// Make sure that VariableThatShouldStartAtFive is set to five\n// before each test\nfunc (suite *ExampleTestSuite) SetupTest() {\n\tsuite.VariableThatShouldStartAtFive = 5\n}\n\n// All methods that begin with \"Test\" are run as tests within a\n// suite.\nfunc (suite *ExampleTestSuite) TestExample() {\n\tsuite.Equal(suite.VariableThatShouldStartAtFive, 5)\n}\n\n// In order for 'go test' to run this suite, we need to create\n// a normal test function and pass our suite to suite.Run\nfunc TestExampleTestSuite(t *testing.T) {\n\tsuite.Run(t, new(ExampleTestSuite))\n}\n```\n\n------\n\nInstallation\n============\n\nTo install Testify, use `go get`:\n\n    go get github.com/stretchr/testify\n\nThis will then make the following packages available to you:\n\n    github.com/stretchr/testify/assert\n    github.com/stretchr/testify/require\n    github.com/stretchr/testify/mock\n    github.com/stretchr/testify/suite\n    github.com/stretchr/testify/http (deprecated)\n\nImport the `testify/assert` package into your code using this template:\n\n```go\npackage yours\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestSomething(t *testing.T) {\n\tassert.True(t, true, \"True is true!\")\n}\n```\n\n------\n\nStaying up to date\n==================\n\nTo update Testify to the latest version, use `go get -u github.com/stretchr/testify`.\n\n------\n\nSupported go versions\n==================\n\nWe currently support the most recent major Go versions from 1.19 onward.\n\n------\n\nContributing\n============\n\nPlease feel free to submit issues, fork the repository and send pull requests!\n\nWhen submitting an issue, we ask that you please include a complete test function that demonstrates the issue. Extra credit for those using Testify to write the test code that demonstrates it.\n\nCode generation is used. [Look for `Code generated with`](https://github.com/search?q=repo%3Astretchr%2Ftestify%20%22Code%20generated%20with%22&type=code) at the top of some files. Run `go generate ./...` to update generated files.\n\nWe also chat on the [Gophers Slack](https://gophers.slack.com) group in the `#testify` and `#testify-dev` channels.\n\n------\n\nLicense\n=======\n\nThis project is licensed under the terms of the MIT license.\n"
  },
  {
    "path": "assert/assertion_compare.go",
    "content": "package assert\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"time\"\n)\n\n// Deprecated: CompareType has only ever been for internal use and has accidentally been published since v1.6.0. Do not use it.\ntype CompareType = compareResult\n\ntype compareResult int\n\nconst (\n\tcompareLess compareResult = iota - 1\n\tcompareEqual\n\tcompareGreater\n)\n\nvar (\n\tintType   = reflect.TypeOf(int(1))\n\tint8Type  = reflect.TypeOf(int8(1))\n\tint16Type = reflect.TypeOf(int16(1))\n\tint32Type = reflect.TypeOf(int32(1))\n\tint64Type = reflect.TypeOf(int64(1))\n\n\tuintType   = reflect.TypeOf(uint(1))\n\tuint8Type  = reflect.TypeOf(uint8(1))\n\tuint16Type = reflect.TypeOf(uint16(1))\n\tuint32Type = reflect.TypeOf(uint32(1))\n\tuint64Type = reflect.TypeOf(uint64(1))\n\n\tuintptrType = reflect.TypeOf(uintptr(1))\n\n\tfloat32Type = reflect.TypeOf(float32(1))\n\tfloat64Type = reflect.TypeOf(float64(1))\n\n\tstringType = reflect.TypeOf(\"\")\n\n\ttimeType  = reflect.TypeOf(time.Time{})\n\tbytesType = reflect.TypeOf([]byte{})\n)\n\nfunc compare(obj1, obj2 interface{}, kind reflect.Kind) (compareResult, bool) {\n\tobj1Value := reflect.ValueOf(obj1)\n\tobj2Value := reflect.ValueOf(obj2)\n\n\t// throughout this switch we try and avoid calling .Convert() if possible,\n\t// as this has a pretty big performance impact\n\tswitch kind {\n\tcase reflect.Int:\n\t\t{\n\t\t\tintobj1, ok := obj1.(int)\n\t\t\tif !ok {\n\t\t\t\tintobj1 = obj1Value.Convert(intType).Interface().(int)\n\t\t\t}\n\t\t\tintobj2, ok := obj2.(int)\n\t\t\tif !ok {\n\t\t\t\tintobj2 = obj2Value.Convert(intType).Interface().(int)\n\t\t\t}\n\t\t\tif intobj1 > intobj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif intobj1 == intobj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif intobj1 < intobj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Int8:\n\t\t{\n\t\t\tint8obj1, ok := obj1.(int8)\n\t\t\tif !ok {\n\t\t\t\tint8obj1 = obj1Value.Convert(int8Type).Interface().(int8)\n\t\t\t}\n\t\t\tint8obj2, ok := obj2.(int8)\n\t\t\tif !ok {\n\t\t\t\tint8obj2 = obj2Value.Convert(int8Type).Interface().(int8)\n\t\t\t}\n\t\t\tif int8obj1 > int8obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif int8obj1 == int8obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif int8obj1 < int8obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Int16:\n\t\t{\n\t\t\tint16obj1, ok := obj1.(int16)\n\t\t\tif !ok {\n\t\t\t\tint16obj1 = obj1Value.Convert(int16Type).Interface().(int16)\n\t\t\t}\n\t\t\tint16obj2, ok := obj2.(int16)\n\t\t\tif !ok {\n\t\t\t\tint16obj2 = obj2Value.Convert(int16Type).Interface().(int16)\n\t\t\t}\n\t\t\tif int16obj1 > int16obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif int16obj1 == int16obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif int16obj1 < int16obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Int32:\n\t\t{\n\t\t\tint32obj1, ok := obj1.(int32)\n\t\t\tif !ok {\n\t\t\t\tint32obj1 = obj1Value.Convert(int32Type).Interface().(int32)\n\t\t\t}\n\t\t\tint32obj2, ok := obj2.(int32)\n\t\t\tif !ok {\n\t\t\t\tint32obj2 = obj2Value.Convert(int32Type).Interface().(int32)\n\t\t\t}\n\t\t\tif int32obj1 > int32obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif int32obj1 == int32obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif int32obj1 < int32obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Int64:\n\t\t{\n\t\t\tint64obj1, ok := obj1.(int64)\n\t\t\tif !ok {\n\t\t\t\tint64obj1 = obj1Value.Convert(int64Type).Interface().(int64)\n\t\t\t}\n\t\t\tint64obj2, ok := obj2.(int64)\n\t\t\tif !ok {\n\t\t\t\tint64obj2 = obj2Value.Convert(int64Type).Interface().(int64)\n\t\t\t}\n\t\t\tif int64obj1 > int64obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif int64obj1 == int64obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif int64obj1 < int64obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Uint:\n\t\t{\n\t\t\tuintobj1, ok := obj1.(uint)\n\t\t\tif !ok {\n\t\t\t\tuintobj1 = obj1Value.Convert(uintType).Interface().(uint)\n\t\t\t}\n\t\t\tuintobj2, ok := obj2.(uint)\n\t\t\tif !ok {\n\t\t\t\tuintobj2 = obj2Value.Convert(uintType).Interface().(uint)\n\t\t\t}\n\t\t\tif uintobj1 > uintobj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif uintobj1 == uintobj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif uintobj1 < uintobj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Uint8:\n\t\t{\n\t\t\tuint8obj1, ok := obj1.(uint8)\n\t\t\tif !ok {\n\t\t\t\tuint8obj1 = obj1Value.Convert(uint8Type).Interface().(uint8)\n\t\t\t}\n\t\t\tuint8obj2, ok := obj2.(uint8)\n\t\t\tif !ok {\n\t\t\t\tuint8obj2 = obj2Value.Convert(uint8Type).Interface().(uint8)\n\t\t\t}\n\t\t\tif uint8obj1 > uint8obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif uint8obj1 == uint8obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif uint8obj1 < uint8obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Uint16:\n\t\t{\n\t\t\tuint16obj1, ok := obj1.(uint16)\n\t\t\tif !ok {\n\t\t\t\tuint16obj1 = obj1Value.Convert(uint16Type).Interface().(uint16)\n\t\t\t}\n\t\t\tuint16obj2, ok := obj2.(uint16)\n\t\t\tif !ok {\n\t\t\t\tuint16obj2 = obj2Value.Convert(uint16Type).Interface().(uint16)\n\t\t\t}\n\t\t\tif uint16obj1 > uint16obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif uint16obj1 == uint16obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif uint16obj1 < uint16obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Uint32:\n\t\t{\n\t\t\tuint32obj1, ok := obj1.(uint32)\n\t\t\tif !ok {\n\t\t\t\tuint32obj1 = obj1Value.Convert(uint32Type).Interface().(uint32)\n\t\t\t}\n\t\t\tuint32obj2, ok := obj2.(uint32)\n\t\t\tif !ok {\n\t\t\t\tuint32obj2 = obj2Value.Convert(uint32Type).Interface().(uint32)\n\t\t\t}\n\t\t\tif uint32obj1 > uint32obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif uint32obj1 == uint32obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif uint32obj1 < uint32obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Uint64:\n\t\t{\n\t\t\tuint64obj1, ok := obj1.(uint64)\n\t\t\tif !ok {\n\t\t\t\tuint64obj1 = obj1Value.Convert(uint64Type).Interface().(uint64)\n\t\t\t}\n\t\t\tuint64obj2, ok := obj2.(uint64)\n\t\t\tif !ok {\n\t\t\t\tuint64obj2 = obj2Value.Convert(uint64Type).Interface().(uint64)\n\t\t\t}\n\t\t\tif uint64obj1 > uint64obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif uint64obj1 == uint64obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif uint64obj1 < uint64obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Float32:\n\t\t{\n\t\t\tfloat32obj1, ok := obj1.(float32)\n\t\t\tif !ok {\n\t\t\t\tfloat32obj1 = obj1Value.Convert(float32Type).Interface().(float32)\n\t\t\t}\n\t\t\tfloat32obj2, ok := obj2.(float32)\n\t\t\tif !ok {\n\t\t\t\tfloat32obj2 = obj2Value.Convert(float32Type).Interface().(float32)\n\t\t\t}\n\t\t\tif float32obj1 > float32obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif float32obj1 == float32obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif float32obj1 < float32obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.Float64:\n\t\t{\n\t\t\tfloat64obj1, ok := obj1.(float64)\n\t\t\tif !ok {\n\t\t\t\tfloat64obj1 = obj1Value.Convert(float64Type).Interface().(float64)\n\t\t\t}\n\t\t\tfloat64obj2, ok := obj2.(float64)\n\t\t\tif !ok {\n\t\t\t\tfloat64obj2 = obj2Value.Convert(float64Type).Interface().(float64)\n\t\t\t}\n\t\t\tif float64obj1 > float64obj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif float64obj1 == float64obj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif float64obj1 < float64obj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\tcase reflect.String:\n\t\t{\n\t\t\tstringobj1, ok := obj1.(string)\n\t\t\tif !ok {\n\t\t\t\tstringobj1 = obj1Value.Convert(stringType).Interface().(string)\n\t\t\t}\n\t\t\tstringobj2, ok := obj2.(string)\n\t\t\tif !ok {\n\t\t\t\tstringobj2 = obj2Value.Convert(stringType).Interface().(string)\n\t\t\t}\n\t\t\tif stringobj1 > stringobj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif stringobj1 == stringobj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif stringobj1 < stringobj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\t// Check for known struct types we can check for compare results.\n\tcase reflect.Struct:\n\t\t{\n\t\t\t// All structs enter here. We're not interested in most types.\n\t\t\tif !obj1Value.CanConvert(timeType) {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// time.Time can be compared!\n\t\t\ttimeObj1, ok := obj1.(time.Time)\n\t\t\tif !ok {\n\t\t\t\ttimeObj1 = obj1Value.Convert(timeType).Interface().(time.Time)\n\t\t\t}\n\n\t\t\ttimeObj2, ok := obj2.(time.Time)\n\t\t\tif !ok {\n\t\t\t\ttimeObj2 = obj2Value.Convert(timeType).Interface().(time.Time)\n\t\t\t}\n\n\t\t\tif timeObj1.Before(timeObj2) {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t\tif timeObj1.Equal(timeObj2) {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\treturn compareGreater, true\n\t\t}\n\tcase reflect.Slice:\n\t\t{\n\t\t\t// We only care about the []byte type.\n\t\t\tif !obj1Value.CanConvert(bytesType) {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// []byte can be compared!\n\t\t\tbytesObj1, ok := obj1.([]byte)\n\t\t\tif !ok {\n\t\t\t\tbytesObj1 = obj1Value.Convert(bytesType).Interface().([]byte)\n\n\t\t\t}\n\t\t\tbytesObj2, ok := obj2.([]byte)\n\t\t\tif !ok {\n\t\t\t\tbytesObj2 = obj2Value.Convert(bytesType).Interface().([]byte)\n\t\t\t}\n\n\t\t\treturn compareResult(bytes.Compare(bytesObj1, bytesObj2)), true\n\t\t}\n\tcase reflect.Uintptr:\n\t\t{\n\t\t\tuintptrObj1, ok := obj1.(uintptr)\n\t\t\tif !ok {\n\t\t\t\tuintptrObj1 = obj1Value.Convert(uintptrType).Interface().(uintptr)\n\t\t\t}\n\t\t\tuintptrObj2, ok := obj2.(uintptr)\n\t\t\tif !ok {\n\t\t\t\tuintptrObj2 = obj2Value.Convert(uintptrType).Interface().(uintptr)\n\t\t\t}\n\t\t\tif uintptrObj1 > uintptrObj2 {\n\t\t\t\treturn compareGreater, true\n\t\t\t}\n\t\t\tif uintptrObj1 == uintptrObj2 {\n\t\t\t\treturn compareEqual, true\n\t\t\t}\n\t\t\tif uintptrObj1 < uintptrObj2 {\n\t\t\t\treturn compareLess, true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn compareEqual, false\n}\n\n// Greater asserts that the first element is greater than the second\n//\n//\tassert.Greater(t, 2, 1)\n//\tassert.Greater(t, float64(2), float64(1))\n//\tassert.Greater(t, \"b\", \"a\")\nfunc Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tfailMessage := fmt.Sprintf(\"\\\"%v\\\" is not greater than \\\"%v\\\"\", e1, e2)\n\treturn compareTwoValues(t, e1, e2, []compareResult{compareGreater}, failMessage, msgAndArgs...)\n}\n\n// GreaterOrEqual asserts that the first element is greater than or equal to the second\n//\n//\tassert.GreaterOrEqual(t, 2, 1)\n//\tassert.GreaterOrEqual(t, 2, 2)\n//\tassert.GreaterOrEqual(t, \"b\", \"a\")\n//\tassert.GreaterOrEqual(t, \"b\", \"b\")\nfunc GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tfailMessage := fmt.Sprintf(\"\\\"%v\\\" is not greater than or equal to \\\"%v\\\"\", e1, e2)\n\treturn compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, failMessage, msgAndArgs...)\n}\n\n// Less asserts that the first element is less than the second\n//\n//\tassert.Less(t, 1, 2)\n//\tassert.Less(t, float64(1), float64(2))\n//\tassert.Less(t, \"a\", \"b\")\nfunc Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tfailMessage := fmt.Sprintf(\"\\\"%v\\\" is not less than \\\"%v\\\"\", e1, e2)\n\treturn compareTwoValues(t, e1, e2, []compareResult{compareLess}, failMessage, msgAndArgs...)\n}\n\n// LessOrEqual asserts that the first element is less than or equal to the second\n//\n//\tassert.LessOrEqual(t, 1, 2)\n//\tassert.LessOrEqual(t, 2, 2)\n//\tassert.LessOrEqual(t, \"a\", \"b\")\n//\tassert.LessOrEqual(t, \"b\", \"b\")\nfunc LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tfailMessage := fmt.Sprintf(\"\\\"%v\\\" is not less than or equal to \\\"%v\\\"\", e1, e2)\n\treturn compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, failMessage, msgAndArgs...)\n}\n\n// Positive asserts that the specified element is positive\n//\n//\tassert.Positive(t, 1)\n//\tassert.Positive(t, 1.23)\nfunc Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tzero := reflect.Zero(reflect.TypeOf(e))\n\tfailMessage := fmt.Sprintf(\"\\\"%v\\\" is not positive\", e)\n\treturn compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, failMessage, msgAndArgs...)\n}\n\n// Negative asserts that the specified element is negative\n//\n//\tassert.Negative(t, -1)\n//\tassert.Negative(t, -1.23)\nfunc Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tzero := reflect.Zero(reflect.TypeOf(e))\n\tfailMessage := fmt.Sprintf(\"\\\"%v\\\" is not negative\", e)\n\treturn compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, failMessage, msgAndArgs...)\n}\n\nfunc compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\te1Kind := reflect.ValueOf(e1).Kind()\n\te2Kind := reflect.ValueOf(e2).Kind()\n\tif e1Kind != e2Kind {\n\t\treturn Fail(t, \"Elements should be the same type\", msgAndArgs...)\n\t}\n\n\tcompareResult, isComparable := compare(e1, e2, e1Kind)\n\tif !isComparable {\n\t\treturn Fail(t, fmt.Sprintf(`Can not compare type \"%T\"`, e1), msgAndArgs...)\n\t}\n\n\tif !containsValue(allowedComparesResults, compareResult) {\n\t\treturn Fail(t, failMessage, msgAndArgs...)\n\t}\n\n\treturn true\n}\n\nfunc containsValue(values []compareResult, value compareResult) bool {\n\tfor _, v := range values {\n\t\tif v == value {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n"
  },
  {
    "path": "assert/assertion_compare_test.go",
    "content": "package assert\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"runtime\"\n\t\"testing\"\n\t\"time\"\n)\n\nfunc TestCompare(t *testing.T) {\n\tt.Parallel()\n\n\ttype customString string\n\ttype customInt int\n\ttype customInt8 int8\n\ttype customInt16 int16\n\ttype customInt32 int32\n\ttype customInt64 int64\n\ttype customUInt uint\n\ttype customUInt8 uint8\n\ttype customUInt16 uint16\n\ttype customUInt32 uint32\n\ttype customUInt64 uint64\n\ttype customFloat32 float32\n\ttype customFloat64 float64\n\ttype customUintptr uintptr\n\ttype customTime time.Time\n\ttype customBytes []byte\n\tfor _, currCase := range []struct {\n\t\tless    interface{}\n\t\tgreater interface{}\n\t\tcType   string\n\t}{\n\t\t{less: customString(\"a\"), greater: customString(\"b\"), cType: \"string\"},\n\t\t{less: \"a\", greater: \"b\", cType: \"string\"},\n\t\t{less: customInt(1), greater: customInt(2), cType: \"int\"},\n\t\t{less: int(1), greater: int(2), cType: \"int\"},\n\t\t{less: customInt8(1), greater: customInt8(2), cType: \"int8\"},\n\t\t{less: int8(1), greater: int8(2), cType: \"int8\"},\n\t\t{less: customInt16(1), greater: customInt16(2), cType: \"int16\"},\n\t\t{less: int16(1), greater: int16(2), cType: \"int16\"},\n\t\t{less: customInt32(1), greater: customInt32(2), cType: \"int32\"},\n\t\t{less: int32(1), greater: int32(2), cType: \"int32\"},\n\t\t{less: customInt64(1), greater: customInt64(2), cType: \"int64\"},\n\t\t{less: int64(1), greater: int64(2), cType: \"int64\"},\n\t\t{less: customUInt(1), greater: customUInt(2), cType: \"uint\"},\n\t\t{less: uint8(1), greater: uint8(2), cType: \"uint8\"},\n\t\t{less: customUInt8(1), greater: customUInt8(2), cType: \"uint8\"},\n\t\t{less: uint16(1), greater: uint16(2), cType: \"uint16\"},\n\t\t{less: customUInt16(1), greater: customUInt16(2), cType: \"uint16\"},\n\t\t{less: uint32(1), greater: uint32(2), cType: \"uint32\"},\n\t\t{less: customUInt32(1), greater: customUInt32(2), cType: \"uint32\"},\n\t\t{less: uint64(1), greater: uint64(2), cType: \"uint64\"},\n\t\t{less: customUInt64(1), greater: customUInt64(2), cType: \"uint64\"},\n\t\t{less: float32(1.23), greater: float32(2.34), cType: \"float32\"},\n\t\t{less: customFloat32(1.23), greater: customFloat32(2.23), cType: \"float32\"},\n\t\t{less: float64(1.23), greater: float64(2.34), cType: \"float64\"},\n\t\t{less: customFloat64(1.23), greater: customFloat64(2.34), cType: \"float64\"},\n\t\t{less: uintptr(1), greater: uintptr(2), cType: \"uintptr\"},\n\t\t{less: customUintptr(1), greater: customUintptr(2), cType: \"uint64\"},\n\t\t{less: time.Now(), greater: time.Now().Add(time.Hour), cType: \"time.Time\"},\n\t\t{less: time.Date(2024, 0, 0, 0, 0, 0, 0, time.Local), greater: time.Date(2263, 0, 0, 0, 0, 0, 0, time.Local), cType: \"time.Time\"},\n\t\t{less: customTime(time.Now()), greater: customTime(time.Now().Add(time.Hour)), cType: \"time.Time\"},\n\t\t{less: []byte{1, 1}, greater: []byte{1, 2}, cType: \"[]byte\"},\n\t\t{less: customBytes([]byte{1, 1}), greater: customBytes([]byte{1, 2}), cType: \"[]byte\"},\n\t} {\n\t\tresLess, isComparable := compare(currCase.less, currCase.greater, reflect.ValueOf(currCase.less).Kind())\n\t\tif !isComparable {\n\t\t\tt.Error(\"object should be comparable for type \" + currCase.cType)\n\t\t}\n\n\t\tif resLess != compareLess {\n\t\t\tt.Errorf(\"object less (%v) should be less than greater (%v) for type \"+currCase.cType,\n\t\t\t\tcurrCase.less, currCase.greater)\n\t\t}\n\n\t\tresGreater, isComparable := compare(currCase.greater, currCase.less, reflect.ValueOf(currCase.less).Kind())\n\t\tif !isComparable {\n\t\t\tt.Error(\"object are comparable for type \" + currCase.cType)\n\t\t}\n\n\t\tif resGreater != compareGreater {\n\t\t\tt.Errorf(\"object greater should be greater than less for type \" + currCase.cType)\n\t\t}\n\n\t\tresEqual, isComparable := compare(currCase.less, currCase.less, reflect.ValueOf(currCase.less).Kind())\n\t\tif !isComparable {\n\t\t\tt.Error(\"object are comparable for type \" + currCase.cType)\n\t\t}\n\n\t\tif resEqual != 0 {\n\t\t\tt.Errorf(\"objects should be equal for type \" + currCase.cType)\n\t\t}\n\t}\n}\n\ntype outputT struct {\n\tbuf     *bytes.Buffer\n\thelpers map[string]struct{}\n}\n\n// Implements TestingT\nfunc (t *outputT) Errorf(format string, args ...interface{}) {\n\ts := fmt.Sprintf(format, args...)\n\tt.buf.WriteString(s)\n}\n\nfunc (t *outputT) Helper() {\n\tif t.helpers == nil {\n\t\tt.helpers = make(map[string]struct{})\n\t}\n\tt.helpers[callerName(1)] = struct{}{}\n}\n\n// callerName gives the function name (qualified with a package path)\n// for the caller after skip frames (where 0 means the current function).\nfunc callerName(skip int) string {\n\t// Make room for the skip PC.\n\tvar pc [1]uintptr\n\tn := runtime.Callers(skip+2, pc[:]) // skip + runtime.Callers + callerName\n\tif n == 0 {\n\t\tpanic(\"testing: zero callers found\")\n\t}\n\tframes := runtime.CallersFrames(pc[:n])\n\tframe, _ := frames.Next()\n\treturn frame.Function\n}\n\nfunc TestGreater(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !Greater(mockT, 2, 1) {\n\t\tt.Error(\"Greater should return true\")\n\t}\n\n\tif Greater(mockT, 1, 1) {\n\t\tt.Error(\"Greater should return false\")\n\t}\n\n\tif Greater(mockT, 1, 2) {\n\t\tt.Error(\"Greater should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\tless    interface{}\n\t\tgreater interface{}\n\t\tmsg     string\n\t}{\n\t\t{less: \"a\", greater: \"b\", msg: `\"a\" is not greater than \"b\"`},\n\t\t{less: int(1), greater: int(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: int8(1), greater: int8(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: int16(1), greater: int16(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: int32(1), greater: int32(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: int64(1), greater: int64(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: uint8(1), greater: uint8(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: uint16(1), greater: uint16(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: uint32(1), greater: uint32(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: uint64(1), greater: uint64(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: float32(1.23), greater: float32(2.34), msg: `\"1.23\" is not greater than \"2.34\"`},\n\t\t{less: float64(1.23), greater: float64(2.34), msg: `\"1.23\" is not greater than \"2.34\"`},\n\t\t{less: uintptr(1), greater: uintptr(2), msg: `\"1\" is not greater than \"2\"`},\n\t\t{less: time.Time{}, greater: time.Time{}.Add(time.Hour), msg: `\"0001-01-01 00:00:00 +0000 UTC\" is not greater than \"0001-01-01 01:00:00 +0000 UTC\"`},\n\t\t{less: []byte{1, 1}, greater: []byte{1, 2}, msg: `\"[1 1]\" is not greater than \"[1 2]\"`},\n\t} {\n\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\tFalse(t, Greater(out, currCase.less, currCase.greater))\n\t\tContains(t, out.buf.String(), currCase.msg)\n\t\tContains(t, out.helpers, \"github.com/stretchr/testify/assert.Greater\")\n\t}\n}\n\nfunc TestGreaterOrEqual(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !GreaterOrEqual(mockT, 2, 1) {\n\t\tt.Error(\"GreaterOrEqual should return true\")\n\t}\n\n\tif !GreaterOrEqual(mockT, 1, 1) {\n\t\tt.Error(\"GreaterOrEqual should return true\")\n\t}\n\n\tif GreaterOrEqual(mockT, 1, 2) {\n\t\tt.Error(\"GreaterOrEqual should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\tless    interface{}\n\t\tgreater interface{}\n\t\tmsg     string\n\t}{\n\t\t{less: \"a\", greater: \"b\", msg: `\"a\" is not greater than or equal to \"b\"`},\n\t\t{less: int(1), greater: int(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: int8(1), greater: int8(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: int16(1), greater: int16(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: int32(1), greater: int32(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: int64(1), greater: int64(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: uint8(1), greater: uint8(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: uint16(1), greater: uint16(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: uint32(1), greater: uint32(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: uint64(1), greater: uint64(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: float32(1.23), greater: float32(2.34), msg: `\"1.23\" is not greater than or equal to \"2.34\"`},\n\t\t{less: float64(1.23), greater: float64(2.34), msg: `\"1.23\" is not greater than or equal to \"2.34\"`},\n\t\t{less: uintptr(1), greater: uintptr(2), msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{less: time.Time{}, greater: time.Time{}.Add(time.Hour), msg: `\"0001-01-01 00:00:00 +0000 UTC\" is not greater than or equal to \"0001-01-01 01:00:00 +0000 UTC\"`},\n\t\t{less: []byte{1, 1}, greater: []byte{1, 2}, msg: `\"[1 1]\" is not greater than or equal to \"[1 2]\"`},\n\t} {\n\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\tFalse(t, GreaterOrEqual(out, currCase.less, currCase.greater))\n\t\tContains(t, out.buf.String(), currCase.msg)\n\t\tContains(t, out.helpers, \"github.com/stretchr/testify/assert.GreaterOrEqual\")\n\t}\n}\n\nfunc TestLess(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !Less(mockT, 1, 2) {\n\t\tt.Error(\"Less should return true\")\n\t}\n\n\tif Less(mockT, 1, 1) {\n\t\tt.Error(\"Less should return false\")\n\t}\n\n\tif Less(mockT, 2, 1) {\n\t\tt.Error(\"Less should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\tless    interface{}\n\t\tgreater interface{}\n\t\tmsg     string\n\t}{\n\t\t{less: \"a\", greater: \"b\", msg: `\"b\" is not less than \"a\"`},\n\t\t{less: int(1), greater: int(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: int8(1), greater: int8(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: int16(1), greater: int16(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: int32(1), greater: int32(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: int64(1), greater: int64(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: uint8(1), greater: uint8(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: uint16(1), greater: uint16(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: uint32(1), greater: uint32(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: uint64(1), greater: uint64(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: float32(1.23), greater: float32(2.34), msg: `\"2.34\" is not less than \"1.23\"`},\n\t\t{less: float64(1.23), greater: float64(2.34), msg: `\"2.34\" is not less than \"1.23\"`},\n\t\t{less: uintptr(1), greater: uintptr(2), msg: `\"2\" is not less than \"1\"`},\n\t\t{less: time.Time{}, greater: time.Time{}.Add(time.Hour), msg: `\"0001-01-01 01:00:00 +0000 UTC\" is not less than \"0001-01-01 00:00:00 +0000 UTC\"`},\n\t\t{less: []byte{1, 1}, greater: []byte{1, 2}, msg: `\"[1 2]\" is not less than \"[1 1]\"`},\n\t} {\n\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\tFalse(t, Less(out, currCase.greater, currCase.less))\n\t\tContains(t, out.buf.String(), currCase.msg)\n\t\tContains(t, out.helpers, \"github.com/stretchr/testify/assert.Less\")\n\t}\n}\n\nfunc TestLessOrEqual(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !LessOrEqual(mockT, 1, 2) {\n\t\tt.Error(\"LessOrEqual should return true\")\n\t}\n\n\tif !LessOrEqual(mockT, 1, 1) {\n\t\tt.Error(\"LessOrEqual should return true\")\n\t}\n\n\tif LessOrEqual(mockT, 2, 1) {\n\t\tt.Error(\"LessOrEqual should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\tless    interface{}\n\t\tgreater interface{}\n\t\tmsg     string\n\t}{\n\t\t{less: \"a\", greater: \"b\", msg: `\"b\" is not less than or equal to \"a\"`},\n\t\t{less: int(1), greater: int(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: int8(1), greater: int8(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: int16(1), greater: int16(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: int32(1), greater: int32(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: int64(1), greater: int64(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: uint8(1), greater: uint8(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: uint16(1), greater: uint16(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: uint32(1), greater: uint32(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: uint64(1), greater: uint64(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: float32(1.23), greater: float32(2.34), msg: `\"2.34\" is not less than or equal to \"1.23\"`},\n\t\t{less: float64(1.23), greater: float64(2.34), msg: `\"2.34\" is not less than or equal to \"1.23\"`},\n\t\t{less: uintptr(1), greater: uintptr(2), msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{less: time.Time{}, greater: time.Time{}.Add(time.Hour), msg: `\"0001-01-01 01:00:00 +0000 UTC\" is not less than or equal to \"0001-01-01 00:00:00 +0000 UTC\"`},\n\t\t{less: []byte{1, 1}, greater: []byte{1, 2}, msg: `\"[1 2]\" is not less than or equal to \"[1 1]\"`},\n\t} {\n\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\tFalse(t, LessOrEqual(out, currCase.greater, currCase.less))\n\t\tContains(t, out.buf.String(), currCase.msg)\n\t\tContains(t, out.helpers, \"github.com/stretchr/testify/assert.LessOrEqual\")\n\t}\n}\n\nfunc TestPositive(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !Positive(mockT, 1) {\n\t\tt.Error(\"Positive should return true\")\n\t}\n\n\tif !Positive(mockT, 1.23) {\n\t\tt.Error(\"Positive should return true\")\n\t}\n\n\tif Positive(mockT, -1) {\n\t\tt.Error(\"Positive should return false\")\n\t}\n\n\tif Positive(mockT, -1.23) {\n\t\tt.Error(\"Positive should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\te   interface{}\n\t\tmsg string\n\t}{\n\t\t{e: int(-1), msg: `\"-1\" is not positive`},\n\t\t{e: int8(-1), msg: `\"-1\" is not positive`},\n\t\t{e: int16(-1), msg: `\"-1\" is not positive`},\n\t\t{e: int32(-1), msg: `\"-1\" is not positive`},\n\t\t{e: int64(-1), msg: `\"-1\" is not positive`},\n\t\t{e: float32(-1.23), msg: `\"-1.23\" is not positive`},\n\t\t{e: float64(-1.23), msg: `\"-1.23\" is not positive`},\n\t} {\n\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\tFalse(t, Positive(out, currCase.e))\n\t\tContains(t, out.buf.String(), currCase.msg)\n\t\tContains(t, out.helpers, \"github.com/stretchr/testify/assert.Positive\")\n\t}\n}\n\nfunc TestNegative(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !Negative(mockT, -1) {\n\t\tt.Error(\"Negative should return true\")\n\t}\n\n\tif !Negative(mockT, -1.23) {\n\t\tt.Error(\"Negative should return true\")\n\t}\n\n\tif Negative(mockT, 1) {\n\t\tt.Error(\"Negative should return false\")\n\t}\n\n\tif Negative(mockT, 1.23) {\n\t\tt.Error(\"Negative should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\te   interface{}\n\t\tmsg string\n\t}{\n\t\t{e: int(1), msg: `\"1\" is not negative`},\n\t\t{e: int8(1), msg: `\"1\" is not negative`},\n\t\t{e: int16(1), msg: `\"1\" is not negative`},\n\t\t{e: int32(1), msg: `\"1\" is not negative`},\n\t\t{e: int64(1), msg: `\"1\" is not negative`},\n\t\t{e: float32(1.23), msg: `\"1.23\" is not negative`},\n\t\t{e: float64(1.23), msg: `\"1.23\" is not negative`},\n\t} {\n\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\tFalse(t, Negative(out, currCase.e))\n\t\tContains(t, out.buf.String(), currCase.msg)\n\t\tContains(t, out.helpers, \"github.com/stretchr/testify/assert.Negative\")\n\t}\n}\n\nfunc Test_compareTwoValuesDifferentValuesTypes(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tfor _, currCase := range []struct {\n\t\tv1            interface{}\n\t\tv2            interface{}\n\t\tcompareResult bool\n\t}{\n\t\t{v1: 123, v2: \"abc\"},\n\t\t{v1: \"abc\", v2: 123456},\n\t\t{v1: float64(12), v2: \"123\"},\n\t\t{v1: \"float(12)\", v2: float64(1)},\n\t} {\n\t\tresult := compareTwoValues(mockT, currCase.v1, currCase.v2, []compareResult{compareLess, compareEqual, compareGreater}, \"testFailMessage\")\n\t\tFalse(t, result)\n\t}\n}\n\nfunc Test_compareTwoValuesNotComparableValues(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\ttype CompareStruct struct {\n\t}\n\n\tfor _, currCase := range []struct {\n\t\tv1 interface{}\n\t\tv2 interface{}\n\t}{\n\t\t{v1: CompareStruct{}, v2: CompareStruct{}},\n\t\t{v1: map[string]int{}, v2: map[string]int{}},\n\t\t{v1: make([]int, 5), v2: make([]int, 5)},\n\t} {\n\t\tresult := compareTwoValues(mockT, currCase.v1, currCase.v2, []compareResult{compareLess, compareEqual, compareGreater}, \"testFailMessage\")\n\t\tFalse(t, result)\n\t}\n}\n\nfunc Test_compareTwoValuesCorrectCompareResult(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tfor _, currCase := range []struct {\n\t\tv1             interface{}\n\t\tv2             interface{}\n\t\tallowedResults []compareResult\n\t}{\n\t\t{v1: 1, v2: 2, allowedResults: []compareResult{compareLess}},\n\t\t{v1: 1, v2: 2, allowedResults: []compareResult{compareLess, compareEqual}},\n\t\t{v1: 2, v2: 2, allowedResults: []compareResult{compareGreater, compareEqual}},\n\t\t{v1: 2, v2: 2, allowedResults: []compareResult{compareEqual}},\n\t\t{v1: 2, v2: 1, allowedResults: []compareResult{compareEqual, compareGreater}},\n\t\t{v1: 2, v2: 1, allowedResults: []compareResult{compareGreater}},\n\t} {\n\t\tresult := compareTwoValues(mockT, currCase.v1, currCase.v2, currCase.allowedResults, \"testFailMessage\")\n\t\tTrue(t, result)\n\t}\n}\n\nfunc Test_containsValue(t *testing.T) {\n\tt.Parallel()\n\n\tfor _, currCase := range []struct {\n\t\tvalues []compareResult\n\t\tvalue  compareResult\n\t\tresult bool\n\t}{\n\t\t{values: []compareResult{compareGreater}, value: compareGreater, result: true},\n\t\t{values: []compareResult{compareGreater, compareLess}, value: compareGreater, result: true},\n\t\t{values: []compareResult{compareGreater, compareLess}, value: compareLess, result: true},\n\t\t{values: []compareResult{compareGreater, compareLess}, value: compareEqual, result: false},\n\t} {\n\t\tresult := containsValue(currCase.values, currCase.value)\n\t\tEqual(t, currCase.result, result)\n\t}\n}\n\nfunc TestComparingMsgAndArgsForwarding(t *testing.T) {\n\tmsgAndArgs := []interface{}{\"format %s %x\", \"this\", 0xc001}\n\texpectedOutput := \"format this c001\\n\"\n\tfuncs := []func(t TestingT){\n\t\tfunc(t TestingT) { Greater(t, 1, 2, msgAndArgs...) },\n\t\tfunc(t TestingT) { GreaterOrEqual(t, 1, 2, msgAndArgs...) },\n\t\tfunc(t TestingT) { Less(t, 2, 1, msgAndArgs...) },\n\t\tfunc(t TestingT) { LessOrEqual(t, 2, 1, msgAndArgs...) },\n\t\tfunc(t TestingT) { Positive(t, 0, msgAndArgs...) },\n\t\tfunc(t TestingT) { Negative(t, 0, msgAndArgs...) },\n\t}\n\tfor _, f := range funcs {\n\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\tf(out)\n\t\tContains(t, out.buf.String(), expectedOutput)\n\t}\n}\n"
  },
  {
    "path": "assert/assertion_format.go",
    "content": "// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.\n\npackage assert\n\nimport (\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Condition(t, comp, append([]interface{}{msg}, args...)...)\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//\tassert.Containsf(t, \"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//\tassert.Containsf(t, [\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//\tassert.Containsf(t, {\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\nfunc Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Contains(t, s, contains, append([]interface{}{msg}, args...)...)\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails\n// if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn DirExists(t, path, append([]interface{}{msg}, args...)...)\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\")\nfunc ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)\n}\n\n// Emptyf asserts that the given value is \"empty\".\n//\n// [Zero values] are \"empty\".\n//\n// Arrays are \"empty\" if every element is the zero value of the type (stricter than \"empty\").\n//\n// Slices, maps and channels with zero length are \"empty\".\n//\n// Pointer values are \"empty\" if the pointer is nil or if the pointed value is \"empty\".\n//\n//\tassert.Emptyf(t, obj, \"error message %s\", \"formatted\")\n//\n// [Zero values]: https://go.dev/ref/spec#The_zero_value\nfunc Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Empty(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// Equalf asserts that two objects are equal.\n//\n//\tassert.Equalf(t, 123, 123, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Equal(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// EqualErrorf asserts that a function returned a non-nil error (i.e. an error)\n// and that it is equal to the provided error.\n//\n//\tactualObj, err := SomeFunction()\n//\tassert.EqualErrorf(t, err,  expectedErrorString, \"error message %s\", \"formatted\")\nfunc EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)\n}\n\n// EqualExportedValuesf asserts that the types of two objects are equal and their public\n// fields are also equal. This is useful for comparing structs that have private fields\n// that could potentially differ.\n//\n//\t type S struct {\n//\t\tExported     \tint\n//\t\tnotExported   \tint\n//\t }\n//\t assert.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, \"error message %s\", \"formatted\") => true\n//\t assert.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, \"error message %s\", \"formatted\") => false\nfunc EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualExportedValues(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// EqualValuesf asserts that two objects are equal or convertible to the larger\n// type and equal.\n//\n//\tassert.EqualValuesf(t, uint32(123), int32(123), \"error message %s\", \"formatted\")\nfunc EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Errorf asserts that a function returned a non-nil error (ie. an error).\n//\n//\tactualObj, err := SomeFunction()\n//\tassert.Errorf(t, err, \"error message %s\", \"formatted\")\nfunc Errorf(t TestingT, err error, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Error(t, err, append([]interface{}{msg}, args...)...)\n}\n\n// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.\n// This is a wrapper for errors.As.\nfunc ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ErrorAs(t, err, target, append([]interface{}{msg}, args...)...)\n}\n\n// ErrorContainsf asserts that a function returned a non-nil error (i.e. an\n// error) and that the error contains the specified substring.\n//\n//\tactualObj, err := SomeFunction()\n//\tassert.ErrorContainsf(t, err,  expectedErrorSubString, \"error message %s\", \"formatted\")\nfunc ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ErrorContains(t, theError, contains, append([]interface{}{msg}, args...)...)\n}\n\n// ErrorIsf asserts that at least one of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ErrorIs(t, err, target, append([]interface{}{msg}, args...)...)\n}\n\n// Eventuallyf asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick.\n//\n//\tassert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, \"error message %s\", \"formatted\")\nfunc Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Eventually(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)\n}\n\n// EventuallyWithTf asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick. In contrast to Eventually,\n// it supplies a CollectT to the condition function, so that the condition\n// function can use the CollectT to call other assertions.\n// The condition is considered \"met\" if no errors are raised in a tick.\n// The supplied CollectT collects all errors from one tick (if there are any).\n// If the condition is not met before waitFor, the collected errors of\n// the last tick are copied to t.\n//\n//\texternalValue := false\n//\tgo func() {\n//\t\ttime.Sleep(8*time.Second)\n//\t\texternalValue = true\n//\t}()\n//\tassert.EventuallyWithTf(t, func(c *assert.CollectT) {\n//\t\t// add assertions as needed; any assertion failure will fail the current tick\n//\t\tassert.True(c, externalValue, \"expected 'externalValue' to be true\")\n//\t}, 10*time.Second, 1*time.Second, \"error message %s\", \"formatted\")\nfunc EventuallyWithTf(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EventuallyWithT(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//\tassert.Exactlyf(t, int32(123), int64(123), \"error message %s\", \"formatted\")\nfunc Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Failf reports a failure through\nfunc Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Fail(t, failureMessage, append([]interface{}{msg}, args...)...)\n}\n\n// FailNowf fails test\nfunc FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)\n}\n\n// Falsef asserts that the specified value is false.\n//\n//\tassert.Falsef(t, myBool, \"error message %s\", \"formatted\")\nfunc Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn False(t, value, append([]interface{}{msg}, args...)...)\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if\n// the path points to a directory or there is an error when trying to check the file.\nfunc FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FileExists(t, path, append([]interface{}{msg}, args...)...)\n}\n\n// Greaterf asserts that the first element is greater than the second\n//\n//\tassert.Greaterf(t, 2, 1, \"error message %s\", \"formatted\")\n//\tassert.Greaterf(t, float64(2), float64(1), \"error message %s\", \"formatted\")\n//\tassert.Greaterf(t, \"b\", \"a\", \"error message %s\", \"formatted\")\nfunc Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Greater(t, e1, e2, append([]interface{}{msg}, args...)...)\n}\n\n// GreaterOrEqualf asserts that the first element is greater than or equal to the second\n//\n//\tassert.GreaterOrEqualf(t, 2, 1, \"error message %s\", \"formatted\")\n//\tassert.GreaterOrEqualf(t, 2, 2, \"error message %s\", \"formatted\")\n//\tassert.GreaterOrEqualf(t, \"b\", \"a\", \"error message %s\", \"formatted\")\n//\tassert.GreaterOrEqualf(t, \"b\", \"b\", \"error message %s\", \"formatted\")\nfunc GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn GreaterOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//\tassert.HTTPBodyContainsf(t, myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//\tassert.HTTPBodyNotContainsf(t, myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//\tassert.HTTPErrorf(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//\tassert.HTTPRedirectf(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPStatusCodef asserts that a specified handler returns a specified status code.\n//\n//\tassert.HTTPStatusCodef(t, myHandler, \"GET\", \"/notImplemented\", nil, 501, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPStatusCode(t, handler, method, url, values, statuscode, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//\tassert.HTTPSuccessf(t, myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//\tassert.Implementsf(t, (*MyInterface)(nil), new(MyObject), \"error message %s\", \"formatted\")\nfunc Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n//\tassert.InDeltaf(t, math.Pi, 22/7.0, 0.01, \"error message %s\", \"formatted\")\nfunc InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\nfunc InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)\n}\n\n// IsDecreasingf asserts that the collection is decreasing\n//\n//\tassert.IsDecreasingf(t, []int{2, 1, 0}, \"error message %s\", \"formatted\")\n//\tassert.IsDecreasingf(t, []float{2, 1}, \"error message %s\", \"formatted\")\n//\tassert.IsDecreasingf(t, []string{\"b\", \"a\"}, \"error message %s\", \"formatted\")\nfunc IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsDecreasing(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// IsIncreasingf asserts that the collection is increasing\n//\n//\tassert.IsIncreasingf(t, []int{1, 2, 3}, \"error message %s\", \"formatted\")\n//\tassert.IsIncreasingf(t, []float{1, 2}, \"error message %s\", \"formatted\")\n//\tassert.IsIncreasingf(t, []string{\"a\", \"b\"}, \"error message %s\", \"formatted\")\nfunc IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsIncreasing(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// IsNonDecreasingf asserts that the collection is not decreasing\n//\n//\tassert.IsNonDecreasingf(t, []int{1, 1, 2}, \"error message %s\", \"formatted\")\n//\tassert.IsNonDecreasingf(t, []float{1, 2}, \"error message %s\", \"formatted\")\n//\tassert.IsNonDecreasingf(t, []string{\"a\", \"b\"}, \"error message %s\", \"formatted\")\nfunc IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsNonDecreasing(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// IsNonIncreasingf asserts that the collection is not increasing\n//\n//\tassert.IsNonIncreasingf(t, []int{2, 1, 1}, \"error message %s\", \"formatted\")\n//\tassert.IsNonIncreasingf(t, []float{2, 1}, \"error message %s\", \"formatted\")\n//\tassert.IsNonIncreasingf(t, []string{\"b\", \"a\"}, \"error message %s\", \"formatted\")\nfunc IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// IsNotTypef asserts that the specified objects are not of the same type.\n//\n//\tassert.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, \"error message %s\", \"formatted\")\nfunc IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsNotType(t, theType, object, append([]interface{}{msg}, args...)...)\n}\n\n// IsTypef asserts that the specified objects are of the same type.\n//\n//\tassert.IsTypef(t, &MyStruct{}, &MyStruct{}, \"error message %s\", \"formatted\")\nfunc IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//\tassert.JSONEqf(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\nfunc JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//\tassert.Lenf(t, mySlice, 3, \"error message %s\", \"formatted\")\nfunc Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Len(t, object, length, append([]interface{}{msg}, args...)...)\n}\n\n// Lessf asserts that the first element is less than the second\n//\n//\tassert.Lessf(t, 1, 2, \"error message %s\", \"formatted\")\n//\tassert.Lessf(t, float64(1), float64(2), \"error message %s\", \"formatted\")\n//\tassert.Lessf(t, \"a\", \"b\", \"error message %s\", \"formatted\")\nfunc Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Less(t, e1, e2, append([]interface{}{msg}, args...)...)\n}\n\n// LessOrEqualf asserts that the first element is less than or equal to the second\n//\n//\tassert.LessOrEqualf(t, 1, 2, \"error message %s\", \"formatted\")\n//\tassert.LessOrEqualf(t, 2, 2, \"error message %s\", \"formatted\")\n//\tassert.LessOrEqualf(t, \"a\", \"b\", \"error message %s\", \"formatted\")\n//\tassert.LessOrEqualf(t, \"b\", \"b\", \"error message %s\", \"formatted\")\nfunc LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)\n}\n\n// Negativef asserts that the specified element is negative\n//\n//\tassert.Negativef(t, -1, \"error message %s\", \"formatted\")\n//\tassert.Negativef(t, -1.23, \"error message %s\", \"formatted\")\nfunc Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Negative(t, e, append([]interface{}{msg}, args...)...)\n}\n\n// Neverf asserts that the given condition doesn't satisfy in waitFor time,\n// periodically checking the target function each tick.\n//\n//\tassert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, \"error message %s\", \"formatted\")\nfunc Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Never(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//\tassert.Nilf(t, err, \"error message %s\", \"formatted\")\nfunc Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Nil(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// NoDirExistsf checks whether a directory does not exist in the given path.\n// It fails if the path points to an existing _directory_ only.\nfunc NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoDirExists(t, path, append([]interface{}{msg}, args...)...)\n}\n\n// NoErrorf asserts that a function returned a nil error (ie. no error).\n//\n//\t  actualObj, err := SomeFunction()\n//\t  if assert.NoErrorf(t, err, \"error message %s\", \"formatted\") {\n//\t\t   assert.Equal(t, expectedObj, actualObj)\n//\t  }\nfunc NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoError(t, err, append([]interface{}{msg}, args...)...)\n}\n\n// NoFileExistsf checks whether a file does not exist in a given path. It fails\n// if the path points to an existing _file_ only.\nfunc NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoFileExists(t, path, append([]interface{}{msg}, args...)...)\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//\tassert.NotContainsf(t, \"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//\tassert.NotContainsf(t, [\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//\tassert.NotContainsf(t, {\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\nfunc NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotContains(t, s, contains, append([]interface{}{msg}, args...)...)\n}\n\n// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should not match.\n// This is an inverse of ElementsMatch.\n//\n// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], \"error message %s\", \"formatted\") -> false\n//\n// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], \"error message %s\", \"formatted\") -> true\n//\n// assert.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], \"error message %s\", \"formatted\") -> true\nfunc NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)\n}\n\n// NotEmptyf asserts that the specified object is NOT [Empty].\n//\n//\tif assert.NotEmptyf(t, obj, \"error message %s\", \"formatted\") {\n//\t  assert.Equal(t, \"two\", obj[1])\n//\t}\nfunc NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEmpty(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//\tassert.NotEqualf(t, obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// NotEqualValuesf asserts that two objects are not equal even when converted to the same type\n//\n//\tassert.NotEqualValuesf(t, obj1, obj2, \"error message %s\", \"formatted\")\nfunc NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// NotErrorAsf asserts that none of the errors in err's chain matches target,\n// but if so, sets target to that error value.\nfunc NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotErrorAs(t, err, target, append([]interface{}{msg}, args...)...)\n}\n\n// NotErrorIsf asserts that none of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...)\n}\n\n// NotImplementsf asserts that an object does not implement the specified interface.\n//\n//\tassert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), \"error message %s\", \"formatted\")\nfunc NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotImplements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//\tassert.NotNilf(t, err, \"error message %s\", \"formatted\")\nfunc NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotNil(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//\tassert.NotPanicsf(t, func(){ RemainCalm() }, \"error message %s\", \"formatted\")\nfunc NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotPanics(t, f, append([]interface{}{msg}, args...)...)\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//\tassert.NotRegexpf(t, regexp.MustCompile(\"starts\"), \"it's starting\", \"error message %s\", \"formatted\")\n//\tassert.NotRegexpf(t, \"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)\n}\n\n// NotSamef asserts that two pointers do not reference the same object.\n//\n//\tassert.NotSamef(t, ptr1, ptr2, \"error message %s\", \"formatted\")\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotSame(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all\n// elements given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\tassert.NotSubsetf(t, [1, 3, 4], [1, 2], \"error message %s\", \"formatted\")\n//\tassert.NotSubsetf(t, {\"x\": 1, \"y\": 2}, {\"z\": 3}, \"error message %s\", \"formatted\")\n//\tassert.NotSubsetf(t, [1, 3, 4], {1: \"one\", 2: \"two\"}, \"error message %s\", \"formatted\")\n//\tassert.NotSubsetf(t, {\"x\": 1, \"y\": 2}, [\"z\"], \"error message %s\", \"formatted\")\nfunc NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)\n}\n\n// NotZerof asserts that i is not the zero value for its type.\nfunc NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotZero(t, i, append([]interface{}{msg}, args...)...)\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//\tassert.Panicsf(t, func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Panics(t, f, append([]interface{}{msg}, args...)...)\n}\n\n// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc\n// panics, and that the recovered panic value is an error that satisfies the\n// EqualError comparison.\n//\n//\tassert.PanicsWithErrorf(t, \"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn PanicsWithError(t, errString, f, append([]interface{}{msg}, args...)...)\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//\tassert.PanicsWithValuef(t, \"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)\n}\n\n// Positivef asserts that the specified element is positive\n//\n//\tassert.Positivef(t, 1, \"error message %s\", \"formatted\")\n//\tassert.Positivef(t, 1.23, \"error message %s\", \"formatted\")\nfunc Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Positive(t, e, append([]interface{}{msg}, args...)...)\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//\tassert.Regexpf(t, regexp.MustCompile(\"start\"), \"it's starting\", \"error message %s\", \"formatted\")\n//\tassert.Regexpf(t, \"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Regexp(t, rx, str, append([]interface{}{msg}, args...)...)\n}\n\n// Samef asserts that two pointers reference the same object.\n//\n//\tassert.Samef(t, ptr1, ptr2, \"error message %s\", \"formatted\")\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Same(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Subsetf asserts that the list (array, slice, or map) contains all elements\n// given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\tassert.Subsetf(t, [1, 2, 3], [1, 2], \"error message %s\", \"formatted\")\n//\tassert.Subsetf(t, {\"x\": 1, \"y\": 2}, {\"x\": 1}, \"error message %s\", \"formatted\")\n//\tassert.Subsetf(t, [1, 2, 3], {1: \"one\", 2: \"two\"}, \"error message %s\", \"formatted\")\n//\tassert.Subsetf(t, {\"x\": 1, \"y\": 2}, [\"x\"], \"error message %s\", \"formatted\")\nfunc Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Subset(t, list, subset, append([]interface{}{msg}, args...)...)\n}\n\n// Truef asserts that the specified value is true.\n//\n//\tassert.Truef(t, myBool, \"error message %s\", \"formatted\")\nfunc Truef(t TestingT, value bool, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn True(t, value, append([]interface{}{msg}, args...)...)\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//\tassert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\nfunc WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// WithinRangef asserts that a time is within a time range (inclusive).\n//\n//\tassert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), \"error message %s\", \"formatted\")\nfunc WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn WithinRange(t, actual, start, end, append([]interface{}{msg}, args...)...)\n}\n\n// YAMLEqf asserts that the first documents in the two YAML strings are equivalent.\n//\n//\texpected := `---\n//\tkey: value\n//\t---\n//\tkey: this is a second document, it is not evaluated\n//\t`\n//\tactual := `---\n//\tkey: value\n//\t---\n//\tkey: this is a subsequent document, it is not evaluated\n//\t`\n//\tassert.YAMLEqf(t, expected, actual, \"error message %s\", \"formatted\")\nfunc YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Zerof asserts that i is the zero value for its type.\nfunc Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Zero(t, i, append([]interface{}{msg}, args...)...)\n}\n"
  },
  {
    "path": "assert/assertion_format.go.tmpl",
    "content": "{{.CommentFormat}}\nfunc {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool {\n\tif h, ok := t.(tHelper); ok { h.Helper() }\n\treturn {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}})\n}\n"
  },
  {
    "path": "assert/assertion_forward.go",
    "content": "// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.\n\npackage assert\n\nimport (\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Condition uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Condition(a.t, comp, msgAndArgs...)\n}\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Conditionf(a.t, comp, msg, args...)\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//\ta.Contains(\"Hello World\", \"World\")\n//\ta.Contains([\"Hello\", \"World\"], \"World\")\n//\ta.Contains({\"Hello\": \"World\"}, \"Hello\")\nfunc (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Contains(a.t, s, contains, msgAndArgs...)\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//\ta.Containsf(\"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//\ta.Containsf([\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//\ta.Containsf({\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Containsf(a.t, s, contains, msg, args...)\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails\n// if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn DirExists(a.t, path, msgAndArgs...)\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails\n// if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn DirExistsf(a.t, path, msg, args...)\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])\nfunc (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ElementsMatch(a.t, listA, listB, msgAndArgs...)\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\")\nfunc (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ElementsMatchf(a.t, listA, listB, msg, args...)\n}\n\n// Empty asserts that the given value is \"empty\".\n//\n// [Zero values] are \"empty\".\n//\n// Arrays are \"empty\" if every element is the zero value of the type (stricter than \"empty\").\n//\n// Slices, maps and channels with zero length are \"empty\".\n//\n// Pointer values are \"empty\" if the pointer is nil or if the pointed value is \"empty\".\n//\n//\ta.Empty(obj)\n//\n// [Zero values]: https://go.dev/ref/spec#The_zero_value\nfunc (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Empty(a.t, object, msgAndArgs...)\n}\n\n// Emptyf asserts that the given value is \"empty\".\n//\n// [Zero values] are \"empty\".\n//\n// Arrays are \"empty\" if every element is the zero value of the type (stricter than \"empty\").\n//\n// Slices, maps and channels with zero length are \"empty\".\n//\n// Pointer values are \"empty\" if the pointer is nil or if the pointed value is \"empty\".\n//\n//\ta.Emptyf(obj, \"error message %s\", \"formatted\")\n//\n// [Zero values]: https://go.dev/ref/spec#The_zero_value\nfunc (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Emptyf(a.t, object, msg, args...)\n}\n\n// Equal asserts that two objects are equal.\n//\n//\ta.Equal(123, 123)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Equal(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualError asserts that a function returned a non-nil error (i.e. an error)\n// and that it is equal to the provided error.\n//\n//\tactualObj, err := SomeFunction()\n//\ta.EqualError(err,  expectedErrorString)\nfunc (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualError(a.t, theError, errString, msgAndArgs...)\n}\n\n// EqualErrorf asserts that a function returned a non-nil error (i.e. an error)\n// and that it is equal to the provided error.\n//\n//\tactualObj, err := SomeFunction()\n//\ta.EqualErrorf(err,  expectedErrorString, \"error message %s\", \"formatted\")\nfunc (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualErrorf(a.t, theError, errString, msg, args...)\n}\n\n// EqualExportedValues asserts that the types of two objects are equal and their public\n// fields are also equal. This is useful for comparing structs that have private fields\n// that could potentially differ.\n//\n//\t type S struct {\n//\t\tExported     \tint\n//\t\tnotExported   \tint\n//\t }\n//\t a.EqualExportedValues(S{1, 2}, S{1, 3}) => true\n//\t a.EqualExportedValues(S{1, 2}, S{2, 3}) => false\nfunc (a *Assertions) EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualExportedValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualExportedValuesf asserts that the types of two objects are equal and their public\n// fields are also equal. This is useful for comparing structs that have private fields\n// that could potentially differ.\n//\n//\t type S struct {\n//\t\tExported     \tint\n//\t\tnotExported   \tint\n//\t }\n//\t a.EqualExportedValuesf(S{1, 2}, S{1, 3}, \"error message %s\", \"formatted\") => true\n//\t a.EqualExportedValuesf(S{1, 2}, S{2, 3}, \"error message %s\", \"formatted\") => false\nfunc (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualExportedValuesf(a.t, expected, actual, msg, args...)\n}\n\n// EqualValues asserts that two objects are equal or convertible to the larger\n// type and equal.\n//\n//\ta.EqualValues(uint32(123), int32(123))\nfunc (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualValuesf asserts that two objects are equal or convertible to the larger\n// type and equal.\n//\n//\ta.EqualValuesf(uint32(123), int32(123), \"error message %s\", \"formatted\")\nfunc (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualValuesf(a.t, expected, actual, msg, args...)\n}\n\n// Equalf asserts that two objects are equal.\n//\n//\ta.Equalf(123, 123, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Equalf(a.t, expected, actual, msg, args...)\n}\n\n// Error asserts that a function returned a non-nil error (ie. an error).\n//\n//\tactualObj, err := SomeFunction()\n//\ta.Error(err)\nfunc (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Error(a.t, err, msgAndArgs...)\n}\n\n// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.\n// This is a wrapper for errors.As.\nfunc (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ErrorAs(a.t, err, target, msgAndArgs...)\n}\n\n// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.\n// This is a wrapper for errors.As.\nfunc (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ErrorAsf(a.t, err, target, msg, args...)\n}\n\n// ErrorContains asserts that a function returned a non-nil error (i.e. an\n// error) and that the error contains the specified substring.\n//\n//\tactualObj, err := SomeFunction()\n//\ta.ErrorContains(err,  expectedErrorSubString)\nfunc (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ErrorContains(a.t, theError, contains, msgAndArgs...)\n}\n\n// ErrorContainsf asserts that a function returned a non-nil error (i.e. an\n// error) and that the error contains the specified substring.\n//\n//\tactualObj, err := SomeFunction()\n//\ta.ErrorContainsf(err,  expectedErrorSubString, \"error message %s\", \"formatted\")\nfunc (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ErrorContainsf(a.t, theError, contains, msg, args...)\n}\n\n// ErrorIs asserts that at least one of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ErrorIs(a.t, err, target, msgAndArgs...)\n}\n\n// ErrorIsf asserts that at least one of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ErrorIsf(a.t, err, target, msg, args...)\n}\n\n// Errorf asserts that a function returned a non-nil error (ie. an error).\n//\n//\tactualObj, err := SomeFunction()\n//\ta.Errorf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Errorf(a.t, err, msg, args...)\n}\n\n// Eventually asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick.\n//\n//\ta.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond)\nfunc (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Eventually(a.t, condition, waitFor, tick, msgAndArgs...)\n}\n\n// EventuallyWithT asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick. In contrast to Eventually,\n// it supplies a CollectT to the condition function, so that the condition\n// function can use the CollectT to call other assertions.\n// The condition is considered \"met\" if no errors are raised in a tick.\n// The supplied CollectT collects all errors from one tick (if there are any).\n// If the condition is not met before waitFor, the collected errors of\n// the last tick are copied to t.\n//\n//\texternalValue := false\n//\tgo func() {\n//\t\ttime.Sleep(8*time.Second)\n//\t\texternalValue = true\n//\t}()\n//\ta.EventuallyWithT(func(c *assert.CollectT) {\n//\t\t// add assertions as needed; any assertion failure will fail the current tick\n//\t\tassert.True(c, externalValue, \"expected 'externalValue' to be true\")\n//\t}, 10*time.Second, 1*time.Second, \"external state has not changed to 'true'; still false\")\nfunc (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EventuallyWithT(a.t, condition, waitFor, tick, msgAndArgs...)\n}\n\n// EventuallyWithTf asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick. In contrast to Eventually,\n// it supplies a CollectT to the condition function, so that the condition\n// function can use the CollectT to call other assertions.\n// The condition is considered \"met\" if no errors are raised in a tick.\n// The supplied CollectT collects all errors from one tick (if there are any).\n// If the condition is not met before waitFor, the collected errors of\n// the last tick are copied to t.\n//\n//\texternalValue := false\n//\tgo func() {\n//\t\ttime.Sleep(8*time.Second)\n//\t\texternalValue = true\n//\t}()\n//\ta.EventuallyWithTf(func(c *assert.CollectT) {\n//\t\t// add assertions as needed; any assertion failure will fail the current tick\n//\t\tassert.True(c, externalValue, \"expected 'externalValue' to be true\")\n//\t}, 10*time.Second, 1*time.Second, \"error message %s\", \"formatted\")\nfunc (a *Assertions) EventuallyWithTf(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EventuallyWithTf(a.t, condition, waitFor, tick, msg, args...)\n}\n\n// Eventuallyf asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick.\n//\n//\ta.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Eventuallyf(a.t, condition, waitFor, tick, msg, args...)\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//\ta.Exactly(int32(123), int64(123))\nfunc (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Exactly(a.t, expected, actual, msgAndArgs...)\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//\ta.Exactlyf(int32(123), int64(123), \"error message %s\", \"formatted\")\nfunc (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Exactlyf(a.t, expected, actual, msg, args...)\n}\n\n// Fail reports a failure through\nfunc (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Fail(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNow fails test\nfunc (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FailNow(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNowf fails test\nfunc (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FailNowf(a.t, failureMessage, msg, args...)\n}\n\n// Failf reports a failure through\nfunc (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Failf(a.t, failureMessage, msg, args...)\n}\n\n// False asserts that the specified value is false.\n//\n//\ta.False(myBool)\nfunc (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn False(a.t, value, msgAndArgs...)\n}\n\n// Falsef asserts that the specified value is false.\n//\n//\ta.Falsef(myBool, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Falsef(a.t, value, msg, args...)\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if\n// the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FileExists(a.t, path, msgAndArgs...)\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if\n// the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FileExistsf(a.t, path, msg, args...)\n}\n\n// Greater asserts that the first element is greater than the second\n//\n//\ta.Greater(2, 1)\n//\ta.Greater(float64(2), float64(1))\n//\ta.Greater(\"b\", \"a\")\nfunc (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Greater(a.t, e1, e2, msgAndArgs...)\n}\n\n// GreaterOrEqual asserts that the first element is greater than or equal to the second\n//\n//\ta.GreaterOrEqual(2, 1)\n//\ta.GreaterOrEqual(2, 2)\n//\ta.GreaterOrEqual(\"b\", \"a\")\n//\ta.GreaterOrEqual(\"b\", \"b\")\nfunc (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn GreaterOrEqual(a.t, e1, e2, msgAndArgs...)\n}\n\n// GreaterOrEqualf asserts that the first element is greater than or equal to the second\n//\n//\ta.GreaterOrEqualf(2, 1, \"error message %s\", \"formatted\")\n//\ta.GreaterOrEqualf(2, 2, \"error message %s\", \"formatted\")\n//\ta.GreaterOrEqualf(\"b\", \"a\", \"error message %s\", \"formatted\")\n//\ta.GreaterOrEqualf(\"b\", \"b\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn GreaterOrEqualf(a.t, e1, e2, msg, args...)\n}\n\n// Greaterf asserts that the first element is greater than the second\n//\n//\ta.Greaterf(2, 1, \"error message %s\", \"formatted\")\n//\ta.Greaterf(float64(2), float64(1), \"error message %s\", \"formatted\")\n//\ta.Greaterf(\"b\", \"a\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Greaterf(a.t, e1, e2, msg, args...)\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//\ta.HTTPBodyContains(myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//\ta.HTTPBodyContainsf(myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//\ta.HTTPBodyNotContains(myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//\ta.HTTPBodyNotContainsf(myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//\ta.HTTPError(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPError(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//\ta.HTTPErrorf(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPErrorf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//\ta.HTTPRedirect(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//\ta.HTTPRedirectf(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPRedirectf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPStatusCode asserts that a specified handler returns a specified status code.\n//\n//\ta.HTTPStatusCode(myHandler, \"GET\", \"/notImplemented\", nil, 501)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...)\n}\n\n// HTTPStatusCodef asserts that a specified handler returns a specified status code.\n//\n//\ta.HTTPStatusCodef(myHandler, \"GET\", \"/notImplemented\", nil, 501, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...)\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//\ta.HTTPSuccess(myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//\ta.HTTPSuccessf(myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPSuccessf(a.t, handler, method, url, values, msg, args...)\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//\ta.Implements((*MyInterface)(nil), new(MyObject))\nfunc (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Implements(a.t, interfaceObject, object, msgAndArgs...)\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//\ta.Implementsf((*MyInterface)(nil), new(MyObject), \"error message %s\", \"formatted\")\nfunc (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Implementsf(a.t, interfaceObject, object, msg, args...)\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n//\ta.InDelta(math.Pi, 22/7.0, 0.01)\nfunc (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDelta(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaSlicef(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n//\ta.InDeltaf(math.Pi, 22/7.0, 0.01, \"error message %s\", \"formatted\")\nfunc (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\nfunc (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\nfunc (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilonf(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// IsDecreasing asserts that the collection is decreasing\n//\n//\ta.IsDecreasing([]int{2, 1, 0})\n//\ta.IsDecreasing([]float{2, 1})\n//\ta.IsDecreasing([]string{\"b\", \"a\"})\nfunc (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsDecreasing(a.t, object, msgAndArgs...)\n}\n\n// IsDecreasingf asserts that the collection is decreasing\n//\n//\ta.IsDecreasingf([]int{2, 1, 0}, \"error message %s\", \"formatted\")\n//\ta.IsDecreasingf([]float{2, 1}, \"error message %s\", \"formatted\")\n//\ta.IsDecreasingf([]string{\"b\", \"a\"}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsDecreasingf(a.t, object, msg, args...)\n}\n\n// IsIncreasing asserts that the collection is increasing\n//\n//\ta.IsIncreasing([]int{1, 2, 3})\n//\ta.IsIncreasing([]float{1, 2})\n//\ta.IsIncreasing([]string{\"a\", \"b\"})\nfunc (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsIncreasing(a.t, object, msgAndArgs...)\n}\n\n// IsIncreasingf asserts that the collection is increasing\n//\n//\ta.IsIncreasingf([]int{1, 2, 3}, \"error message %s\", \"formatted\")\n//\ta.IsIncreasingf([]float{1, 2}, \"error message %s\", \"formatted\")\n//\ta.IsIncreasingf([]string{\"a\", \"b\"}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsIncreasingf(a.t, object, msg, args...)\n}\n\n// IsNonDecreasing asserts that the collection is not decreasing\n//\n//\ta.IsNonDecreasing([]int{1, 1, 2})\n//\ta.IsNonDecreasing([]float{1, 2})\n//\ta.IsNonDecreasing([]string{\"a\", \"b\"})\nfunc (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsNonDecreasing(a.t, object, msgAndArgs...)\n}\n\n// IsNonDecreasingf asserts that the collection is not decreasing\n//\n//\ta.IsNonDecreasingf([]int{1, 1, 2}, \"error message %s\", \"formatted\")\n//\ta.IsNonDecreasingf([]float{1, 2}, \"error message %s\", \"formatted\")\n//\ta.IsNonDecreasingf([]string{\"a\", \"b\"}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsNonDecreasingf(a.t, object, msg, args...)\n}\n\n// IsNonIncreasing asserts that the collection is not increasing\n//\n//\ta.IsNonIncreasing([]int{2, 1, 1})\n//\ta.IsNonIncreasing([]float{2, 1})\n//\ta.IsNonIncreasing([]string{\"b\", \"a\"})\nfunc (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsNonIncreasing(a.t, object, msgAndArgs...)\n}\n\n// IsNonIncreasingf asserts that the collection is not increasing\n//\n//\ta.IsNonIncreasingf([]int{2, 1, 1}, \"error message %s\", \"formatted\")\n//\ta.IsNonIncreasingf([]float{2, 1}, \"error message %s\", \"formatted\")\n//\ta.IsNonIncreasingf([]string{\"b\", \"a\"}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsNonIncreasingf(a.t, object, msg, args...)\n}\n\n// IsNotType asserts that the specified objects are not of the same type.\n//\n//\ta.IsNotType(&NotMyStruct{}, &MyStruct{})\nfunc (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsNotType(a.t, theType, object, msgAndArgs...)\n}\n\n// IsNotTypef asserts that the specified objects are not of the same type.\n//\n//\ta.IsNotTypef(&NotMyStruct{}, &MyStruct{}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsNotTypef(a.t, theType, object, msg, args...)\n}\n\n// IsType asserts that the specified objects are of the same type.\n//\n//\ta.IsType(&MyStruct{}, &MyStruct{})\nfunc (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsType(a.t, expectedType, object, msgAndArgs...)\n}\n\n// IsTypef asserts that the specified objects are of the same type.\n//\n//\ta.IsTypef(&MyStruct{}, &MyStruct{}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsTypef(a.t, expectedType, object, msg, args...)\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//\ta.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\nfunc (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn JSONEq(a.t, expected, actual, msgAndArgs...)\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//\ta.JSONEqf(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\nfunc (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn JSONEqf(a.t, expected, actual, msg, args...)\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//\ta.Len(mySlice, 3)\nfunc (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Len(a.t, object, length, msgAndArgs...)\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//\ta.Lenf(mySlice, 3, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Lenf(a.t, object, length, msg, args...)\n}\n\n// Less asserts that the first element is less than the second\n//\n//\ta.Less(1, 2)\n//\ta.Less(float64(1), float64(2))\n//\ta.Less(\"a\", \"b\")\nfunc (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Less(a.t, e1, e2, msgAndArgs...)\n}\n\n// LessOrEqual asserts that the first element is less than or equal to the second\n//\n//\ta.LessOrEqual(1, 2)\n//\ta.LessOrEqual(2, 2)\n//\ta.LessOrEqual(\"a\", \"b\")\n//\ta.LessOrEqual(\"b\", \"b\")\nfunc (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn LessOrEqual(a.t, e1, e2, msgAndArgs...)\n}\n\n// LessOrEqualf asserts that the first element is less than or equal to the second\n//\n//\ta.LessOrEqualf(1, 2, \"error message %s\", \"formatted\")\n//\ta.LessOrEqualf(2, 2, \"error message %s\", \"formatted\")\n//\ta.LessOrEqualf(\"a\", \"b\", \"error message %s\", \"formatted\")\n//\ta.LessOrEqualf(\"b\", \"b\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn LessOrEqualf(a.t, e1, e2, msg, args...)\n}\n\n// Lessf asserts that the first element is less than the second\n//\n//\ta.Lessf(1, 2, \"error message %s\", \"formatted\")\n//\ta.Lessf(float64(1), float64(2), \"error message %s\", \"formatted\")\n//\ta.Lessf(\"a\", \"b\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Lessf(a.t, e1, e2, msg, args...)\n}\n\n// Negative asserts that the specified element is negative\n//\n//\ta.Negative(-1)\n//\ta.Negative(-1.23)\nfunc (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Negative(a.t, e, msgAndArgs...)\n}\n\n// Negativef asserts that the specified element is negative\n//\n//\ta.Negativef(-1, \"error message %s\", \"formatted\")\n//\ta.Negativef(-1.23, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Negativef(a.t, e, msg, args...)\n}\n\n// Never asserts that the given condition doesn't satisfy in waitFor time,\n// periodically checking the target function each tick.\n//\n//\ta.Never(func() bool { return false; }, time.Second, 10*time.Millisecond)\nfunc (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Never(a.t, condition, waitFor, tick, msgAndArgs...)\n}\n\n// Neverf asserts that the given condition doesn't satisfy in waitFor time,\n// periodically checking the target function each tick.\n//\n//\ta.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Neverf(a.t, condition, waitFor, tick, msg, args...)\n}\n\n// Nil asserts that the specified object is nil.\n//\n//\ta.Nil(err)\nfunc (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Nil(a.t, object, msgAndArgs...)\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//\ta.Nilf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Nilf(a.t, object, msg, args...)\n}\n\n// NoDirExists checks whether a directory does not exist in the given path.\n// It fails if the path points to an existing _directory_ only.\nfunc (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoDirExists(a.t, path, msgAndArgs...)\n}\n\n// NoDirExistsf checks whether a directory does not exist in the given path.\n// It fails if the path points to an existing _directory_ only.\nfunc (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoDirExistsf(a.t, path, msg, args...)\n}\n\n// NoError asserts that a function returned a nil error (ie. no error).\n//\n//\t  actualObj, err := SomeFunction()\n//\t  if a.NoError(err) {\n//\t\t   assert.Equal(t, expectedObj, actualObj)\n//\t  }\nfunc (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoError(a.t, err, msgAndArgs...)\n}\n\n// NoErrorf asserts that a function returned a nil error (ie. no error).\n//\n//\t  actualObj, err := SomeFunction()\n//\t  if a.NoErrorf(err, \"error message %s\", \"formatted\") {\n//\t\t   assert.Equal(t, expectedObj, actualObj)\n//\t  }\nfunc (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoErrorf(a.t, err, msg, args...)\n}\n\n// NoFileExists checks whether a file does not exist in a given path. It fails\n// if the path points to an existing _file_ only.\nfunc (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoFileExists(a.t, path, msgAndArgs...)\n}\n\n// NoFileExistsf checks whether a file does not exist in a given path. It fails\n// if the path points to an existing _file_ only.\nfunc (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoFileExistsf(a.t, path, msg, args...)\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//\ta.NotContains(\"Hello World\", \"Earth\")\n//\ta.NotContains([\"Hello\", \"World\"], \"Earth\")\n//\ta.NotContains({\"Hello\": \"World\"}, \"Earth\")\nfunc (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotContains(a.t, s, contains, msgAndArgs...)\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//\ta.NotContainsf(\"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//\ta.NotContainsf([\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//\ta.NotContainsf({\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotContainsf(a.t, s, contains, msg, args...)\n}\n\n// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should not match.\n// This is an inverse of ElementsMatch.\n//\n// a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false\n//\n// a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true\n//\n// a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true\nfunc (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotElementsMatch(a.t, listA, listB, msgAndArgs...)\n}\n\n// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should not match.\n// This is an inverse of ElementsMatch.\n//\n// a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], \"error message %s\", \"formatted\") -> false\n//\n// a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], \"error message %s\", \"formatted\") -> true\n//\n// a.NotElementsMatchf([1, 2, 3], [1, 2, 4], \"error message %s\", \"formatted\") -> true\nfunc (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotElementsMatchf(a.t, listA, listB, msg, args...)\n}\n\n// NotEmpty asserts that the specified object is NOT [Empty].\n//\n//\tif a.NotEmpty(obj) {\n//\t  assert.Equal(t, \"two\", obj[1])\n//\t}\nfunc (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEmpty(a.t, object, msgAndArgs...)\n}\n\n// NotEmptyf asserts that the specified object is NOT [Empty].\n//\n//\tif a.NotEmptyf(obj, \"error message %s\", \"formatted\") {\n//\t  assert.Equal(t, \"two\", obj[1])\n//\t}\nfunc (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEmptyf(a.t, object, msg, args...)\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//\ta.NotEqual(obj1, obj2)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEqual(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotEqualValues asserts that two objects are not equal even when converted to the same type\n//\n//\ta.NotEqualValues(obj1, obj2)\nfunc (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEqualValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotEqualValuesf asserts that two objects are not equal even when converted to the same type\n//\n//\ta.NotEqualValuesf(obj1, obj2, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEqualValuesf(a.t, expected, actual, msg, args...)\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//\ta.NotEqualf(obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEqualf(a.t, expected, actual, msg, args...)\n}\n\n// NotErrorAs asserts that none of the errors in err's chain matches target,\n// but if so, sets target to that error value.\nfunc (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotErrorAs(a.t, err, target, msgAndArgs...)\n}\n\n// NotErrorAsf asserts that none of the errors in err's chain matches target,\n// but if so, sets target to that error value.\nfunc (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotErrorAsf(a.t, err, target, msg, args...)\n}\n\n// NotErrorIs asserts that none of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotErrorIs(a.t, err, target, msgAndArgs...)\n}\n\n// NotErrorIsf asserts that none of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotErrorIsf(a.t, err, target, msg, args...)\n}\n\n// NotImplements asserts that an object does not implement the specified interface.\n//\n//\ta.NotImplements((*MyInterface)(nil), new(MyObject))\nfunc (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotImplements(a.t, interfaceObject, object, msgAndArgs...)\n}\n\n// NotImplementsf asserts that an object does not implement the specified interface.\n//\n//\ta.NotImplementsf((*MyInterface)(nil), new(MyObject), \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotImplementsf(a.t, interfaceObject, object, msg, args...)\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//\ta.NotNil(err)\nfunc (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotNil(a.t, object, msgAndArgs...)\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//\ta.NotNilf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotNilf(a.t, object, msg, args...)\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//\ta.NotPanics(func(){ RemainCalm() })\nfunc (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotPanics(a.t, f, msgAndArgs...)\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//\ta.NotPanicsf(func(){ RemainCalm() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotPanicsf(a.t, f, msg, args...)\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//\ta.NotRegexp(regexp.MustCompile(\"starts\"), \"it's starting\")\n//\ta.NotRegexp(\"^start\", \"it's not starting\")\nfunc (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotRegexp(a.t, rx, str, msgAndArgs...)\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//\ta.NotRegexpf(regexp.MustCompile(\"starts\"), \"it's starting\", \"error message %s\", \"formatted\")\n//\ta.NotRegexpf(\"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotRegexpf(a.t, rx, str, msg, args...)\n}\n\n// NotSame asserts that two pointers do not reference the same object.\n//\n//\ta.NotSame(ptr1, ptr2)\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotSame(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotSamef asserts that two pointers do not reference the same object.\n//\n//\ta.NotSamef(ptr1, ptr2, \"error message %s\", \"formatted\")\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotSamef(a.t, expected, actual, msg, args...)\n}\n\n// NotSubset asserts that the list (array, slice, or map) does NOT contain all\n// elements given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\ta.NotSubset([1, 3, 4], [1, 2])\n//\ta.NotSubset({\"x\": 1, \"y\": 2}, {\"z\": 3})\n//\ta.NotSubset([1, 3, 4], {1: \"one\", 2: \"two\"})\n//\ta.NotSubset({\"x\": 1, \"y\": 2}, [\"z\"])\nfunc (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotSubset(a.t, list, subset, msgAndArgs...)\n}\n\n// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all\n// elements given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\ta.NotSubsetf([1, 3, 4], [1, 2], \"error message %s\", \"formatted\")\n//\ta.NotSubsetf({\"x\": 1, \"y\": 2}, {\"z\": 3}, \"error message %s\", \"formatted\")\n//\ta.NotSubsetf([1, 3, 4], {1: \"one\", 2: \"two\"}, \"error message %s\", \"formatted\")\n//\ta.NotSubsetf({\"x\": 1, \"y\": 2}, [\"z\"], \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotSubsetf(a.t, list, subset, msg, args...)\n}\n\n// NotZero asserts that i is not the zero value for its type.\nfunc (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotZero(a.t, i, msgAndArgs...)\n}\n\n// NotZerof asserts that i is not the zero value for its type.\nfunc (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotZerof(a.t, i, msg, args...)\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//\ta.Panics(func(){ GoCrazy() })\nfunc (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Panics(a.t, f, msgAndArgs...)\n}\n\n// PanicsWithError asserts that the code inside the specified PanicTestFunc\n// panics, and that the recovered panic value is an error that satisfies the\n// EqualError comparison.\n//\n//\ta.PanicsWithError(\"crazy error\", func(){ GoCrazy() })\nfunc (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn PanicsWithError(a.t, errString, f, msgAndArgs...)\n}\n\n// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc\n// panics, and that the recovered panic value is an error that satisfies the\n// EqualError comparison.\n//\n//\ta.PanicsWithErrorf(\"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn PanicsWithErrorf(a.t, errString, f, msg, args...)\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//\ta.PanicsWithValue(\"crazy error\", func(){ GoCrazy() })\nfunc (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn PanicsWithValue(a.t, expected, f, msgAndArgs...)\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//\ta.PanicsWithValuef(\"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn PanicsWithValuef(a.t, expected, f, msg, args...)\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//\ta.Panicsf(func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Panicsf(a.t, f, msg, args...)\n}\n\n// Positive asserts that the specified element is positive\n//\n//\ta.Positive(1)\n//\ta.Positive(1.23)\nfunc (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Positive(a.t, e, msgAndArgs...)\n}\n\n// Positivef asserts that the specified element is positive\n//\n//\ta.Positivef(1, \"error message %s\", \"formatted\")\n//\ta.Positivef(1.23, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Positivef(a.t, e, msg, args...)\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//\ta.Regexp(regexp.MustCompile(\"start\"), \"it's starting\")\n//\ta.Regexp(\"start...$\", \"it's not starting\")\nfunc (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Regexp(a.t, rx, str, msgAndArgs...)\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//\ta.Regexpf(regexp.MustCompile(\"start\"), \"it's starting\", \"error message %s\", \"formatted\")\n//\ta.Regexpf(\"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Regexpf(a.t, rx, str, msg, args...)\n}\n\n// Same asserts that two pointers reference the same object.\n//\n//\ta.Same(ptr1, ptr2)\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Same(a.t, expected, actual, msgAndArgs...)\n}\n\n// Samef asserts that two pointers reference the same object.\n//\n//\ta.Samef(ptr1, ptr2, \"error message %s\", \"formatted\")\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Samef(a.t, expected, actual, msg, args...)\n}\n\n// Subset asserts that the list (array, slice, or map) contains all elements\n// given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\ta.Subset([1, 2, 3], [1, 2])\n//\ta.Subset({\"x\": 1, \"y\": 2}, {\"x\": 1})\n//\ta.Subset([1, 2, 3], {1: \"one\", 2: \"two\"})\n//\ta.Subset({\"x\": 1, \"y\": 2}, [\"x\"])\nfunc (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Subset(a.t, list, subset, msgAndArgs...)\n}\n\n// Subsetf asserts that the list (array, slice, or map) contains all elements\n// given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\ta.Subsetf([1, 2, 3], [1, 2], \"error message %s\", \"formatted\")\n//\ta.Subsetf({\"x\": 1, \"y\": 2}, {\"x\": 1}, \"error message %s\", \"formatted\")\n//\ta.Subsetf([1, 2, 3], {1: \"one\", 2: \"two\"}, \"error message %s\", \"formatted\")\n//\ta.Subsetf({\"x\": 1, \"y\": 2}, [\"x\"], \"error message %s\", \"formatted\")\nfunc (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Subsetf(a.t, list, subset, msg, args...)\n}\n\n// True asserts that the specified value is true.\n//\n//\ta.True(myBool)\nfunc (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn True(a.t, value, msgAndArgs...)\n}\n\n// Truef asserts that the specified value is true.\n//\n//\ta.Truef(myBool, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Truef(a.t, value, msg, args...)\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//\ta.WithinDuration(time.Now(), time.Now(), 10*time.Second)\nfunc (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn WithinDuration(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//\ta.WithinDurationf(time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\nfunc (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn WithinDurationf(a.t, expected, actual, delta, msg, args...)\n}\n\n// WithinRange asserts that a time is within a time range (inclusive).\n//\n//\ta.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))\nfunc (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn WithinRange(a.t, actual, start, end, msgAndArgs...)\n}\n\n// WithinRangef asserts that a time is within a time range (inclusive).\n//\n//\ta.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), \"error message %s\", \"formatted\")\nfunc (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn WithinRangef(a.t, actual, start, end, msg, args...)\n}\n\n// YAMLEq asserts that the first documents in the two YAML strings are equivalent.\n//\n//\texpected := `---\n//\tkey: value\n//\t---\n//\tkey: this is a second document, it is not evaluated\n//\t`\n//\tactual := `---\n//\tkey: value\n//\t---\n//\tkey: this is a subsequent document, it is not evaluated\n//\t`\n//\ta.YAMLEq(expected, actual)\nfunc (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn YAMLEq(a.t, expected, actual, msgAndArgs...)\n}\n\n// YAMLEqf asserts that the first documents in the two YAML strings are equivalent.\n//\n//\texpected := `---\n//\tkey: value\n//\t---\n//\tkey: this is a second document, it is not evaluated\n//\t`\n//\tactual := `---\n//\tkey: value\n//\t---\n//\tkey: this is a subsequent document, it is not evaluated\n//\t`\n//\ta.YAMLEqf(expected, actual, \"error message %s\", \"formatted\")\nfunc (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn YAMLEqf(a.t, expected, actual, msg, args...)\n}\n\n// Zero asserts that i is the zero value for its type.\nfunc (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Zero(a.t, i, msgAndArgs...)\n}\n\n// Zerof asserts that i is the zero value for its type.\nfunc (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Zerof(a.t, i, msg, args...)\n}\n"
  },
  {
    "path": "assert/assertion_forward.go.tmpl",
    "content": "{{.CommentWithoutT \"a\"}}\nfunc (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool {\n\tif h, ok := a.t.(tHelper); ok { h.Helper() }\n\treturn {{.DocInfo.Name}}(a.t, {{.ForwardedParams}})\n}\n"
  },
  {
    "path": "assert/assertion_order.go",
    "content": "package assert\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n)\n\n// isOrdered checks that collection contains orderable elements.\nfunc isOrdered(t TestingT, object interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool {\n\tobjKind := reflect.TypeOf(object).Kind()\n\tif objKind != reflect.Slice && objKind != reflect.Array {\n\t\treturn Fail(t, fmt.Sprintf(\"object %T is not an ordered collection\", object), msgAndArgs...)\n\t}\n\n\tobjValue := reflect.ValueOf(object)\n\tobjLen := objValue.Len()\n\n\tif objLen <= 1 {\n\t\treturn true\n\t}\n\n\tvalue := objValue.Index(0)\n\tvalueInterface := value.Interface()\n\tfirstValueKind := value.Kind()\n\n\tfor i := 1; i < objLen; i++ {\n\t\tprevValue := value\n\t\tprevValueInterface := valueInterface\n\n\t\tvalue = objValue.Index(i)\n\t\tvalueInterface = value.Interface()\n\n\t\tcompareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind)\n\n\t\tif !isComparable {\n\t\t\treturn Fail(t, fmt.Sprintf(`Can not compare type \"%T\" and \"%T\"`, value, prevValue), msgAndArgs...)\n\t\t}\n\n\t\tif !containsValue(allowedComparesResults, compareResult) {\n\t\t\treturn Fail(t, fmt.Sprintf(failMessage, prevValue, value), msgAndArgs...)\n\t\t}\n\t}\n\n\treturn true\n}\n\n// IsIncreasing asserts that the collection is increasing\n//\n//\tassert.IsIncreasing(t, []int{1, 2, 3})\n//\tassert.IsIncreasing(t, []float{1, 2})\n//\tassert.IsIncreasing(t, []string{\"a\", \"b\"})\nfunc IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn isOrdered(t, object, []compareResult{compareLess}, \"\\\"%v\\\" is not less than \\\"%v\\\"\", msgAndArgs...)\n}\n\n// IsNonIncreasing asserts that the collection is not increasing\n//\n//\tassert.IsNonIncreasing(t, []int{2, 1, 1})\n//\tassert.IsNonIncreasing(t, []float{2, 1})\n//\tassert.IsNonIncreasing(t, []string{\"b\", \"a\"})\nfunc IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn isOrdered(t, object, []compareResult{compareEqual, compareGreater}, \"\\\"%v\\\" is not greater than or equal to \\\"%v\\\"\", msgAndArgs...)\n}\n\n// IsDecreasing asserts that the collection is decreasing\n//\n//\tassert.IsDecreasing(t, []int{2, 1, 0})\n//\tassert.IsDecreasing(t, []float{2, 1})\n//\tassert.IsDecreasing(t, []string{\"b\", \"a\"})\nfunc IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn isOrdered(t, object, []compareResult{compareGreater}, \"\\\"%v\\\" is not greater than \\\"%v\\\"\", msgAndArgs...)\n}\n\n// IsNonDecreasing asserts that the collection is not decreasing\n//\n//\tassert.IsNonDecreasing(t, []int{1, 1, 2})\n//\tassert.IsNonDecreasing(t, []float{1, 2})\n//\tassert.IsNonDecreasing(t, []string{\"a\", \"b\"})\nfunc IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn isOrdered(t, object, []compareResult{compareLess, compareEqual}, \"\\\"%v\\\" is not less than or equal to \\\"%v\\\"\", msgAndArgs...)\n}\n"
  },
  {
    "path": "assert/assertion_order_test.go",
    "content": "package assert\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"testing\"\n)\n\nfunc TestIsIncreasing(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !IsIncreasing(mockT, []int{1, 2}) {\n\t\tt.Error(\"IsIncreasing should return true\")\n\t}\n\n\tif !IsIncreasing(mockT, []int{1, 2, 3, 4, 5}) {\n\t\tt.Error(\"IsIncreasing should return true\")\n\t}\n\n\tif IsIncreasing(mockT, []int{1, 1}) {\n\t\tt.Error(\"IsIncreasing should return false\")\n\t}\n\n\tif IsIncreasing(mockT, []int{2, 1}) {\n\t\tt.Error(\"IsIncreasing should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\tcollection interface{}\n\t\tmsg        string\n\t}{\n\t\t{collection: []string{\"b\", \"a\"}, msg: `\"b\" is not less than \"a\"`},\n\t\t{collection: []int{2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []int{2, 1, 3, 4, 5, 6, 7}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []int{-1, 0, 2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []int8{2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []int16{2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []int32{2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []int64{2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []uint8{2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []uint16{2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []uint32{2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []uint64{2, 1}, msg: `\"2\" is not less than \"1\"`},\n\t\t{collection: []float32{2.34, 1.23}, msg: `\"2.34\" is not less than \"1.23\"`},\n\t\t{collection: []float64{2.34, 1.23}, msg: `\"2.34\" is not less than \"1.23\"`},\n\t\t{collection: struct{}{}, msg: `object struct {} is not an ordered collection`},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"%#v\", currCase.collection), func(t *testing.T) {\n\t\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\t\tFalse(t, IsIncreasing(out, currCase.collection))\n\t\t\tContains(t, out.buf.String(), currCase.msg)\n\t\t})\n\t}\n}\n\nfunc TestIsNonIncreasing(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !IsNonIncreasing(mockT, []int{2, 1}) {\n\t\tt.Error(\"IsNonIncreasing should return true\")\n\t}\n\n\tif !IsNonIncreasing(mockT, []int{5, 4, 4, 3, 2, 1}) {\n\t\tt.Error(\"IsNonIncreasing should return true\")\n\t}\n\n\tif !IsNonIncreasing(mockT, []int{1, 1}) {\n\t\tt.Error(\"IsNonIncreasing should return true\")\n\t}\n\n\tif IsNonIncreasing(mockT, []int{1, 2}) {\n\t\tt.Error(\"IsNonIncreasing should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\tcollection interface{}\n\t\tmsg        string\n\t}{\n\t\t{collection: []string{\"a\", \"b\"}, msg: `\"a\" is not greater than or equal to \"b\"`},\n\t\t{collection: []int{1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []int{1, 2, 7, 6, 5, 4, 3}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []int{5, 4, 3, 1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []int8{1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []int16{1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []int32{1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []int64{1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []uint8{1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []uint16{1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []uint32{1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []uint64{1, 2}, msg: `\"1\" is not greater than or equal to \"2\"`},\n\t\t{collection: []float32{1.23, 2.34}, msg: `\"1.23\" is not greater than or equal to \"2.34\"`},\n\t\t{collection: []float64{1.23, 2.34}, msg: `\"1.23\" is not greater than or equal to \"2.34\"`},\n\t\t{collection: struct{}{}, msg: `object struct {} is not an ordered collection`},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"%#v\", currCase.collection), func(t *testing.T) {\n\t\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\t\tFalse(t, IsNonIncreasing(out, currCase.collection))\n\t\t\tContains(t, out.buf.String(), currCase.msg)\n\t\t})\n\t}\n}\n\nfunc TestIsDecreasing(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !IsDecreasing(mockT, []int{2, 1}) {\n\t\tt.Error(\"IsDecreasing should return true\")\n\t}\n\n\tif !IsDecreasing(mockT, []int{5, 4, 3, 2, 1}) {\n\t\tt.Error(\"IsDecreasing should return true\")\n\t}\n\n\tif IsDecreasing(mockT, []int{1, 1}) {\n\t\tt.Error(\"IsDecreasing should return false\")\n\t}\n\n\tif IsDecreasing(mockT, []int{1, 2}) {\n\t\tt.Error(\"IsDecreasing should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\tcollection interface{}\n\t\tmsg        string\n\t}{\n\t\t{collection: []string{\"a\", \"b\"}, msg: `\"a\" is not greater than \"b\"`},\n\t\t{collection: []int{1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []int{1, 2, 7, 6, 5, 4, 3}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []int{5, 4, 3, 1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []int8{1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []int16{1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []int32{1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []int64{1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []uint8{1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []uint16{1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []uint32{1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []uint64{1, 2}, msg: `\"1\" is not greater than \"2\"`},\n\t\t{collection: []float32{1.23, 2.34}, msg: `\"1.23\" is not greater than \"2.34\"`},\n\t\t{collection: []float64{1.23, 2.34}, msg: `\"1.23\" is not greater than \"2.34\"`},\n\t\t{collection: struct{}{}, msg: `object struct {} is not an ordered collection`},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"%#v\", currCase.collection), func(t *testing.T) {\n\t\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\t\tFalse(t, IsDecreasing(out, currCase.collection))\n\t\t\tContains(t, out.buf.String(), currCase.msg)\n\t\t})\n\t}\n}\n\nfunc TestIsNonDecreasing(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !IsNonDecreasing(mockT, []int{1, 2}) {\n\t\tt.Error(\"IsNonDecreasing should return true\")\n\t}\n\n\tif !IsNonDecreasing(mockT, []int{1, 1, 2, 3, 4, 5}) {\n\t\tt.Error(\"IsNonDecreasing should return true\")\n\t}\n\n\tif !IsNonDecreasing(mockT, []int{1, 1}) {\n\t\tt.Error(\"IsNonDecreasing should return false\")\n\t}\n\n\tif IsNonDecreasing(mockT, []int{2, 1}) {\n\t\tt.Error(\"IsNonDecreasing should return false\")\n\t}\n\n\t// Check error report\n\tfor _, currCase := range []struct {\n\t\tcollection interface{}\n\t\tmsg        string\n\t}{\n\t\t{collection: []string{\"b\", \"a\"}, msg: `\"b\" is not less than or equal to \"a\"`},\n\t\t{collection: []int{2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []int{2, 1, 3, 4, 5, 6, 7}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []int{-1, 0, 2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []int8{2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []int16{2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []int32{2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []int64{2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []uint8{2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []uint16{2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []uint32{2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []uint64{2, 1}, msg: `\"2\" is not less than or equal to \"1\"`},\n\t\t{collection: []float32{2.34, 1.23}, msg: `\"2.34\" is not less than or equal to \"1.23\"`},\n\t\t{collection: []float64{2.34, 1.23}, msg: `\"2.34\" is not less than or equal to \"1.23\"`},\n\t\t{collection: struct{}{}, msg: `object struct {} is not an ordered collection`},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"%#v\", currCase.collection), func(t *testing.T) {\n\t\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\t\tFalse(t, IsNonDecreasing(out, currCase.collection))\n\t\t\tContains(t, out.buf.String(), currCase.msg)\n\t\t})\n\t}\n}\n\nfunc TestOrderingMsgAndArgsForwarding(t *testing.T) {\n\tt.Parallel()\n\n\tmsgAndArgs := []interface{}{\"format %s %x\", \"this\", 0xc001}\n\texpectedOutput := \"format this c001\\n\"\n\tcollection := []int{1, 2, 1}\n\tfuncs := []func(t TestingT){\n\t\tfunc(t TestingT) { IsIncreasing(t, collection, msgAndArgs...) },\n\t\tfunc(t TestingT) { IsNonIncreasing(t, collection, msgAndArgs...) },\n\t\tfunc(t TestingT) { IsDecreasing(t, collection, msgAndArgs...) },\n\t\tfunc(t TestingT) { IsNonDecreasing(t, collection, msgAndArgs...) },\n\t}\n\tfor _, f := range funcs {\n\t\tout := &outputT{buf: bytes.NewBuffer(nil)}\n\t\tf(out)\n\t\tContains(t, out.buf.String(), expectedOutput)\n\t}\n}\n"
  },
  {
    "path": "assert/assertions.go",
    "content": "package assert\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"math\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"runtime/debug\"\n\t\"strings\"\n\t\"time\"\n\t\"unicode\"\n\t\"unicode/utf8\"\n\n\t// Wrapper around gopkg.in/yaml.v3\n\t\"github.com/stretchr/testify/assert/yaml\"\n\t\"github.com/stretchr/testify/internal/difflib\"\n\t\"github.com/stretchr/testify/internal/spew\"\n)\n\n//go:generate sh -c \"cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl\"\n\n// TestingT is an interface wrapper around *testing.T\ntype TestingT interface {\n\tErrorf(format string, args ...interface{})\n}\n\n// ComparisonAssertionFunc is a common function prototype when comparing two values.  Can be useful\n// for table driven tests.\ntype ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool\n\n// ValueAssertionFunc is a common function prototype when validating a single value.  Can be useful\n// for table driven tests.\ntype ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool\n\n// BoolAssertionFunc is a common function prototype when validating a bool value.  Can be useful\n// for table driven tests.\ntype BoolAssertionFunc func(TestingT, bool, ...interface{}) bool\n\n// ErrorAssertionFunc is a common function prototype when validating an error value.  Can be useful\n// for table driven tests.\ntype ErrorAssertionFunc func(TestingT, error, ...interface{}) bool\n\n// PanicAssertionFunc is a common function prototype when validating a panic value.  Can be useful\n// for table driven tests.\ntype PanicAssertionFunc = func(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool\n\n// Comparison is a custom function that returns true on success and false on failure\ntype Comparison func() (success bool)\n\n/*\n\tHelper functions\n*/\n\n// ObjectsAreEqual determines if two objects are considered equal.\n//\n// This function does no assertion of any kind.\nfunc ObjectsAreEqual(expected, actual interface{}) bool {\n\tif expected == nil || actual == nil {\n\t\treturn expected == actual\n\t}\n\n\texp, ok := expected.([]byte)\n\tif !ok {\n\t\treturn reflect.DeepEqual(expected, actual)\n\t}\n\n\tact, ok := actual.([]byte)\n\tif !ok {\n\t\treturn false\n\t}\n\tif exp == nil || act == nil {\n\t\treturn exp == nil && act == nil\n\t}\n\treturn bytes.Equal(exp, act)\n}\n\n// copyExportedFields iterates downward through nested data structures and creates a copy\n// that only contains the exported struct fields.\nfunc copyExportedFields(expected interface{}) interface{} {\n\tif isNil(expected) {\n\t\treturn expected\n\t}\n\n\texpectedType := reflect.TypeOf(expected)\n\texpectedKind := expectedType.Kind()\n\texpectedValue := reflect.ValueOf(expected)\n\n\tswitch expectedKind {\n\tcase reflect.Struct:\n\t\tresult := reflect.New(expectedType).Elem()\n\t\tfor i := 0; i < expectedType.NumField(); i++ {\n\t\t\tfield := expectedType.Field(i)\n\t\t\tisExported := field.IsExported()\n\t\t\tif isExported {\n\t\t\t\tfieldValue := expectedValue.Field(i)\n\t\t\t\tif isNil(fieldValue) || isNil(fieldValue.Interface()) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnewValue := copyExportedFields(fieldValue.Interface())\n\t\t\t\tresult.Field(i).Set(reflect.ValueOf(newValue))\n\t\t\t}\n\t\t}\n\t\treturn result.Interface()\n\n\tcase reflect.Ptr:\n\t\tresult := reflect.New(expectedType.Elem())\n\t\tunexportedRemoved := copyExportedFields(expectedValue.Elem().Interface())\n\t\tresult.Elem().Set(reflect.ValueOf(unexportedRemoved))\n\t\treturn result.Interface()\n\n\tcase reflect.Array, reflect.Slice:\n\t\tvar result reflect.Value\n\t\tif expectedKind == reflect.Array {\n\t\t\tresult = reflect.New(reflect.ArrayOf(expectedValue.Len(), expectedType.Elem())).Elem()\n\t\t} else {\n\t\t\tresult = reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len())\n\t\t}\n\t\tfor i := 0; i < expectedValue.Len(); i++ {\n\t\t\tindex := expectedValue.Index(i)\n\t\t\tif isNil(index) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tunexportedRemoved := copyExportedFields(index.Interface())\n\t\t\tresult.Index(i).Set(reflect.ValueOf(unexportedRemoved))\n\t\t}\n\t\treturn result.Interface()\n\n\tcase reflect.Map:\n\t\tresult := reflect.MakeMap(expectedType)\n\t\tfor _, k := range expectedValue.MapKeys() {\n\t\t\tindex := expectedValue.MapIndex(k)\n\t\t\tunexportedRemoved := copyExportedFields(index.Interface())\n\t\t\tresult.SetMapIndex(k, reflect.ValueOf(unexportedRemoved))\n\t\t}\n\t\treturn result.Interface()\n\n\tdefault:\n\t\treturn expected\n\t}\n}\n\n// ObjectsExportedFieldsAreEqual determines if the exported (public) fields of two objects are\n// considered equal. This comparison of only exported fields is applied recursively to nested data\n// structures.\n//\n// This function does no assertion of any kind.\n//\n// Deprecated: Use [EqualExportedValues] instead.\nfunc ObjectsExportedFieldsAreEqual(expected, actual interface{}) bool {\n\texpectedCleaned := copyExportedFields(expected)\n\tactualCleaned := copyExportedFields(actual)\n\treturn ObjectsAreEqualValues(expectedCleaned, actualCleaned)\n}\n\n// ObjectsAreEqualValues gets whether two objects are equal, or if their\n// values are equal.\nfunc ObjectsAreEqualValues(expected, actual interface{}) bool {\n\tif ObjectsAreEqual(expected, actual) {\n\t\treturn true\n\t}\n\n\texpectedValue := reflect.ValueOf(expected)\n\tactualValue := reflect.ValueOf(actual)\n\tif !expectedValue.IsValid() || !actualValue.IsValid() {\n\t\treturn false\n\t}\n\n\texpectedType := expectedValue.Type()\n\tactualType := actualValue.Type()\n\tif !expectedType.ConvertibleTo(actualType) {\n\t\treturn false\n\t}\n\n\tif !isNumericType(expectedType) || !isNumericType(actualType) {\n\t\t// Attempt comparison after type conversion\n\t\treturn reflect.DeepEqual(\n\t\t\texpectedValue.Convert(actualType).Interface(), actual,\n\t\t)\n\t}\n\n\t// If BOTH values are numeric, there are chances of false positives due\n\t// to overflow or underflow. So, we need to make sure to always convert\n\t// the smaller type to a larger type before comparing.\n\tif expectedType.Size() >= actualType.Size() {\n\t\treturn actualValue.Convert(expectedType).Interface() == expected\n\t}\n\n\treturn expectedValue.Convert(actualType).Interface() == actual\n}\n\n// isNumericType returns true if the type is one of:\n// int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64,\n// float32, float64, complex64, complex128\nfunc isNumericType(t reflect.Type) bool {\n\treturn t.Kind() >= reflect.Int && t.Kind() <= reflect.Complex128\n}\n\n/* CallerInfo is necessary because the assert functions use the testing object\ninternally, causing it to print the file:line of the assert method, rather than where\nthe problem actually occurred in calling code.*/\n\n// CallerInfo returns an array of strings containing the file and line number\n// of each stack frame leading from the current test to the assert call that\n// failed.\nfunc CallerInfo() []string {\n\tvar pc uintptr\n\tvar file string\n\tvar line int\n\tvar name string\n\n\tconst stackFrameBufferSize = 10\n\tpcs := make([]uintptr, stackFrameBufferSize)\n\n\tcallers := []string{}\n\toffset := 1\n\n\tfor {\n\t\tn := runtime.Callers(offset, pcs)\n\n\t\tif n == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tframes := runtime.CallersFrames(pcs[:n])\n\n\t\tfor {\n\t\t\tframe, more := frames.Next()\n\t\t\tpc = frame.PC\n\t\t\tfile = frame.File\n\t\t\tline = frame.Line\n\n\t\t\t// This is a huge edge case, but it will panic if this is the case, see #180\n\t\t\tif file == \"<autogenerated>\" {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tf := runtime.FuncForPC(pc)\n\t\t\tif f == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tname = f.Name()\n\n\t\t\t// testing.tRunner is the standard library function that calls\n\t\t\t// tests. Subtests are called directly by tRunner, without going through\n\t\t\t// the Test/Benchmark/Example function that contains the t.Run calls, so\n\t\t\t// with subtests we should break when we hit tRunner, without adding it\n\t\t\t// to the list of callers.\n\t\t\tif name == \"testing.tRunner\" {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tparts := strings.Split(file, \"/\")\n\t\t\tif len(parts) > 1 {\n\t\t\t\tfilename := parts[len(parts)-1]\n\t\t\t\tdir := parts[len(parts)-2]\n\t\t\t\tif (dir != \"assert\" && dir != \"mock\" && dir != \"require\") || filename == \"mock_test.go\" {\n\t\t\t\t\tcallers = append(callers, fmt.Sprintf(\"%s:%d\", file, line))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Drop the package\n\t\t\tdotPos := strings.LastIndexByte(name, '.')\n\t\t\tname = name[dotPos+1:]\n\t\t\tif isTest(name, \"Test\") ||\n\t\t\t\tisTest(name, \"Benchmark\") ||\n\t\t\t\tisTest(name, \"Example\") {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif !more {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// Next batch\n\t\toffset += cap(pcs)\n\t}\n\n\treturn callers\n}\n\n// Stolen from the `go test` tool.\n// isTest tells whether name looks like a test (or benchmark, according to prefix).\n// It is a Test (say) if there is a character after Test that is not a lower-case letter.\n// We don't want TesticularCancer.\nfunc isTest(name, prefix string) bool {\n\tif !strings.HasPrefix(name, prefix) {\n\t\treturn false\n\t}\n\tif len(name) == len(prefix) { // \"Test\" is ok\n\t\treturn true\n\t}\n\tr, _ := utf8.DecodeRuneInString(name[len(prefix):])\n\treturn !unicode.IsLower(r)\n}\n\nfunc messageFromMsgAndArgs(msgAndArgs ...interface{}) string {\n\tif len(msgAndArgs) == 0 || msgAndArgs == nil {\n\t\treturn \"\"\n\t}\n\tif len(msgAndArgs) == 1 {\n\t\tmsg := msgAndArgs[0]\n\t\tif msgAsStr, ok := msg.(string); ok {\n\t\t\treturn msgAsStr\n\t\t}\n\t\treturn fmt.Sprintf(\"%+v\", msg)\n\t}\n\tif len(msgAndArgs) > 1 {\n\t\treturn fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...)\n\t}\n\treturn \"\"\n}\n\n// Aligns the provided message so that all lines after the first line start at the same location as the first line.\n// Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab).\n// The longestLabelLen parameter specifies the length of the longest label in the output (required because this is the\n// basis on which the alignment occurs).\nfunc indentMessageLines(message string, longestLabelLen int) string {\n\toutBuf := new(bytes.Buffer)\n\n\tscanner := bufio.NewScanner(strings.NewReader(message))\n\tfor firstLine := true; scanner.Scan(); firstLine = false {\n\t\tif !firstLine {\n\t\t\tfmt.Fprint(outBuf, \"\\n\\t\"+strings.Repeat(\" \", longestLabelLen+1)+\"\\t\")\n\t\t}\n\t\tfmt.Fprint(outBuf, scanner.Text())\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn fmt.Sprintf(\"cannot display message: %s\", err)\n\t}\n\n\treturn outBuf.String()\n}\n\ntype failNower interface {\n\tFailNow()\n}\n\n// FailNow fails test\nfunc FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFail(t, failureMessage, msgAndArgs...)\n\n\t// We cannot extend TestingT with FailNow() and\n\t// maintain backwards compatibility, so we fallback\n\t// to panicking when FailNow is not available in\n\t// TestingT.\n\t// See issue #263\n\n\tif t, ok := t.(failNower); ok {\n\t\tt.FailNow()\n\t} else {\n\t\tpanic(\"test failed and t is missing `FailNow()`\")\n\t}\n\treturn false\n}\n\n// Fail reports a failure through\nfunc Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tcontent := []labeledContent{\n\t\t{\"Error Trace\", strings.Join(CallerInfo(), \"\\n\\t\\t\\t\")},\n\t\t{\"Error\", failureMessage},\n\t}\n\n\t// Add test name if the Go version supports it\n\tif n, ok := t.(interface {\n\t\tName() string\n\t}); ok {\n\t\tcontent = append(content, labeledContent{\"Test\", n.Name()})\n\t}\n\n\tmessage := messageFromMsgAndArgs(msgAndArgs...)\n\tif len(message) > 0 {\n\t\tcontent = append(content, labeledContent{\"Messages\", message})\n\t}\n\n\tt.Errorf(\"\\n%s\", \"\"+labeledOutput(content...))\n\n\treturn false\n}\n\ntype labeledContent struct {\n\tlabel   string\n\tcontent string\n}\n\n// labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner:\n//\n//\t\\t{{label}}:{{align_spaces}}\\t{{content}}\\n\n//\n// The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The \"\\t{{label}}:\" is for the label.\n// If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this\n// alignment is achieved, \"\\t{{content}}\\n\" is added for the output.\n//\n// If the content of the labeledOutput contains line breaks, the subsequent lines are aligned so that they start at the same location as the first line.\nfunc labeledOutput(content ...labeledContent) string {\n\tlongestLabel := 0\n\tfor _, v := range content {\n\t\tif len(v.label) > longestLabel {\n\t\t\tlongestLabel = len(v.label)\n\t\t}\n\t}\n\tvar output string\n\tfor _, v := range content {\n\t\toutput += \"\\t\" + v.label + \":\" + strings.Repeat(\" \", longestLabel-len(v.label)) + \"\\t\" + indentMessageLines(v.content, longestLabel) + \"\\n\"\n\t}\n\treturn output\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//\tassert.Implements(t, (*MyInterface)(nil), new(MyObject))\nfunc Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tinterfaceType := reflect.TypeOf(interfaceObject).Elem()\n\n\tif object == nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Cannot check if nil implements %v\", interfaceType), msgAndArgs...)\n\t}\n\tif !reflect.TypeOf(object).Implements(interfaceType) {\n\t\treturn Fail(t, fmt.Sprintf(\"%T must implement %v\", object, interfaceType), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// NotImplements asserts that an object does not implement the specified interface.\n//\n//\tassert.NotImplements(t, (*MyInterface)(nil), new(MyObject))\nfunc NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tinterfaceType := reflect.TypeOf(interfaceObject).Elem()\n\n\tif object == nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Cannot check if nil does not implement %v\", interfaceType), msgAndArgs...)\n\t}\n\tif reflect.TypeOf(object).Implements(interfaceType) {\n\t\treturn Fail(t, fmt.Sprintf(\"%T implements %v\", object, interfaceType), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\nfunc isType(expectedType, object interface{}) bool {\n\treturn ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType))\n}\n\n// IsType asserts that the specified objects are of the same type.\n//\n//\tassert.IsType(t, &MyStruct{}, &MyStruct{})\nfunc IsType(t TestingT, expectedType, object interface{}, msgAndArgs ...interface{}) bool {\n\tif isType(expectedType, object) {\n\t\treturn true\n\t}\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Fail(t, fmt.Sprintf(\"Object expected to be of type %T, but was %T\", expectedType, object), msgAndArgs...)\n}\n\n// IsNotType asserts that the specified objects are not of the same type.\n//\n//\tassert.IsNotType(t, &NotMyStruct{}, &MyStruct{})\nfunc IsNotType(t TestingT, theType, object interface{}, msgAndArgs ...interface{}) bool {\n\tif !isType(theType, object) {\n\t\treturn true\n\t}\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Fail(t, fmt.Sprintf(\"Object type expected to be different than %T\", theType), msgAndArgs...)\n}\n\n// Equal asserts that two objects are equal.\n//\n//\tassert.Equal(t, 123, 123)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif err := validateEqualArgs(expected, actual); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Invalid operation: %#v == %#v (%s)\",\n\t\t\texpected, actual, err), msgAndArgs...)\n\t}\n\n\tif !ObjectsAreEqual(expected, actual) {\n\t\tdiff := diff(expected, actual)\n\t\texpected, actual = formatUnequalValues(expected, actual)\n\t\treturn Fail(t, fmt.Sprintf(\"Not equal: \\n\"+\n\t\t\t\"expected: %s\\n\"+\n\t\t\t\"actual  : %s%s\", expected, actual, diff), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// validateEqualArgs checks whether provided arguments can be safely used in the\n// Equal/NotEqual functions.\nfunc validateEqualArgs(expected, actual interface{}) error {\n\tif expected == nil && actual == nil {\n\t\treturn nil\n\t}\n\n\tif isFunction(expected) || isFunction(actual) {\n\t\treturn errors.New(\"cannot take func type as argument\")\n\t}\n\treturn nil\n}\n\n// Same asserts that two pointers reference the same object.\n//\n//\tassert.Same(t, ptr1, ptr2)\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tsame, ok := samePointers(expected, actual)\n\tif !ok {\n\t\treturn Fail(t, \"Both arguments must be pointers\", msgAndArgs...)\n\t}\n\n\tif !same {\n\t\t// both are pointers but not the same type & pointing to the same address\n\t\treturn Fail(t, fmt.Sprintf(\"Not same: \\n\"+\n\t\t\t\"expected: %[2]s (%[1]T)(%[1]p)\\n\"+\n\t\t\t\"actual  : %[4]s (%[3]T)(%[3]p)\", expected, truncatingFormat(\"%#v\", expected), actual, truncatingFormat(\"%#v\", actual)), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// NotSame asserts that two pointers do not reference the same object.\n//\n//\tassert.NotSame(t, ptr1, ptr2)\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tsame, ok := samePointers(expected, actual)\n\tif !ok {\n\t\t// fails when the arguments are not pointers\n\t\treturn !(Fail(t, \"Both arguments must be pointers\", msgAndArgs...))\n\t}\n\n\tif same {\n\t\treturn Fail(t, fmt.Sprintf(\n\t\t\t\"Expected and actual point to the same object: %p %s\",\n\t\t\texpected, truncatingFormat(\"%#v\", expected)), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// samePointers checks if two generic interface objects are pointers of the same\n// type pointing to the same object. It returns two values: same indicating if\n// they are the same type and point to the same object, and ok indicating that\n// both inputs are pointers.\nfunc samePointers(first, second interface{}) (same bool, ok bool) {\n\tfirstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second)\n\tif firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr {\n\t\treturn false, false // not both are pointers\n\t}\n\n\tfirstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second)\n\tif firstType != secondType {\n\t\treturn false, true // both are pointers, but of different types\n\t}\n\n\t// compare pointer addresses\n\treturn first == second, true\n}\n\n// formatUnequalValues takes two values of arbitrary types and returns string\n// representations appropriate to be presented to the user.\n//\n// If the values are not of like type, the returned strings will be prefixed\n// with the type name, and the value will be enclosed in parentheses similar\n// to a type conversion in the Go grammar.\nfunc formatUnequalValues(expected, actual interface{}) (e string, a string) {\n\tif reflect.TypeOf(expected) != reflect.TypeOf(actual) {\n\t\treturn fmt.Sprintf(\"%T(%s)\", expected, truncatingFormat(\"%#v\", expected)),\n\t\t\tfmt.Sprintf(\"%T(%s)\", actual, truncatingFormat(\"%#v\", actual))\n\t}\n\tswitch expected.(type) {\n\tcase time.Duration:\n\t\treturn fmt.Sprintf(\"%v\", expected), fmt.Sprintf(\"%v\", actual)\n\t}\n\treturn truncatingFormat(\"%#v\", expected), truncatingFormat(\"%#v\", actual)\n}\n\n// truncatingFormat formats the data and truncates it if it's too long.\n//\n// This helps keep formatted error messages lines from exceeding the\n// bufio.MaxScanTokenSize max line length that the go testing framework imposes.\nfunc truncatingFormat(format string, data interface{}) string {\n\tvalue := fmt.Sprintf(format, data)\n\t// Give us space for two truncated objects and the surrounding sentence.\n\tmaxMessageSize := bufio.MaxScanTokenSize/2 - 100\n\tif len(value) > maxMessageSize {\n\t\tvalue = value[0:maxMessageSize] + \"<... truncated>\"\n\t}\n\treturn value\n}\n\n// EqualValues asserts that two objects are equal or convertible to the larger\n// type and equal.\n//\n//\tassert.EqualValues(t, uint32(123), int32(123))\nfunc EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif !ObjectsAreEqualValues(expected, actual) {\n\t\tdiff := diff(expected, actual)\n\t\texpected, actual = formatUnequalValues(expected, actual)\n\t\treturn Fail(t, fmt.Sprintf(\"Not equal: \\n\"+\n\t\t\t\"expected: %s\\n\"+\n\t\t\t\"actual  : %s%s\", expected, actual, diff), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// EqualExportedValues asserts that the types of two objects are equal and their public\n// fields are also equal. This is useful for comparing structs that have private fields\n// that could potentially differ.\n//\n//\t type S struct {\n//\t\tExported     \tint\n//\t\tnotExported   \tint\n//\t }\n//\t assert.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true\n//\t assert.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false\nfunc EqualExportedValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\taType := reflect.TypeOf(expected)\n\tbType := reflect.TypeOf(actual)\n\n\tif aType != bType {\n\t\treturn Fail(t, fmt.Sprintf(\"Types expected to match exactly\\n\\t%v != %v\", aType, bType), msgAndArgs...)\n\t}\n\n\texpected = copyExportedFields(expected)\n\tactual = copyExportedFields(actual)\n\n\tif !ObjectsAreEqualValues(expected, actual) {\n\t\tdiff := diff(expected, actual)\n\t\texpected, actual = formatUnequalValues(expected, actual)\n\t\treturn Fail(t, fmt.Sprintf(\"Not equal (comparing only exported fields): \\n\"+\n\t\t\t\"expected: %s\\n\"+\n\t\t\t\"actual  : %s%s\", expected, actual, diff), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//\tassert.Exactly(t, int32(123), int64(123))\nfunc Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\taType := reflect.TypeOf(expected)\n\tbType := reflect.TypeOf(actual)\n\n\tif aType != bType {\n\t\treturn Fail(t, fmt.Sprintf(\"Types expected to match exactly\\n\\t%v != %v\", aType, bType), msgAndArgs...)\n\t}\n\n\treturn Equal(t, expected, actual, msgAndArgs...)\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//\tassert.NotNil(t, err)\nfunc NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif !isNil(object) {\n\t\treturn true\n\t}\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Fail(t, \"Expected value not to be nil.\", msgAndArgs...)\n}\n\n// isNil checks if a specified object is nil or not, without Failing.\nfunc isNil(object interface{}) bool {\n\tif object == nil {\n\t\treturn true\n\t}\n\n\tvalue := reflect.ValueOf(object)\n\tswitch value.Kind() {\n\tcase\n\t\treflect.Chan, reflect.Func,\n\t\treflect.Interface, reflect.Map,\n\t\treflect.Ptr, reflect.Slice, reflect.UnsafePointer:\n\n\t\treturn value.IsNil()\n\t}\n\n\treturn false\n}\n\n// Nil asserts that the specified object is nil.\n//\n//\tassert.Nil(t, err)\nfunc Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif isNil(object) {\n\t\treturn true\n\t}\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Fail(t, fmt.Sprintf(\"Expected nil, but got: %s\", truncatingFormat(\"%#v\", object)), msgAndArgs...)\n}\n\n// isEmpty gets whether the specified object is considered empty or not.\nfunc isEmpty(object interface{}) bool {\n\t// get nil case out of the way\n\tif object == nil {\n\t\treturn true\n\t}\n\n\treturn isEmptyValue(reflect.ValueOf(object))\n}\n\n// isEmptyValue gets whether the specified reflect.Value is considered empty or not.\nfunc isEmptyValue(objValue reflect.Value) bool {\n\tif objValue.IsZero() {\n\t\treturn true\n\t}\n\t// Special cases of non-zero values that we consider empty\n\tswitch objValue.Kind() {\n\t// collection types are empty when they have no element\n\t// Note: array types are empty when they match their zero-initialized state.\n\tcase reflect.Chan, reflect.Map, reflect.Slice:\n\t\treturn objValue.Len() == 0\n\t// non-nil pointers are empty if the value they point to is empty\n\tcase reflect.Ptr:\n\t\treturn isEmptyValue(objValue.Elem())\n\t}\n\treturn false\n}\n\n// Empty asserts that the given value is \"empty\".\n//\n// [Zero values] are \"empty\".\n//\n// Arrays are \"empty\" if every element is the zero value of the type (stricter than \"empty\").\n//\n// Slices, maps and channels with zero length are \"empty\".\n//\n// Pointer values are \"empty\" if the pointer is nil or if the pointed value is \"empty\".\n//\n//\tassert.Empty(t, obj)\n//\n// [Zero values]: https://go.dev/ref/spec#The_zero_value\nfunc Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tpass := isEmpty(object)\n\tif !pass {\n\t\tif h, ok := t.(tHelper); ok {\n\t\t\th.Helper()\n\t\t}\n\t\tFail(t, fmt.Sprintf(\"Should be empty, but was %s\", truncatingFormat(\"%v\", object)), msgAndArgs...)\n\t}\n\n\treturn pass\n}\n\n// NotEmpty asserts that the specified object is NOT [Empty].\n//\n//\tif assert.NotEmpty(t, obj) {\n//\t  assert.Equal(t, \"two\", obj[1])\n//\t}\nfunc NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tpass := !isEmpty(object)\n\tif !pass {\n\t\tif h, ok := t.(tHelper); ok {\n\t\t\th.Helper()\n\t\t}\n\t\tFail(t, fmt.Sprintf(\"Should NOT be empty, but was %v\", object), msgAndArgs...)\n\t}\n\n\treturn pass\n}\n\n// getLen tries to get the length of an object.\n// It returns (0, false) if impossible.\nfunc getLen(x interface{}) (length int, ok bool) {\n\tv := reflect.ValueOf(x)\n\tdefer func() {\n\t\tok = recover() == nil\n\t}()\n\treturn v.Len(), true\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//\tassert.Len(t, mySlice, 3)\nfunc Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tl, ok := getLen(object)\n\tif !ok {\n\t\treturn Fail(t, fmt.Sprintf(\"%q could not be applied builtin len()\", truncatingFormat(\"%v\", object)), msgAndArgs...)\n\t}\n\n\tif l != length {\n\t\treturn Fail(t, fmt.Sprintf(\"%q should have %d item(s), but has %d\", truncatingFormat(\"%v\", object), length, l), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// True asserts that the specified value is true.\n//\n//\tassert.True(t, myBool)\nfunc True(t TestingT, value bool, msgAndArgs ...interface{}) bool {\n\tif !value {\n\t\tif h, ok := t.(tHelper); ok {\n\t\t\th.Helper()\n\t\t}\n\t\treturn Fail(t, \"Should be true\", msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// False asserts that the specified value is false.\n//\n//\tassert.False(t, myBool)\nfunc False(t TestingT, value bool, msgAndArgs ...interface{}) bool {\n\tif value {\n\t\tif h, ok := t.(tHelper); ok {\n\t\t\th.Helper()\n\t\t}\n\t\treturn Fail(t, \"Should be false\", msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//\tassert.NotEqual(t, obj1, obj2)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif err := validateEqualArgs(expected, actual); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Invalid operation: %#v != %#v (%s)\",\n\t\t\texpected, actual, err), msgAndArgs...)\n\t}\n\n\tif ObjectsAreEqual(expected, actual) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should not be: %s\\n\", truncatingFormat(\"%#v\", actual)), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// NotEqualValues asserts that two objects are not equal even when converted to the same type\n//\n//\tassert.NotEqualValues(t, obj1, obj2)\nfunc NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif ObjectsAreEqualValues(expected, actual) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should not be: %s\\n\", truncatingFormat(\"%#v\", actual)), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// containsElement try loop over the list check if the list includes the element.\n// return (false, false) if impossible.\n// return (true, false) if element was not found.\n// return (true, true) if element was found.\nfunc containsElement(list interface{}, element interface{}) (ok, found bool) {\n\tlistValue := reflect.ValueOf(list)\n\tlistType := reflect.TypeOf(list)\n\tif listType == nil {\n\t\treturn false, false\n\t}\n\tlistKind := listType.Kind()\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tok = false\n\t\t\tfound = false\n\t\t}\n\t}()\n\n\tif listKind == reflect.String {\n\t\telementValue := reflect.ValueOf(element)\n\t\treturn true, strings.Contains(listValue.String(), elementValue.String())\n\t}\n\n\tif listKind == reflect.Map {\n\t\tmapKeys := listValue.MapKeys()\n\t\tfor i := 0; i < len(mapKeys); i++ {\n\t\t\tif ObjectsAreEqual(mapKeys[i].Interface(), element) {\n\t\t\t\treturn true, true\n\t\t\t}\n\t\t}\n\t\treturn true, false\n\t}\n\n\tfor i := 0; i < listValue.Len(); i++ {\n\t\tif ObjectsAreEqual(listValue.Index(i).Interface(), element) {\n\t\t\treturn true, true\n\t\t}\n\t}\n\treturn true, false\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//\tassert.Contains(t, \"Hello World\", \"World\")\n//\tassert.Contains(t, [\"Hello\", \"World\"], \"World\")\n//\tassert.Contains(t, {\"Hello\": \"World\"}, \"Hello\")\nfunc Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tok, found := containsElement(s, contains)\n\tif !ok {\n\t\treturn Fail(t, fmt.Sprintf(\"%s could not be applied builtin len()\", truncatingFormat(\"%#v\", s)), msgAndArgs...)\n\t}\n\tif !found {\n\t\treturn Fail(t, fmt.Sprintf(\"%s does not contain %#v\", truncatingFormat(\"%#v\", s), contains), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//\tassert.NotContains(t, \"Hello World\", \"Earth\")\n//\tassert.NotContains(t, [\"Hello\", \"World\"], \"Earth\")\n//\tassert.NotContains(t, {\"Hello\": \"World\"}, \"Earth\")\nfunc NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tok, found := containsElement(s, contains)\n\tif !ok {\n\t\treturn Fail(t, fmt.Sprintf(\"%s could not be applied builtin len()\", truncatingFormat(\"%#v\", s)), msgAndArgs...)\n\t}\n\tif found {\n\t\treturn Fail(t, fmt.Sprintf(\"%s should not contain %#v\", truncatingFormat(\"%#v\", s), contains), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// Subset asserts that the list (array, slice, or map) contains all elements\n// given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\tassert.Subset(t, [1, 2, 3], [1, 2])\n//\tassert.Subset(t, {\"x\": 1, \"y\": 2}, {\"x\": 1})\n//\tassert.Subset(t, [1, 2, 3], {1: \"one\", 2: \"two\"})\n//\tassert.Subset(t, {\"x\": 1, \"y\": 2}, [\"x\"])\nfunc Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif subset == nil {\n\t\treturn true // we consider nil to be equal to the nil set\n\t}\n\n\tlistKind := reflect.TypeOf(list).Kind()\n\tif listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", list, listKind), msgAndArgs...)\n\t}\n\n\tsubsetKind := reflect.TypeOf(subset).Kind()\n\tif subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", subset, subsetKind), msgAndArgs...)\n\t}\n\n\tif subsetKind == reflect.Map && listKind == reflect.Map {\n\t\tsubsetMap := reflect.ValueOf(subset)\n\t\tactualMap := reflect.ValueOf(list)\n\n\t\tfor _, k := range subsetMap.MapKeys() {\n\t\t\tev := subsetMap.MapIndex(k)\n\t\t\tav := actualMap.MapIndex(k)\n\n\t\t\tif !av.IsValid() {\n\t\t\t\treturn Fail(t, fmt.Sprintf(\"%s does not contain %s\", truncatingFormat(\"%#v\", list), truncatingFormat(\"%#v\", subset)), msgAndArgs...)\n\t\t\t}\n\t\t\tif !ObjectsAreEqual(ev.Interface(), av.Interface()) {\n\t\t\t\treturn Fail(t, fmt.Sprintf(\"%s does not contain %s\", truncatingFormat(\"%#v\", list), truncatingFormat(\"%#v\", subset)), msgAndArgs...)\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\tsubsetList := reflect.ValueOf(subset)\n\tif subsetKind == reflect.Map {\n\t\tkeys := make([]interface{}, subsetList.Len())\n\t\tfor idx, key := range subsetList.MapKeys() {\n\t\t\tkeys[idx] = key.Interface()\n\t\t}\n\t\tsubsetList = reflect.ValueOf(keys)\n\t}\n\tfor i := 0; i < subsetList.Len(); i++ {\n\t\telement := subsetList.Index(i).Interface()\n\t\tok, found := containsElement(list, element)\n\t\tif !ok {\n\t\t\treturn Fail(t, fmt.Sprintf(\"%#v could not be applied builtin len()\", list), msgAndArgs...)\n\t\t}\n\t\tif !found {\n\t\t\treturn Fail(t, fmt.Sprintf(\"%s does not contain %#v\", truncatingFormat(\"%#v\", list), element), msgAndArgs...)\n\t\t}\n\t}\n\n\treturn true\n}\n\n// NotSubset asserts that the list (array, slice, or map) does NOT contain all\n// elements given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\tassert.NotSubset(t, [1, 3, 4], [1, 2])\n//\tassert.NotSubset(t, {\"x\": 1, \"y\": 2}, {\"z\": 3})\n//\tassert.NotSubset(t, [1, 3, 4], {1: \"one\", 2: \"two\"})\n//\tassert.NotSubset(t, {\"x\": 1, \"y\": 2}, [\"z\"])\nfunc NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif subset == nil {\n\t\treturn Fail(t, \"nil is the empty set which is a subset of every set\", msgAndArgs...)\n\t}\n\n\tlistKind := reflect.TypeOf(list).Kind()\n\tif listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", list, listKind), msgAndArgs...)\n\t}\n\n\tsubsetKind := reflect.TypeOf(subset).Kind()\n\tif subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", subset, subsetKind), msgAndArgs...)\n\t}\n\n\tif subsetKind == reflect.Map && listKind == reflect.Map {\n\t\tsubsetMap := reflect.ValueOf(subset)\n\t\tactualMap := reflect.ValueOf(list)\n\n\t\tfor _, k := range subsetMap.MapKeys() {\n\t\t\tev := subsetMap.MapIndex(k)\n\t\t\tav := actualMap.MapIndex(k)\n\n\t\t\tif !av.IsValid() {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif !ObjectsAreEqual(ev.Interface(), av.Interface()) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn Fail(t, fmt.Sprintf(\"%s is a subset of %s\", truncatingFormat(\"%q\", subset), truncatingFormat(\"%q\", list)), msgAndArgs...)\n\t}\n\n\tsubsetList := reflect.ValueOf(subset)\n\tif subsetKind == reflect.Map {\n\t\tkeys := make([]interface{}, subsetList.Len())\n\t\tfor idx, key := range subsetList.MapKeys() {\n\t\t\tkeys[idx] = key.Interface()\n\t\t}\n\t\tsubsetList = reflect.ValueOf(keys)\n\t}\n\tfor i := 0; i < subsetList.Len(); i++ {\n\t\telement := subsetList.Index(i).Interface()\n\t\tok, found := containsElement(list, element)\n\t\tif !ok {\n\t\t\treturn Fail(t, fmt.Sprintf(\"%q could not be applied builtin len()\", list), msgAndArgs...)\n\t\t}\n\t\tif !found {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn Fail(t, fmt.Sprintf(\"%s is a subset of %s\", truncatingFormat(\"%q\", subset), truncatingFormat(\"%q\", list)), msgAndArgs...)\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])\nfunc ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif isEmpty(listA) && isEmpty(listB) {\n\t\treturn true\n\t}\n\n\tif !isList(t, listA, msgAndArgs...) || !isList(t, listB, msgAndArgs...) {\n\t\treturn false\n\t}\n\n\textraA, extraB := diffLists(listA, listB)\n\n\tif len(extraA) == 0 && len(extraB) == 0 {\n\t\treturn true\n\t}\n\n\treturn Fail(t, formatListDiff(listA, listB, extraA, extraB), msgAndArgs...)\n}\n\n// isList checks that the provided value is array or slice.\nfunc isList(t TestingT, list interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tkind := reflect.TypeOf(list).Kind()\n\tif kind != reflect.Array && kind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s, expecting array or slice\", list, kind),\n\t\t\tmsgAndArgs...)\n\t}\n\treturn true\n}\n\n// diffLists diffs two arrays/slices and returns slices of elements that are only in A and only in B.\n// If some element is present multiple times, each instance is counted separately (e.g. if something is 2x in A and\n// 5x in B, it will be 0x in extraA and 3x in extraB). The order of items in both lists is ignored.\nfunc diffLists(listA, listB interface{}) (extraA, extraB []interface{}) {\n\taValue := reflect.ValueOf(listA)\n\tbValue := reflect.ValueOf(listB)\n\n\taLen := aValue.Len()\n\tbLen := bValue.Len()\n\n\t// Mark indexes in bValue that we already used\n\tvisited := make([]bool, bLen)\n\tfor i := 0; i < aLen; i++ {\n\t\telement := aValue.Index(i).Interface()\n\t\tfound := false\n\t\tfor j := 0; j < bLen; j++ {\n\t\t\tif visited[j] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ObjectsAreEqual(bValue.Index(j).Interface(), element) {\n\t\t\t\tvisited[j] = true\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\textraA = append(extraA, element)\n\t\t}\n\t}\n\n\tfor j := 0; j < bLen; j++ {\n\t\tif visited[j] {\n\t\t\tcontinue\n\t\t}\n\t\textraB = append(extraB, bValue.Index(j).Interface())\n\t}\n\n\treturn\n}\n\nfunc formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) string {\n\tvar msg bytes.Buffer\n\n\tmsg.WriteString(\"elements differ\")\n\tif len(extraA) > 0 {\n\t\tmsg.WriteString(\"\\n\\nextra elements in list A:\\n\")\n\t\tmsg.WriteString(spewConfig.Sdump(extraA))\n\t}\n\tif len(extraB) > 0 {\n\t\tmsg.WriteString(\"\\n\\nextra elements in list B:\\n\")\n\t\tmsg.WriteString(spewConfig.Sdump(extraB))\n\t}\n\tmsg.WriteString(\"\\n\\nlistA:\\n\")\n\tmsg.WriteString(spewConfig.Sdump(listA))\n\tmsg.WriteString(\"\\n\\nlistB:\\n\")\n\tmsg.WriteString(spewConfig.Sdump(listB))\n\n\treturn msg.String()\n}\n\n// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should not match.\n// This is an inverse of ElementsMatch.\n//\n// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false\n//\n// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true\n//\n// assert.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true\nfunc NotElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif isEmpty(listA) && isEmpty(listB) {\n\t\treturn Fail(t, \"listA and listB contain the same elements\", msgAndArgs)\n\t}\n\n\tif !isList(t, listA, msgAndArgs...) {\n\t\treturn Fail(t, \"listA is not a list type\", msgAndArgs...)\n\t}\n\tif !isList(t, listB, msgAndArgs...) {\n\t\treturn Fail(t, \"listB is not a list type\", msgAndArgs...)\n\t}\n\n\textraA, extraB := diffLists(listA, listB)\n\tif len(extraA) == 0 && len(extraB) == 0 {\n\t\treturn Fail(t, \"listA and listB contain the same elements\", msgAndArgs)\n\t}\n\n\treturn true\n}\n\n// Condition uses a Comparison to assert a complex condition.\nfunc Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tresult := comp()\n\tif !result {\n\t\tFail(t, \"Condition failed!\", msgAndArgs...)\n\t}\n\treturn result\n}\n\n// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics\n// methods, and represents a simple func that takes no arguments, and returns nothing.\ntype PanicTestFunc func()\n\n// didPanic returns true if the function passed to it panics. Otherwise, it returns false.\nfunc didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stack string) {\n\tdidPanic = true\n\n\tdefer func() {\n\t\tmessage = recover()\n\t\tif didPanic {\n\t\t\tstack = string(debug.Stack())\n\t\t}\n\t}()\n\n\t// call the target function\n\tf()\n\tdidPanic = false\n\n\treturn\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//\tassert.Panics(t, func(){ GoCrazy() })\nfunc Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif funcDidPanic, panicValue, _ := didPanic(f); !funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic\\n\\tPanic value:\\t%#v\", f, panicValue), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//\tassert.PanicsWithValue(t, \"crazy error\", func(){ GoCrazy() })\nfunc PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tfuncDidPanic, panicValue, panickedStack := didPanic(f)\n\tif !funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic\\n\\tPanic value:\\t%#v\", f, panicValue), msgAndArgs...)\n\t}\n\tif panicValue != expected {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic with value:\\t%#v\\n\\tPanic value:\\t%#v\\n\\tPanic stack:\\t%s\", f, expected, panicValue, panickedStack), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// PanicsWithError asserts that the code inside the specified PanicTestFunc\n// panics, and that the recovered panic value is an error that satisfies the\n// EqualError comparison.\n//\n//\tassert.PanicsWithError(t, \"crazy error\", func(){ GoCrazy() })\nfunc PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tfuncDidPanic, panicValue, panickedStack := didPanic(f)\n\tif !funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic\\n\\tPanic value:\\t%#v\", f, panicValue), msgAndArgs...)\n\t}\n\tpanicErr, isError := panicValue.(error)\n\tif !isError || panicErr.Error() != errString {\n\t\tmsg := fmt.Sprintf(\"func %#v should panic with error message:\\t%#v\\n\", f, errString)\n\t\tif isError {\n\t\t\tmsg += fmt.Sprintf(\"\\tError message:\\t%#v\\n\", panicErr.Error())\n\t\t}\n\t\tmsg += fmt.Sprintf(\"\\tPanic value:\\t%#v\\n\", panicValue)\n\t\tmsg += fmt.Sprintf(\"\\tPanic stack:\\t%s\\n\", panickedStack)\n\t\treturn Fail(t, msg, msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//\tassert.NotPanics(t, func(){ RemainCalm() })\nfunc NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif funcDidPanic, panicValue, panickedStack := didPanic(f); funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should not panic\\n\\tPanic value:\\t%v\\n\\tPanic stack:\\t%s\", f, panicValue, panickedStack), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//\tassert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)\nfunc WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tdt := expected.Sub(actual)\n\tif dt < -delta || dt > delta {\n\t\treturn Fail(t, fmt.Sprintf(\"Max difference between %v and %v allowed is %v, but difference was %v\", expected, actual, delta, dt), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// WithinRange asserts that a time is within a time range (inclusive).\n//\n//\tassert.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))\nfunc WithinRange(t TestingT, actual, start, end time.Time, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif end.Before(start) {\n\t\treturn Fail(t, \"Start should be before end\", msgAndArgs...)\n\t}\n\n\tif actual.Before(start) {\n\t\treturn Fail(t, fmt.Sprintf(\"Time %v expected to be in time range %v to %v, but is before the range\", actual, start, end), msgAndArgs...)\n\t} else if actual.After(end) {\n\t\treturn Fail(t, fmt.Sprintf(\"Time %v expected to be in time range %v to %v, but is after the range\", actual, start, end), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\nfunc toFloat(x interface{}) (float64, bool) {\n\tvar xf float64\n\txok := true\n\n\tswitch xn := x.(type) {\n\tcase uint:\n\t\txf = float64(xn)\n\tcase uint8:\n\t\txf = float64(xn)\n\tcase uint16:\n\t\txf = float64(xn)\n\tcase uint32:\n\t\txf = float64(xn)\n\tcase uint64:\n\t\txf = float64(xn)\n\tcase int:\n\t\txf = float64(xn)\n\tcase int8:\n\t\txf = float64(xn)\n\tcase int16:\n\t\txf = float64(xn)\n\tcase int32:\n\t\txf = float64(xn)\n\tcase int64:\n\t\txf = float64(xn)\n\tcase float32:\n\t\txf = float64(xn)\n\tcase float64:\n\t\txf = xn\n\tcase time.Duration:\n\t\txf = float64(xn)\n\tdefault:\n\t\txok = false\n\t}\n\n\treturn xf, xok\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n//\tassert.InDelta(t, math.Pi, 22/7.0, 0.01)\nfunc InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\taf, aok := toFloat(expected)\n\tbf, bok := toFloat(actual)\n\n\tif !aok || !bok {\n\t\treturn Fail(t, \"Parameters must be numerical\", msgAndArgs...)\n\t}\n\n\tif math.IsNaN(af) && math.IsNaN(bf) {\n\t\treturn true\n\t}\n\n\tif math.IsNaN(af) {\n\t\treturn Fail(t, \"Expected must not be NaN\", msgAndArgs...)\n\t}\n\n\tif math.IsNaN(bf) {\n\t\treturn Fail(t, fmt.Sprintf(\"Expected %v with delta %v, but was NaN\", expected, delta), msgAndArgs...)\n\t}\n\n\tdt := af - bf\n\tif dt < -delta || dt > delta {\n\t\treturn Fail(t, fmt.Sprintf(\"Max difference between %v and %v allowed is %v, but difference was %v\", expected, actual, delta, dt), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif expected == nil || actual == nil ||\n\t\treflect.TypeOf(actual).Kind() != reflect.Slice ||\n\t\treflect.TypeOf(expected).Kind() != reflect.Slice {\n\t\treturn Fail(t, \"Parameters must be slice\", msgAndArgs...)\n\t}\n\n\tactualSlice := reflect.ValueOf(actual)\n\texpectedSlice := reflect.ValueOf(expected)\n\n\tfor i := 0; i < actualSlice.Len(); i++ {\n\t\tresult := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta, msgAndArgs...)\n\t\tif !result {\n\t\t\treturn result\n\t\t}\n\t}\n\n\treturn true\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif expected == nil || actual == nil ||\n\t\treflect.TypeOf(actual).Kind() != reflect.Map ||\n\t\treflect.TypeOf(expected).Kind() != reflect.Map {\n\t\treturn Fail(t, \"Arguments must be maps\", msgAndArgs...)\n\t}\n\n\texpectedMap := reflect.ValueOf(expected)\n\tactualMap := reflect.ValueOf(actual)\n\n\tif expectedMap.Len() != actualMap.Len() {\n\t\treturn Fail(t, \"Arguments must have the same number of keys\", msgAndArgs...)\n\t}\n\n\tfor _, k := range expectedMap.MapKeys() {\n\t\tev := expectedMap.MapIndex(k)\n\t\tav := actualMap.MapIndex(k)\n\n\t\tif !ev.IsValid() {\n\t\t\treturn Fail(t, fmt.Sprintf(\"missing key %q in expected map\", k), msgAndArgs...)\n\t\t}\n\n\t\tif !av.IsValid() {\n\t\t\treturn Fail(t, fmt.Sprintf(\"missing key %q in actual map\", k), msgAndArgs...)\n\t\t}\n\n\t\tif !InDelta(\n\t\t\tt,\n\t\t\tev.Interface(),\n\t\t\tav.Interface(),\n\t\t\tdelta,\n\t\t\tmsgAndArgs...,\n\t\t) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\nfunc calcRelativeError(expected, actual interface{}) (float64, error) {\n\taf, aok := toFloat(expected)\n\tbf, bok := toFloat(actual)\n\tif !aok || !bok {\n\t\treturn 0, fmt.Errorf(\"Parameters must be numerical\")\n\t}\n\tif math.IsNaN(af) && math.IsNaN(bf) {\n\t\treturn 0, nil\n\t}\n\tif math.IsNaN(af) {\n\t\treturn 0, errors.New(\"expected value must not be NaN\")\n\t}\n\tif af == 0 {\n\t\treturn 0, fmt.Errorf(\"expected value must have a value other than zero to calculate the relative error\")\n\t}\n\tif math.IsNaN(bf) {\n\t\treturn 0, errors.New(\"actual value must not be NaN\")\n\t}\n\n\treturn math.Abs(af-bf) / math.Abs(af), nil\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\nfunc InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif math.IsNaN(epsilon) {\n\t\treturn Fail(t, \"epsilon must not be NaN\", msgAndArgs...)\n\t}\n\tactualEpsilon, err := calcRelativeError(expected, actual)\n\tif err != nil {\n\t\treturn Fail(t, err.Error(), msgAndArgs...)\n\t}\n\tif math.IsNaN(actualEpsilon) {\n\t\treturn Fail(t, \"relative error is NaN\", msgAndArgs...)\n\t}\n\tif actualEpsilon > epsilon {\n\t\treturn Fail(t, fmt.Sprintf(\"Relative error is too high: %#v (expected)\\n\"+\n\t\t\t\"        < %#v (actual)\", epsilon, actualEpsilon), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif expected == nil || actual == nil {\n\t\treturn Fail(t, \"Parameters must be slice\", msgAndArgs...)\n\t}\n\n\texpectedSlice := reflect.ValueOf(expected)\n\tactualSlice := reflect.ValueOf(actual)\n\n\tif expectedSlice.Type().Kind() != reflect.Slice {\n\t\treturn Fail(t, \"Expected value must be slice\", msgAndArgs...)\n\t}\n\n\texpectedLen := expectedSlice.Len()\n\tif !IsType(t, expected, actual) || !Len(t, actual, expectedLen) {\n\t\treturn false\n\t}\n\n\tfor i := 0; i < expectedLen; i++ {\n\t\tif !InEpsilon(t, expectedSlice.Index(i).Interface(), actualSlice.Index(i).Interface(), epsilon, \"at index %d\", i) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\n/*\n\tErrors\n*/\n\n// NoError asserts that a function returned a nil error (ie. no error).\n//\n//\t  actualObj, err := SomeFunction()\n//\t  if assert.NoError(t, err) {\n//\t\t   assert.Equal(t, expectedObj, actualObj)\n//\t  }\nfunc NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {\n\tif err != nil {\n\t\tif h, ok := t.(tHelper); ok {\n\t\t\th.Helper()\n\t\t}\n\t\treturn Fail(t, fmt.Sprintf(\"Received unexpected error:\\n%s\", truncatingFormat(\"%+v\", err)), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// Error asserts that a function returned a non-nil error (ie. an error).\n//\n//\tactualObj, err := SomeFunction()\n//\tassert.Error(t, err)\nfunc Error(t TestingT, err error, msgAndArgs ...interface{}) bool {\n\tif err == nil {\n\t\tif h, ok := t.(tHelper); ok {\n\t\t\th.Helper()\n\t\t}\n\t\treturn Fail(t, \"An error is expected but got nil.\", msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// EqualError asserts that a function returned a non-nil error (i.e. an error)\n// and that it is equal to the provided error.\n//\n//\tactualObj, err := SomeFunction()\n//\tassert.EqualError(t, err,  expectedErrorString)\nfunc EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !Error(t, theError, msgAndArgs...) {\n\t\treturn false\n\t}\n\texpected := errString\n\tactual := theError.Error()\n\t// don't need to use deep equals here, we know they are both strings\n\tif expected != actual {\n\t\treturn Fail(t, fmt.Sprintf(\"Error message not equal:\\n\"+\n\t\t\t\"expected: %q\\n\"+\n\t\t\t\"actual  : %s\", expected, truncatingFormat(\"%q\", actual)), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// ErrorContains asserts that a function returned a non-nil error (i.e. an\n// error) and that the error contains the specified substring.\n//\n//\tactualObj, err := SomeFunction()\n//\tassert.ErrorContains(t, err,  expectedErrorSubString)\nfunc ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !Error(t, theError, msgAndArgs...) {\n\t\treturn false\n\t}\n\n\tactual := theError.Error()\n\tif !strings.Contains(actual, contains) {\n\t\treturn Fail(t, fmt.Sprintf(\"Error %s does not contain %#v\", truncatingFormat(\"%#v\", actual), contains), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// matchRegexp return true if a specified regexp matches a string.\nfunc matchRegexp(rx interface{}, str interface{}) bool {\n\tvar r *regexp.Regexp\n\tif rr, ok := rx.(*regexp.Regexp); ok {\n\t\tr = rr\n\t} else {\n\t\tr = regexp.MustCompile(fmt.Sprint(rx))\n\t}\n\n\tswitch v := str.(type) {\n\tcase []byte:\n\t\treturn r.Match(v)\n\tcase string:\n\t\treturn r.MatchString(v)\n\tdefault:\n\t\treturn r.MatchString(fmt.Sprint(v))\n\t}\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//\tassert.Regexp(t, regexp.MustCompile(\"start\"), \"it's starting\")\n//\tassert.Regexp(t, \"start...$\", \"it's not starting\")\nfunc Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tmatch := matchRegexp(rx, str)\n\n\tif !match {\n\t\tFail(t, fmt.Sprintf(\"Expect \\\"%v\\\" to match \\\"%v\\\"\", str, rx), msgAndArgs...)\n\t}\n\n\treturn match\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//\tassert.NotRegexp(t, regexp.MustCompile(\"starts\"), \"it's starting\")\n//\tassert.NotRegexp(t, \"^start\", \"it's not starting\")\nfunc NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tmatch := matchRegexp(rx, str)\n\n\tif match {\n\t\tFail(t, fmt.Sprintf(\"Expect \\\"%v\\\" to NOT match \\\"%v\\\"\", str, rx), msgAndArgs...)\n\t}\n\n\treturn !match\n}\n\n// Zero asserts that i is the zero value for its type.\nfunc Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should be zero, but was %s\", truncatingFormat(\"%v\", i)), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// NotZero asserts that i is not the zero value for its type.\nfunc NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should not be zero, but was %v\", i), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if\n// the path points to a directory or there is an error when trying to check the file.\nfunc FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn Fail(t, fmt.Sprintf(\"unable to find file %q\", path), msgAndArgs...)\n\t\t}\n\t\treturn Fail(t, fmt.Sprintf(\"error when running os.Lstat(%q): %s\", path, err), msgAndArgs...)\n\t}\n\tif info.IsDir() {\n\t\treturn Fail(t, fmt.Sprintf(\"%q is a directory\", path), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// NoFileExists checks whether a file does not exist in a given path. It fails\n// if the path points to an existing _file_ only.\nfunc NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\treturn true\n\t}\n\tif info.IsDir() {\n\t\treturn true\n\t}\n\treturn Fail(t, fmt.Sprintf(\"file %q exists\", path), msgAndArgs...)\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails\n// if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn Fail(t, fmt.Sprintf(\"unable to find file %q\", path), msgAndArgs...)\n\t\t}\n\t\treturn Fail(t, fmt.Sprintf(\"error when running os.Lstat(%q): %s\", path, err), msgAndArgs...)\n\t}\n\tif !info.IsDir() {\n\t\treturn Fail(t, fmt.Sprintf(\"%q is a file\", path), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// NoDirExists checks whether a directory does not exist in the given path.\n// It fails if the path points to an existing _directory_ only.\nfunc NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn true\n\t\t}\n\t\treturn true\n\t}\n\tif !info.IsDir() {\n\t\treturn true\n\t}\n\treturn Fail(t, fmt.Sprintf(\"directory %q exists\", path), msgAndArgs...)\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//\tassert.JSONEq(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\nfunc JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tvar expectedJSONAsInterface, actualJSONAsInterface interface{}\n\n\tif err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Expected value ('%s') is not valid json.\\nJSON parsing error: '%s'\", expected, err.Error()), msgAndArgs...)\n\t}\n\n\t// Shortcut if same bytes\n\tif actual == expected {\n\t\treturn true\n\t}\n\n\tif err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Input ('%s') needs to be valid json.\\nJSON parsing error: '%s'\", actual, err.Error()), msgAndArgs...)\n\t}\n\n\treturn Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...)\n}\n\n// YAMLEq asserts that the first documents in the two YAML strings are equivalent.\n//\n//\texpected := `---\n//\tkey: value\n//\t---\n//\tkey: this is a second document, it is not evaluated\n//\t`\n//\tactual := `---\n//\tkey: value\n//\t---\n//\tkey: this is a subsequent document, it is not evaluated\n//\t`\n//\tassert.YAMLEq(t, expected, actual)\nfunc YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tvar expectedYAMLAsInterface, actualYAMLAsInterface interface{}\n\n\tif err := yaml.Unmarshal([]byte(expected), &expectedYAMLAsInterface); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Expected value ('%s') is not valid yaml.\\nYAML parsing error: '%s'\", expected, err.Error()), msgAndArgs...)\n\t}\n\n\t// Shortcut if same bytes\n\tif actual == expected {\n\t\treturn true\n\t}\n\n\tif err := yaml.Unmarshal([]byte(actual), &actualYAMLAsInterface); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Input ('%s') needs to be valid yaml.\\nYAML error: '%s'\", actual, err.Error()), msgAndArgs...)\n\t}\n\n\treturn Equal(t, expectedYAMLAsInterface, actualYAMLAsInterface, msgAndArgs...)\n}\n\nfunc typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {\n\tt := reflect.TypeOf(v)\n\tk := t.Kind()\n\n\tif k == reflect.Ptr {\n\t\tt = t.Elem()\n\t\tk = t.Kind()\n\t}\n\treturn t, k\n}\n\n// diff returns a diff of both values as long as both are of the same type and\n// are a struct, map, slice, array or string. Otherwise it returns an empty string.\nfunc diff(expected interface{}, actual interface{}) string {\n\tif expected == nil || actual == nil {\n\t\treturn \"\"\n\t}\n\n\tet, ek := typeAndKind(expected)\n\tat, _ := typeAndKind(actual)\n\n\tif et != at {\n\t\treturn \"\"\n\t}\n\n\tif ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array && ek != reflect.String {\n\t\treturn \"\"\n\t}\n\n\tvar e, a string\n\n\tswitch et {\n\tcase reflect.TypeOf(\"\"):\n\t\te = reflect.ValueOf(expected).String()\n\t\ta = reflect.ValueOf(actual).String()\n\tcase reflect.TypeOf(time.Time{}):\n\t\te = spewConfigStringerEnabled.Sdump(expected)\n\t\ta = spewConfigStringerEnabled.Sdump(actual)\n\tdefault:\n\t\te = spewConfig.Sdump(expected)\n\t\ta = spewConfig.Sdump(actual)\n\t}\n\n\tdiff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{\n\t\tA:        difflib.SplitLines(e),\n\t\tB:        difflib.SplitLines(a),\n\t\tFromFile: \"Expected\",\n\t\tFromDate: \"\",\n\t\tToFile:   \"Actual\",\n\t\tToDate:   \"\",\n\t\tContext:  1,\n\t})\n\n\treturn \"\\n\\nDiff:\\n\" + diff\n}\n\nfunc isFunction(arg interface{}) bool {\n\tif arg == nil {\n\t\treturn false\n\t}\n\treturn reflect.TypeOf(arg).Kind() == reflect.Func\n}\n\nvar spewConfig = spew.ConfigState{\n\tIndent:                  \" \",\n\tDisablePointerAddresses: true,\n\tDisableCapacities:       true,\n\tSortKeys:                true,\n\tDisableMethods:          true,\n\tMaxDepth:                10,\n}\n\nvar spewConfigStringerEnabled = spew.ConfigState{\n\tIndent:                  \" \",\n\tDisablePointerAddresses: true,\n\tDisableCapacities:       true,\n\tSortKeys:                true,\n\tMaxDepth:                10,\n}\n\ntype tHelper = interface {\n\tHelper()\n}\n\n// Eventually asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick.\n//\n//\tassert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond)\nfunc Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tch := make(chan bool, 1)\n\tcheckCond := func() { ch <- condition() }\n\n\ttimer := time.NewTimer(waitFor)\n\tdefer timer.Stop()\n\n\tticker := time.NewTicker(tick)\n\tdefer ticker.Stop()\n\n\tvar tickC <-chan time.Time\n\n\t// Check the condition once first on the initial call.\n\tgo checkCond()\n\n\tfor {\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\treturn Fail(t, \"Condition never satisfied\", msgAndArgs...)\n\t\tcase <-tickC:\n\t\t\ttickC = nil\n\t\t\tgo checkCond()\n\t\tcase v := <-ch:\n\t\t\tif v {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\ttickC = ticker.C\n\t\t}\n\t}\n}\n\n// CollectT implements the TestingT interface and collects all errors.\ntype CollectT struct {\n\t// A slice of errors. Non-nil slice denotes a failure.\n\t// If it's non-nil but len(c.errors) == 0, this is also a failure\n\t// obtained by direct c.FailNow() call.\n\terrors []error\n}\n\n// Helper is like [testing.T.Helper] but does nothing.\nfunc (CollectT) Helper() {}\n\n// Errorf collects the error.\nfunc (c *CollectT) Errorf(format string, args ...interface{}) {\n\tc.errors = append(c.errors, fmt.Errorf(format, args...))\n}\n\n// FailNow stops execution by calling runtime.Goexit.\nfunc (c *CollectT) FailNow() {\n\tc.fail()\n\truntime.Goexit()\n}\n\n// Deprecated: That was a method for internal usage that should not have been published. Now just panics.\nfunc (*CollectT) Reset() {\n\tpanic(\"Reset() is deprecated\")\n}\n\n// Deprecated: That was a method for internal usage that should not have been published. Now just panics.\nfunc (*CollectT) Copy(TestingT) {\n\tpanic(\"Copy() is deprecated\")\n}\n\nfunc (c *CollectT) fail() {\n\tif !c.failed() {\n\t\tc.errors = []error{} // Make it non-nil to mark a failure.\n\t}\n}\n\nfunc (c *CollectT) failed() bool {\n\treturn c.errors != nil\n}\n\n// EventuallyWithT asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick. In contrast to Eventually,\n// it supplies a CollectT to the condition function, so that the condition\n// function can use the CollectT to call other assertions.\n// The condition is considered \"met\" if no errors are raised in a tick.\n// The supplied CollectT collects all errors from one tick (if there are any).\n// If the condition is not met before waitFor, the collected errors of\n// the last tick are copied to t.\n//\n//\texternalValue := false\n//\tgo func() {\n//\t\ttime.Sleep(8*time.Second)\n//\t\texternalValue = true\n//\t}()\n//\tassert.EventuallyWithT(t, func(c *assert.CollectT) {\n//\t\t// add assertions as needed; any assertion failure will fail the current tick\n//\t\tassert.True(c, externalValue, \"expected 'externalValue' to be true\")\n//\t}, 10*time.Second, 1*time.Second, \"external state has not changed to 'true'; still false\")\nfunc EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tvar lastFinishedTickErrs []error\n\tch := make(chan *CollectT, 1)\n\n\tcheckCond := func() {\n\t\tcollect := new(CollectT)\n\t\tdefer func() {\n\t\t\tch <- collect\n\t\t}()\n\t\tcondition(collect)\n\t}\n\n\ttimer := time.NewTimer(waitFor)\n\tdefer timer.Stop()\n\n\tticker := time.NewTicker(tick)\n\tdefer ticker.Stop()\n\n\tvar tickC <-chan time.Time\n\n\t// Check the condition once first on the initial call.\n\tgo checkCond()\n\n\tfor {\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\tfor _, err := range lastFinishedTickErrs {\n\t\t\t\tt.Errorf(\"%v\", err)\n\t\t\t}\n\t\t\treturn Fail(t, \"Condition never satisfied\", msgAndArgs...)\n\t\tcase <-tickC:\n\t\t\ttickC = nil\n\t\t\tgo checkCond()\n\t\tcase collect := <-ch:\n\t\t\tif !collect.failed() {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\t// Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached.\n\t\t\tlastFinishedTickErrs = collect.errors\n\t\t\ttickC = ticker.C\n\t\t}\n\t}\n}\n\n// Never asserts that the given condition doesn't satisfy in waitFor time,\n// periodically checking the target function each tick.\n//\n//\tassert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond)\nfunc Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tch := make(chan bool, 1)\n\tcheckCond := func() { ch <- condition() }\n\n\ttimer := time.NewTimer(waitFor)\n\tdefer timer.Stop()\n\n\tticker := time.NewTicker(tick)\n\tdefer ticker.Stop()\n\n\tvar tickC <-chan time.Time\n\n\t// Check the condition once first on the initial call.\n\tgo checkCond()\n\n\tfor {\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\treturn true\n\t\tcase <-tickC:\n\t\t\ttickC = nil\n\t\t\tgo checkCond()\n\t\tcase v := <-ch:\n\t\t\tif v {\n\t\t\t\treturn Fail(t, \"Condition satisfied\", msgAndArgs...)\n\t\t\t}\n\t\t\ttickC = ticker.C\n\t\t}\n\t}\n}\n\n// ErrorIs asserts that at least one of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif errors.Is(err, target) {\n\t\treturn true\n\t}\n\n\tvar expectedText string\n\tif target != nil {\n\t\texpectedText = target.Error()\n\t\tif err == nil {\n\t\t\treturn Fail(t, fmt.Sprintf(\"Expected error with %q in chain but got nil.\", expectedText), msgAndArgs...)\n\t\t}\n\t}\n\n\tchain := buildErrorChainString(err, false)\n\n\treturn Fail(t, fmt.Sprintf(\"Target error should be in err chain:\\n\"+\n\t\t\"expected: %s\\n\"+\n\t\t\"in chain: %s\", truncatingFormat(\"%q\", expectedText), truncatingFormat(\"%s\", chain),\n\t), msgAndArgs...)\n}\n\n// NotErrorIs asserts that none of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !errors.Is(err, target) {\n\t\treturn true\n\t}\n\n\tvar expectedText string\n\tif target != nil {\n\t\texpectedText = target.Error()\n\t}\n\n\tchain := buildErrorChainString(err, false)\n\n\treturn Fail(t, fmt.Sprintf(\"Target error should not be in err chain:\\n\"+\n\t\t\"found: %s\\n\"+\n\t\t\"in chain: %s\", truncatingFormat(\"%q\", expectedText), truncatingFormat(\"%s\", chain),\n\t), msgAndArgs...)\n}\n\n// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.\n// This is a wrapper for errors.As.\nfunc ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif errors.As(err, target) {\n\t\treturn true\n\t}\n\n\texpectedType := reflect.TypeOf(target).Elem().String()\n\tif err == nil {\n\t\treturn Fail(t, fmt.Sprintf(\"An error is expected but got nil.\\n\"+\n\t\t\t\"expected: %s\", expectedType), msgAndArgs...)\n\t}\n\n\tchain := buildErrorChainString(err, true)\n\n\treturn Fail(t, fmt.Sprintf(\"Should be in error chain:\\n\"+\n\t\t\"expected: %s\\n\"+\n\t\t\"in chain: %s\", expectedType, truncatingFormat(\"%s\", chain),\n\t), msgAndArgs...)\n}\n\n// NotErrorAs asserts that none of the errors in err's chain matches target,\n// but if so, sets target to that error value.\nfunc NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !errors.As(err, target) {\n\t\treturn true\n\t}\n\n\tchain := buildErrorChainString(err, true)\n\n\treturn Fail(t, fmt.Sprintf(\"Target error should not be in err chain:\\n\"+\n\t\t\"found: %s\\n\"+\n\t\t\"in chain: %s\", reflect.TypeOf(target).Elem().String(), truncatingFormat(\"%s\", chain),\n\t), msgAndArgs...)\n}\n\nfunc unwrapAll(err error) (errs []error) {\n\terrs = append(errs, err)\n\tswitch x := err.(type) {\n\tcase interface{ Unwrap() error }:\n\t\terr = x.Unwrap()\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\terrs = append(errs, unwrapAll(err)...)\n\tcase interface{ Unwrap() []error }:\n\t\tfor _, err := range x.Unwrap() {\n\t\t\terrs = append(errs, unwrapAll(err)...)\n\t\t}\n\t}\n\treturn\n}\n\nfunc buildErrorChainString(err error, withType bool) string {\n\tif err == nil {\n\t\treturn \"\"\n\t}\n\n\tvar chain string\n\terrs := unwrapAll(err)\n\tfor i := range errs {\n\t\tif i != 0 {\n\t\t\tchain += \"\\n\\t\"\n\t\t}\n\t\tchain += fmt.Sprintf(\"%q\", errs[i].Error())\n\t\tif withType {\n\t\t\tchain += fmt.Sprintf(\" (%T)\", errs[i])\n\t\t}\n\t}\n\treturn chain\n}\n"
  },
  {
    "path": "assert/assertions_test.go",
    "content": "package assert\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"math\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n)\n\nvar (\n\ti     interface{}\n\tzeros = []interface{}{\n\t\tfalse,\n\t\tbyte(0),\n\t\tcomplex64(0),\n\t\tcomplex128(0),\n\t\tfloat32(0),\n\t\tfloat64(0),\n\t\tint(0),\n\t\tint8(0),\n\t\tint16(0),\n\t\tint32(0),\n\t\tint64(0),\n\t\trune(0),\n\t\tuint(0),\n\t\tuint8(0),\n\t\tuint16(0),\n\t\tuint32(0),\n\t\tuint64(0),\n\t\tuintptr(0),\n\t\t\"\",\n\t\t[0]interface{}{},\n\t\t[]interface{}(nil),\n\t\tstruct{ x int }{},\n\t\t(*interface{})(nil),\n\t\t(func())(nil),\n\t\tnil,\n\t\tinterface{}(nil),\n\t\tmap[interface{}]interface{}(nil),\n\t\t(chan interface{})(nil),\n\t\t(<-chan interface{})(nil),\n\t\t(chan<- interface{})(nil),\n\t}\n\tnonZeros = []interface{}{\n\t\ttrue,\n\t\tbyte(1),\n\t\tcomplex64(1),\n\t\tcomplex128(1),\n\t\tfloat32(1),\n\t\tfloat64(1),\n\t\tint(1),\n\t\tint8(1),\n\t\tint16(1),\n\t\tint32(1),\n\t\tint64(1),\n\t\trune(1),\n\t\tuint(1),\n\t\tuint8(1),\n\t\tuint16(1),\n\t\tuint32(1),\n\t\tuint64(1),\n\t\tuintptr(1),\n\t\t\"s\",\n\t\t[1]interface{}{1},\n\t\t[]interface{}{},\n\t\tstruct{ x int }{1},\n\t\t(&i),\n\t\t(func() {}),\n\t\tinterface{}(1),\n\t\tmap[interface{}]interface{}{},\n\t\t(make(chan interface{})),\n\t\t(<-chan interface{})(make(chan interface{})),\n\t\t(chan<- interface{})(make(chan interface{})),\n\t}\n)\n\n// AssertionTesterInterface defines an interface to be used for testing assertion methods\ntype AssertionTesterInterface interface {\n\tTestMethod()\n}\n\n// AssertionTesterConformingObject is an object that conforms to the AssertionTesterInterface interface\ntype AssertionTesterConformingObject struct{}\n\nfunc (a *AssertionTesterConformingObject) TestMethod() {\n}\n\n// AssertionTesterNonConformingObject is an object that does not conform to the AssertionTesterInterface interface\ntype AssertionTesterNonConformingObject struct{}\n\nfunc TestObjectsAreEqual(t *testing.T) {\n\tt.Parallel()\n\n\tcases := []struct {\n\t\texpected interface{}\n\t\tactual   interface{}\n\t\tresult   bool\n\t}{\n\t\t// cases that are expected to be equal\n\t\t{\"Hello World\", \"Hello World\", true},\n\t\t{123, 123, true},\n\t\t{123.5, 123.5, true},\n\t\t{[]byte(\"Hello World\"), []byte(\"Hello World\"), true},\n\t\t{nil, nil, true},\n\n\t\t// cases that are expected not to be equal\n\t\t{map[int]int{5: 10}, map[int]int{10: 20}, false},\n\t\t{'x', \"x\", false},\n\t\t{\"x\", 'x', false},\n\t\t{0, 0.1, false},\n\t\t{0.1, 0, false},\n\t\t{time.Now, time.Now, false},\n\t\t{func() {}, func() {}, false},\n\t\t{uint32(10), int32(10), false},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"ObjectsAreEqual(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tres := ObjectsAreEqual(c.expected, c.actual)\n\n\t\t\tif res != c.result {\n\t\t\t\tt.Errorf(\"ObjectsAreEqual(%#v, %#v) should return %#v\", c.expected, c.actual, c.result)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestObjectsAreEqualValues(t *testing.T) {\n\tt.Parallel()\n\n\tnow := time.Now()\n\n\tcases := []struct {\n\t\texpected interface{}\n\t\tactual   interface{}\n\t\tresult   bool\n\t}{\n\t\t{uint32(10), int32(10), true},\n\t\t{0, nil, false},\n\t\t{nil, 0, false},\n\t\t{now, now.In(time.Local), false}, // should not be time zone independent\n\t\t{int(270), int8(14), false},      // should handle overflow/underflow\n\t\t{int8(14), int(270), false},\n\t\t{[]int{270, 270}, []int8{14, 14}, false},\n\t\t{complex128(1e+100 + 1e+100i), complex64(complex(math.Inf(0), math.Inf(0))), false},\n\t\t{complex64(complex(math.Inf(0), math.Inf(0))), complex128(1e+100 + 1e+100i), false},\n\t\t{complex128(1e+100 + 1e+100i), 270, false},\n\t\t{270, complex128(1e+100 + 1e+100i), false},\n\t\t{complex128(1e+100 + 1e+100i), 3.14, false},\n\t\t{3.14, complex128(1e+100 + 1e+100i), false},\n\t\t{complex128(1e+10 + 1e+10i), complex64(1e+10 + 1e+10i), true},\n\t\t{complex64(1e+10 + 1e+10i), complex128(1e+10 + 1e+10i), true},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"ObjectsAreEqualValues(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tres := ObjectsAreEqualValues(c.expected, c.actual)\n\n\t\t\tif res != c.result {\n\t\t\t\tt.Errorf(\"ObjectsAreEqualValues(%#v, %#v) should return %#v\", c.expected, c.actual, c.result)\n\t\t\t}\n\t\t})\n\t}\n}\n\ntype Nested struct {\n\tExported    interface{}\n\tnotExported interface{}\n}\n\ntype S struct {\n\tExported1    interface{}\n\tExported2    Nested\n\tnotExported1 interface{}\n\tnotExported2 Nested\n}\n\ntype S2 struct {\n\tfoo interface{}\n}\n\ntype S3 struct {\n\tExported1 *Nested\n\tExported2 *Nested\n}\n\ntype S4 struct {\n\tExported1 []*Nested\n}\n\ntype S5 struct {\n\tExported Nested\n}\n\ntype S6 struct {\n\tExported   string\n\tunexported string\n}\n\nfunc TestObjectsExportedFieldsAreEqual(t *testing.T) {\n\tt.Parallel()\n\n\tintValue := 1\n\n\tcases := []struct {\n\t\texpected interface{}\n\t\tactual   interface{}\n\t\tresult   bool\n\t}{\n\t\t{S{1, Nested{2, 3}, 4, Nested{5, 6}}, S{1, Nested{2, 3}, 4, Nested{5, 6}}, true},\n\t\t{S{1, Nested{2, 3}, 4, Nested{5, 6}}, S{1, Nested{2, 3}, \"a\", Nested{5, 6}}, true},\n\t\t{S{1, Nested{2, 3}, 4, Nested{5, 6}}, S{1, Nested{2, 3}, 4, Nested{5, \"a\"}}, true},\n\t\t{S{1, Nested{2, 3}, 4, Nested{5, 6}}, S{1, Nested{2, 3}, 4, Nested{\"a\", \"a\"}}, true},\n\t\t{S{1, Nested{2, 3}, 4, Nested{5, 6}}, S{1, Nested{2, \"a\"}, 4, Nested{5, 6}}, true},\n\t\t{S{1, Nested{2, 3}, 4, Nested{5, 6}}, S{\"a\", Nested{2, 3}, 4, Nested{5, 6}}, false},\n\t\t{S{1, Nested{2, 3}, 4, Nested{5, 6}}, S{1, Nested{\"a\", 3}, 4, Nested{5, 6}}, false},\n\t\t{S{1, Nested{2, 3}, 4, Nested{5, 6}}, S2{1}, false},\n\t\t{1, S{1, Nested{2, 3}, 4, Nested{5, 6}}, false},\n\n\t\t{S3{&Nested{1, 2}, &Nested{3, 4}}, S3{&Nested{1, 2}, &Nested{3, 4}}, true},\n\t\t{S3{nil, &Nested{3, 4}}, S3{nil, &Nested{3, 4}}, true},\n\t\t{S3{&Nested{1, 2}, &Nested{3, 4}}, S3{&Nested{1, 2}, &Nested{3, \"b\"}}, true},\n\t\t{S3{&Nested{1, 2}, &Nested{3, 4}}, S3{&Nested{1, \"a\"}, &Nested{3, \"b\"}}, true},\n\t\t{S3{&Nested{1, 2}, &Nested{3, 4}}, S3{&Nested{\"a\", 2}, &Nested{3, 4}}, false},\n\t\t{S3{&Nested{1, 2}, &Nested{3, 4}}, S3{}, false},\n\t\t{S3{}, S3{}, true},\n\n\t\t{S4{[]*Nested{{1, 2}}}, S4{[]*Nested{{1, 2}}}, true},\n\t\t{S4{[]*Nested{{1, 2}}}, S4{[]*Nested{{1, 3}}}, true},\n\t\t{S4{[]*Nested{{1, 2}, {3, 4}}}, S4{[]*Nested{{1, \"a\"}, {3, \"b\"}}}, true},\n\t\t{S4{[]*Nested{{1, 2}, {3, 4}}}, S4{[]*Nested{{1, \"a\"}, {2, \"b\"}}}, false},\n\n\t\t{Nested{&intValue, 2}, Nested{&intValue, 2}, true},\n\t\t{Nested{&Nested{1, 2}, 3}, Nested{&Nested{1, \"b\"}, 3}, true},\n\t\t{Nested{&Nested{1, 2}, 3}, Nested{nil, 3}, false},\n\n\t\t{\n\t\t\tNested{map[interface{}]*Nested{nil: nil}, 2},\n\t\t\tNested{map[interface{}]*Nested{nil: nil}, 2},\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\tNested{map[interface{}]*Nested{\"a\": nil}, 2},\n\t\t\tNested{map[interface{}]*Nested{\"a\": nil}, 2},\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\tNested{map[interface{}]*Nested{\"a\": nil}, 2},\n\t\t\tNested{map[interface{}]*Nested{\"a\": {1, 2}}, 2},\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\tNested{map[interface{}]Nested{\"a\": {1, 2}, \"b\": {3, 4}}, 2},\n\t\t\tNested{map[interface{}]Nested{\"a\": {1, 5}, \"b\": {3, 7}}, 2},\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\tNested{map[interface{}]Nested{\"a\": {1, 2}, \"b\": {3, 4}}, 2},\n\t\t\tNested{map[interface{}]Nested{\"a\": {2, 2}, \"b\": {3, 4}}, 2},\n\t\t\tfalse,\n\t\t},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"ObjectsExportedFieldsAreEqual(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tres := ObjectsExportedFieldsAreEqual(c.expected, c.actual)\n\n\t\t\tif res != c.result {\n\t\t\t\tt.Errorf(\"ObjectsExportedFieldsAreEqual(%#v, %#v) should return %#v\", c.expected, c.actual, c.result)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestCopyExportedFields(t *testing.T) {\n\tt.Parallel()\n\n\tintValue := 1\n\n\tcases := []struct {\n\t\tinput    interface{}\n\t\texpected interface{}\n\t}{\n\t\t{\n\t\t\tinput:    Nested{\"a\", \"b\"},\n\t\t\texpected: Nested{\"a\", nil},\n\t\t},\n\t\t{\n\t\t\tinput:    Nested{&intValue, 2},\n\t\t\texpected: Nested{&intValue, nil},\n\t\t},\n\t\t{\n\t\t\tinput:    Nested{nil, 3},\n\t\t\texpected: Nested{nil, nil},\n\t\t},\n\t\t{\n\t\t\tinput:    S{1, Nested{2, 3}, 4, Nested{5, 6}},\n\t\t\texpected: S{1, Nested{2, nil}, nil, Nested{}},\n\t\t},\n\t\t{\n\t\t\tinput:    S3{},\n\t\t\texpected: S3{},\n\t\t},\n\t\t{\n\t\t\tinput:    S3{&Nested{1, 2}, &Nested{3, 4}},\n\t\t\texpected: S3{&Nested{1, nil}, &Nested{3, nil}},\n\t\t},\n\t\t{\n\t\t\tinput:    S3{Exported1: &Nested{\"a\", \"b\"}},\n\t\t\texpected: S3{Exported1: &Nested{\"a\", nil}},\n\t\t},\n\t\t{\n\t\t\tinput: S4{[]*Nested{\n\t\t\t\tnil,\n\t\t\t\t{1, 2},\n\t\t\t}},\n\t\t\texpected: S4{[]*Nested{\n\t\t\t\tnil,\n\t\t\t\t{1, nil},\n\t\t\t}},\n\t\t},\n\t\t{\n\t\t\tinput: S4{\n\t\t\t\t[]*Nested{\n\t\t\t\t\t{1, 2},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: S4{\n\t\t\t\t[]*Nested{\n\t\t\t\t\t{1, nil},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tinput: S4{[]*Nested{\n\t\t\t\t{1, 2},\n\t\t\t\t{3, 4},\n\t\t\t}},\n\t\t\texpected: S4{[]*Nested{\n\t\t\t\t{1, nil},\n\t\t\t\t{3, nil},\n\t\t\t}},\n\t\t},\n\t\t{\n\t\t\tinput:    S5{Exported: Nested{\"a\", \"b\"}},\n\t\t\texpected: S5{Exported: Nested{\"a\", nil}},\n\t\t},\n\t\t{\n\t\t\tinput:    S6{\"a\", \"b\"},\n\t\t\texpected: S6{\"a\", \"\"},\n\t\t},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\toutput := copyExportedFields(c.input)\n\t\t\tif !ObjectsAreEqualValues(c.expected, output) {\n\t\t\t\tt.Errorf(\"%#v, %#v should be equal\", c.expected, output)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestEqualExportedValues(t *testing.T) {\n\tt.Parallel()\n\n\tcases := []struct {\n\t\tvalue1        interface{}\n\t\tvalue2        interface{}\n\t\texpectedEqual bool\n\t\texpectedFail  string\n\t}{\n\t\t{\n\t\t\tvalue1:        S{1, Nested{2, 3}, 4, Nested{5, 6}},\n\t\t\tvalue2:        S{1, Nested{2, nil}, nil, Nested{}},\n\t\t\texpectedEqual: true,\n\t\t},\n\t\t{\n\t\t\tvalue1:        S{1, Nested{2, 3}, 4, Nested{5, 6}},\n\t\t\tvalue2:        S{1, Nested{1, nil}, nil, Nested{}},\n\t\t\texpectedEqual: false,\n\t\t\texpectedFail: `\n\t            \tDiff:\n\t            \t--- Expected\n\t            \t+++ Actual\n\t            \t@@ -3,3 +3,3 @@\n\t            \t  Exported2: (assert.Nested) {\n\t            \t-  Exported: (int) 2,\n\t            \t+  Exported: (int) 1,\n\t            \t   notExported: (interface {}) <nil>`,\n\t\t},\n\t\t{\n\t\t\tvalue1:        S3{&Nested{1, 2}, &Nested{3, 4}},\n\t\t\tvalue2:        S3{&Nested{\"a\", 2}, &Nested{3, 4}},\n\t\t\texpectedEqual: false,\n\t\t\texpectedFail: `\n\t            \tDiff:\n\t            \t--- Expected\n\t            \t+++ Actual\n\t            \t@@ -2,3 +2,3 @@\n\t            \t  Exported1: (*assert.Nested)({\n\t            \t-  Exported: (int) 1,\n\t            \t+  Exported: (string) (len=1) \"a\",\n\t            \t   notExported: (interface {}) <nil>`,\n\t\t},\n\t\t{\n\t\t\tvalue1: S4{[]*Nested{\n\t\t\t\t{1, 2},\n\t\t\t\t{3, 4},\n\t\t\t}},\n\t\t\tvalue2: S4{[]*Nested{\n\t\t\t\t{1, \"a\"},\n\t\t\t\t{2, \"b\"},\n\t\t\t}},\n\t\t\texpectedEqual: false,\n\t\t\texpectedFail: `\n\t            \tDiff:\n\t            \t--- Expected\n\t            \t+++ Actual\n\t            \t@@ -7,3 +7,3 @@\n\t            \t   (*assert.Nested)({\n\t            \t-   Exported: (int) 3,\n\t            \t+   Exported: (int) 2,\n\t            \t    notExported: (interface {}) <nil>`,\n\t\t},\n\t\t{\n\t\t\tvalue1:        S{[2]int{1, 2}, Nested{2, 3}, 4, Nested{5, 6}},\n\t\t\tvalue2:        S{[2]int{1, 2}, Nested{2, nil}, nil, Nested{}},\n\t\t\texpectedEqual: true,\n\t\t},\n\t\t{\n\t\t\tvalue1:        &S{1, Nested{2, 3}, 4, Nested{5, 6}},\n\t\t\tvalue2:        &S{1, Nested{2, nil}, nil, Nested{}},\n\t\t\texpectedEqual: true,\n\t\t},\n\t\t{\n\t\t\tvalue1:        &S{1, Nested{2, 3}, 4, Nested{5, 6}},\n\t\t\tvalue2:        &S{1, Nested{1, nil}, nil, Nested{}},\n\t\t\texpectedEqual: false,\n\t\t\texpectedFail: `\n\t            \tDiff:\n\t            \t--- Expected\n\t            \t+++ Actual\n\t            \t@@ -3,3 +3,3 @@\n\t            \t  Exported2: (assert.Nested) {\n\t            \t-  Exported: (int) 2,\n\t            \t+  Exported: (int) 1,\n\t            \t   notExported: (interface {}) <nil>`,\n\t\t},\n\t\t{\n\t\t\tvalue1:        []int{1, 2},\n\t\t\tvalue2:        []int{1, 2},\n\t\t\texpectedEqual: true,\n\t\t},\n\t\t{\n\t\t\tvalue1:        []int{1, 2},\n\t\t\tvalue2:        []int{1, 3},\n\t\t\texpectedEqual: false,\n\t\t\texpectedFail: `\n\t            \tDiff:\n\t            \t--- Expected\n\t            \t+++ Actual\n\t            \t@@ -2,3 +2,3 @@\n\t            \t  (int) 1,\n\t            \t- (int) 2\n\t            \t+ (int) 3\n\t            \t }`,\n\t\t},\n\t\t{\n\t\t\tvalue1: []*Nested{\n\t\t\t\t{1, 2},\n\t\t\t\t{3, 4},\n\t\t\t},\n\t\t\tvalue2: []*Nested{\n\t\t\t\t{1, \"a\"},\n\t\t\t\t{3, \"b\"},\n\t\t\t},\n\t\t\texpectedEqual: true,\n\t\t},\n\t\t{\n\t\t\tvalue1: []*Nested{\n\t\t\t\t{1, 2},\n\t\t\t\t{3, 4},\n\t\t\t},\n\t\t\tvalue2: []*Nested{\n\t\t\t\t{1, \"a\"},\n\t\t\t\t{2, \"b\"},\n\t\t\t},\n\t\t\texpectedEqual: false,\n\t\t\texpectedFail: `\n\t            \tDiff:\n\t            \t--- Expected\n\t            \t+++ Actual\n\t            \t@@ -6,3 +6,3 @@\n\t            \t  (*assert.Nested)({\n\t            \t-  Exported: (int) 3,\n\t            \t+  Exported: (int) 2,\n\t            \t   notExported: (interface {}) <nil>`,\n\t\t},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\tmockT := new(mockTestingT)\n\n\t\t\tactual := EqualExportedValues(mockT, c.value1, c.value2)\n\t\t\tif actual != c.expectedEqual {\n\t\t\t\tt.Errorf(\"Expected EqualExportedValues to be %t, but was %t\", c.expectedEqual, actual)\n\t\t\t}\n\n\t\t\tactualFail := mockT.errorString()\n\t\t\tif !strings.Contains(actualFail, c.expectedFail) {\n\t\t\t\tt.Errorf(\"Contains failure should include %q but was %q\", c.expectedFail, actualFail)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestImplements(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !Implements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"Implements method should return true: AssertionTesterConformingObject implements AssertionTesterInterface\")\n\t}\n\tif Implements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"Implements method should return false: AssertionTesterNonConformingObject does not implements AssertionTesterInterface\")\n\t}\n\tif Implements(mockT, (*AssertionTesterInterface)(nil), nil) {\n\t\tt.Error(\"Implements method should return false: nil does not implement AssertionTesterInterface\")\n\t}\n}\n\nfunc TestNotImplements(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !NotImplements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"NotImplements method should return true: AssertionTesterNonConformingObject does not implement AssertionTesterInterface\")\n\t}\n\tif NotImplements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotImplements method should return false: AssertionTesterConformingObject implements AssertionTesterInterface\")\n\t}\n\tif NotImplements(mockT, (*AssertionTesterInterface)(nil), nil) {\n\t\tt.Error(\"NotImplements method should return false: nil can't be checked to be implementing AssertionTesterInterface or not\")\n\t}\n}\n\nfunc TestIsType(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !IsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"IsType should return true: AssertionTesterConformingObject is the same type as AssertionTesterConformingObject\")\n\t}\n\tif IsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"IsType should return false: AssertionTesterConformingObject is not the same type as AssertionTesterNonConformingObject\")\n\t}\n}\n\nfunc TestNotIsType(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !IsNotType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"NotIsType should return true: AssertionTesterConformingObject is not the same type as AssertionTesterNonConformingObject\")\n\t}\n\tif IsNotType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotIsType should return false: AssertionTesterConformingObject is the same type as AssertionTesterConformingObject\")\n\t}\n}\n\nfunc TestEqual(t *testing.T) {\n\tt.Parallel()\n\n\ttype myType string\n\n\tmockT := new(testing.T)\n\tvar m map[string]interface{}\n\n\tcases := []struct {\n\t\texpected interface{}\n\t\tactual   interface{}\n\t\tresult   bool\n\t\tremark   string\n\t}{\n\t\t{\"Hello World\", \"Hello World\", true, \"\"},\n\t\t{123, 123, true, \"\"},\n\t\t{123.5, 123.5, true, \"\"},\n\t\t{[]byte(\"Hello World\"), []byte(\"Hello World\"), true, \"\"},\n\t\t{nil, nil, true, \"\"},\n\t\t{int32(123), int32(123), true, \"\"},\n\t\t{uint64(123), uint64(123), true, \"\"},\n\t\t{myType(\"1\"), myType(\"1\"), true, \"\"},\n\t\t{&struct{}{}, &struct{}{}, true, \"pointer equality is based on equality of underlying value\"},\n\n\t\t// Not expected to be equal\n\t\t{m[\"bar\"], \"something\", false, \"\"},\n\t\t{myType(\"1\"), myType(\"2\"), false, \"\"},\n\n\t\t// A case that might be confusing, especially with numeric literals\n\t\t{10, uint(10), false, \"\"},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"Equal(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tres := Equal(mockT, c.expected, c.actual)\n\n\t\t\tif res != c.result {\n\t\t\t\tt.Errorf(\"Equal(%#v, %#v) should return %#v: %s\", c.expected, c.actual, c.result, c.remark)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc ptr(i int) *int {\n\treturn &i\n}\n\nfunc TestSame(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(mockTestingT)\n\n\tif Same(mockT, ptr(1), ptr(1)) {\n\t\tt.Error(\"Same should return false\")\n\t}\n\tif Same(mockT, 1, 1) {\n\t\tt.Error(\"Same should return false\")\n\t}\n\tp := ptr(2)\n\tif Same(mockT, p, *p) {\n\t\tt.Error(\"Same should return false\")\n\t}\n\tif !Same(mockT, p, p) {\n\t\tt.Error(\"Same should return true\")\n\t}\n\n\tt.Run(\"same object, different type\", func(t *testing.T) {\n\t\ttype s struct {\n\t\t\ti int\n\t\t}\n\t\ttype sPtr *s\n\t\tps := &s{1}\n\t\tdps := sPtr(ps)\n\t\tif Same(mockT, dps, ps) {\n\t\t\tt.Error(\"Same should return false\")\n\t\t}\n\t\texpPat :=\n\t\t\t`expected: &assert.s\\{i:1\\} \\(assert.sPtr\\)\\((0x[a-f0-9]+)\\)\\s*\\n` +\n\t\t\t\t`\\s+actual  : &assert.s\\{i:1\\} \\(\\*assert.s\\)\\((0x[a-f0-9]+)\\)`\n\t\tRegexp(t, regexp.MustCompile(expPat), mockT.errorString())\n\t})\n}\n\nfunc TestNotSame(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !NotSame(mockT, ptr(1), ptr(1)) {\n\t\tt.Error(\"NotSame should return true; different pointers\")\n\t}\n\tif !NotSame(mockT, 1, 1) {\n\t\tt.Error(\"NotSame should return true; constant inputs\")\n\t}\n\tp := ptr(2)\n\tif !NotSame(mockT, p, *p) {\n\t\tt.Error(\"NotSame should return true; mixed-type inputs\")\n\t}\n\tif NotSame(mockT, p, p) {\n\t\tt.Error(\"NotSame should return false\")\n\t}\n}\n\nfunc Test_samePointers(t *testing.T) {\n\tt.Parallel()\n\n\tp := ptr(2)\n\n\ttype args struct {\n\t\tfirst  interface{}\n\t\tsecond interface{}\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\tsame BoolAssertionFunc\n\t\tok   BoolAssertionFunc\n\t}{\n\t\t{\n\t\t\tname: \"1 != 2\",\n\t\t\targs: args{first: 1, second: 2},\n\t\t\tsame: False,\n\t\t\tok:   False,\n\t\t},\n\t\t{\n\t\t\tname: \"1 != 1 (not same ptr)\",\n\t\t\targs: args{first: 1, second: 1},\n\t\t\tsame: False,\n\t\t\tok:   False,\n\t\t},\n\t\t{\n\t\t\tname: \"ptr(1) == ptr(1)\",\n\t\t\targs: args{first: p, second: p},\n\t\t\tsame: True,\n\t\t\tok:   True,\n\t\t},\n\t\t{\n\t\t\tname: \"int(1) != float32(1)\",\n\t\t\targs: args{first: int(1), second: float32(1)},\n\t\t\tsame: False,\n\t\t\tok:   False,\n\t\t},\n\t\t{\n\t\t\tname: \"array != slice\",\n\t\t\targs: args{first: [2]int{1, 2}, second: []int{1, 2}},\n\t\t\tsame: False,\n\t\t\tok:   False,\n\t\t},\n\t\t{\n\t\t\tname: \"non-pointer vs pointer (1 != ptr(2))\",\n\t\t\targs: args{first: 1, second: p},\n\t\t\tsame: False,\n\t\t\tok:   False,\n\t\t},\n\t\t{\n\t\t\tname: \"pointer vs non-pointer (ptr(2) != 1)\",\n\t\t\targs: args{first: p, second: 1},\n\t\t\tsame: False,\n\t\t\tok:   False,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tsame, ok := samePointers(tt.args.first, tt.args.second)\n\t\t\ttt.same(t, same)\n\t\t\ttt.ok(t, ok)\n\t\t})\n\t}\n}\n\n// bufferT implements TestingT. Its implementation of Errorf writes the output that would be produced by\n// testing.T.Errorf to an internal bytes.Buffer.\ntype bufferT struct {\n\tbuf bytes.Buffer\n}\n\n// Helper is like [testing.T.Helper] but does nothing.\nfunc (bufferT) Helper() {}\n\nfunc (t *bufferT) Errorf(format string, args ...interface{}) {\n\t// implementation of decorate is copied from testing.T\n\tdecorate := func(s string) string {\n\t\t_, file, line, ok := runtime.Caller(3) // decorate + log + public function.\n\t\tif ok {\n\t\t\t// Truncate file name at last file name separator.\n\t\t\tif index := strings.LastIndex(file, \"/\"); index >= 0 {\n\t\t\t\tfile = file[index+1:]\n\t\t\t} else if index = strings.LastIndex(file, \"\\\\\"); index >= 0 {\n\t\t\t\tfile = file[index+1:]\n\t\t\t}\n\t\t} else {\n\t\t\tfile = \"???\"\n\t\t\tline = 1\n\t\t}\n\t\tbuf := new(bytes.Buffer)\n\t\t// Every line is indented at least one tab.\n\t\tbuf.WriteByte('\\t')\n\t\tfmt.Fprintf(buf, \"%s:%d: \", file, line)\n\t\tlines := strings.Split(s, \"\\n\")\n\t\tif l := len(lines); l > 1 && lines[l-1] == \"\" {\n\t\t\tlines = lines[:l-1]\n\t\t}\n\t\tfor i, line := range lines {\n\t\t\tif i > 0 {\n\t\t\t\t// Second and subsequent lines are indented an extra tab.\n\t\t\t\tbuf.WriteString(\"\\n\\t\\t\")\n\t\t\t}\n\t\t\tbuf.WriteString(line)\n\t\t}\n\t\tbuf.WriteByte('\\n')\n\t\treturn buf.String()\n\t}\n\tt.buf.WriteString(decorate(fmt.Sprintf(format, args...)))\n}\n\nfunc TestStringEqual(t *testing.T) {\n\tt.Parallel()\n\n\tfor i, currCase := range []struct {\n\t\tequalWant  string\n\t\tequalGot   string\n\t\tmsgAndArgs []interface{}\n\t\twant       string\n\t}{\n\t\t{equalWant: \"hi, \\nmy name is\", equalGot: \"what,\\nmy name is\", want: \"\\tassertions.go:\\\\d+: \\n\\t+Error Trace:\\t\\n\\t+Error:\\\\s+Not equal:\\\\s+\\n\\\\s+expected: \\\"hi, \\\\\\\\nmy name is\\\"\\n\\\\s+actual\\\\s+: \\\"what,\\\\\\\\nmy name is\\\"\\n\\\\s+Diff:\\n\\\\s+-+ Expected\\n\\\\s+\\\\++ Actual\\n\\\\s+@@ -1,2 \\\\+1,2 @@\\n\\\\s+-hi, \\n\\\\s+\\\\+what,\\n\\\\s+my name is\"},\n\t} {\n\t\tmockT := &bufferT{}\n\t\tEqual(mockT, currCase.equalWant, currCase.equalGot, currCase.msgAndArgs...)\n\t\tRegexp(t, regexp.MustCompile(currCase.want), mockT.buf.String(), \"Case %d\", i)\n\t}\n}\n\nfunc TestEqualFormatting(t *testing.T) {\n\tt.Parallel()\n\n\tfor i, currCase := range []struct {\n\t\tequalWant  string\n\t\tequalGot   string\n\t\tmsgAndArgs []interface{}\n\t\twant       string\n\t}{\n\t\t{equalWant: \"want\", equalGot: \"got\", want: \"\\tassertions.go:\\\\d+: \\n\\t+Error Trace:\\t\\n\\t+Error:\\\\s+Not equal:\\\\s+\\n\\\\s+expected: \\\"want\\\"\\n\\\\s+actual\\\\s+: \\\"got\\\"\\n\\\\s+Diff:\\n\\\\s+-+ Expected\\n\\\\s+\\\\++ Actual\\n\\\\s+@@ -1 \\\\+1 @@\\n\\\\s+-want\\n\\\\s+\\\\+got\\n\"},\n\t\t{equalWant: \"want\", equalGot: \"got\", msgAndArgs: []interface{}{\"hello, %v!\", \"world\"}, want: \"\\tassertions.go:[0-9]+: \\n\\t+Error Trace:\\t\\n\\t+Error:\\\\s+Not equal:\\\\s+\\n\\\\s+expected: \\\"want\\\"\\n\\\\s+actual\\\\s+: \\\"got\\\"\\n\\\\s+Diff:\\n\\\\s+-+ Expected\\n\\\\s+\\\\++ Actual\\n\\\\s+@@ -1 \\\\+1 @@\\n\\\\s+-want\\n\\\\s+\\\\+got\\n\\\\s+Messages:\\\\s+hello, world!\\n\"},\n\t\t{equalWant: \"want\", equalGot: \"got\", msgAndArgs: []interface{}{123}, want: \"\\tassertions.go:[0-9]+: \\n\\t+Error Trace:\\t\\n\\t+Error:\\\\s+Not equal:\\\\s+\\n\\\\s+expected: \\\"want\\\"\\n\\\\s+actual\\\\s+: \\\"got\\\"\\n\\\\s+Diff:\\n\\\\s+-+ Expected\\n\\\\s+\\\\++ Actual\\n\\\\s+@@ -1 \\\\+1 @@\\n\\\\s+-want\\n\\\\s+\\\\+got\\n\\\\s+Messages:\\\\s+123\\n\"},\n\t\t{equalWant: \"want\", equalGot: \"got\", msgAndArgs: []interface{}{struct{ a string }{\"hello\"}}, want: \"\\tassertions.go:[0-9]+: \\n\\t+Error Trace:\\t\\n\\t+Error:\\\\s+Not equal:\\\\s+\\n\\\\s+expected: \\\"want\\\"\\n\\\\s+actual\\\\s+: \\\"got\\\"\\n\\\\s+Diff:\\n\\\\s+-+ Expected\\n\\\\s+\\\\++ Actual\\n\\\\s+@@ -1 \\\\+1 @@\\n\\\\s+-want\\n\\\\s+\\\\+got\\n\\\\s+Messages:\\\\s+{a:hello}\\n\"},\n\t} {\n\t\tmockT := &bufferT{}\n\t\tEqual(mockT, currCase.equalWant, currCase.equalGot, currCase.msgAndArgs...)\n\t\tRegexp(t, regexp.MustCompile(currCase.want), mockT.buf.String(), \"Case %d\", i)\n\t}\n}\n\nfunc TestFormatUnequalValues(t *testing.T) {\n\tt.Parallel()\n\n\texpected, actual := formatUnequalValues(\"foo\", \"bar\")\n\tEqual(t, `\"foo\"`, expected, \"value should not include type\")\n\tEqual(t, `\"bar\"`, actual, \"value should not include type\")\n\n\texpected, actual = formatUnequalValues(123, 123)\n\tEqual(t, `123`, expected, \"value should not include type\")\n\tEqual(t, `123`, actual, \"value should not include type\")\n\n\texpected, actual = formatUnequalValues(int64(123), int32(123))\n\tEqual(t, `int64(123)`, expected, \"value should include type\")\n\tEqual(t, `int32(123)`, actual, \"value should include type\")\n\n\texpected, actual = formatUnequalValues(int64(123), nil)\n\tEqual(t, `int64(123)`, expected, \"value should include type\")\n\tEqual(t, `<nil>(<nil>)`, actual, \"value should include type\")\n\n\ttype testStructType struct {\n\t\tVal string\n\t}\n\n\texpected, actual = formatUnequalValues(&testStructType{Val: \"test\"}, &testStructType{Val: \"test\"})\n\tEqual(t, `&assert.testStructType{Val:\"test\"}`, expected, \"value should not include type annotation\")\n\tEqual(t, `&assert.testStructType{Val:\"test\"}`, actual, \"value should not include type annotation\")\n}\n\nfunc TestNotNil(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !NotNil(mockT, new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotNil should return true: object is not nil\")\n\t}\n\tif NotNil(mockT, nil) {\n\t\tt.Error(\"NotNil should return false: object is nil\")\n\t}\n\tif NotNil(mockT, (*struct{})(nil)) {\n\t\tt.Error(\"NotNil should return false: object is (*struct{})(nil)\")\n\t}\n}\n\nfunc TestNil(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !Nil(mockT, nil) {\n\t\tt.Error(\"Nil should return true: object is nil\")\n\t}\n\tif !Nil(mockT, (*struct{})(nil)) {\n\t\tt.Error(\"Nil should return true: object is (*struct{})(nil)\")\n\t}\n\tif Nil(mockT, new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"Nil should return false: object is not nil\")\n\t}\n}\n\nfunc TestTrue(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !True(mockT, true) {\n\t\tt.Error(\"True should return true\")\n\t}\n\tif True(mockT, false) {\n\t\tt.Error(\"True should return false\")\n\t}\n}\n\nfunc TestFalse(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !False(mockT, false) {\n\t\tt.Error(\"False should return true\")\n\t}\n\tif False(mockT, true) {\n\t\tt.Error(\"False should return false\")\n\t}\n}\n\nfunc TestExactly(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(testing.T)\n\n\ta := float32(1)\n\tb := float64(1)\n\tc := float32(1)\n\td := float32(2)\n\tcases := []struct {\n\t\texpected interface{}\n\t\tactual   interface{}\n\t\tresult   bool\n\t}{\n\t\t{a, b, false},\n\t\t{a, d, false},\n\t\t{a, c, true},\n\t\t{nil, a, false},\n\t\t{a, nil, false},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"Exactly(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tres := Exactly(mockT, c.expected, c.actual)\n\n\t\t\tif res != c.result {\n\t\t\t\tt.Errorf(\"Exactly(%#v, %#v) should return %#v\", c.expected, c.actual, c.result)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestNotEqual(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(testing.T)\n\n\tcases := []struct {\n\t\texpected interface{}\n\t\tactual   interface{}\n\t\tresult   bool\n\t}{\n\t\t// cases that are expected not to match\n\t\t{\"Hello World\", \"Hello World!\", true},\n\t\t{123, 1234, true},\n\t\t{123.5, 123.55, true},\n\t\t{[]byte(\"Hello World\"), []byte(\"Hello World!\"), true},\n\t\t{nil, new(AssertionTesterConformingObject), true},\n\n\t\t// cases that are expected to match\n\t\t{nil, nil, false},\n\t\t{\"Hello World\", \"Hello World\", false},\n\t\t{123, 123, false},\n\t\t{123.5, 123.5, false},\n\t\t{[]byte(\"Hello World\"), []byte(\"Hello World\"), false},\n\t\t{new(AssertionTesterConformingObject), new(AssertionTesterConformingObject), false},\n\t\t{&struct{}{}, &struct{}{}, false},\n\t\t{func() int { return 23 }, func() int { return 24 }, false},\n\t\t// A case that might be confusing, especially with numeric literals\n\t\t{int(10), uint(10), true},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"NotEqual(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tres := NotEqual(mockT, c.expected, c.actual)\n\n\t\t\tif res != c.result {\n\t\t\t\tt.Errorf(\"NotEqual(%#v, %#v) should return %#v\", c.expected, c.actual, c.result)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestEqualValuesAndNotEqualValues(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tcases := []struct {\n\t\texpected       interface{}\n\t\tactual         interface{}\n\t\tnotEqualResult bool // result for NotEqualValues\n\t}{\n\t\t// cases that are expected not to match\n\t\t{\"Hello World\", \"Hello World!\", true},\n\t\t{123, 1234, true},\n\t\t{123.5, 123.55, true},\n\t\t{[]byte(\"Hello World\"), []byte(\"Hello World!\"), true},\n\t\t{nil, new(AssertionTesterConformingObject), true},\n\n\t\t// cases that are expected to match\n\t\t{nil, nil, false},\n\t\t{\"Hello World\", \"Hello World\", false},\n\t\t{123, 123, false},\n\t\t{123.5, 123.5, false},\n\t\t{[]byte(\"Hello World\"), []byte(\"Hello World\"), false},\n\t\t{new(AssertionTesterConformingObject), new(AssertionTesterConformingObject), false},\n\t\t{&struct{}{}, &struct{}{}, false},\n\n\t\t// Different behavior from NotEqual()\n\t\t{func() int { return 23 }, func() int { return 24 }, true},\n\t\t{int(10), int(11), true},\n\t\t{int(10), uint(10), false},\n\n\t\t{struct{}{}, struct{}{}, false},\n\t}\n\n\tfor _, c := range cases {\n\t\t// Test NotEqualValues\n\t\tt.Run(fmt.Sprintf(\"NotEqualValues(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tres := NotEqualValues(mockT, c.expected, c.actual)\n\n\t\t\tif res != c.notEqualResult {\n\t\t\t\tt.Errorf(\"NotEqualValues(%#v, %#v) should return %#v\", c.expected, c.actual, c.notEqualResult)\n\t\t\t}\n\t\t})\n\n\t\t// Test EqualValues (inverse of NotEqualValues)\n\t\tt.Run(fmt.Sprintf(\"EqualValues(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\texpectedEqualResult := !c.notEqualResult // EqualValues should return opposite of NotEqualValues\n\t\t\tres := EqualValues(mockT, c.expected, c.actual)\n\n\t\t\tif res != expectedEqualResult {\n\t\t\t\tt.Errorf(\"EqualValues(%#v, %#v) should return %#v\", c.expected, c.actual, expectedEqualResult)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestContainsNotContains(t *testing.T) {\n\tt.Parallel()\n\n\ttype A struct {\n\t\tName, Value string\n\t}\n\tlist := []string{\"Foo\", \"Bar\"}\n\n\tcomplexList := []*A{\n\t\t{\"b\", \"c\"},\n\t\t{\"d\", \"e\"},\n\t\t{\"g\", \"h\"},\n\t\t{\"j\", \"k\"},\n\t}\n\tsimpleMap := map[interface{}]interface{}{\"Foo\": \"Bar\"}\n\tvar zeroMap map[interface{}]interface{}\n\n\tcases := []struct {\n\t\texpected interface{}\n\t\tactual   interface{}\n\t\tresult   bool\n\t}{\n\t\t{\"Hello World\", \"Hello\", true},\n\t\t{\"Hello World\", \"Salut\", false},\n\t\t{list, \"Bar\", true},\n\t\t{list, \"Salut\", false},\n\t\t{complexList, &A{\"g\", \"h\"}, true},\n\t\t{complexList, &A{\"g\", \"e\"}, false},\n\t\t{simpleMap, \"Foo\", true},\n\t\t{simpleMap, \"Bar\", false},\n\t\t{zeroMap, \"Bar\", false},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"Contains(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tmockT := new(testing.T)\n\t\t\tres := Contains(mockT, c.expected, c.actual)\n\n\t\t\tif res != c.result {\n\t\t\t\tif res {\n\t\t\t\t\tt.Errorf(\"Contains(%#v, %#v) should return true:\\n\\t%#v contains %#v\", c.expected, c.actual, c.expected, c.actual)\n\t\t\t\t} else {\n\t\t\t\t\tt.Errorf(\"Contains(%#v, %#v) should return false:\\n\\t%#v does not contain %#v\", c.expected, c.actual, c.expected, c.actual)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"NotContains(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tmockT := new(testing.T)\n\t\t\tres := NotContains(mockT, c.expected, c.actual)\n\n\t\t\t// NotContains should be inverse of Contains. If it's not, something is wrong\n\t\t\tif res == Contains(mockT, c.expected, c.actual) {\n\t\t\t\tif res {\n\t\t\t\t\tt.Errorf(\"NotContains(%#v, %#v) should return true:\\n\\t%#v does not contains %#v\", c.expected, c.actual, c.expected, c.actual)\n\t\t\t\t} else {\n\t\t\t\t\tt.Errorf(\"NotContains(%#v, %#v) should return false:\\n\\t%#v contains %#v\", c.expected, c.actual, c.expected, c.actual)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestContainsNotContainsFailMessage(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(mockTestingT)\n\n\ttype nonContainer struct {\n\t\tValue string\n\t}\n\n\tcases := []struct {\n\t\tassertion func(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool\n\t\tcontainer interface{}\n\t\tinstance  interface{}\n\t\texpected  string\n\t}{\n\t\t{\n\t\t\tassertion: Contains,\n\t\t\tcontainer: \"Hello World\",\n\t\t\tinstance:  errors.New(\"Hello\"),\n\t\t\texpected:  \"\\\"Hello World\\\" does not contain &errors.errorString{s:\\\"Hello\\\"}\",\n\t\t},\n\t\t{\n\t\t\tassertion: Contains,\n\t\t\tcontainer: map[string]int{\"one\": 1},\n\t\t\tinstance:  \"two\",\n\t\t\texpected:  \"map[string]int{\\\"one\\\":1} does not contain \\\"two\\\"\\n\",\n\t\t},\n\t\t{\n\t\t\tassertion: NotContains,\n\t\t\tcontainer: map[string]int{\"one\": 1},\n\t\t\tinstance:  \"one\",\n\t\t\texpected:  \"map[string]int{\\\"one\\\":1} should not contain \\\"one\\\"\",\n\t\t},\n\t\t{\n\t\t\tassertion: Contains,\n\t\t\tcontainer: nonContainer{Value: \"Hello\"},\n\t\t\tinstance:  \"Hello\",\n\t\t\texpected:  \"assert.nonContainer{Value:\\\"Hello\\\"} could not be applied builtin len()\\n\",\n\t\t},\n\t\t{\n\t\t\tassertion: NotContains,\n\t\t\tcontainer: nonContainer{Value: \"Hello\"},\n\t\t\tinstance:  \"Hello\",\n\t\t\texpected:  \"assert.nonContainer{Value:\\\"Hello\\\"} could not be applied builtin len()\\n\",\n\t\t},\n\t}\n\tfor _, c := range cases {\n\t\tname := filepath.Base(runtime.FuncForPC(reflect.ValueOf(c.assertion).Pointer()).Name())\n\t\tt.Run(fmt.Sprintf(\"%v(%T, %T)\", name, c.container, c.instance), func(t *testing.T) {\n\t\t\tc.assertion(mockT, c.container, c.instance)\n\t\t\tactualFail := mockT.errorString()\n\t\t\tif !strings.Contains(actualFail, c.expected) {\n\t\t\t\tt.Errorf(\"Contains failure should include %q but was %q\", c.expected, actualFail)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestContainsNotContainsOnNilValue(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(mockTestingT)\n\n\tContains(mockT, nil, \"key\")\n\texpectedFail := \"<nil> could not be applied builtin len()\"\n\tactualFail := mockT.errorString()\n\tif !strings.Contains(actualFail, expectedFail) {\n\t\tt.Errorf(\"Contains failure should include %q but was %q\", expectedFail, actualFail)\n\t}\n\n\tNotContains(mockT, nil, \"key\")\n\tif !strings.Contains(actualFail, expectedFail) {\n\t\tt.Errorf(\"Contains failure should include %q but was %q\", expectedFail, actualFail)\n\t}\n}\n\nfunc TestSubsetNotSubset(t *testing.T) {\n\tt.Parallel()\n\n\tcases := []struct {\n\t\tlist    interface{}\n\t\tsubset  interface{}\n\t\tresult  bool\n\t\tmessage string\n\t}{\n\t\t// cases that are expected to contain\n\t\t{[]int{1, 2, 3}, nil, true, `nil is the empty set which is a subset of every set`},\n\t\t{[]int{1, 2, 3}, []int{}, true, `[] is a subset of ['\\x01' '\\x02' '\\x03']`},\n\t\t{[]int{1, 2, 3}, []int{1, 2}, true, `['\\x01' '\\x02'] is a subset of ['\\x01' '\\x02' '\\x03']`},\n\t\t{[]int{1, 2, 3}, []int{1, 2, 3}, true, `['\\x01' '\\x02' '\\x03'] is a subset of ['\\x01' '\\x02' '\\x03']`},\n\t\t{[]string{\"hello\", \"world\"}, []string{\"hello\"}, true, `[\"hello\"] is a subset of [\"hello\" \"world\"]`},\n\t\t{map[string]string{\n\t\t\t\"a\": \"x\",\n\t\t\t\"c\": \"z\",\n\t\t\t\"b\": \"y\",\n\t\t}, map[string]string{\n\t\t\t\"a\": \"x\",\n\t\t\t\"b\": \"y\",\n\t\t}, true, `map[\"a\":\"x\" \"b\":\"y\"] is a subset of map[\"a\":\"x\" \"b\":\"y\" \"c\":\"z\"]`},\n\t\t{[]string{\"a\", \"b\", \"c\"}, map[string]int{\"a\": 1, \"c\": 3}, true, `map[\"a\":'\\x01' \"c\":'\\x03'] is a subset of [\"a\" \"b\" \"c\"]`},\n\n\t\t// cases that are expected not to contain\n\t\t{[]string{\"hello\", \"world\"}, []string{\"hello\", \"testify\"}, false, `[]string{\"hello\", \"world\"} does not contain \"testify\"`},\n\t\t{[]int{1, 2, 3}, []int{4, 5}, false, `[]int{1, 2, 3} does not contain 4`},\n\t\t{[]int{1, 2, 3}, []int{1, 5}, false, `[]int{1, 2, 3} does not contain 5`},\n\t\t{map[string]string{\n\t\t\t\"a\": \"x\",\n\t\t\t\"c\": \"z\",\n\t\t\t\"b\": \"y\",\n\t\t}, map[string]string{\n\t\t\t\"a\": \"x\",\n\t\t\t\"b\": \"z\",\n\t\t}, false, `map[string]string{\"a\":\"x\", \"b\":\"y\", \"c\":\"z\"} does not contain map[string]string{\"a\":\"x\", \"b\":\"z\"}`},\n\t\t{map[string]string{\n\t\t\t\"a\": \"x\",\n\t\t\t\"b\": \"y\",\n\t\t}, map[string]string{\n\t\t\t\"a\": \"x\",\n\t\t\t\"b\": \"y\",\n\t\t\t\"c\": \"z\",\n\t\t}, false, `map[string]string{\"a\":\"x\", \"b\":\"y\"} does not contain map[string]string{\"a\":\"x\", \"b\":\"y\", \"c\":\"z\"}`},\n\t\t{[]string{\"a\", \"b\", \"c\"}, map[string]int{\"c\": 3, \"d\": 4}, false, `[]string{\"a\", \"b\", \"c\"} does not contain \"d\"`},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(\"SubSet: \"+c.message, func(t *testing.T) {\n\t\t\tmockT := new(mockTestingT)\n\t\t\tres := Subset(mockT, c.list, c.subset)\n\n\t\t\tif res != c.result {\n\t\t\t\tt.Errorf(\"Subset should return %t: %s\", c.result, c.message)\n\t\t\t}\n\t\t\tif !c.result {\n\t\t\t\texpectedFail := c.message\n\t\t\t\tactualFail := mockT.errorString()\n\t\t\t\tif !strings.Contains(actualFail, expectedFail) {\n\t\t\t\t\tt.Log(actualFail)\n\t\t\t\t\tt.Errorf(\"Subset failure should contain %q but was %q\", expectedFail, actualFail)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\tfor _, c := range cases {\n\t\tt.Run(\"NotSubSet: \"+c.message, func(t *testing.T) {\n\t\t\tmockT := new(mockTestingT)\n\t\t\tres := NotSubset(mockT, c.list, c.subset)\n\n\t\t\t// NotSubset should match the inverse of Subset. If it doesn't, something is wrong\n\t\t\tif res == Subset(mockT, c.list, c.subset) {\n\t\t\t\tt.Errorf(\"NotSubset should return %t: %s\", !c.result, c.message)\n\t\t\t}\n\t\t\tif c.result {\n\t\t\t\texpectedFail := c.message\n\t\t\t\tactualFail := mockT.errorString()\n\t\t\t\tif !strings.Contains(actualFail, expectedFail) {\n\t\t\t\t\tt.Log(actualFail)\n\t\t\t\t\tt.Errorf(\"NotSubset failure should contain %q but was %q\", expectedFail, actualFail)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestNotSubsetNil(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tNotSubset(mockT, []string{\"foo\"}, nil)\n\tif !mockT.Failed() {\n\t\tt.Error(\"NotSubset on nil set should have failed the test\")\n\t}\n}\n\nfunc Test_containsElement(t *testing.T) {\n\tt.Parallel()\n\n\tlist1 := []string{\"Foo\", \"Bar\"}\n\tlist2 := []int{1, 2}\n\tsimpleMap := map[interface{}]interface{}{\"Foo\": \"Bar\"}\n\n\tok, found := containsElement(\"Hello World\", \"World\")\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = containsElement(list1, \"Foo\")\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = containsElement(list1, \"Bar\")\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = containsElement(list2, 1)\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = containsElement(list2, 2)\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = containsElement(list1, \"Foo!\")\n\tTrue(t, ok)\n\tFalse(t, found)\n\n\tok, found = containsElement(list2, 3)\n\tTrue(t, ok)\n\tFalse(t, found)\n\n\tok, found = containsElement(list2, \"1\")\n\tTrue(t, ok)\n\tFalse(t, found)\n\n\tok, found = containsElement(simpleMap, \"Foo\")\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = containsElement(simpleMap, \"Bar\")\n\tTrue(t, ok)\n\tFalse(t, found)\n\n\tok, found = containsElement(1433, \"1\")\n\tFalse(t, ok)\n\tFalse(t, found)\n}\n\nfunc TestElementsMatch(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tcases := []struct {\n\t\texpected interface{}\n\t\tactual   interface{}\n\t\tresult   bool\n\t}{\n\t\t// matching\n\t\t{nil, nil, true},\n\n\t\t{nil, nil, true},\n\t\t{[]int{}, []int{}, true},\n\t\t{[]int{1}, []int{1}, true},\n\t\t{[]int{1, 1}, []int{1, 1}, true},\n\t\t{[]int{1, 2}, []int{1, 2}, true},\n\t\t{[]int{1, 2}, []int{2, 1}, true},\n\t\t{[2]int{1, 2}, [2]int{2, 1}, true},\n\t\t{[]string{\"hello\", \"world\"}, []string{\"world\", \"hello\"}, true},\n\t\t{[]string{\"hello\", \"hello\"}, []string{\"hello\", \"hello\"}, true},\n\t\t{[]string{\"hello\", \"hello\", \"world\"}, []string{\"hello\", \"world\", \"hello\"}, true},\n\t\t{[3]string{\"hello\", \"hello\", \"world\"}, [3]string{\"hello\", \"world\", \"hello\"}, true},\n\t\t{[]int{}, nil, true},\n\n\t\t// not matching\n\t\t{[]int{1}, []int{1, 1}, false},\n\t\t{[]int{1, 2}, []int{2, 2}, false},\n\t\t{[]string{\"hello\", \"hello\"}, []string{\"hello\"}, false},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"ElementsMatch(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tres := ElementsMatch(mockT, c.actual, c.expected)\n\n\t\t\tif res != c.result {\n\t\t\t\tt.Errorf(\"ElementsMatch(%#v, %#v) should return %v\", c.actual, c.expected, c.result)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestDiffLists(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname   string\n\t\tlistA  interface{}\n\t\tlistB  interface{}\n\t\textraA []interface{}\n\t\textraB []interface{}\n\t}{\n\t\t{\n\t\t\tname:   \"equal empty\",\n\t\t\tlistA:  []string{},\n\t\t\tlistB:  []string{},\n\t\t\textraA: nil,\n\t\t\textraB: nil,\n\t\t},\n\t\t{\n\t\t\tname:   \"equal same order\",\n\t\t\tlistA:  []string{\"hello\", \"world\"},\n\t\t\tlistB:  []string{\"hello\", \"world\"},\n\t\t\textraA: nil,\n\t\t\textraB: nil,\n\t\t},\n\t\t{\n\t\t\tname:   \"equal different order\",\n\t\t\tlistA:  []string{\"hello\", \"world\"},\n\t\t\tlistB:  []string{\"world\", \"hello\"},\n\t\t\textraA: nil,\n\t\t\textraB: nil,\n\t\t},\n\t\t{\n\t\t\tname:   \"extra A\",\n\t\t\tlistA:  []string{\"hello\", \"hello\", \"world\"},\n\t\t\tlistB:  []string{\"hello\", \"world\"},\n\t\t\textraA: []interface{}{\"hello\"},\n\t\t\textraB: nil,\n\t\t},\n\t\t{\n\t\t\tname:   \"extra A twice\",\n\t\t\tlistA:  []string{\"hello\", \"hello\", \"hello\", \"world\"},\n\t\t\tlistB:  []string{\"hello\", \"world\"},\n\t\t\textraA: []interface{}{\"hello\", \"hello\"},\n\t\t\textraB: nil,\n\t\t},\n\t\t{\n\t\t\tname:   \"extra B\",\n\t\t\tlistA:  []string{\"hello\", \"world\"},\n\t\t\tlistB:  []string{\"hello\", \"hello\", \"world\"},\n\t\t\textraA: nil,\n\t\t\textraB: []interface{}{\"hello\"},\n\t\t},\n\t\t{\n\t\t\tname:   \"extra B twice\",\n\t\t\tlistA:  []string{\"hello\", \"world\"},\n\t\t\tlistB:  []string{\"hello\", \"hello\", \"world\", \"hello\"},\n\t\t\textraA: nil,\n\t\t\textraB: []interface{}{\"hello\", \"hello\"},\n\t\t},\n\t\t{\n\t\t\tname:   \"integers 1\",\n\t\t\tlistA:  []int{1, 2, 3, 4, 5},\n\t\t\tlistB:  []int{5, 4, 3, 2, 1},\n\t\t\textraA: nil,\n\t\t\textraB: nil,\n\t\t},\n\t\t{\n\t\t\tname:   \"integers 2\",\n\t\t\tlistA:  []int{1, 2, 1, 2, 1},\n\t\t\tlistB:  []int{2, 1, 2, 1, 2},\n\t\t\textraA: []interface{}{1},\n\t\t\textraB: []interface{}{2},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\ttest := test\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tactualExtraA, actualExtraB := diffLists(test.listA, test.listB)\n\t\t\tEqual(t, test.extraA, actualExtraA, \"extra A does not match for listA=%v listB=%v\",\n\t\t\t\ttest.listA, test.listB)\n\t\t\tEqual(t, test.extraB, actualExtraB, \"extra B does not match for listA=%v listB=%v\",\n\t\t\t\ttest.listA, test.listB)\n\t\t})\n\t}\n}\n\nfunc TestNotElementsMatch(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tcases := []struct {\n\t\texpected interface{}\n\t\tactual   interface{}\n\t\tresult   bool\n\t}{\n\t\t// not matching\n\t\t{[]int{1}, []int{}, true},\n\t\t{[]int{}, []int{2}, true},\n\t\t{[]int{1}, []int{2}, true},\n\t\t{[]int{1}, []int{1, 1}, true},\n\t\t{[]int{1, 2}, []int{3, 4}, true},\n\t\t{[]int{3, 4}, []int{1, 2}, true},\n\t\t{[]int{1, 1, 2, 3}, []int{1, 2, 3}, true},\n\t\t{[]string{\"hello\"}, []string{\"world\"}, true},\n\t\t{[]string{\"hello\", \"hello\"}, []string{\"world\", \"world\"}, true},\n\t\t{[3]string{\"hello\", \"hello\", \"hello\"}, [3]string{\"world\", \"world\", \"world\"}, true},\n\n\t\t// matching\n\t\t{nil, nil, false},\n\t\t{[]int{}, nil, false},\n\t\t{[]int{}, []int{}, false},\n\t\t{[]int{1}, []int{1}, false},\n\t\t{[]int{1, 1}, []int{1, 1}, false},\n\t\t{[]int{1, 2}, []int{2, 1}, false},\n\t\t{[2]int{1, 2}, [2]int{2, 1}, false},\n\t\t{[]int{1, 1, 2}, []int{1, 2, 1}, false},\n\t\t{[]string{\"hello\", \"world\"}, []string{\"world\", \"hello\"}, false},\n\t\t{[]string{\"hello\", \"hello\"}, []string{\"hello\", \"hello\"}, false},\n\t\t{[]string{\"hello\", \"hello\", \"world\"}, []string{\"hello\", \"world\", \"hello\"}, false},\n\t\t{[3]string{\"hello\", \"hello\", \"world\"}, [3]string{\"hello\", \"world\", \"hello\"}, false},\n\t}\n\n\tfor _, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"NotElementsMatch(%#v, %#v)\", c.expected, c.actual), func(t *testing.T) {\n\t\t\tres := NotElementsMatch(mockT, c.actual, c.expected)\n\n\t\t\tif res != c.result {\n\t\t\t\tt.Errorf(\"NotElementsMatch(%#v, %#v) should return %v\", c.actual, c.expected, c.result)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestCondition(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !Condition(mockT, func() bool { return true }, \"Truth\") {\n\t\tt.Error(\"Condition should return true\")\n\t}\n\n\tif Condition(mockT, func() bool { return false }, \"Lie\") {\n\t\tt.Error(\"Condition should return false\")\n\t}\n}\n\nfunc TestDidPanic(t *testing.T) {\n\tt.Parallel()\n\n\tconst panicMsg = \"Panic!\"\n\n\tif funcDidPanic, msg, _ := didPanic(func() {\n\t\tpanic(panicMsg)\n\t}); !funcDidPanic || msg != panicMsg {\n\t\tt.Error(\"didPanic should return true, panicMsg\")\n\t}\n\n\tif funcDidPanic, msg, _ := didPanic(func() {\n\t\tpanic(nil)\n\t}); !funcDidPanic || msg != nil {\n\t\tt.Error(\"didPanic should return true, nil\")\n\t}\n\n\tif funcDidPanic, _, _ := didPanic(func() {\n\t}); funcDidPanic {\n\t\tt.Error(\"didPanic should return false\")\n\t}\n}\n\nfunc TestPanics(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !Panics(mockT, func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"Panics should return true\")\n\t}\n\n\tif Panics(mockT, func() {\n\t}) {\n\t\tt.Error(\"Panics should return false\")\n\t}\n}\n\nfunc TestPanicsWithValue(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !PanicsWithValue(mockT, \"Panic!\", func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"PanicsWithValue should return true\")\n\t}\n\n\tif !PanicsWithValue(mockT, nil, func() {\n\t\tpanic(nil)\n\t}) {\n\t\tt.Error(\"PanicsWithValue should return true\")\n\t}\n\n\tif PanicsWithValue(mockT, \"Panic!\", func() {\n\t}) {\n\t\tt.Error(\"PanicsWithValue should return false\")\n\t}\n\n\tif PanicsWithValue(mockT, \"at the disco\", func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"PanicsWithValue should return false\")\n\t}\n}\n\nfunc TestPanicsWithError(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(captureTestingT)\n\tsucceeded := PanicsWithError(mockT, \"panic\", func() {\n\t\tpanic(errors.New(\"panic\"))\n\t})\n\tmockT.checkResultAndErrMsg(t, true, succeeded, \"\")\n\n\tsucceeded = PanicsWithError(mockT, \"Panic!\", func() {})\n\tEqual(t, false, succeeded, \"PanicsWithError should return false\")\n\tContains(t, mockT.msg, \"Panic value:\\t<nil>\")\n\n\tsucceeded = PanicsWithError(mockT, \"expected panic err msg\", func() {\n\t\tpanic(errors.New(\"actual panic err msg\"))\n\t})\n\tEqual(t, false, succeeded, \"PanicsWithError should return false\")\n\tContains(t, mockT.msg, `Error message:\t\"actual panic err msg\"`)\n\n\tsucceeded = PanicsWithError(mockT, \"expected panic err msg\", func() {\n\t\tpanic(&PanicsWithErrorWrapper{\"wrapped\", errors.New(\"actual panic err msg\")})\n\t})\n\tEqual(t, false, succeeded, \"PanicsWithError should return false\")\n\tContains(t, mockT.msg, `Error message:\t\"wrapped: actual panic err msg\"`)\n\n\tsucceeded = PanicsWithError(mockT, \"expected panic msg\", func() {\n\t\tpanic(\"actual panic msg\")\n\t})\n\tEqual(t, false, succeeded, \"PanicsWithError should return false\")\n\tContains(t, mockT.msg, `Panic value:\t\"actual panic msg\"`)\n\tNotContains(t, mockT.msg, \"Error message:\", \"PanicsWithError should not report error message if not due an error\")\n}\n\ntype PanicsWithErrorWrapper struct {\n\tPrefix string\n\tErr    error\n}\n\nfunc (e PanicsWithErrorWrapper) Error() string {\n\treturn e.Prefix + \": \" + e.Err.Error()\n}\n\nfunc TestNotPanics(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tif !NotPanics(mockT, func() {\n\t}) {\n\t\tt.Error(\"NotPanics should return true\")\n\t}\n\n\tif NotPanics(mockT, func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"NotPanics should return false\")\n\t}\n}\n\nfunc TestNoError(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\t// start with a nil error\n\tvar err error\n\n\tTrue(t, NoError(mockT, err), \"NoError should return True for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error\")\n\n\tFalse(t, NoError(mockT, err), \"NoError with error should return False\")\n\n\t// returning an empty error interface\n\terr = func() error {\n\t\tvar err *customError\n\t\treturn err\n\t}()\n\n\tif err == nil { // err is not nil here!\n\t\tt.Errorf(\"Error should be nil due to empty interface: %s\", err)\n\t}\n\n\tFalse(t, NoError(mockT, err), \"NoError should fail with empty error interface\")\n}\n\ntype customError struct{}\n\nfunc (*customError) Error() string { return \"fail\" }\n\nfunc TestError(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\t// start with a nil error\n\tvar err error\n\n\tFalse(t, Error(mockT, err), \"Error should return False for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error\")\n\n\tTrue(t, Error(mockT, err), \"Error with error should return True\")\n\n\t// go vet check\n\tTrue(t, Errorf(mockT, err, \"example with %s\", \"formatted message\"), \"Errorf with error should return True\")\n\n\t// returning an empty error interface\n\terr = func() error {\n\t\tvar err *customError\n\t\treturn err\n\t}()\n\n\tif err == nil { // err is not nil here!\n\t\tt.Errorf(\"Error should be nil due to empty interface: %s\", err)\n\t}\n\n\tTrue(t, Error(mockT, err), \"Error should pass with empty error interface\")\n}\n\nfunc TestEqualError(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\t// start with a nil error\n\tvar err error\n\tFalse(t, EqualError(mockT, err, \"\"),\n\t\t\"EqualError should return false for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error\")\n\tFalse(t, EqualError(mockT, err, \"Not some error\"),\n\t\t\"EqualError should return false for different error string\")\n\tTrue(t, EqualError(mockT, err, \"some error\"),\n\t\t\"EqualError should return true\")\n}\n\nfunc TestErrorContains(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\t// start with a nil error\n\tvar err error\n\tFalse(t, ErrorContains(mockT, err, \"\"),\n\t\t\"ErrorContains should return false for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error: another error\")\n\tFalse(t, ErrorContains(mockT, err, \"bad error\"),\n\t\t\"ErrorContains should return false for different error string\")\n\tTrue(t, ErrorContains(mockT, err, \"some error\"),\n\t\t\"ErrorContains should return true\")\n\tTrue(t, ErrorContains(mockT, err, \"another error\"),\n\t\t\"ErrorContains should return true\")\n}\n\nfunc Test_isEmpty(t *testing.T) {\n\tt.Parallel()\n\n\tchWithValue := make(chan struct{}, 1)\n\tchWithValue <- struct{}{}\n\n\tTrue(t, isEmpty(\"\"))\n\tTrue(t, isEmpty(nil))\n\tTrue(t, isEmpty(error(nil)))\n\tTrue(t, isEmpty((*int)(nil)))\n\tTrue(t, isEmpty((*string)(nil)))\n\tTrue(t, isEmpty(new(string)))\n\tTrue(t, isEmpty([]string{}))\n\tTrue(t, isEmpty([]string(nil)))\n\tTrue(t, isEmpty([]byte(nil)))\n\tTrue(t, isEmpty([]byte{}))\n\tTrue(t, isEmpty([]byte(\"\")))\n\tTrue(t, isEmpty([]bool(nil)))\n\tTrue(t, isEmpty([]bool{}))\n\tTrue(t, isEmpty([]interface{}(nil)))\n\tTrue(t, isEmpty([]interface{}{}))\n\tTrue(t, isEmpty(struct{}{}))\n\tTrue(t, isEmpty(&struct{}{}))\n\tTrue(t, isEmpty(struct{ A int }{A: 0}))\n\tTrue(t, isEmpty(struct{ a int }{a: 0}))\n\tTrue(t, isEmpty(struct {\n\t\ta int\n\t\tB int\n\t}{a: 0, B: 0}))\n\tTrue(t, isEmpty(0))\n\tTrue(t, isEmpty(int(0)))\n\tTrue(t, isEmpty(int8(0)))\n\tTrue(t, isEmpty(int16(0)))\n\tTrue(t, isEmpty(uint16(0)))\n\tTrue(t, isEmpty(int32(0)))\n\tTrue(t, isEmpty(uint32(0)))\n\tTrue(t, isEmpty(int64(0)))\n\tTrue(t, isEmpty(uint64(0)))\n\tTrue(t, isEmpty('\\u0000')) // rune => int32\n\tTrue(t, isEmpty(float32(0)))\n\tTrue(t, isEmpty(float64(0)))\n\tTrue(t, isEmpty(0i))   // complex\n\tTrue(t, isEmpty(0.0i)) // complex\n\tTrue(t, isEmpty(false))\n\tTrue(t, isEmpty(new(bool)))\n\tTrue(t, isEmpty(map[string]string{}))\n\tTrue(t, isEmpty(map[string]string(nil)))\n\tTrue(t, isEmpty(new(time.Time)))\n\tTrue(t, isEmpty(time.Time{}))\n\tTrue(t, isEmpty(make(chan struct{})))\n\tTrue(t, isEmpty(chan struct{}(nil)))\n\tTrue(t, isEmpty(chan<- struct{}(nil)))\n\tTrue(t, isEmpty(make(chan struct{})))\n\tTrue(t, isEmpty(make(chan<- struct{})))\n\tTrue(t, isEmpty(make(chan struct{}, 1)))\n\tTrue(t, isEmpty(make(chan<- struct{}, 1)))\n\tTrue(t, isEmpty([1]int{0}))\n\tTrue(t, isEmpty([2]int{0, 0}))\n\tTrue(t, isEmpty([8]int{}))\n\tTrue(t, isEmpty([...]int{7: 0}))\n\tTrue(t, isEmpty([...]bool{false, false}))\n\tTrue(t, isEmpty(errors.New(\"\"))) // BEWARE\n\tTrue(t, isEmpty([]error{}))\n\tTrue(t, isEmpty([]error(nil)))\n\tTrue(t, isEmpty(&[1]int{0}))\n\tTrue(t, isEmpty(&[2]int{0, 0}))\n\tFalse(t, isEmpty(\"something\"))\n\tFalse(t, isEmpty(errors.New(\"something\")))\n\tFalse(t, isEmpty([]string{\"something\"}))\n\tFalse(t, isEmpty(1))\n\tFalse(t, isEmpty(int(1)))\n\tFalse(t, isEmpty(uint(1)))\n\tFalse(t, isEmpty(byte(1)))\n\tFalse(t, isEmpty(int8(1)))\n\tFalse(t, isEmpty(uint8(1)))\n\tFalse(t, isEmpty(int16(1)))\n\tFalse(t, isEmpty(uint16(1)))\n\tFalse(t, isEmpty(int32(1)))\n\tFalse(t, isEmpty(uint32(1)))\n\tFalse(t, isEmpty(int64(1)))\n\tFalse(t, isEmpty(uint64(1)))\n\tFalse(t, isEmpty('A')) // rune => int32\n\tFalse(t, isEmpty(true))\n\tFalse(t, isEmpty(1.0))\n\tFalse(t, isEmpty(1i))            // complex\n\tFalse(t, isEmpty([]byte{0}))     // elements values are ignored for slices\n\tFalse(t, isEmpty([]byte{0, 0}))  // elements values are ignored for slices\n\tFalse(t, isEmpty([]string{\"\"}))  // elements values are ignored for slices\n\tFalse(t, isEmpty([]string{\"a\"})) // elements values are ignored for slices\n\tFalse(t, isEmpty([]bool{false})) // elements values are ignored for slices\n\tFalse(t, isEmpty([]bool{true}))  // elements values are ignored for slices\n\tFalse(t, isEmpty([]error{errors.New(\"xxx\")}))\n\tFalse(t, isEmpty([]error{nil}))            // BEWARE\n\tFalse(t, isEmpty([]error{errors.New(\"\")})) // BEWARE\n\tFalse(t, isEmpty(map[string]string{\"Hello\": \"World\"}))\n\tFalse(t, isEmpty(map[string]string{\"\": \"\"}))\n\tFalse(t, isEmpty(map[string]string{\"foo\": \"\"}))\n\tFalse(t, isEmpty(map[string]string{\"\": \"foo\"}))\n\tFalse(t, isEmpty(chWithValue))\n\tFalse(t, isEmpty([1]bool{true}))\n\tFalse(t, isEmpty([2]bool{false, true}))\n\tFalse(t, isEmpty([...]bool{10: true}))\n\tFalse(t, isEmpty([]int{0}))\n\tFalse(t, isEmpty([]int{42}))\n\tFalse(t, isEmpty([1]int{42}))\n\tFalse(t, isEmpty([2]int{0, 42}))\n\tFalse(t, isEmpty(&[1]int{42}))\n\tFalse(t, isEmpty(&[2]int{0, 42}))\n\tFalse(t, isEmpty([1]*int{new(int)})) // array elements must be the zero value, not any Empty value\n\tFalse(t, isEmpty(struct{ A int }{A: 42}))\n\tFalse(t, isEmpty(struct{ a int }{a: 42}))\n\tFalse(t, isEmpty(struct{ a *int }{a: new(int)})) // fields must be the zero value, not any Empty value\n\tFalse(t, isEmpty(struct{ a []int }{a: []int{}})) // fields must be the zero value, not any Empty value\n\tFalse(t, isEmpty(struct {\n\t\ta int\n\t\tB int\n\t}{a: 0, B: 42}))\n\tFalse(t, isEmpty(struct {\n\t\ta int\n\t\tB int\n\t}{a: 42, B: 0}))\n}\n\nfunc Benchmark_isEmpty(b *testing.B) {\n\tb.ReportAllocs()\n\n\tv := new(int)\n\tb.ResetTimer()\n\n\tfor i := 0; i < b.N; i++ {\n\t\tisEmpty(\"\")\n\t\tisEmpty(42)\n\t\tisEmpty(v)\n\t}\n}\n\nfunc TestEmpty(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tchWithValue := make(chan struct{}, 1)\n\tchWithValue <- struct{}{}\n\tvar tiP *time.Time\n\tvar tiNP time.Time\n\tvar s *string\n\tvar f *os.File\n\tsP := &s\n\tx := 1\n\txP := &x\n\n\ttype TString string\n\ttype TStruct struct {\n\t\tx int\n\t}\n\n\tTrue(t, Empty(mockT, \"\"), \"Empty string is empty\")\n\tTrue(t, Empty(mockT, nil), \"Nil is empty\")\n\tTrue(t, Empty(mockT, []string{}), \"Empty string array is empty\")\n\tTrue(t, Empty(mockT, 0), \"Zero int value is empty\")\n\tTrue(t, Empty(mockT, false), \"False value is empty\")\n\tTrue(t, Empty(mockT, make(chan struct{})), \"Channel without values is empty\")\n\tTrue(t, Empty(mockT, s), \"Nil string pointer is empty\")\n\tTrue(t, Empty(mockT, f), \"Nil os.File pointer is empty\")\n\tTrue(t, Empty(mockT, tiP), \"Nil time.Time pointer is empty\")\n\tTrue(t, Empty(mockT, tiNP), \"time.Time is empty\")\n\tTrue(t, Empty(mockT, TStruct{}), \"struct with zero values is empty\")\n\tTrue(t, Empty(mockT, TString(\"\")), \"empty aliased string is empty\")\n\tTrue(t, Empty(mockT, sP), \"ptr to nil value is empty\")\n\tTrue(t, Empty(mockT, [1]int{}), \"array is state\")\n\n\tFalse(t, Empty(mockT, \"something\"), \"Non Empty string is not empty\")\n\tFalse(t, Empty(mockT, errors.New(\"something\")), \"Non nil object is not empty\")\n\tFalse(t, Empty(mockT, []string{\"something\"}), \"Non empty string array is not empty\")\n\tFalse(t, Empty(mockT, 1), \"Non-zero int value is not empty\")\n\tFalse(t, Empty(mockT, true), \"True value is not empty\")\n\tFalse(t, Empty(mockT, chWithValue), \"Channel with values is not empty\")\n\tFalse(t, Empty(mockT, TStruct{x: 1}), \"struct with initialized values is empty\")\n\tFalse(t, Empty(mockT, TString(\"abc\")), \"non-empty aliased string is empty\")\n\tFalse(t, Empty(mockT, xP), \"ptr to non-nil value is not empty\")\n\tFalse(t, Empty(mockT, [1]int{42}), \"array is not state\")\n\n\t// error messages validation\n\ttests := []struct {\n\t\tname           string\n\t\tvalue          interface{}\n\t\texpectedResult bool\n\t\texpectedErrMsg string\n\t}{\n\t\t{\n\t\t\tname:           \"Non Empty string is not empty\",\n\t\t\tvalue:          \"something\",\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should be empty, but was something\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"Non nil object is not empty\",\n\t\t\tvalue:          errors.New(\"something\"),\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should be empty, but was something\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"Non empty string array is not empty\",\n\t\t\tvalue:          []string{\"something\"},\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should be empty, but was [something]\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"Non-zero int value is not empty\",\n\t\t\tvalue:          1,\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should be empty, but was 1\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"True value is not empty\",\n\t\t\tvalue:          true,\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should be empty, but was true\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"Channel with values is not empty\",\n\t\t\tvalue:          chWithValue,\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: fmt.Sprintf(\"Should be empty, but was %v\\n\", chWithValue),\n\t\t},\n\t\t{\n\t\t\tname:           \"struct with initialized values is empty\",\n\t\t\tvalue:          TStruct{x: 1},\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should be empty, but was {1}\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"non-empty aliased string is empty\",\n\t\t\tvalue:          TString(\"abc\"),\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should be empty, but was abc\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"ptr to non-nil value is not empty\",\n\t\t\tvalue:          xP,\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: fmt.Sprintf(\"Should be empty, but was %p\\n\", xP),\n\t\t},\n\t\t{\n\t\t\tname:           \"array is not state\",\n\t\t\tvalue:          [1]int{42},\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should be empty, but was [42]\\n\",\n\t\t},\n\n\t\t// Here are some edge cases\n\t\t{\n\t\t\tname:           \"string with only spaces is not empty\",\n\t\t\tvalue:          \"   \",\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should be empty, but was    \\n\", // TODO FIX THIS strange error message\n\t\t},\n\t\t{\n\t\t\tname:           \"string with a line feed is not empty\",\n\t\t\tvalue:          \"\\n\",\n\t\t\texpectedResult: false,\n\t\t\t// TODO This is the exact same error message as for an empty string\n\t\t\texpectedErrMsg: \"Should be empty, but was \\n\", // TODO FIX THIS strange error message\n\t\t},\n\t\t{\n\t\t\tname:           \"string with only tabulation and lines feed is not empty\",\n\t\t\tvalue:          \"\\n\\t\\n\",\n\t\t\texpectedResult: false,\n\t\t\t// TODO The line feeds and tab are not helping to spot what is expected\n\t\t\texpectedErrMsg: \"\" + // this syntax is used to show how errors are reported.\n\t\t\t\t\"Should be empty, but was \\n\" +\n\t\t\t\t\"\\t\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"string with trailing lines feed is not empty\",\n\t\t\tvalue:          \"foo\\n\\n\",\n\t\t\texpectedResult: false,\n\t\t\t// TODO it's not clear if one or two lines feed are expected\n\t\t\texpectedErrMsg: \"Should be empty, but was foo\\n\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"string with leading and trailing tabulation and lines feed is not empty\",\n\t\t\tvalue:          \"\\n\\nfoo\\t\\n\\t\\n\",\n\t\t\texpectedResult: false,\n\t\t\t// TODO The line feeds and tab are not helping to figure what is expected\n\t\t\texpectedErrMsg: \"\" +\n\t\t\t\t\"Should be empty, but was \\n\" +\n\t\t\t\t\"\\n\" +\n\t\t\t\t\"foo\\t\\n\" +\n\t\t\t\t\"\\t\\n\",\n\t\t},\n\n\t\t{\n\t\t\tname:           \"non-printable character is not empty\",\n\t\t\tvalue:          \"\\u00a0\", // NO-BREAK SPACE UNICODE CHARACTER\n\t\t\texpectedResult: false,\n\t\t\t// TODO here you cannot figure out what is expected\n\t\t\texpectedErrMsg: \"Should be empty, but was \\u00a0\\n\",\n\t\t},\n\n\t\t// Here we are testing there is no error message on success\n\t\t{\n\t\t\tname:           \"Empty string is empty\",\n\t\t\tvalue:          \"\",\n\t\t\texpectedResult: true,\n\t\t\texpectedErrMsg: \"\",\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\ttt := tt\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tmockCT := new(captureTestingT)\n\t\t\tres := Empty(mockCT, tt.value)\n\t\t\tmockCT.checkResultAndErrMsg(t, res, tt.expectedResult, tt.expectedErrMsg)\n\t\t})\n\t}\n}\n\nfunc TestNotEmpty(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tchWithValue := make(chan struct{}, 1)\n\tchWithValue <- struct{}{}\n\n\tFalse(t, NotEmpty(mockT, \"\"), \"Empty string is empty\")\n\tFalse(t, NotEmpty(mockT, nil), \"Nil is empty\")\n\tFalse(t, NotEmpty(mockT, []string{}), \"Empty string array is empty\")\n\tFalse(t, NotEmpty(mockT, 0), \"Zero int value is empty\")\n\tFalse(t, NotEmpty(mockT, false), \"False value is empty\")\n\tFalse(t, NotEmpty(mockT, make(chan struct{})), \"Channel without values is empty\")\n\tFalse(t, NotEmpty(mockT, [1]int{}), \"array is state\")\n\n\tTrue(t, NotEmpty(mockT, \"something\"), \"Non Empty string is not empty\")\n\tTrue(t, NotEmpty(mockT, errors.New(\"something\")), \"Non nil object is not empty\")\n\tTrue(t, NotEmpty(mockT, []string{\"something\"}), \"Non empty string array is not empty\")\n\tTrue(t, NotEmpty(mockT, 1), \"Non-zero int value is not empty\")\n\tTrue(t, NotEmpty(mockT, true), \"True value is not empty\")\n\tTrue(t, NotEmpty(mockT, chWithValue), \"Channel with values is not empty\")\n\tTrue(t, NotEmpty(mockT, [1]int{42}), \"array is not state\")\n\n\t// error messages validation\n\ttests := []struct {\n\t\tname           string\n\t\tvalue          interface{}\n\t\texpectedResult bool\n\t\texpectedErrMsg string\n\t}{\n\t\t{\n\t\t\tname:           \"Empty string is empty\",\n\t\t\tvalue:          \"\",\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: `Should NOT be empty, but was ` + \"\\n\", // TODO FIX THIS strange error message\n\t\t},\n\t\t{\n\t\t\tname:           \"Nil is empty\",\n\t\t\tvalue:          nil,\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should NOT be empty, but was <nil>\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"Empty string array is empty\",\n\t\t\tvalue:          []string{},\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should NOT be empty, but was []\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"Zero int value is empty\",\n\t\t\tvalue:          0,\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should NOT be empty, but was 0\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"False value is empty\",\n\t\t\tvalue:          false,\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should NOT be empty, but was false\\n\",\n\t\t},\n\t\t{\n\t\t\tname:           \"array is state\",\n\t\t\tvalue:          [1]int{},\n\t\t\texpectedResult: false,\n\t\t\texpectedErrMsg: \"Should NOT be empty, but was [0]\\n\",\n\t\t},\n\n\t\t// Here we are testing there is no error message on success\n\t\t{\n\t\t\tname:           \"Non Empty string is not empty\",\n\t\t\tvalue:          \"something\",\n\t\t\texpectedResult: true,\n\t\t\texpectedErrMsg: \"\",\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\ttt := tt\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tmockCT := new(captureTestingT)\n\t\t\tres := NotEmpty(mockCT, tt.value)\n\t\t\tmockCT.checkResultAndErrMsg(t, tt.expectedResult, res, tt.expectedErrMsg)\n\t\t})\n\t}\n}\n\nfunc Test_getLen(t *testing.T) {\n\tt.Parallel()\n\n\tfalseCases := []interface{}{\n\t\tnil,\n\t\t0,\n\t\ttrue,\n\t\tfalse,\n\t\t'A',\n\t\tstruct{}{},\n\t}\n\tfor _, v := range falseCases {\n\t\tl, ok := getLen(v)\n\t\tFalse(t, ok, \"Expected getLen fail to get length of %#v\", v)\n\t\tEqual(t, 0, l, \"getLen should return 0 for %#v\", v)\n\t}\n\n\tch := make(chan int, 5)\n\tch <- 1\n\tch <- 2\n\tch <- 3\n\ttrueCases := []struct {\n\t\tv interface{}\n\t\tl int\n\t}{\n\t\t{[]int{1, 2, 3}, 3},\n\t\t{[...]int{1, 2, 3}, 3},\n\t\t{\"ABC\", 3},\n\t\t{map[int]int{1: 2, 2: 4, 3: 6}, 3},\n\t\t{ch, 3},\n\n\t\t{[]int{}, 0},\n\t\t{map[int]int{}, 0},\n\t\t{make(chan int), 0},\n\n\t\t{[]int(nil), 0},\n\t\t{map[int]int(nil), 0},\n\t\t{(chan int)(nil), 0},\n\t}\n\n\tfor _, c := range trueCases {\n\t\tl, ok := getLen(c.v)\n\t\tTrue(t, ok, \"Expected getLen success to get length of %#v\", c.v)\n\t\tEqual(t, c.l, l)\n\t}\n}\n\nfunc TestLen(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tFalse(t, Len(mockT, nil, 0), \"nil does not have length\")\n\tFalse(t, Len(mockT, 0, 0), \"int does not have length\")\n\tFalse(t, Len(mockT, true, 0), \"true does not have length\")\n\tFalse(t, Len(mockT, false, 0), \"false does not have length\")\n\tFalse(t, Len(mockT, 'A', 0), \"Rune does not have length\")\n\tFalse(t, Len(mockT, struct{}{}, 0), \"Struct does not have length\")\n\n\tch := make(chan int, 5)\n\tch <- 1\n\tch <- 2\n\tch <- 3\n\n\tcases := []struct {\n\t\tv               interface{}\n\t\tl               int\n\t\texpected1234567 string // message when expecting 1234567 items\n\t}{\n\t\t{[]int{1, 2, 3}, 3, `\"[1 2 3]\" should have 1234567 item(s), but has 3`},\n\t\t{[...]int{1, 2, 3}, 3, `\"[1 2 3]\" should have 1234567 item(s), but has 3`},\n\t\t{\"ABC\", 3, `\"ABC\" should have 1234567 item(s), but has 3`},\n\t\t{map[int]int{1: 2, 2: 4, 3: 6}, 3, `\"map[1:2 2:4 3:6]\" should have 1234567 item(s), but has 3`},\n\t\t{ch, 3, \"\"},\n\n\t\t{[]int{}, 0, `\"[]\" should have 1234567 item(s), but has 0`},\n\t\t{map[int]int{}, 0, `\"map[]\" should have 1234567 item(s), but has 0`},\n\t\t{make(chan int), 0, \"\"},\n\n\t\t{[]int(nil), 0, `\"[]\" should have 1234567 item(s), but has 0`},\n\t\t{map[int]int(nil), 0, `\"map[]\" should have 1234567 item(s), but has 0`},\n\t\t{(chan int)(nil), 0, `\"<nil>\" should have 1234567 item(s), but has 0`},\n\t}\n\n\tfor _, c := range cases {\n\t\tTrue(t, Len(mockT, c.v, c.l), \"%#v have %d items\", c.v, c.l)\n\t\tFalse(t, Len(mockT, c.v, c.l+1), \"%#v have %d items\", c.v, c.l)\n\t\tif c.expected1234567 != \"\" {\n\t\t\tmsgMock := new(mockTestingT)\n\t\t\tLen(msgMock, c.v, 1234567)\n\t\t\tContains(t, msgMock.errorString(), c.expected1234567)\n\t\t}\n\t}\n}\n\nfunc TestWithinDuration(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\ta := time.Now()\n\tb := a.Add(10 * time.Second)\n\n\tTrue(t, WithinDuration(mockT, a, b, 10*time.Second), \"A 10s difference is within a 10s time difference\")\n\tTrue(t, WithinDuration(mockT, b, a, 10*time.Second), \"A 10s difference is within a 10s time difference\")\n\n\tFalse(t, WithinDuration(mockT, a, b, 9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tFalse(t, WithinDuration(mockT, b, a, 9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\n\tFalse(t, WithinDuration(mockT, a, b, -9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tFalse(t, WithinDuration(mockT, b, a, -9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\n\tFalse(t, WithinDuration(mockT, a, b, -11*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tFalse(t, WithinDuration(mockT, b, a, -11*time.Second), \"A 10s difference is not within a 9s time difference\")\n}\n\nfunc TestWithinRange(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tn := time.Now()\n\ts := n.Add(-time.Second)\n\te := n.Add(time.Second)\n\n\tTrue(t, WithinRange(mockT, n, n, n), \"Exact same actual, start, and end values return true\")\n\n\tTrue(t, WithinRange(mockT, n, s, e), \"Time in range is within the time range\")\n\tTrue(t, WithinRange(mockT, s, s, e), \"The start time is within the time range\")\n\tTrue(t, WithinRange(mockT, e, s, e), \"The end time is within the time range\")\n\n\tFalse(t, WithinRange(mockT, s.Add(-time.Nanosecond), s, e, \"Just before the start time is not within the time range\"))\n\tFalse(t, WithinRange(mockT, e.Add(time.Nanosecond), s, e, \"Just after the end time is not within the time range\"))\n\n\tFalse(t, WithinRange(mockT, n, e, s, \"Just after the end time is not within the time range\"))\n}\n\nfunc TestInDelta(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tTrue(t, InDelta(mockT, 1.001, 1, 0.01), \"|1.001 - 1| <= 0.01\")\n\tTrue(t, InDelta(mockT, 1, 1.001, 0.01), \"|1 - 1.001| <= 0.01\")\n\tTrue(t, InDelta(mockT, 1, 2, 1), \"|1 - 2| <= 1\")\n\tFalse(t, InDelta(mockT, 1, 2, 0.5), \"Expected |1 - 2| <= 0.5 to fail\")\n\tFalse(t, InDelta(mockT, 2, 1, 0.5), \"Expected |2 - 1| <= 0.5 to fail\")\n\tFalse(t, InDelta(mockT, \"\", nil, 1), \"Expected non numerals to fail\")\n\tFalse(t, InDelta(mockT, 42, math.NaN(), 0.01), \"Expected NaN for actual to fail\")\n\tFalse(t, InDelta(mockT, math.NaN(), 42, 0.01), \"Expected NaN for expected to fail\")\n\tTrue(t, InDelta(mockT, math.NaN(), math.NaN(), 0.01), \"Expected NaN for both to pass\")\n\n\tcases := []struct {\n\t\ta, b  interface{}\n\t\tdelta float64\n\t}{\n\t\t{uint(2), uint(1), 1},\n\t\t{uint8(2), uint8(1), 1},\n\t\t{uint16(2), uint16(1), 1},\n\t\t{uint32(2), uint32(1), 1},\n\t\t{uint64(2), uint64(1), 1},\n\n\t\t{int(2), int(1), 1},\n\t\t{int8(2), int8(1), 1},\n\t\t{int16(2), int16(1), 1},\n\t\t{int32(2), int32(1), 1},\n\t\t{int64(2), int64(1), 1},\n\n\t\t{float32(2), float32(1), 1},\n\t\t{float64(2), float64(1), 1},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, InDelta(mockT, tc.a, tc.b, tc.delta), \"Expected |%V - %V| <= %v\", tc.a, tc.b, tc.delta)\n\t}\n}\n\nfunc TestInDeltaSlice(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tTrue(t, InDeltaSlice(mockT,\n\t\t[]float64{1.001, math.NaN(), 0.999},\n\t\t[]float64{1, math.NaN(), 1},\n\t\t0.1), \"{1.001, NaN, 0.009} is element-wise close to {1, NaN, 1} in delta=0.1\")\n\n\tTrue(t, InDeltaSlice(mockT,\n\t\t[]float64{1, math.NaN(), 2},\n\t\t[]float64{0, math.NaN(), 3},\n\t\t1), \"{1, NaN, 2} is element-wise close to {0, NaN, 3} in delta=1\")\n\n\tFalse(t, InDeltaSlice(mockT,\n\t\t[]float64{1, math.NaN(), 2},\n\t\t[]float64{0, math.NaN(), 3},\n\t\t0.1), \"{1, NaN, 2} is not element-wise close to {0, NaN, 3} in delta=0.1\")\n\n\tFalse(t, InDeltaSlice(mockT, \"\", nil, 1), \"Expected non numeral slices to fail\")\n}\n\nfunc TestInDeltaMapValues(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tfor _, tc := range []struct {\n\t\ttitle  string\n\t\texpect interface{}\n\t\tactual interface{}\n\t\tf      func(TestingT, bool, ...interface{}) bool\n\t\tdelta  float64\n\t}{\n\t\t{\n\t\t\ttitle: \"Within delta\",\n\t\t\texpect: map[string]float64{\n\t\t\t\t\"foo\": 1.0,\n\t\t\t\t\"bar\": 2.0,\n\t\t\t\t\"baz\": math.NaN(),\n\t\t\t},\n\t\t\tactual: map[string]float64{\n\t\t\t\t\"foo\": 1.01,\n\t\t\t\t\"bar\": 1.99,\n\t\t\t\t\"baz\": math.NaN(),\n\t\t\t},\n\t\t\tdelta: 0.1,\n\t\t\tf:     True,\n\t\t},\n\t\t{\n\t\t\ttitle: \"Within delta\",\n\t\t\texpect: map[int]float64{\n\t\t\t\t1: 1.0,\n\t\t\t\t2: 2.0,\n\t\t\t},\n\t\t\tactual: map[int]float64{\n\t\t\t\t1: 1.0,\n\t\t\t\t2: 1.99,\n\t\t\t},\n\t\t\tdelta: 0.1,\n\t\t\tf:     True,\n\t\t},\n\t\t{\n\t\t\ttitle: \"Different number of keys\",\n\t\t\texpect: map[int]float64{\n\t\t\t\t1: 1.0,\n\t\t\t\t2: 2.0,\n\t\t\t},\n\t\t\tactual: map[int]float64{\n\t\t\t\t1: 1.0,\n\t\t\t},\n\t\t\tdelta: 0.1,\n\t\t\tf:     False,\n\t\t},\n\t\t{\n\t\t\ttitle: \"Within delta with zero value\",\n\t\t\texpect: map[string]float64{\n\t\t\t\t\"zero\": 0,\n\t\t\t},\n\t\t\tactual: map[string]float64{\n\t\t\t\t\"zero\": 0,\n\t\t\t},\n\t\t\tdelta: 0.1,\n\t\t\tf:     True,\n\t\t},\n\t\t{\n\t\t\ttitle: \"With missing key with zero value\",\n\t\t\texpect: map[string]float64{\n\t\t\t\t\"zero\": 0,\n\t\t\t\t\"foo\":  0,\n\t\t\t},\n\t\t\tactual: map[string]float64{\n\t\t\t\t\"zero\": 0,\n\t\t\t\t\"bar\":  0,\n\t\t\t},\n\t\t\tf: False,\n\t\t},\n\t} {\n\t\ttc.f(t, InDeltaMapValues(mockT, tc.expect, tc.actual, tc.delta), tc.title+\"\\n\"+diff(tc.expect, tc.actual))\n\t}\n}\n\nfunc TestInEpsilon(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tcases := []struct {\n\t\ta, b    interface{}\n\t\tepsilon float64\n\t}{\n\t\t{uint8(2), uint16(2), .001},\n\t\t{2.1, 2.2, 0.1},\n\t\t{2.2, 2.1, 0.1},\n\t\t{-2.1, -2.2, 0.1},\n\t\t{-2.2, -2.1, 0.1},\n\t\t{uint64(100), uint8(101), 0.01},\n\t\t{0.1, -0.1, 2},\n\t\t{0.1, 0, 2},\n\t\t{math.NaN(), math.NaN(), 1},\n\t\t{time.Second, time.Second + time.Millisecond, 0.002},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, InEpsilon(t, tc.a, tc.b, tc.epsilon, \"Expected %V and %V to have a relative difference of %v\", tc.a, tc.b, tc.epsilon), \"test: %q\", tc)\n\t}\n\n\tcases = []struct {\n\t\ta, b    interface{}\n\t\tepsilon float64\n\t}{\n\t\t{uint8(2), int16(-2), .001},\n\t\t{uint64(100), uint8(102), 0.01},\n\t\t{2.1, 2.2, 0.001},\n\t\t{2.2, 2.1, 0.001},\n\t\t{2.1, -2.2, 1},\n\t\t{2.1, \"bla-bla\", 0},\n\t\t{0.1, -0.1, 1.99},\n\t\t{0, 0.1, 2}, // expected must be different to zero\n\t\t{time.Second, time.Second + 10*time.Millisecond, 0.002},\n\t\t{math.NaN(), 0, 1},\n\t\t{0, math.NaN(), 1},\n\t\t{0, 0, math.NaN()},\n\t\t{math.Inf(1), 1, 1},\n\t\t{math.Inf(-1), 1, 1},\n\t\t{1, math.Inf(1), 1},\n\t\t{1, math.Inf(-1), 1},\n\t\t{math.Inf(1), math.Inf(1), 1},\n\t\t{math.Inf(1), math.Inf(-1), 1},\n\t\t{math.Inf(-1), math.Inf(1), 1},\n\t\t{math.Inf(-1), math.Inf(-1), 1},\n\t}\n\n\tfor _, tc := range cases {\n\t\tFalse(t, InEpsilon(mockT, tc.a, tc.b, tc.epsilon, \"Expected %V and %V to have a relative difference of %v\", tc.a, tc.b, tc.epsilon))\n\t}\n}\n\nfunc TestInEpsilonSlice(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tTrue(t, InEpsilonSlice(mockT,\n\t\t[]float64{2.2, math.NaN(), 2.0},\n\t\t[]float64{2.1, math.NaN(), 2.1},\n\t\t0.06), \"{2.2, NaN, 2.0} is element-wise close to {2.1, NaN, 2.1} in epsilon=0.06\")\n\n\tFalse(t, InEpsilonSlice(mockT,\n\t\t[]float64{2.2, 2.0},\n\t\t[]float64{2.1, 2.1},\n\t\t0.04), \"{2.2, 2.0} is not element-wise close to {2.1, 2.1} in epsilon=0.04\")\n\n\tFalse(t, InEpsilonSlice(mockT, \"\", nil, 1), \"Expected non numeral slices to fail\")\n}\n\nfunc TestRegexp(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tcases := []struct {\n\t\trx, str string\n\t}{\n\t\t{\"^start\", \"start of the line\"},\n\t\t{\"end$\", \"in the end\"},\n\t\t{\"end$\", \"in the end\"},\n\t\t{\"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}\", \"My phone number is 650.12.34\"},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, Regexp(mockT, tc.rx, tc.str))\n\t\tTrue(t, Regexp(mockT, regexp.MustCompile(tc.rx), tc.str))\n\t\tTrue(t, Regexp(mockT, regexp.MustCompile(tc.rx), []byte(tc.str)))\n\t\tFalse(t, NotRegexp(mockT, tc.rx, tc.str))\n\t\tFalse(t, NotRegexp(mockT, tc.rx, []byte(tc.str)))\n\t\tFalse(t, NotRegexp(mockT, regexp.MustCompile(tc.rx), tc.str))\n\t}\n\n\tcases = []struct {\n\t\trx, str string\n\t}{\n\t\t{\"^asdfastart\", \"Not the start of the line\"},\n\t\t{\"end$\", \"in the end.\"},\n\t\t{\"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}\", \"My phone number is 650.12a.34\"},\n\t}\n\n\tfor _, tc := range cases {\n\t\tFalse(t, Regexp(mockT, tc.rx, tc.str), \"Expected %q to not match %q\", tc.rx, tc.str)\n\t\tFalse(t, Regexp(mockT, regexp.MustCompile(tc.rx), tc.str))\n\t\tFalse(t, Regexp(mockT, regexp.MustCompile(tc.rx), []byte(tc.str)))\n\t\tTrue(t, NotRegexp(mockT, tc.rx, tc.str))\n\t\tTrue(t, NotRegexp(mockT, tc.rx, []byte(tc.str)))\n\t\tTrue(t, NotRegexp(mockT, regexp.MustCompile(tc.rx), tc.str))\n\t}\n}\n\nfunc testAutogeneratedFunction() {\n\tdefer func() {\n\t\tif err := recover(); err == nil {\n\t\t\tpanic(\"did not panic\")\n\t\t}\n\t\tCallerInfo()\n\t}()\n\tt := struct {\n\t\tio.Closer\n\t}{}\n\tc := t\n\tc.Close()\n}\n\nfunc TestCallerInfoWithAutogeneratedFunctions(t *testing.T) {\n\tt.Parallel()\n\n\tNotPanics(t, func() {\n\t\ttestAutogeneratedFunction()\n\t})\n}\n\nfunc TestZero(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tfor _, test := range zeros {\n\t\tTrue(t, Zero(mockT, test, \"%#v is not the %T zero value\", test, test))\n\t}\n\n\tfor _, test := range nonZeros {\n\t\tFalse(t, Zero(mockT, test, \"%#v is not the %T zero value\", test, test))\n\t}\n}\n\nfunc TestNotZero(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tfor _, test := range zeros {\n\t\tFalse(t, NotZero(mockT, test, \"%#v is not the %T zero value\", test, test))\n\t}\n\n\tfor _, test := range nonZeros {\n\t\tTrue(t, NotZero(mockT, test, \"%#v is not the %T zero value\", test, test))\n\t}\n}\n\nfunc TestFileExists(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, FileExists(mockT, \"assertions.go\"))\n\n\tmockT = new(testing.T)\n\tFalse(t, FileExists(mockT, \"random_file\"))\n\n\tmockT = new(testing.T)\n\tFalse(t, FileExists(mockT, \"../_codegen\"))\n\n\tlink := getTempSymlinkPath(t, \"assertions.go\")\n\tmockT = new(testing.T)\n\tTrue(t, FileExists(mockT, link))\n\n\tlink = getTempSymlinkPath(t, \"non_existent_file\")\n\tmockT = new(testing.T)\n\tTrue(t, FileExists(mockT, link))\n}\n\nfunc TestNoFileExists(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, NoFileExists(mockT, \"assertions.go\"))\n\n\tmockT = new(testing.T)\n\tTrue(t, NoFileExists(mockT, \"non_existent_file\"))\n\n\tmockT = new(testing.T)\n\tTrue(t, NoFileExists(mockT, \"../_codegen\"))\n\n\tlink := getTempSymlinkPath(t, \"assertions.go\")\n\tmockT = new(testing.T)\n\tFalse(t, NoFileExists(mockT, link))\n\n\tlink = getTempSymlinkPath(t, \"non_existent_file\")\n\tmockT = new(testing.T)\n\tFalse(t, NoFileExists(mockT, link))\n}\n\nfunc getTempSymlinkPath(t *testing.T, file string) string {\n\tt.Helper()\n\n\ttempDir := t.TempDir()\n\tlink := filepath.Join(tempDir, file+\"_symlink\")\n\tif err := os.Symlink(file, link); err != nil {\n\t\tt.Fatalf(\"could not create temp symlink %q pointing to %q: %v\", link, file, err)\n\t}\n\treturn link\n}\n\nfunc TestDirExists(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, DirExists(mockT, \"assertions.go\"))\n\n\tmockT = new(testing.T)\n\tFalse(t, DirExists(mockT, \"non_existent_dir\"))\n\n\tmockT = new(testing.T)\n\tTrue(t, DirExists(mockT, \"../_codegen\"))\n\n\tlink := getTempSymlinkPath(t, \"assertions.go\")\n\tmockT = new(testing.T)\n\tFalse(t, DirExists(mockT, link))\n\n\tlink = getTempSymlinkPath(t, \"non_existent_dir\")\n\tmockT = new(testing.T)\n\tFalse(t, DirExists(mockT, link))\n}\n\nfunc TestNoDirExists(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, NoDirExists(mockT, \"assertions.go\"))\n\n\tmockT = new(testing.T)\n\tTrue(t, NoDirExists(mockT, \"non_existent_dir\"))\n\n\tmockT = new(testing.T)\n\tFalse(t, NoDirExists(mockT, \"../_codegen\"))\n\n\tlink := getTempSymlinkPath(t, \"assertions.go\")\n\tmockT = new(testing.T)\n\tTrue(t, NoDirExists(mockT, link))\n\n\tlink = getTempSymlinkPath(t, \"non_existent_dir\")\n\tmockT = new(testing.T)\n\tTrue(t, NoDirExists(mockT, link))\n}\n\nfunc TestJSONEq_EqualSONString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, JSONEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`))\n}\n\nfunc TestJSONEq_EquivalentButNotEqual(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, JSONEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`))\n}\n\nfunc TestJSONEq_HashOfArraysAndHashes(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, JSONEq(mockT, \"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]],\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\"\\r\\n}\",\n\t\t\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\",\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]]\\r\\n}\"))\n}\n\nfunc TestJSONEq_Array(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, JSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`))\n}\n\nfunc TestJSONEq_HashAndArrayNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`))\n}\n\nfunc TestJSONEq_HashesNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, `{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`))\n}\n\nfunc TestJSONEq_ActualIsNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, `{\"foo\": \"bar\"}`, \"Not JSON\"))\n}\n\nfunc TestJSONEq_ExpectedIsNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, \"Not JSON\", `{\"foo\": \"bar\", \"hello\": \"world\"}`))\n}\n\nfunc TestJSONEq_ExpectedAndActualNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, \"Not JSON\", \"Not JSON\"))\n}\n\nfunc TestJSONEq_ArraysOfDifferentOrder(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`))\n}\n\nfunc TestYAMLEq_EqualYAMLString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, YAMLEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`))\n}\n\nfunc TestYAMLEq_EquivalentButNotEqual(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, YAMLEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`))\n}\n\nfunc TestYAMLEq_HashOfArraysAndHashes(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\texpected := `\nnumeric: 1.5\narray:\n  - foo: bar\n  - 1\n  - \"string\"\n  - [\"nested\", \"array\", 5.5]\nhash:\n  nested: hash\n  nested_slice: [this, is, nested]\nstring: \"foo\"\n`\n\n\tactual := `\nnumeric: 1.5\nhash:\n  nested: hash\n  nested_slice: [this, is, nested]\nstring: \"foo\"\narray:\n  - foo: bar\n  - 1\n  - \"string\"\n  - [\"nested\", \"array\", 5.5]\n`\n\tTrue(t, YAMLEq(mockT, expected, actual))\n}\n\nfunc TestYAMLEq_Array(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, YAMLEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`))\n}\n\nfunc TestYAMLEq_HashAndArrayNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, YAMLEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`))\n}\n\nfunc TestYAMLEq_HashesNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, YAMLEq(mockT, `{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`))\n}\n\nfunc TestYAMLEq_ActualIsSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, YAMLEq(mockT, `{\"foo\": \"bar\"}`, \"Simple String\"))\n}\n\nfunc TestYAMLEq_ExpectedIsSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, YAMLEq(mockT, \"Simple String\", `{\"foo\": \"bar\", \"hello\": \"world\"}`))\n}\n\nfunc TestYAMLEq_ExpectedAndActualSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, YAMLEq(mockT, \"Simple String\", \"Simple String\"))\n}\n\nfunc TestYAMLEq_ArraysOfDifferentOrder(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, YAMLEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`))\n}\n\nfunc TestYAMLEq_OnlyFirstDocument(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tTrue(t, YAMLEq(mockT,\n\t\t`---\ndoc1: same\n---\ndoc2: different\n`,\n\t\t`---\ndoc1: same\n---\ndoc2: notsame\n`,\n\t))\n}\n\nfunc TestYAMLEq_InvalidIdenticalYAML(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\tFalse(t, YAMLEq(mockT, `}`, `}`))\n}\n\ntype diffTestingStruct struct {\n\tA string\n\tB int\n}\n\nfunc (d *diffTestingStruct) String() string {\n\treturn d.A\n}\n\nfunc TestDiff(t *testing.T) {\n\tt.Parallel()\n\n\texpected := `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -1,3 +1,3 @@\n (struct { foo string }) {\n- foo: (string) (len=5) \"hello\"\n+ foo: (string) (len=3) \"bar\"\n }\n`\n\tactual := diff(\n\t\tstruct{ foo string }{\"hello\"},\n\t\tstruct{ foo string }{\"bar\"},\n\t)\n\tEqual(t, expected, actual)\n\n\texpected = `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -2,5 +2,5 @@\n  (int) 1,\n- (int) 2,\n  (int) 3,\n- (int) 4\n+ (int) 5,\n+ (int) 7\n }\n`\n\tactual = diff(\n\t\t[]int{1, 2, 3, 4},\n\t\t[]int{1, 3, 5, 7},\n\t)\n\tEqual(t, expected, actual)\n\n\texpected = `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -2,4 +2,4 @@\n  (int) 1,\n- (int) 2,\n- (int) 3\n+ (int) 3,\n+ (int) 5\n }\n`\n\tactual = diff(\n\t\t[]int{1, 2, 3, 4}[0:3],\n\t\t[]int{1, 3, 5, 7}[0:3],\n\t)\n\tEqual(t, expected, actual)\n\n\texpected = `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -1,6 +1,6 @@\n (map[string]int) (len=4) {\n- (string) (len=4) \"four\": (int) 4,\n+ (string) (len=4) \"five\": (int) 5,\n  (string) (len=3) \"one\": (int) 1,\n- (string) (len=5) \"three\": (int) 3,\n- (string) (len=3) \"two\": (int) 2\n+ (string) (len=5) \"seven\": (int) 7,\n+ (string) (len=5) \"three\": (int) 3\n }\n`\n\n\tactual = diff(\n\t\tmap[string]int{\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4},\n\t\tmap[string]int{\"one\": 1, \"three\": 3, \"five\": 5, \"seven\": 7},\n\t)\n\tEqual(t, expected, actual)\n\n\texpected = `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -1,3 +1,3 @@\n (*errors.errorString)({\n- s: (string) (len=19) \"some expected error\"\n+ s: (string) (len=12) \"actual error\"\n })\n`\n\n\tactual = diff(\n\t\terrors.New(\"some expected error\"),\n\t\terrors.New(\"actual error\"),\n\t)\n\tEqual(t, expected, actual)\n\n\texpected = `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -2,3 +2,3 @@\n  A: (string) (len=11) \"some string\",\n- B: (int) 10\n+ B: (int) 15\n }\n`\n\n\tactual = diff(\n\t\tdiffTestingStruct{A: \"some string\", B: 10},\n\t\tdiffTestingStruct{A: \"some string\", B: 15},\n\t)\n\tEqual(t, expected, actual)\n\n\texpected = `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -1,2 +1,2 @@\n-(time.Time) 2020-09-24 00:00:00 +0000 UTC\n+(time.Time) 2020-09-25 00:00:00 +0000 UTC\n \n`\n\n\tactual = diff(\n\t\ttime.Date(2020, 9, 24, 0, 0, 0, 0, time.UTC),\n\t\ttime.Date(2020, 9, 25, 0, 0, 0, 0, time.UTC),\n\t)\n\tEqual(t, expected, actual)\n}\n\nfunc TestTimeEqualityErrorFormatting(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(mockTestingT)\n\n\tEqual(mockT, time.Second*2, time.Millisecond)\n\n\texpectedErr := \"\\\\s+Error Trace:\\\\s+Error:\\\\s+Not equal:\\\\s+\\n\\\\s+expected: 2s\\n\\\\s+actual\\\\s+: 1ms\\n\"\n\tRegexp(t, regexp.MustCompile(expectedErr), mockT.errorString())\n}\n\nfunc TestDiffEmptyCases(t *testing.T) {\n\tt.Parallel()\n\n\tEqual(t, \"\", diff(nil, nil))\n\tEqual(t, \"\", diff(struct{ foo string }{}, nil))\n\tEqual(t, \"\", diff(nil, struct{ foo string }{}))\n\tEqual(t, \"\", diff(1, 2))\n\tEqual(t, \"\", diff(1, 2))\n\tEqual(t, \"\", diff([]int{1}, []bool{true}))\n}\n\n// Ensure there are no data races\nfunc TestDiffRace(t *testing.T) {\n\tt.Parallel()\n\n\texpected := map[string]string{\n\t\t\"a\": \"A\",\n\t\t\"b\": \"B\",\n\t\t\"c\": \"C\",\n\t}\n\n\tactual := map[string]string{\n\t\t\"d\": \"D\",\n\t\t\"e\": \"E\",\n\t\t\"f\": \"F\",\n\t}\n\n\t// run diffs in parallel simulating tests with t.Parallel()\n\tnumRoutines := 10\n\trChans := make([]chan string, numRoutines)\n\tfor idx := range rChans {\n\t\trChans[idx] = make(chan string)\n\t\tgo func(ch chan string) {\n\t\t\tdefer close(ch)\n\t\t\tch <- diff(expected, actual)\n\t\t}(rChans[idx])\n\t}\n\n\tfor _, ch := range rChans {\n\t\tfor msg := range ch {\n\t\t\tNotZero(t, msg) // dummy assert\n\t\t}\n\t}\n}\n\ntype mockTestingT struct {\n\terrorFmt string\n\targs     []interface{}\n}\n\n// Helper is like [testing.T.Helper] but does nothing.\nfunc (mockTestingT) Helper() {}\n\nfunc (m *mockTestingT) errorString() string {\n\treturn fmt.Sprintf(m.errorFmt, m.args...)\n}\n\nfunc (m *mockTestingT) Errorf(format string, args ...interface{}) {\n\tm.errorFmt = format\n\tm.args = args\n}\n\nfunc (m *mockTestingT) Failed() bool {\n\treturn m.errorFmt != \"\"\n}\n\nfunc TestFailNowWithPlainTestingT(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := &mockTestingT{}\n\n\tPanics(t, func() {\n\t\tFailNow(mockT, \"failed\")\n\t}, \"should panic since mockT is missing FailNow()\")\n}\n\ntype mockFailNowTestingT struct{}\n\n// Helper is like [testing.T.Helper] but does nothing.\nfunc (mockFailNowTestingT) Helper() {}\n\nfunc (m *mockFailNowTestingT) Errorf(format string, args ...interface{}) {}\n\nfunc (m *mockFailNowTestingT) FailNow() {}\n\nfunc TestFailNowWithFullTestingT(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := &mockFailNowTestingT{}\n\n\tNotPanics(t, func() {\n\t\tFailNow(mockT, \"failed\")\n\t}, \"should call mockT.FailNow() rather than panicking\")\n}\n\nfunc TestBytesEqual(t *testing.T) {\n\tt.Parallel()\n\n\tcases := []struct {\n\t\ta, b []byte\n\t}{\n\t\t{make([]byte, 2), make([]byte, 2)},\n\t\t{make([]byte, 2), make([]byte, 2, 3)},\n\t\t{nil, make([]byte, 0)},\n\t}\n\tfor i, c := range cases {\n\t\tEqual(t, reflect.DeepEqual(c.a, c.b), ObjectsAreEqual(c.a, c.b), \"case %d failed\", i+1)\n\t}\n}\n\nfunc BenchmarkBytesEqual(b *testing.B) {\n\tconst size = 1024 * 8\n\ts := make([]byte, size)\n\tfor i := range s {\n\t\ts[i] = byte(i % 255)\n\t}\n\ts2 := make([]byte, size)\n\tcopy(s2, s)\n\n\tmockT := &mockFailNowTestingT{}\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tEqual(mockT, s, s2)\n\t}\n}\n\nfunc BenchmarkNotNil(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tNotNil(b, b)\n\t}\n}\n\nfunc ExampleComparisonAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tadder := func(x, y int) int {\n\t\treturn x + y\n\t}\n\n\ttype args struct {\n\t\tx int\n\t\ty int\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targs      args\n\t\texpect    int\n\t\tassertion ComparisonAssertionFunc\n\t}{\n\t\t{\"2+2=4\", args{2, 2}, 4, Equal},\n\t\t{\"2+2!=5\", args{2, 2}, 5, NotEqual},\n\t\t{\"2+3==5\", args{2, 3}, 5, Exactly},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.expect, adder(tt.args.x, tt.args.y))\n\t\t})\n\t}\n}\n\nfunc TestComparisonAssertionFunc(t *testing.T) {\n\tt.Parallel()\n\n\ttype iface interface {\n\t\tName() string\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\texpect    interface{}\n\t\tgot       interface{}\n\t\tassertion ComparisonAssertionFunc\n\t}{\n\t\t{\"implements\", (*iface)(nil), t, Implements},\n\t\t{\"isType\", (*testing.T)(nil), t, IsType},\n\t\t{\"equal\", t, t, Equal},\n\t\t{\"equalValues\", t, t, EqualValues},\n\t\t{\"notEqualValues\", t, nil, NotEqualValues},\n\t\t{\"exactly\", t, t, Exactly},\n\t\t{\"notEqual\", t, nil, NotEqual},\n\t\t{\"notContains\", []int{1, 2, 3}, 4, NotContains},\n\t\t{\"subset\", []int{1, 2, 3, 4}, []int{2, 3}, Subset},\n\t\t{\"notSubset\", []int{1, 2, 3, 4}, []int{0, 3}, NotSubset},\n\t\t{\"elementsMatch\", []byte(\"abc\"), []byte(\"bac\"), ElementsMatch},\n\t\t{\"regexp\", \"^t.*y$\", \"testify\", Regexp},\n\t\t{\"notRegexp\", \"^t.*y$\", \"Testify\", NotRegexp},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.expect, tt.got)\n\t\t})\n\t}\n}\n\nfunc ExampleValueAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tdumbParse := func(input string) interface{} {\n\t\tvar x interface{}\n\t\t_ = json.Unmarshal([]byte(input), &x)\n\t\treturn x\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       string\n\t\tassertion ValueAssertionFunc\n\t}{\n\t\t{\"true is not nil\", \"true\", NotNil},\n\t\t{\"empty string is nil\", \"\", Nil},\n\t\t{\"zero is not nil\", \"0\", NotNil},\n\t\t{\"zero is zero\", \"0\", Zero},\n\t\t{\"false is zero\", \"false\", Zero},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, dumbParse(tt.arg))\n\t\t})\n\t}\n}\n\nfunc TestValueAssertionFunc(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname      string\n\t\tvalue     interface{}\n\t\tassertion ValueAssertionFunc\n\t}{\n\t\t{\"notNil\", true, NotNil},\n\t\t{\"nil\", nil, Nil},\n\t\t{\"empty\", []int{}, Empty},\n\t\t{\"notEmpty\", []int{1}, NotEmpty},\n\t\t{\"zero\", false, Zero},\n\t\t{\"notZero\", 42, NotZero},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.value)\n\t\t})\n\t}\n}\n\nfunc ExampleBoolAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tisOkay := func(x int) bool {\n\t\treturn x >= 42\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       int\n\t\tassertion BoolAssertionFunc\n\t}{\n\t\t{\"-1 is bad\", -1, False},\n\t\t{\"42 is good\", 42, True},\n\t\t{\"41 is bad\", 41, False},\n\t\t{\"45 is cool\", 45, True},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, isOkay(tt.arg))\n\t\t})\n\t}\n}\n\nfunc TestBoolAssertionFunc(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname      string\n\t\tvalue     bool\n\t\tassertion BoolAssertionFunc\n\t}{\n\t\t{\"true\", true, True},\n\t\t{\"false\", false, False},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.value)\n\t\t})\n\t}\n}\n\nfunc ExampleErrorAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tdumbParseNum := func(input string, v interface{}) error {\n\t\treturn json.Unmarshal([]byte(input), v)\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       string\n\t\tassertion ErrorAssertionFunc\n\t}{\n\t\t{\"1.2 is number\", \"1.2\", NoError},\n\t\t{\"1.2.3 not number\", \"1.2.3\", Error},\n\t\t{\"true is not number\", \"true\", Error},\n\t\t{\"3 is number\", \"3\", NoError},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tvar x float64\n\t\t\ttt.assertion(t, dumbParseNum(tt.arg, &x))\n\t\t})\n\t}\n}\n\nfunc TestErrorAssertionFunc(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname      string\n\t\terr       error\n\t\tassertion ErrorAssertionFunc\n\t}{\n\t\t{\"noError\", nil, NoError},\n\t\t{\"error\", errors.New(\"whoops\"), Error},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.err)\n\t\t})\n\t}\n}\n\nfunc ExamplePanicAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\ttests := []struct {\n\t\tname      string\n\t\tpanicFn   PanicTestFunc\n\t\tassertion PanicAssertionFunc\n\t}{\n\t\t{\"with panic\", func() { panic(nil) }, Panics},\n\t\t{\"without panic\", func() {}, NotPanics},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.panicFn)\n\t\t})\n\t}\n}\n\nfunc TestPanicAssertionFunc(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname      string\n\t\tpanicFn   PanicTestFunc\n\t\tassertion PanicAssertionFunc\n\t}{\n\t\t{\"not panic\", func() {}, NotPanics},\n\t\t{\"panic\", func() { panic(nil) }, Panics},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.panicFn)\n\t\t})\n\t}\n}\n\nfunc TestEventuallyFalse(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tcondition := func() bool {\n\t\treturn false\n\t}\n\n\tFalse(t, Eventually(mockT, condition, 100*time.Millisecond, 20*time.Millisecond))\n}\n\nfunc TestEventuallyTrue(t *testing.T) {\n\tt.Parallel()\n\n\tstate := 0\n\tcondition := func() bool {\n\t\tdefer func() {\n\t\t\tstate += 1\n\t\t}()\n\t\treturn state == 2\n\t}\n\n\tTrue(t, Eventually(t, condition, 100*time.Millisecond, 20*time.Millisecond))\n}\n\n// errorsCapturingT is a mock implementation of TestingT that captures errors reported with Errorf.\ntype errorsCapturingT struct {\n\terrors []error\n}\n\n// Helper is like [testing.T.Helper] but does nothing.\nfunc (errorsCapturingT) Helper() {}\n\nfunc (t *errorsCapturingT) Errorf(format string, args ...interface{}) {\n\tt.errors = append(t.errors, fmt.Errorf(format, args...))\n}\n\nfunc TestEventuallyWithTFalse(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(errorsCapturingT)\n\n\tcondition := func(collect *CollectT) {\n\t\tFail(collect, \"condition fixed failure\")\n\t}\n\n\tFalse(t, EventuallyWithT(mockT, condition, 100*time.Millisecond, 20*time.Millisecond))\n\tLen(t, mockT.errors, 2)\n}\n\nfunc TestEventuallyWithTTrue(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(errorsCapturingT)\n\n\tcounter := 0\n\tcondition := func(collect *CollectT) {\n\t\tcounter += 1\n\t\tTrue(collect, counter == 2)\n\t}\n\n\tTrue(t, EventuallyWithT(mockT, condition, 100*time.Millisecond, 20*time.Millisecond))\n\tLen(t, mockT.errors, 0)\n\tEqual(t, 2, counter, \"Condition is expected to be called 2 times\")\n}\n\nfunc TestEventuallyWithT_ConcurrencySafe(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(errorsCapturingT)\n\n\tcondition := func(collect *CollectT) {\n\t\tFail(collect, \"condition fixed failure\")\n\t}\n\n\t// To trigger race conditions, we run EventuallyWithT with a nanosecond tick.\n\tFalse(t, EventuallyWithT(mockT, condition, 100*time.Millisecond, time.Nanosecond))\n\tLen(t, mockT.errors, 2)\n}\n\nfunc TestEventuallyWithT_ReturnsTheLatestFinishedConditionErrors(t *testing.T) {\n\tt.Parallel()\n\n\t// We'll use a channel to control whether a condition should sleep or not.\n\tmustSleep := make(chan bool, 2)\n\tmustSleep <- false\n\tmustSleep <- true\n\tclose(mustSleep)\n\n\tcondition := func(collect *CollectT) {\n\t\tif <-mustSleep {\n\t\t\t// Sleep to ensure that the second condition runs longer than timeout.\n\t\t\ttime.Sleep(time.Second)\n\t\t\treturn\n\t\t}\n\n\t\t// The first condition will fail. We expect to get this error as a result.\n\t\tFail(collect, \"condition fixed failure\")\n\t}\n\n\tmockT := new(errorsCapturingT)\n\tFalse(t, EventuallyWithT(mockT, condition, 100*time.Millisecond, 20*time.Millisecond))\n\tLen(t, mockT.errors, 2)\n}\n\nfunc TestEventuallyWithTFailNow(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(CollectT)\n\n\tcondition := func(collect *CollectT) {\n\t\tcollect.FailNow()\n\t}\n\n\tFalse(t, EventuallyWithT(mockT, condition, 100*time.Millisecond, 20*time.Millisecond))\n\tLen(t, mockT.errors, 1)\n}\n\n// Check that a long running condition doesn't block Eventually.\n// See issue 805 (and its long tail of following issues)\nfunc TestEventuallyTimeout(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tNotPanics(t, func() {\n\t\tdone, done2 := make(chan struct{}), make(chan struct{})\n\n\t\t// A condition function that returns after the Eventually timeout\n\t\tcondition := func() bool {\n\t\t\t// Wait until Eventually times out and terminates\n\t\t\t<-done\n\t\t\tclose(done2)\n\t\t\treturn true\n\t\t}\n\n\t\tFalse(t, Eventually(mockT, condition, time.Millisecond, time.Microsecond))\n\n\t\tclose(done)\n\t\t<-done2\n\t})\n}\n\nfunc TestEventuallySucceedQuickly(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tcondition := func() bool { return true }\n\n\t// By making the tick longer than the total duration, we expect that this test would fail if\n\t// we didn't check the condition before the first tick elapses.\n\tTrue(t, Eventually(mockT, condition, 100*time.Millisecond, time.Second))\n}\n\nfunc TestEventuallyWithTSucceedQuickly(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\tcondition := func(t *CollectT) {}\n\n\t// By making the tick longer than the total duration, we expect that this test would fail if\n\t// we didn't check the condition before the first tick elapses.\n\tTrue(t, EventuallyWithT(mockT, condition, 100*time.Millisecond, time.Second))\n}\n\nfunc TestNeverFalse(t *testing.T) {\n\tt.Parallel()\n\n\tcondition := func() bool {\n\t\treturn false\n\t}\n\n\tTrue(t, Never(t, condition, 100*time.Millisecond, 20*time.Millisecond))\n}\n\n// TestNeverTrue checks Never with a condition that returns true on second call.\nfunc TestNeverTrue(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\t// A list of values returned by condition.\n\t// Channel protects against concurrent access.\n\treturns := make(chan bool, 2)\n\treturns <- false\n\treturns <- true\n\tdefer close(returns)\n\n\t// Will return true on second call.\n\tcondition := func() bool {\n\t\treturn <-returns\n\t}\n\n\tFalse(t, Never(mockT, condition, 100*time.Millisecond, 20*time.Millisecond))\n}\n\nfunc TestNeverFailQuickly(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(testing.T)\n\n\t// By making the tick longer than the total duration, we expect that this test would fail if\n\t// we didn't check the condition before the first tick elapses.\n\tcondition := func() bool { return true }\n\tFalse(t, Never(mockT, condition, 100*time.Millisecond, time.Second))\n}\n\nfunc Test_validateEqualArgs(t *testing.T) {\n\tt.Parallel()\n\n\tif validateEqualArgs(func() {}, func() {}) == nil {\n\t\tt.Error(\"non-nil functions should error\")\n\t}\n\n\tif validateEqualArgs(func() {}, func() {}) == nil {\n\t\tt.Error(\"non-nil functions should error\")\n\t}\n\n\tif validateEqualArgs(nil, nil) != nil {\n\t\tt.Error(\"nil functions are equal\")\n\t}\n}\n\nfunc Test_truncatingFormat(t *testing.T) {\n\tt.Parallel()\n\n\toriginal := strings.Repeat(\"a\", bufio.MaxScanTokenSize/2-102)\n\tresult := truncatingFormat(\"%#v\", original)\n\tEqual(t, fmt.Sprintf(\"%#v\", original), result, \"string should not be truncated\")\n\n\toriginal = original + \"x\"\n\tresult = truncatingFormat(\"%#v\", original)\n\tNotEqual(t, fmt.Sprintf(\"%#v\", original), result, \"string should have been truncated.\")\n\n\tif !strings.HasSuffix(result, \"<... truncated>\") {\n\t\tt.Error(\"truncated string should have <... truncated> suffix\")\n\t}\n}\n\n// parseLabeledOutput does the inverse of labeledOutput - it takes a formatted\n// output string and turns it back into a slice of labeledContent.\nfunc parseLabeledOutput(output string) []labeledContent {\n\tlabelPattern := regexp.MustCompile(`^\\t([^\\t]*): *\\t(.*)$`)\n\tcontentPattern := regexp.MustCompile(`^\\t *\\t(.*)$`)\n\tvar contents []labeledContent\n\tlines := strings.Split(output, \"\\n\")\n\ti := -1\n\tfor _, line := range lines {\n\t\tif line == \"\" {\n\t\t\t// skip blank lines\n\t\t\tcontinue\n\t\t}\n\t\tmatches := labelPattern.FindStringSubmatch(line)\n\t\tif len(matches) == 3 {\n\t\t\t// a label\n\t\t\tcontents = append(contents, labeledContent{\n\t\t\t\tlabel:   matches[1],\n\t\t\t\tcontent: matches[2] + \"\\n\",\n\t\t\t})\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\tmatches = contentPattern.FindStringSubmatch(line)\n\t\tif len(matches) == 2 {\n\t\t\t// just content\n\t\t\tif i >= 0 {\n\t\t\t\tcontents[i].content += matches[1] + \"\\n\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\t// Couldn't parse output\n\t\treturn nil\n\t}\n\treturn contents\n}\n\ntype captureTestingT struct {\n\tfailed bool\n\tmsg    string\n}\n\n// Helper is like [testing.T.Helper] but does nothing.\nfunc (captureTestingT) Helper() {}\n\nfunc (ctt *captureTestingT) Errorf(format string, args ...interface{}) {\n\tctt.msg = fmt.Sprintf(format, args...)\n\tctt.failed = true\n}\n\nfunc (ctt *captureTestingT) checkResultAndErrMsg(t *testing.T, expectedRes, res bool, expectedErrMsg string) {\n\tt.Helper()\n\tif res != expectedRes {\n\t\tt.Errorf(\"Should return %t\", expectedRes)\n\t\treturn\n\t}\n\tif res == ctt.failed {\n\t\tt.Errorf(\"The test result (%t) should be reflected in the testing.T type (%t)\", res, !ctt.failed)\n\t\treturn\n\t}\n\tcontents := parseLabeledOutput(ctt.msg)\n\tif res == true {\n\t\tif contents != nil {\n\t\t\tt.Errorf(\"Should not log an error. Log output: %q\", ctt.msg)\n\t\t}\n\t\treturn\n\t}\n\tif contents == nil {\n\t\tt.Errorf(\"Should log an error. Log output: %q\", ctt.msg)\n\t\treturn\n\t}\n\tfor _, content := range contents {\n\t\tif content.label == \"Error\" {\n\t\t\tif expectedErrMsg == content.content {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tt.Errorf(\"Recorded Error: %q\", content.content)\n\t\t}\n\t}\n\tt.Errorf(\"Expected Error: %q\", expectedErrMsg)\n}\n\nfunc TestErrorIs(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\terr          error\n\t\ttarget       error\n\t\tresult       bool\n\t\tresultErrMsg string\n\t}{\n\t\t{\n\t\t\terr:    io.EOF,\n\t\t\ttarget: io.EOF,\n\t\t\tresult: true,\n\t\t},\n\t\t{\n\t\t\terr:    fmt.Errorf(\"wrap: %w\", io.EOF),\n\t\t\ttarget: io.EOF,\n\t\t\tresult: true,\n\t\t},\n\t\t{\n\t\t\terr:    io.EOF,\n\t\t\ttarget: io.ErrClosedPipe,\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"Target error should be in err chain:\\n\" +\n\t\t\t\t\"expected: \\\"io: read/write on closed pipe\\\"\\n\" +\n\t\t\t\t\"in chain: \\\"EOF\\\"\\n\",\n\t\t},\n\t\t{\n\t\t\terr:          nil,\n\t\t\ttarget:       io.EOF,\n\t\t\tresult:       false,\n\t\t\tresultErrMsg: \"Expected error with \\\"EOF\\\" in chain but got nil.\\n\",\n\t\t},\n\t\t{\n\t\t\terr:    io.EOF,\n\t\t\ttarget: nil,\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"Target error should be in err chain:\\n\" +\n\t\t\t\t\"expected: \\\"\\\"\\n\" +\n\t\t\t\t\"in chain: \\\"EOF\\\"\\n\",\n\t\t},\n\t\t{\n\t\t\terr:    nil,\n\t\t\ttarget: nil,\n\t\t\tresult: true,\n\t\t},\n\t\t{\n\t\t\terr:    fmt.Errorf(\"abc: %w\", errors.New(\"def\")),\n\t\t\ttarget: io.EOF,\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"Target error should be in err chain:\\n\" +\n\t\t\t\t\"expected: \\\"EOF\\\"\\n\" +\n\t\t\t\t\"in chain: \\\"abc: def\\\"\\n\" +\n\t\t\t\t\"\\t\\\"def\\\"\\n\",\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\ttt := tt\n\t\tt.Run(fmt.Sprintf(\"ErrorIs(%#v,%#v)\", tt.err, tt.target), func(t *testing.T) {\n\t\t\tmockT := new(captureTestingT)\n\t\t\tres := ErrorIs(mockT, tt.err, tt.target)\n\t\t\tmockT.checkResultAndErrMsg(t, tt.result, res, tt.resultErrMsg)\n\t\t})\n\t}\n}\n\nfunc TestNotErrorIs(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\terr          error\n\t\ttarget       error\n\t\tresult       bool\n\t\tresultErrMsg string\n\t}{\n\t\t{\n\t\t\terr:    io.EOF,\n\t\t\ttarget: io.EOF,\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"Target error should not be in err chain:\\n\" +\n\t\t\t\t\"found: \\\"EOF\\\"\\n\" +\n\t\t\t\t\"in chain: \\\"EOF\\\"\\n\",\n\t\t},\n\t\t{\n\t\t\terr:    fmt.Errorf(\"wrap: %w\", io.EOF),\n\t\t\ttarget: io.EOF,\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"Target error should not be in err chain:\\n\" +\n\t\t\t\t\"found: \\\"EOF\\\"\\n\" +\n\t\t\t\t\"in chain: \\\"wrap: EOF\\\"\\n\" +\n\t\t\t\t\"\\t\\\"EOF\\\"\\n\",\n\t\t},\n\t\t{\n\t\t\terr:    io.EOF,\n\t\t\ttarget: io.ErrClosedPipe,\n\t\t\tresult: true,\n\t\t},\n\t\t{\n\t\t\terr:    nil,\n\t\t\ttarget: io.EOF,\n\t\t\tresult: true,\n\t\t},\n\t\t{\n\t\t\terr:    io.EOF,\n\t\t\ttarget: nil,\n\t\t\tresult: true,\n\t\t},\n\t\t{\n\t\t\terr:    nil,\n\t\t\ttarget: nil,\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"Target error should not be in err chain:\\n\" +\n\t\t\t\t\"found: \\\"\\\"\\n\" +\n\t\t\t\t\"in chain: \\n\",\n\t\t},\n\t\t{\n\t\t\terr:    fmt.Errorf(\"abc: %w\", errors.New(\"def\")),\n\t\t\ttarget: io.EOF,\n\t\t\tresult: true,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\ttt := tt\n\t\tt.Run(fmt.Sprintf(\"NotErrorIs(%#v,%#v)\", tt.err, tt.target), func(t *testing.T) {\n\t\t\tmockT := new(captureTestingT)\n\t\t\tres := NotErrorIs(mockT, tt.err, tt.target)\n\t\t\tmockT.checkResultAndErrMsg(t, tt.result, res, tt.resultErrMsg)\n\t\t})\n\t}\n}\n\nfunc TestErrorAs(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\terr          error\n\t\tresult       bool\n\t\tresultErrMsg string\n\t}{\n\t\t{\n\t\t\terr:    fmt.Errorf(\"wrap: %w\", &customError{}),\n\t\t\tresult: true,\n\t\t},\n\t\t{\n\t\t\terr:    io.EOF,\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"Should be in error chain:\\n\" +\n\t\t\t\t\"expected: *assert.customError\\n\" +\n\t\t\t\t\"in chain: \\\"EOF\\\" (*errors.errorString)\\n\",\n\t\t},\n\t\t{\n\t\t\terr:    nil,\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"An error is expected but got nil.\\n\" +\n\t\t\t\t`expected: *assert.customError` + \"\\n\",\n\t\t},\n\t\t{\n\t\t\terr:    fmt.Errorf(\"abc: %w\", errors.New(\"def\")),\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"Should be in error chain:\\n\" +\n\t\t\t\t\"expected: *assert.customError\\n\" +\n\t\t\t\t\"in chain: \\\"abc: def\\\" (*fmt.wrapError)\\n\" +\n\t\t\t\t\"\\t\\\"def\\\" (*errors.errorString)\\n\",\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\ttt := tt\n\t\tvar target *customError\n\t\tt.Run(fmt.Sprintf(\"ErrorAs(%#v,%#v)\", tt.err, target), func(t *testing.T) {\n\t\t\tmockT := new(captureTestingT)\n\t\t\tres := ErrorAs(mockT, tt.err, &target)\n\t\t\tmockT.checkResultAndErrMsg(t, tt.result, res, tt.resultErrMsg)\n\t\t})\n\t}\n}\n\nfunc TestNotErrorAs(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\terr          error\n\t\tresult       bool\n\t\tresultErrMsg string\n\t}{\n\t\t{\n\t\t\terr:    fmt.Errorf(\"wrap: %w\", &customError{}),\n\t\t\tresult: false,\n\t\t\tresultErrMsg: \"\" +\n\t\t\t\t\"Target error should not be in err chain:\\n\" +\n\t\t\t\t\"found: *assert.customError\\n\" +\n\t\t\t\t\"in chain: \\\"wrap: fail\\\" (*fmt.wrapError)\\n\" +\n\t\t\t\t\"\\t\\\"fail\\\" (*assert.customError)\\n\",\n\t\t},\n\t\t{\n\t\t\terr:    io.EOF,\n\t\t\tresult: true,\n\t\t},\n\t\t{\n\t\t\terr:    nil,\n\t\t\tresult: true,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\ttt := tt\n\t\tvar target *customError\n\t\tt.Run(fmt.Sprintf(\"NotErrorAs(%#v,%#v)\", tt.err, target), func(t *testing.T) {\n\t\t\tmockT := new(captureTestingT)\n\t\t\tres := NotErrorAs(mockT, tt.err, &target)\n\t\t\tmockT.checkResultAndErrMsg(t, tt.result, res, tt.resultErrMsg)\n\t\t})\n\t}\n}\n\nfunc TestLenWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tLen(mockT, longSlice, 1)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \t\"[0 0 0`)\n\tContains(t, mockT.errorString(), `<... truncated>\" should have 1 item(s), but has 1000000`)\n}\n\nfunc TestContainsWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tContains(mockT, longSlice, 1)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \t[]int{0, 0, 0,`)\n\tContains(t, mockT.errorString(), `<... truncated> does not contain 1`)\n}\n\nfunc TestNotContainsWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tNotContains(mockT, longSlice, 0)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \t[]int{0, 0, 0,`)\n\tContains(t, mockT.errorString(), `<... truncated> should not contain 0`)\n}\n\nfunc TestSubsetWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tSubset(mockT, longSlice, []int{1})\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \t[]int{0, 0, 0,`)\n\tContains(t, mockT.errorString(), `<... truncated> does not contain 1`)\n}\n\nfunc TestSubsetWithMapTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tSubset(mockT, map[bool][]int{true: longSlice}, map[bool][]int{false: longSlice})\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tmap[bool][]int{true:[]int{0, 0, 0,`)\n\tContains(t, mockT.errorString(), `<... truncated> does not contain map[bool][]int{false:[]int{0, 0, 0,`)\n}\n\nfunc TestNotSubsetWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tNotSubset(mockT, longSlice, longSlice)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \t['\\x00' '\\x00' '\\x00'`)\n\tContains(t, mockT.errorString(), `<... truncated> is a subset of ['\\x00' '\\x00' '\\x00'`)\n}\n\nfunc TestNotSubsetWithMapTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tNotSubset(mockT, map[int][]int{1: longSlice}, map[int][]int{1: longSlice})\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tmap['\\x01':['\\x00' '\\x00' '\\x00'`)\n\tContains(t, mockT.errorString(), `<... truncated> is a subset of map['\\x01':['\\x00' '\\x00' '\\x00'`)\n}\n\nfunc TestSameWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tSame(mockT, &[]int{}, &longSlice)\n\tContains(t, mockT.errorString(), `&[]int{0, 0, 0,`)\n}\n\nfunc TestNotSameWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tNotSame(mockT, &longSlice, &longSlice)\n\tContains(t, mockT.errorString(), `&[]int{0, 0, 0,`)\n}\n\nfunc TestNilWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tNil(mockT, &longSlice)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tExpected nil, but got: &[]int{0, 0, 0,`)\n\tContains(t, mockT.errorString(), `<... truncated>`)\n}\n\nfunc TestEmptyWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tEmpty(mockT, longSlice)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tShould be empty, but was [0 0 0`)\n\tContains(t, mockT.errorString(), `<... truncated>`)\n}\n\nfunc TestNotEqualWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tNotEqual(mockT, longSlice, longSlice)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tShould not be: []int{0, 0, 0,`)\n\tContains(t, mockT.errorString(), `<... truncated>`)\n}\n\nfunc TestNotEqualValuesWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tNotEqualValues(mockT, longSlice, longSlice)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tShould not be: []int{0, 0, 0,`)\n\tContains(t, mockT.errorString(), `<... truncated>`)\n}\n\nfunc TestNoErrorWithErrorTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tNoError(mockT, fmt.Errorf(\"long: %v\", longSlice))\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tReceived unexpected error:\n\t            \tlong: [0 0 0`)\n\tContains(t, mockT.errorString(), `<... truncated>`)\n}\n\nfunc TestEqualErrorWithErrorTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tEqualError(mockT, fmt.Errorf(\"long: %v\", longSlice), \"EOF\")\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tError message not equal:\n\t            \texpected: \"EOF\"\n\t            \tactual  : \"long: [0 0 0`)\n\tContains(t, mockT.errorString(), `<... truncated>`)\n}\n\nfunc TestErrorContainsWithErrorTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tErrorContains(mockT, fmt.Errorf(\"long: %v\", longSlice), \"EOF\")\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tError \"long: [0 0 0`)\n\tContains(t, mockT.errorString(), `<... truncated> does not contain \"EOF\"`)\n}\n\nfunc TestZeroWithSliceTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tZero(mockT, longSlice)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tShould be zero, but was [0 0 0`)\n\tContains(t, mockT.errorString(), `<... truncated>`)\n}\n\nfunc TestErrorIsWithErrorTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tErrorIs(mockT, fmt.Errorf(\"long: %v\", longSlice), fmt.Errorf(\"also: %v\", longSlice))\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tTarget error should be in err chain:\n\t            \texpected: \"also: [0 0 0`)\n\tContains(t, mockT.errorString(), `<... truncated>\n\t            \tin chain: \"long: [0 0 0`)\n}\n\nfunc TestNotErrorIsWithErrorTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\terr := fmt.Errorf(\"long: %v\", longSlice)\n\tNotErrorIs(mockT, err, err)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tTarget error should not be in err chain:\n\t            \tfound: \"long: [0 0 0`)\n\tContains(t, mockT.errorString(), `<... truncated>\n\t            \tin chain: \"long: [0 0 0`)\n}\n\nfunc TestErrorAsWithErrorTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tvar target *customError\n\tErrorAs(mockT, fmt.Errorf(\"long: %v\", longSlice), &target)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tShould be in error chain:\n\t            \texpected: *assert.customError`)\n\tContains(t, mockT.errorString(), `\n\t            \tin chain: \"long: [0 0 0`)\n\tContains(t, mockT.errorString(), \"<... truncated>\")\n}\n\nfunc TestNotErrorAsWithErrorTooLongToPrint(t *testing.T) {\n\tt.Parallel()\n\tmockT := new(mockTestingT)\n\tlongSlice := make([]int, 1_000_000)\n\tvar target *customError\n\tNotErrorAs(mockT, fmt.Errorf(\"long: %v %w\", longSlice, &customError{}), &target)\n\tContains(t, mockT.errorString(), `\n\tError Trace:\t\n\tError:      \tTarget error should not be in err chain:\n\t            \tfound: *assert.customError`)\n\tContains(t, mockT.errorString(), `\n\t            \tin chain: \"long: [0 0 0`)\n\tContains(t, mockT.errorString(), \"<... truncated>\")\n}\n"
  },
  {
    "path": "assert/doc.go",
    "content": "// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.\n//\n// # Note\n//\n// All functions in this package return a bool value indicating whether the assertion has passed.\n//\n// # Example Usage\n//\n// The following is a complete example using assert in a standard test function:\n//\n//\timport (\n//\t  \"testing\"\n//\t  \"github.com/stretchr/testify/assert\"\n//\t)\n//\n//\tfunc TestSomething(t *testing.T) {\n//\n//\t  var a string = \"Hello\"\n//\t  var b string = \"Hello\"\n//\n//\t  assert.Equal(t, a, b, \"The two words should be the same.\")\n//\n//\t}\n//\n// if you assert many times, use the format below:\n//\n//\timport (\n//\t  \"testing\"\n//\t  \"github.com/stretchr/testify/assert\"\n//\t)\n//\n//\tfunc TestSomething(t *testing.T) {\n//\t  assert := assert.New(t)\n//\n//\t  var a string = \"Hello\"\n//\t  var b string = \"Hello\"\n//\n//\t  assert.Equal(a, b, \"The two words should be the same.\")\n//\t}\n//\n// # Assertions\n//\n// Assertions allow you to easily write test code, and are global funcs in the assert package.\n// All assertion functions take, as the first argument, the [*testing.T] object provided by the\n// testing framework. This allows the assertion funcs to write the failings and other details to\n// the correct place.\n//\n// Every assertion function also takes an optional string message as the final argument,\n// allowing custom error messages to be appended to the message the assertion method outputs.\npackage assert\n"
  },
  {
    "path": "assert/errors.go",
    "content": "package assert\n\nimport (\n\t\"errors\"\n)\n\n// AnError is an error instance useful for testing.  If the code does not care\n// about error specifics, and only needs to return the error for example, this\n// error should be used to make the test code more readable.\nvar AnError = errors.New(\"assert.AnError general error for testing\")\n"
  },
  {
    "path": "assert/forward_assertions.go",
    "content": "package assert\n\n// Assertions provides assertion methods around the\n// TestingT interface.\ntype Assertions struct {\n\tt TestingT\n}\n\n// New makes a new Assertions object for the specified TestingT.\nfunc New(t TestingT) *Assertions {\n\treturn &Assertions{\n\t\tt: t,\n\t}\n}\n\n//go:generate sh -c \"cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs\"\n"
  },
  {
    "path": "assert/forward_assertions_test.go",
    "content": "package assert\n\nimport (\n\t\"errors\"\n\t\"regexp\"\n\t\"testing\"\n\t\"time\"\n)\n\nfunc TestImplementsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"Implements method should return true: AssertionTesterConformingObject implements AssertionTesterInterface\")\n\t}\n\tif assert.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"Implements method should return false: AssertionTesterNonConformingObject does not implements AssertionTesterInterface\")\n\t}\n}\n\nfunc TestIsTypeWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.IsType(new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"IsType should return true: AssertionTesterConformingObject is the same type as AssertionTesterConformingObject\")\n\t}\n\tif assert.IsType(new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"IsType should return false: AssertionTesterConformingObject is not the same type as AssertionTesterNonConformingObject\")\n\t}\n\n}\n\nfunc TestEqualWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.Equal(\"Hello World\", \"Hello World\") {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !assert.Equal(123, 123) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !assert.Equal(123.5, 123.5) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !assert.Equal([]byte(\"Hello World\"), []byte(\"Hello World\")) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !assert.Equal(nil, nil) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n}\n\nfunc TestEqualValuesWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.EqualValues(uint32(10), int32(10)) {\n\t\tt.Error(\"EqualValues should return true\")\n\t}\n}\n\nfunc TestNotNilWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.NotNil(new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotNil should return true: object is not nil\")\n\t}\n\tif assert.NotNil(nil) {\n\t\tt.Error(\"NotNil should return false: object is nil\")\n\t}\n\n}\n\nfunc TestNilWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.Nil(nil) {\n\t\tt.Error(\"Nil should return true: object is nil\")\n\t}\n\tif assert.Nil(new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"Nil should return false: object is not nil\")\n\t}\n\n}\n\nfunc TestTrueWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.True(true) {\n\t\tt.Error(\"True should return true\")\n\t}\n\tif assert.True(false) {\n\t\tt.Error(\"True should return false\")\n\t}\n\n}\n\nfunc TestFalseWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.False(false) {\n\t\tt.Error(\"False should return true\")\n\t}\n\tif assert.False(true) {\n\t\tt.Error(\"False should return false\")\n\t}\n\n}\n\nfunc TestExactlyWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\ta := float32(1)\n\tb := float64(1)\n\tc := float32(1)\n\td := float32(2)\n\n\tif assert.Exactly(a, b) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\tif assert.Exactly(a, d) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\tif !assert.Exactly(a, c) {\n\t\tt.Error(\"Exactly should return true\")\n\t}\n\n\tif assert.Exactly(nil, a) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\tif assert.Exactly(a, nil) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\n}\n\nfunc TestNotEqualWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.NotEqual(\"Hello World\", \"Hello World!\") {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !assert.NotEqual(123, 1234) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !assert.NotEqual(123.5, 123.55) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !assert.NotEqual([]byte(\"Hello World\"), []byte(\"Hello World!\")) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !assert.NotEqual(nil, new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n}\n\nfunc TestNotEqualValuesWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.NotEqualValues(\"Hello World\", \"Hello World!\") {\n\t\tt.Error(\"NotEqualValues should return true\")\n\t}\n\tif !assert.NotEqualValues(123, 1234) {\n\t\tt.Error(\"NotEqualValues should return true\")\n\t}\n\tif !assert.NotEqualValues(123.5, 123.55) {\n\t\tt.Error(\"NotEqualValues should return true\")\n\t}\n\tif !assert.NotEqualValues([]byte(\"Hello World\"), []byte(\"Hello World!\")) {\n\t\tt.Error(\"NotEqualValues should return true\")\n\t}\n\tif !assert.NotEqualValues(nil, new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotEqualValues should return true\")\n\t}\n\tif assert.NotEqualValues(10, uint(10)) {\n\t\tt.Error(\"NotEqualValues should return false\")\n\t}\n}\n\nfunc TestContainsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tlist := []string{\"Foo\", \"Bar\"}\n\n\tif !assert.Contains(\"Hello World\", \"Hello\") {\n\t\tt.Error(\"Contains should return true: \\\"Hello World\\\" contains \\\"Hello\\\"\")\n\t}\n\tif assert.Contains(\"Hello World\", \"Salut\") {\n\t\tt.Error(\"Contains should return false: \\\"Hello World\\\" does not contain \\\"Salut\\\"\")\n\t}\n\n\tif !assert.Contains(list, \"Foo\") {\n\t\tt.Error(\"Contains should return true: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" contains \\\"Foo\\\"\")\n\t}\n\tif assert.Contains(list, \"Salut\") {\n\t\tt.Error(\"Contains should return false: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" does not contain \\\"Salut\\\"\")\n\t}\n\n}\n\nfunc TestNotContainsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tlist := []string{\"Foo\", \"Bar\"}\n\n\tif !assert.NotContains(\"Hello World\", \"Hello!\") {\n\t\tt.Error(\"NotContains should return true: \\\"Hello World\\\" does not contain \\\"Hello!\\\"\")\n\t}\n\tif assert.NotContains(\"Hello World\", \"Hello\") {\n\t\tt.Error(\"NotContains should return false: \\\"Hello World\\\" contains \\\"Hello\\\"\")\n\t}\n\n\tif !assert.NotContains(list, \"Foo!\") {\n\t\tt.Error(\"NotContains should return true: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" does not contain \\\"Foo!\\\"\")\n\t}\n\tif assert.NotContains(list, \"Foo\") {\n\t\tt.Error(\"NotContains should return false: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" contains \\\"Foo\\\"\")\n\t}\n\n}\n\nfunc TestConditionWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.Condition(func() bool { return true }, \"Truth\") {\n\t\tt.Error(\"Condition should return true\")\n\t}\n\n\tif assert.Condition(func() bool { return false }, \"Lie\") {\n\t\tt.Error(\"Condition should return false\")\n\t}\n\n}\n\nfunc TestDidPanicWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tif funcDidPanic, _, _ := didPanic(func() {\n\t\tpanic(\"Panic!\")\n\t}); !funcDidPanic {\n\t\tt.Error(\"didPanic should return true\")\n\t}\n\n\tif funcDidPanic, _, _ := didPanic(func() {\n\t}); funcDidPanic {\n\t\tt.Error(\"didPanic should return false\")\n\t}\n\n}\n\nfunc TestPanicsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.Panics(func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"Panics should return true\")\n\t}\n\n\tif assert.Panics(func() {\n\t}) {\n\t\tt.Error(\"Panics should return false\")\n\t}\n\n}\n\nfunc TestNotPanicsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tif !assert.NotPanics(func() {\n\t}) {\n\t\tt.Error(\"NotPanics should return true\")\n\t}\n\n\tif assert.NotPanics(func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"NotPanics should return false\")\n\t}\n\n}\n\nfunc TestNoErrorWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\t// start with a nil error\n\tvar err error\n\n\tassert.True(mockAssert.NoError(err), \"NoError should return True for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"Some error\")\n\n\tassert.False(mockAssert.NoError(err), \"NoError with error should return False\")\n\n}\n\nfunc TestErrorWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\t// start with a nil error\n\tvar err error\n\n\tassert.False(mockAssert.Error(err), \"Error should return False for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"Some error\")\n\n\tassert.True(mockAssert.Error(err), \"Error with error should return True\")\n\n}\n\nfunc TestErrorContainsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\t// start with a nil error\n\tvar err error\n\tassert.False(mockAssert.ErrorContains(err, \"\"),\n\t\t\"ErrorContains should return false for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error: another error\")\n\tassert.False(mockAssert.ErrorContains(err, \"different error\"),\n\t\t\"ErrorContains should return false for different error string\")\n\tassert.True(mockAssert.ErrorContains(err, \"some error\"),\n\t\t\"ErrorContains should return true\")\n\tassert.True(mockAssert.ErrorContains(err, \"another error\"),\n\t\t\"ErrorContains should return true\")\n}\n\nfunc TestEqualErrorWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\t// start with a nil error\n\tvar err error\n\tassert.False(mockAssert.EqualError(err, \"\"),\n\t\t\"EqualError should return false for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error\")\n\tassert.False(mockAssert.EqualError(err, \"Not some error\"),\n\t\t\"EqualError should return false for different error string\")\n\tassert.True(mockAssert.EqualError(err, \"some error\"),\n\t\t\"EqualError should return true\")\n}\n\nfunc TestEmptyWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.True(mockAssert.Empty(\"\"), \"Empty string is empty\")\n\tassert.True(mockAssert.Empty(nil), \"Nil is empty\")\n\tassert.True(mockAssert.Empty([]string{}), \"Empty string array is empty\")\n\tassert.True(mockAssert.Empty(0), \"Zero int value is empty\")\n\tassert.True(mockAssert.Empty(false), \"False value is empty\")\n\n\tassert.False(mockAssert.Empty(\"something\"), \"Non Empty string is not empty\")\n\tassert.False(mockAssert.Empty(errors.New(\"something\")), \"Non nil object is not empty\")\n\tassert.False(mockAssert.Empty([]string{\"something\"}), \"Non empty string array is not empty\")\n\tassert.False(mockAssert.Empty(1), \"Non-zero int value is not empty\")\n\tassert.False(mockAssert.Empty(true), \"True value is not empty\")\n\n}\n\nfunc TestNotEmptyWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.False(mockAssert.NotEmpty(\"\"), \"Empty string is empty\")\n\tassert.False(mockAssert.NotEmpty(nil), \"Nil is empty\")\n\tassert.False(mockAssert.NotEmpty([]string{}), \"Empty string array is empty\")\n\tassert.False(mockAssert.NotEmpty(0), \"Zero int value is empty\")\n\tassert.False(mockAssert.NotEmpty(false), \"False value is empty\")\n\n\tassert.True(mockAssert.NotEmpty(\"something\"), \"Non Empty string is not empty\")\n\tassert.True(mockAssert.NotEmpty(errors.New(\"something\")), \"Non nil object is not empty\")\n\tassert.True(mockAssert.NotEmpty([]string{\"something\"}), \"Non empty string array is not empty\")\n\tassert.True(mockAssert.NotEmpty(1), \"Non-zero int value is not empty\")\n\tassert.True(mockAssert.NotEmpty(true), \"True value is not empty\")\n\n}\n\nfunc TestLenWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.False(mockAssert.Len(nil, 0), \"nil does not have length\")\n\tassert.False(mockAssert.Len(0, 0), \"int does not have length\")\n\tassert.False(mockAssert.Len(true, 0), \"true does not have length\")\n\tassert.False(mockAssert.Len(false, 0), \"false does not have length\")\n\tassert.False(mockAssert.Len('A', 0), \"Rune does not have length\")\n\tassert.False(mockAssert.Len(struct{}{}, 0), \"Struct does not have length\")\n\n\tch := make(chan int, 5)\n\tch <- 1\n\tch <- 2\n\tch <- 3\n\n\tcases := []struct {\n\t\tv interface{}\n\t\tl int\n\t}{\n\t\t{[]int{1, 2, 3}, 3},\n\t\t{[...]int{1, 2, 3}, 3},\n\t\t{\"ABC\", 3},\n\t\t{map[int]int{1: 2, 2: 4, 3: 6}, 3},\n\t\t{ch, 3},\n\n\t\t{[]int{}, 0},\n\t\t{map[int]int{}, 0},\n\t\t{make(chan int), 0},\n\n\t\t{[]int(nil), 0},\n\t\t{map[int]int(nil), 0},\n\t\t{(chan int)(nil), 0},\n\t}\n\n\tfor _, c := range cases {\n\t\tassert.True(mockAssert.Len(c.v, c.l), \"%#v have %d items\", c.v, c.l)\n\t}\n}\n\nfunc TestWithinDurationWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\ta := time.Now()\n\tb := a.Add(10 * time.Second)\n\n\tassert.True(mockAssert.WithinDuration(a, b, 10*time.Second), \"A 10s difference is within a 10s time difference\")\n\tassert.True(mockAssert.WithinDuration(b, a, 10*time.Second), \"A 10s difference is within a 10s time difference\")\n\n\tassert.False(mockAssert.WithinDuration(a, b, 9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tassert.False(mockAssert.WithinDuration(b, a, 9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\n\tassert.False(mockAssert.WithinDuration(a, b, -9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tassert.False(mockAssert.WithinDuration(b, a, -9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\n\tassert.False(mockAssert.WithinDuration(a, b, -11*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tassert.False(mockAssert.WithinDuration(b, a, -11*time.Second), \"A 10s difference is not within a 9s time difference\")\n}\n\nfunc TestInDeltaWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tTrue(t, assert.InDelta(1.001, 1, 0.01), \"|1.001 - 1| <= 0.01\")\n\tTrue(t, assert.InDelta(1, 1.001, 0.01), \"|1 - 1.001| <= 0.01\")\n\tTrue(t, assert.InDelta(1, 2, 1), \"|1 - 2| <= 1\")\n\tFalse(t, assert.InDelta(1, 2, 0.5), \"Expected |1 - 2| <= 0.5 to fail\")\n\tFalse(t, assert.InDelta(2, 1, 0.5), \"Expected |2 - 1| <= 0.5 to fail\")\n\tFalse(t, assert.InDelta(\"\", nil, 1), \"Expected non numerals to fail\")\n\n\tcases := []struct {\n\t\ta, b  interface{}\n\t\tdelta float64\n\t}{\n\t\t{uint8(2), uint8(1), 1},\n\t\t{uint16(2), uint16(1), 1},\n\t\t{uint32(2), uint32(1), 1},\n\t\t{uint64(2), uint64(1), 1},\n\n\t\t{int(2), int(1), 1},\n\t\t{int8(2), int8(1), 1},\n\t\t{int16(2), int16(1), 1},\n\t\t{int32(2), int32(1), 1},\n\t\t{int64(2), int64(1), 1},\n\n\t\t{float32(2), float32(1), 1},\n\t\t{float64(2), float64(1), 1},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, assert.InDelta(tc.a, tc.b, tc.delta), \"Expected |%V - %V| <= %v\", tc.a, tc.b, tc.delta)\n\t}\n}\n\nfunc TestInEpsilonWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tcases := []struct {\n\t\ta, b    interface{}\n\t\tepsilon float64\n\t}{\n\t\t{uint8(2), uint16(2), .001},\n\t\t{2.1, 2.2, 0.1},\n\t\t{2.2, 2.1, 0.1},\n\t\t{-2.1, -2.2, 0.1},\n\t\t{-2.2, -2.1, 0.1},\n\t\t{uint64(100), uint8(101), 0.01},\n\t\t{0.1, -0.1, 2},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, assert.InEpsilon(tc.a, tc.b, tc.epsilon, \"Expected %V and %V to have a relative difference of %v\", tc.a, tc.b, tc.epsilon))\n\t}\n\n\tcases = []struct {\n\t\ta, b    interface{}\n\t\tepsilon float64\n\t}{\n\t\t{uint8(2), int16(-2), .001},\n\t\t{uint64(100), uint8(102), 0.01},\n\t\t{2.1, 2.2, 0.001},\n\t\t{2.2, 2.1, 0.001},\n\t\t{2.1, -2.2, 1},\n\t\t{2.1, \"bla-bla\", 0},\n\t\t{0.1, -0.1, 1.99},\n\t}\n\n\tfor _, tc := range cases {\n\t\tFalse(t, assert.InEpsilon(tc.a, tc.b, tc.epsilon, \"Expected %V and %V to have a relative difference of %v\", tc.a, tc.b, tc.epsilon))\n\t}\n}\n\nfunc TestRegexpWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\n\tcases := []struct {\n\t\trx, str string\n\t}{\n\t\t{\"^start\", \"start of the line\"},\n\t\t{\"end$\", \"in the end\"},\n\t\t{\"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}\", \"My phone number is 650.12.34\"},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, assert.Regexp(tc.rx, tc.str))\n\t\tTrue(t, assert.Regexp(regexp.MustCompile(tc.rx), tc.str))\n\t\tFalse(t, assert.NotRegexp(tc.rx, tc.str))\n\t\tFalse(t, assert.NotRegexp(regexp.MustCompile(tc.rx), tc.str))\n\t}\n\n\tcases = []struct {\n\t\trx, str string\n\t}{\n\t\t{\"^asdfastart\", \"Not the start of the line\"},\n\t\t{\"end$\", \"in the end.\"},\n\t\t{\"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}\", \"My phone number is 650.12a.34\"},\n\t}\n\n\tfor _, tc := range cases {\n\t\tFalse(t, assert.Regexp(tc.rx, tc.str), \"Expected %q to not match %q\", tc.rx, tc.str)\n\t\tFalse(t, assert.Regexp(regexp.MustCompile(tc.rx), tc.str))\n\t\tTrue(t, assert.NotRegexp(tc.rx, tc.str))\n\t\tTrue(t, assert.NotRegexp(regexp.MustCompile(tc.rx), tc.str))\n\t}\n}\n\nfunc TestZeroWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tfor _, test := range zeros {\n\t\tassert.True(mockAssert.Zero(test), \"Zero should return true for %v\", test)\n\t}\n\n\tfor _, test := range nonZeros {\n\t\tassert.False(mockAssert.Zero(test), \"Zero should return false for %v\", test)\n\t}\n}\n\nfunc TestNotZeroWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tfor _, test := range zeros {\n\t\tassert.False(mockAssert.NotZero(test), \"Zero should return true for %v\", test)\n\t}\n\n\tfor _, test := range nonZeros {\n\t\tassert.True(mockAssert.NotZero(test), \"Zero should return false for %v\", test)\n\t}\n}\n\nfunc TestJSONEqWrapper_EqualSONString(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif !assert.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`) {\n\t\tt.Error(\"JSONEq should return true\")\n\t}\n\n}\n\nfunc TestJSONEqWrapper_EquivalentButNotEqual(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif !assert.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`) {\n\t\tt.Error(\"JSONEq should return true\")\n\t}\n\n}\n\nfunc TestJSONEqWrapper_HashOfArraysAndHashes(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif !assert.JSONEq(\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]],\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\"\\r\\n}\",\n\t\t\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\",\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]]\\r\\n}\") {\n\t\tt.Error(\"JSONEq should return true\")\n\t}\n}\n\nfunc TestJSONEqWrapper_Array(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif !assert.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`) {\n\t\tt.Error(\"JSONEq should return true\")\n\t}\n\n}\n\nfunc TestJSONEqWrapper_HashAndArrayNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`) {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_HashesNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(`{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`) {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ActualIsNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(`{\"foo\": \"bar\"}`, \"Not JSON\") {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ExpectedIsNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(\"Not JSON\", `{\"foo\": \"bar\", \"hello\": \"world\"}`) {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ExpectedAndActualNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(\"Not JSON\", \"Not JSON\") {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ArraysOfDifferentOrder(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`) {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_EqualYAMLString(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif !assert.YAMLEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`) {\n\t\tt.Error(\"YAMLEq should return true\")\n\t}\n\n}\n\nfunc TestYAMLEqWrapper_EquivalentButNotEqual(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif !assert.YAMLEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`) {\n\t\tt.Error(\"YAMLEq should return true\")\n\t}\n\n}\n\nfunc TestYAMLEqWrapper_HashOfArraysAndHashes(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\texpected := `\nnumeric: 1.5\narray:\n  - foo: bar\n  - 1\n  - \"string\"\n  - [\"nested\", \"array\", 5.5]\nhash:\n  nested: hash\n  nested_slice: [this, is, nested]\nstring: \"foo\"\n`\n\n\tactual := `\nnumeric: 1.5\nhash:\n  nested: hash\n  nested_slice: [this, is, nested]\nstring: \"foo\"\narray:\n  - foo: bar\n  - 1\n  - \"string\"\n  - [\"nested\", \"array\", 5.5]\n`\n\tif !assert.YAMLEq(expected, actual) {\n\t\tt.Error(\"YAMLEq should return true\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_Array(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif !assert.YAMLEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`) {\n\t\tt.Error(\"YAMLEq should return true\")\n\t}\n\n}\n\nfunc TestYAMLEqWrapper_HashAndArrayNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.YAMLEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`) {\n\t\tt.Error(\"YAMLEq should return false\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_HashesNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.YAMLEq(`{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`) {\n\t\tt.Error(\"YAMLEq should return false\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_ActualIsSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.YAMLEq(`{\"foo\": \"bar\"}`, \"Simple String\") {\n\t\tt.Error(\"YAMLEq should return false\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_ExpectedIsSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.YAMLEq(\"Simple String\", `{\"foo\": \"bar\", \"hello\": \"world\"}`) {\n\t\tt.Error(\"YAMLEq should return false\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_ExpectedAndActualSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif !assert.YAMLEq(\"Simple String\", \"Simple String\") {\n\t\tt.Error(\"YAMLEq should return true\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_ArraysOfDifferentOrder(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(new(testing.T))\n\tif assert.YAMLEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`) {\n\t\tt.Error(\"YAMLEq should return false\")\n\t}\n}\n"
  },
  {
    "path": "assert/http_assertions.go",
    "content": "package assert\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"net/url\"\n\t\"strings\"\n)\n\n// httpCode is a helper that returns HTTP code of the response. It returns -1 and\n// an error if building a new request fails.\nfunc httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) {\n\tw := httptest.NewRecorder()\n\treq, err := http.NewRequest(method, url, http.NoBody)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treq.URL.RawQuery = values.Encode()\n\thandler(w, req)\n\treturn w.Code, nil\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//\tassert.HTTPSuccess(t, myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err), msgAndArgs...)\n\t}\n\n\tisSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent\n\tif !isSuccessCode {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP success status code for %q but received %d\", url+\"?\"+values.Encode(), code), msgAndArgs...)\n\t}\n\n\treturn isSuccessCode\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//\tassert.HTTPRedirect(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err), msgAndArgs...)\n\t}\n\n\tisRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect\n\tif !isRedirectCode {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP redirect status code for %q but received %d\", url+\"?\"+values.Encode(), code), msgAndArgs...)\n\t}\n\n\treturn isRedirectCode\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//\tassert.HTTPError(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err), msgAndArgs...)\n\t}\n\n\tisErrorCode := code >= http.StatusBadRequest\n\tif !isErrorCode {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP error status code for %q but received %d\", url+\"?\"+values.Encode(), code), msgAndArgs...)\n\t}\n\n\treturn isErrorCode\n}\n\n// HTTPStatusCode asserts that a specified handler returns a specified status code.\n//\n//\tassert.HTTPStatusCode(t, myHandler, \"GET\", \"/notImplemented\", nil, 501)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err), msgAndArgs...)\n\t}\n\n\tsuccessful := code == statuscode\n\tif !successful {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP status code %d for %q but received %d\", statuscode, url+\"?\"+values.Encode(), code), msgAndArgs...)\n\t}\n\n\treturn successful\n}\n\n// HTTPBody is a helper that returns HTTP body of the response. It returns\n// empty string if building a new request fails.\nfunc HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string {\n\tw := httptest.NewRecorder()\n\tif len(values) > 0 {\n\t\turl += \"?\" + values.Encode()\n\t}\n\treq, err := http.NewRequest(method, url, http.NoBody)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\thandler(w, req)\n\treturn w.Body.String()\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//\tassert.HTTPBodyContains(t, myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tbody := HTTPBody(handler, method, url, values)\n\n\tcontains := strings.Contains(body, fmt.Sprint(str))\n\tif !contains {\n\t\tFail(t, fmt.Sprintf(\"Expected response body for %q to contain %q but found %q\", url+\"?\"+values.Encode(), str, body), msgAndArgs...)\n\t}\n\n\treturn contains\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//\tassert.HTTPBodyNotContains(t, myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tbody := HTTPBody(handler, method, url, values)\n\n\tcontains := strings.Contains(body, fmt.Sprint(str))\n\tif contains {\n\t\tFail(t, fmt.Sprintf(\"Expected response body for %q to NOT contain %q but found %q\", url+\"?\"+values.Encode(), str, body), msgAndArgs...)\n\t}\n\n\treturn !contains\n}\n"
  },
  {
    "path": "assert/http_assertions_test.go",
    "content": "package assert\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"testing\"\n)\n\nfunc httpOK(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}\n\nfunc httpReadBody(w http.ResponseWriter, r *http.Request) {\n\t_, _ = io.Copy(io.Discard, r.Body)\n\tw.WriteHeader(http.StatusOK)\n\t_, _ = w.Write([]byte(\"hello\"))\n}\n\nfunc httpRedirect(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusTemporaryRedirect)\n}\n\nfunc httpError(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusInternalServerError)\n}\n\nfunc httpStatusCode(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusSwitchingProtocols)\n}\n\nfunc TestHTTPSuccess(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\n\tmockT1 := new(testing.T)\n\tassert.Equal(HTTPSuccess(mockT1, httpOK, \"GET\", \"/\", nil), true)\n\tassert.False(mockT1.Failed())\n\n\tmockT2 := new(testing.T)\n\tassert.Equal(HTTPSuccess(mockT2, httpRedirect, \"GET\", \"/\", nil), false)\n\tassert.True(mockT2.Failed())\n\n\tmockT3 := new(mockTestingT)\n\tassert.Equal(HTTPSuccess(\n\t\tmockT3, httpError, \"GET\", \"/\", nil,\n\t\t\"was not expecting a failure here\",\n\t), false)\n\tassert.True(mockT3.Failed())\n\tassert.Contains(mockT3.errorString(), \"was not expecting a failure here\")\n\n\tmockT4 := new(testing.T)\n\tassert.Equal(HTTPSuccess(mockT4, httpStatusCode, \"GET\", \"/\", nil), false)\n\tassert.True(mockT4.Failed())\n\n\tmockT5 := new(testing.T)\n\tassert.Equal(HTTPSuccess(mockT5, httpReadBody, \"POST\", \"/\", nil), true)\n\tassert.False(mockT5.Failed())\n}\n\nfunc TestHTTPRedirect(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\n\tmockT1 := new(mockTestingT)\n\tassert.Equal(HTTPRedirect(\n\t\tmockT1, httpOK, \"GET\", \"/\", nil,\n\t\t\"was expecting a 3xx status code. Got 200.\",\n\t), false)\n\tassert.True(mockT1.Failed())\n\tassert.Contains(mockT1.errorString(), \"was expecting a 3xx status code. Got 200.\")\n\n\tmockT2 := new(testing.T)\n\tassert.Equal(HTTPRedirect(mockT2, httpRedirect, \"GET\", \"/\", nil), true)\n\tassert.False(mockT2.Failed())\n\n\tmockT3 := new(testing.T)\n\tassert.Equal(HTTPRedirect(mockT3, httpError, \"GET\", \"/\", nil), false)\n\tassert.True(mockT3.Failed())\n\n\tmockT4 := new(testing.T)\n\tassert.Equal(HTTPRedirect(mockT4, httpStatusCode, \"GET\", \"/\", nil), false)\n\tassert.True(mockT4.Failed())\n}\n\nfunc TestHTTPError(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\n\tmockT1 := new(testing.T)\n\tassert.Equal(HTTPError(mockT1, httpOK, \"GET\", \"/\", nil), false)\n\tassert.True(mockT1.Failed())\n\n\tmockT2 := new(mockTestingT)\n\tassert.Equal(HTTPError(\n\t\tmockT2, httpRedirect, \"GET\", \"/\", nil,\n\t\t\"Expected this request to error out. But it didn't\",\n\t), false)\n\tassert.True(mockT2.Failed())\n\tassert.Contains(mockT2.errorString(), \"Expected this request to error out. But it didn't\")\n\n\tmockT3 := new(testing.T)\n\tassert.Equal(HTTPError(mockT3, httpError, \"GET\", \"/\", nil), true)\n\tassert.False(mockT3.Failed())\n\n\tmockT4 := new(testing.T)\n\tassert.Equal(HTTPError(mockT4, httpStatusCode, \"GET\", \"/\", nil), false)\n\tassert.True(mockT4.Failed())\n}\n\nfunc TestHTTPStatusCode(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\n\tmockT1 := new(testing.T)\n\tassert.Equal(HTTPStatusCode(mockT1, httpOK, \"GET\", \"/\", nil, http.StatusSwitchingProtocols), false)\n\tassert.True(mockT1.Failed())\n\n\tmockT2 := new(testing.T)\n\tassert.Equal(HTTPStatusCode(mockT2, httpRedirect, \"GET\", \"/\", nil, http.StatusSwitchingProtocols), false)\n\tassert.True(mockT2.Failed())\n\n\tmockT3 := new(mockTestingT)\n\tassert.Equal(HTTPStatusCode(\n\t\tmockT3, httpError, \"GET\", \"/\", nil, http.StatusSwitchingProtocols,\n\t\t\"Expected the status code to be %d\", http.StatusSwitchingProtocols,\n\t), false)\n\tassert.True(mockT3.Failed())\n\tassert.Contains(mockT3.errorString(), \"Expected the status code to be 101\")\n\n\tmockT4 := new(testing.T)\n\tassert.Equal(HTTPStatusCode(mockT4, httpStatusCode, \"GET\", \"/\", nil, http.StatusSwitchingProtocols), true)\n\tassert.False(mockT4.Failed())\n}\n\nfunc TestHTTPStatusesWrapper(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.Equal(mockAssert.HTTPSuccess(httpOK, \"GET\", \"/\", nil), true)\n\tassert.Equal(mockAssert.HTTPSuccess(httpRedirect, \"GET\", \"/\", nil), false)\n\tassert.Equal(mockAssert.HTTPSuccess(httpError, \"GET\", \"/\", nil), false)\n\n\tassert.Equal(mockAssert.HTTPRedirect(httpOK, \"GET\", \"/\", nil), false)\n\tassert.Equal(mockAssert.HTTPRedirect(httpRedirect, \"GET\", \"/\", nil), true)\n\tassert.Equal(mockAssert.HTTPRedirect(httpError, \"GET\", \"/\", nil), false)\n\n\tassert.Equal(mockAssert.HTTPError(httpOK, \"GET\", \"/\", nil), false)\n\tassert.Equal(mockAssert.HTTPError(httpRedirect, \"GET\", \"/\", nil), false)\n\tassert.Equal(mockAssert.HTTPError(httpError, \"GET\", \"/\", nil), true)\n}\n\nfunc httpHelloName(w http.ResponseWriter, r *http.Request) {\n\tname := r.FormValue(\"name\")\n\t_, _ = fmt.Fprintf(w, \"Hello, %s!\", name)\n}\n\nfunc TestHTTPRequestWithNoParams(t *testing.T) {\n\tt.Parallel()\n\n\tvar got *http.Request\n\thandler := func(w http.ResponseWriter, r *http.Request) {\n\t\tgot = r\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n\n\tTrue(t, HTTPSuccess(t, handler, \"GET\", \"/url\", nil))\n\n\tEmpty(t, got.URL.Query())\n\tEqual(t, \"/url\", got.URL.RequestURI())\n}\n\nfunc TestHTTPRequestWithParams(t *testing.T) {\n\tt.Parallel()\n\n\tvar got *http.Request\n\thandler := func(w http.ResponseWriter, r *http.Request) {\n\t\tgot = r\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n\tparams := url.Values{}\n\tparams.Add(\"id\", \"12345\")\n\n\tTrue(t, HTTPSuccess(t, handler, \"GET\", \"/url\", params))\n\n\tEqual(t, url.Values{\"id\": []string{\"12345\"}}, got.URL.Query())\n\tEqual(t, \"/url?id=12345\", got.URL.String())\n\tEqual(t, \"/url?id=12345\", got.URL.RequestURI())\n}\n\nfunc TestHttpBody(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockT := new(mockTestingT)\n\n\tassert.True(HTTPBodyContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"Hello, World!\"))\n\tassert.True(HTTPBodyContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"World\"))\n\tassert.False(HTTPBodyContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"world\"))\n\n\tassert.False(HTTPBodyNotContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"Hello, World!\"))\n\tassert.False(HTTPBodyNotContains(\n\t\tmockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"World\",\n\t\t\"Expected the request body to not contain 'World'. But it did.\",\n\t))\n\tassert.True(HTTPBodyNotContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"world\"))\n\tassert.Contains(mockT.errorString(), \"Expected the request body to not contain 'World'. But it did.\")\n\n\tassert.True(HTTPBodyContains(mockT, httpReadBody, \"GET\", \"/\", nil, \"hello\"))\n}\n\nfunc TestHttpBodyWrappers(t *testing.T) {\n\tt.Parallel()\n\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.True(mockAssert.HTTPBodyContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"Hello, World!\"))\n\tassert.True(mockAssert.HTTPBodyContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"World\"))\n\tassert.False(mockAssert.HTTPBodyContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"world\"))\n\n\tassert.False(mockAssert.HTTPBodyNotContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"Hello, World!\"))\n\tassert.False(mockAssert.HTTPBodyNotContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"World\"))\n\tassert.True(mockAssert.HTTPBodyNotContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"world\"))\n}\n"
  },
  {
    "path": "assert/internal/unsafetests/doc.go",
    "content": "// This package exists just to isolate tests that reference the [unsafe] package.\n//\n// The tests in this package are totally safe.\npackage unsafetests\n"
  },
  {
    "path": "assert/internal/unsafetests/unsafetests_test.go",
    "content": "package unsafetests_test\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\t\"unsafe\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\ntype ignoreTestingT struct{}\n\nvar _ assert.TestingT = ignoreTestingT{}\n\nfunc (ignoreTestingT) Helper() {}\n\nfunc (ignoreTestingT) Errorf(format string, args ...interface{}) {\n\t// Run the formatting, but ignore the result\n\tmsg := fmt.Sprintf(format, args...)\n\t_ = msg\n}\n\nfunc TestUnsafePointers(t *testing.T) {\n\tvar ignore ignoreTestingT\n\n\tassert.True(t, assert.Nil(t, unsafe.Pointer(nil), \"unsafe.Pointer(nil) is nil\"))\n\tassert.False(t, assert.NotNil(ignore, unsafe.Pointer(nil), \"unsafe.Pointer(nil) is nil\"))\n\n\tassert.True(t, assert.Nil(t, unsafe.Pointer((*int)(nil)), \"unsafe.Pointer((*int)(nil)) is nil\"))\n\tassert.False(t, assert.NotNil(ignore, unsafe.Pointer((*int)(nil)), \"unsafe.Pointer((*int)(nil)) is nil\"))\n\n\tassert.False(t, assert.Nil(ignore, unsafe.Pointer(new(int)), \"unsafe.Pointer(new(int)) is NOT nil\"))\n\tassert.True(t, assert.NotNil(t, unsafe.Pointer(new(int)), \"unsafe.Pointer(new(int)) is NOT nil\"))\n}\n"
  },
  {
    "path": "assert/yaml/yaml_custom.go",
    "content": "//go:build testify_yaml_custom && !testify_yaml_fail && !testify_yaml_default\n\n// Package yaml is an implementation of YAML functions that calls a pluggable implementation.\n//\n// This implementation is selected with the testify_yaml_custom build tag.\n//\n//\tgo test -tags testify_yaml_custom\n//\n// This implementation can be used at build time to replace the default implementation\n// to avoid linking with [gopkg.in/yaml.v3].\n//\n// In your test package:\n//\n//\t\timport assertYaml \"github.com/stretchr/testify/assert/yaml\"\n//\n//\t\tfunc init() {\n//\t\t\tassertYaml.Unmarshal = func (in []byte, out interface{}) error {\n//\t\t\t\t// ...\n//\t     \t\t\treturn nil\n//\t\t\t}\n//\t\t}\npackage yaml\n\nvar Unmarshal func(in []byte, out interface{}) error\n"
  },
  {
    "path": "assert/yaml/yaml_default.go",
    "content": "//go:build !testify_yaml_fail && !testify_yaml_custom\n\n// Package yaml is just an indirection to handle YAML deserialization.\n//\n// This package is just an indirection that allows the builder to override the\n// indirection with an alternative implementation of this package that uses\n// another implementation of YAML deserialization. This allows to not either not\n// use YAML deserialization at all, or to use another implementation than\n// [gopkg.in/yaml.v3] (for example for license compatibility reasons, see [PR #1120]).\n//\n// Alternative implementations are selected using build tags:\n//\n//   - testify_yaml_fail: [Unmarshal] always fails with an error\n//   - testify_yaml_custom: [Unmarshal] is a variable. Caller must initialize it\n//     before calling any of [github.com/stretchr/testify/assert.YAMLEq] or\n//     [github.com/stretchr/testify/assert.YAMLEqf].\n//\n// Usage:\n//\n//\tgo test -tags testify_yaml_fail\n//\n// You can check with \"go list\" which implementation is linked:\n//\n//\tgo list -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml\n//\tgo list -tags testify_yaml_fail -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml\n//\tgo list -tags testify_yaml_custom -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml\n//\n// [PR #1120]: https://github.com/stretchr/testify/pull/1120\npackage yaml\n\nimport goyaml \"gopkg.in/yaml.v3\"\n\n// Unmarshal is just a wrapper of [gopkg.in/yaml.v3.Unmarshal].\nfunc Unmarshal(in []byte, out interface{}) error {\n\treturn goyaml.Unmarshal(in, out)\n}\n"
  },
  {
    "path": "assert/yaml/yaml_fail.go",
    "content": "//go:build testify_yaml_fail && !testify_yaml_custom && !testify_yaml_default\n\n// Package yaml is an implementation of YAML functions that always fail.\n//\n// This implementation can be used at build time to replace the default implementation\n// to avoid linking with [gopkg.in/yaml.v3]:\n//\n//\tgo test -tags testify_yaml_fail\npackage yaml\n\nimport \"errors\"\n\nvar errNotImplemented = errors.New(\"YAML functions are not available (see https://pkg.go.dev/github.com/stretchr/testify/assert/yaml)\")\n\nfunc Unmarshal([]byte, interface{}) error {\n\treturn errNotImplemented\n}\n"
  },
  {
    "path": "doc.go",
    "content": "// Module testify is a set of packages that provide many tools for testifying that your code will behave as you intend.\n//\n// Testify contains the following packages:\n//\n// The [github.com/stretchr/testify/assert] package provides a comprehensive set of assertion functions that tie in to [the Go testing system].\n// The [github.com/stretchr/testify/require] package provides the same assertions but as fatal checks.\n//\n// The [github.com/stretchr/testify/mock] package provides a system by which it is possible to mock your objects and verify calls are happening as expected.\n//\n// The [github.com/stretchr/testify/suite] package provides a basic structure for using structs as testing suites, and methods on those structs as tests.  It includes setup/teardown functionality in the way of interfaces.\n//\n// A [golangci-lint] compatible linter for testify is available called [testifylint].\n//\n// [the Go testing system]: https://go.dev/doc/code#Testing\n// [golangci-lint]: https://golangci-lint.run/\n// [testifylint]: https://github.com/Antonboom/testifylint\npackage testify\n"
  },
  {
    "path": "go.mod",
    "content": "module github.com/stretchr/testify\n\n// This should match the minimum supported version that is tested in\n// .github/workflows/main.yml\ngo 1.17\n\nrequire (\n\tgithub.com/stretchr/objx v0.5.2 // To avoid a cycle the version of testify used by objx should be excluded below\n\tgopkg.in/yaml.v3 v3.0.1\n)\n\n// Break dependency cycle with objx.\n// See https://github.com/stretchr/objx/pull/140\nexclude github.com/stretchr/testify v1.8.4\n"
  },
  {
    "path": "go.sum",
    "content": "github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=\ngithub.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=\ngithub.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=\ngopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=\ngopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=\ngopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\n"
  },
  {
    "path": "http/doc.go",
    "content": "// Deprecated: Use [net/http/httptest] instead.\npackage http\n"
  },
  {
    "path": "http/test_response_writer.go",
    "content": "package http\n\nimport (\n\t\"net/http\"\n)\n\n// Deprecated: Use [net/http/httptest] instead.\ntype TestResponseWriter struct {\n\n\t// StatusCode is the last int written by the call to WriteHeader(int)\n\tStatusCode int\n\n\t// Output is a string containing the written bytes using the Write([]byte) func.\n\tOutput string\n\n\t// header is the internal storage of the http.Header object\n\theader http.Header\n}\n\n// Deprecated: Use [net/http/httptest] instead.\nfunc (rw *TestResponseWriter) Header() http.Header {\n\n\tif rw.header == nil {\n\t\trw.header = make(http.Header)\n\t}\n\n\treturn rw.header\n}\n\n// Deprecated: Use [net/http/httptest] instead.\nfunc (rw *TestResponseWriter) Write(bytes []byte) (int, error) {\n\n\t// assume 200 success if no header has been set\n\tif rw.StatusCode == 0 {\n\t\trw.WriteHeader(200)\n\t}\n\n\t// add these bytes to the output string\n\trw.Output += string(bytes)\n\n\t// return normal values\n\treturn 0, nil\n\n}\n\n// Deprecated: Use [net/http/httptest] instead.\nfunc (rw *TestResponseWriter) WriteHeader(i int) {\n\trw.StatusCode = i\n}\n"
  },
  {
    "path": "http/test_round_tripper.go",
    "content": "package http\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/stretchr/testify/mock\"\n)\n\n// Deprecated: Use [net/http/httptest] instead.\ntype TestRoundTripper struct {\n\tmock.Mock\n}\n\n// Deprecated: Use [net/http/httptest] instead.\nfunc (t *TestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {\n\targs := t.Called(req)\n\treturn args.Get(0).(*http.Response), args.Error(1)\n}\n"
  },
  {
    "path": "internal/difflib/LICENSE",
    "content": "Copyright (c) 2013, Patrick Mezard\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n    Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n    Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n    The names of its contributors may not be used to endorse or promote\nproducts derived from this software without specific prior written\npermission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\nIS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
  },
  {
    "path": "internal/difflib/difflib.go",
    "content": "// Package difflib is a partial port of Python difflib module.\n//\n// It provides tools to compare sequences of strings and generate textual diffs.\n//\n// The following class and functions have been ported:\n//\n// - SequenceMatcher\n//\n// - unified_diff\n//\n// Getting unified diffs was the main goal of the port. Keep in mind this code\n// is mostly suitable to output text differences in a human friendly way, there\n// are no guarantees generated diffs are consumable by patch(1).\n//\n// This package was adopted from [github.com/pmezard/go-difflib] which\n// is no longer maintained.\n//\n// [github.com/pmezard/go-difflib]: https://github.com/pmezard/go-difflib\npackage difflib\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"strings\"\n)\n\nfunc min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc max(a, b int) int {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}\n\ntype Match struct {\n\tA    int\n\tB    int\n\tSize int\n}\n\ntype OpCode struct {\n\tTag byte\n\tI1  int\n\tI2  int\n\tJ1  int\n\tJ2  int\n}\n\n// SequenceMatcher compares sequence of strings. The basic\n// algorithm predates, and is a little fancier than, an algorithm\n// published in the late 1980's by Ratcliff and Obershelp under the\n// hyperbolic name \"gestalt pattern matching\".  The basic idea is to find\n// the longest contiguous matching subsequence that contains no \"junk\"\n// elements (R-O doesn't address junk).  The same idea is then applied\n// recursively to the pieces of the sequences to the left and to the right\n// of the matching subsequence.  This does not yield minimal edit\n// sequences, but does tend to yield matches that \"look right\" to people.\n//\n// SequenceMatcher tries to compute a \"human-friendly diff\" between two\n// sequences.  Unlike e.g. UNIX(tm) diff, the fundamental notion is the\n// longest *contiguous* & junk-free matching subsequence.  That's what\n// catches peoples' eyes.  The Windows(tm) windiff has another interesting\n// notion, pairing up elements that appear uniquely in each sequence.\n// That, and the method here, appear to yield more intuitive difference\n// reports than does diff.  This method appears to be the least vulnerable\n// to synching up on blocks of \"junk lines\", though (like blank lines in\n// ordinary text files, or maybe \"<P>\" lines in HTML files).  That may be\n// because this is the only method of the 3 that has a *concept* of\n// \"junk\" <wink>.\n//\n// Timing:  Basic R-O is cubic time worst case and quadratic time expected\n// case.  SequenceMatcher is quadratic time for the worst case and has\n// expected-case behavior dependent in a complicated way on how many\n// elements the sequences have in common; best case time is linear.\ntype SequenceMatcher struct {\n\ta              []string\n\tb              []string\n\tb2j            map[string][]int\n\tIsJunk         func(string) bool\n\tautoJunk       bool\n\tbJunk          map[string]struct{}\n\tmatchingBlocks []Match\n\tfullBCount     map[string]int\n\tbPopular       map[string]struct{}\n\topCodes        []OpCode\n}\n\nfunc NewMatcher(a, b []string) *SequenceMatcher {\n\tm := SequenceMatcher{autoJunk: true}\n\tm.SetSeqs(a, b)\n\treturn &m\n}\n\n// Set two sequences to be compared.\nfunc (m *SequenceMatcher) SetSeqs(a, b []string) {\n\tm.SetSeq1(a)\n\tm.SetSeq2(b)\n}\n\n// Set the first sequence to be compared. The second sequence to be compared is\n// not changed.\n//\n// SequenceMatcher computes and caches detailed information about the second\n// sequence, so if you want to compare one sequence S against many sequences,\n// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other\n// sequences.\n//\n// See also SetSeqs() and SetSeq2().\nfunc (m *SequenceMatcher) SetSeq1(a []string) {\n\tif &a == &m.a {\n\t\treturn\n\t}\n\tm.a = a\n\tm.matchingBlocks = nil\n\tm.opCodes = nil\n}\n\n// Set the second sequence to be compared. The first sequence to be compared is\n// not changed.\nfunc (m *SequenceMatcher) SetSeq2(b []string) {\n\tif &b == &m.b {\n\t\treturn\n\t}\n\tm.b = b\n\tm.matchingBlocks = nil\n\tm.opCodes = nil\n\tm.fullBCount = nil\n\tm.chainB()\n}\n\nfunc (m *SequenceMatcher) chainB() {\n\t// Populate line -> index mapping\n\tb2j := map[string][]int{}\n\tfor i, s := range m.b {\n\t\tindices := b2j[s]\n\t\tindices = append(indices, i)\n\t\tb2j[s] = indices\n\t}\n\n\t// Purge junk elements\n\tm.bJunk = map[string]struct{}{}\n\tif m.IsJunk != nil {\n\t\tjunk := m.bJunk\n\t\tfor s, _ := range b2j {\n\t\t\tif m.IsJunk(s) {\n\t\t\t\tjunk[s] = struct{}{}\n\t\t\t}\n\t\t}\n\t\tfor s, _ := range junk {\n\t\t\tdelete(b2j, s)\n\t\t}\n\t}\n\n\t// Purge remaining popular elements\n\tpopular := map[string]struct{}{}\n\tn := len(m.b)\n\tif m.autoJunk && n >= 200 {\n\t\tntest := n/100 + 1\n\t\tfor s, indices := range b2j {\n\t\t\tif len(indices) > ntest {\n\t\t\t\tpopular[s] = struct{}{}\n\t\t\t}\n\t\t}\n\t\tfor s, _ := range popular {\n\t\t\tdelete(b2j, s)\n\t\t}\n\t}\n\tm.bPopular = popular\n\tm.b2j = b2j\n}\n\nfunc (m *SequenceMatcher) isBJunk(s string) bool {\n\t_, ok := m.bJunk[s]\n\treturn ok\n}\n\n// Find longest matching block in a[alo:ahi] and b[blo:bhi].\n//\n// If IsJunk is not defined:\n//\n// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where\n//\n//\talo <= i <= i+k <= ahi\n//\tblo <= j <= j+k <= bhi\n//\n// and for all (i',j',k') meeting those conditions,\n//\n//\tk >= k'\n//\ti <= i'\n//\tand if i == i', j <= j'\n//\n// In other words, of all maximal matching blocks, return one that\n// starts earliest in a, and of all those maximal matching blocks that\n// start earliest in a, return the one that starts earliest in b.\n//\n// If IsJunk is defined, first the longest matching block is\n// determined as above, but with the additional restriction that no\n// junk element appears in the block.  Then that block is extended as\n// far as possible by matching (only) junk elements on both sides.  So\n// the resulting block never matches on junk except as identical junk\n// happens to be adjacent to an \"interesting\" match.\n//\n// If no blocks match, return (alo, blo, 0).\nfunc (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match {\n\t// CAUTION:  stripping common prefix or suffix would be incorrect.\n\t// E.g.,\n\t//    ab\n\t//    acab\n\t// Longest matching block is \"ab\", but if common prefix is\n\t// stripped, it's \"a\" (tied with \"b\").  UNIX(tm) diff does so\n\t// strip, so ends up claiming that ab is changed to acab by\n\t// inserting \"ca\" in the middle.  That's minimal but unintuitive:\n\t// \"it's obvious\" that someone inserted \"ac\" at the front.\n\t// Windiff ends up at the same place as diff, but by pairing up\n\t// the unique 'b's and then matching the first two 'a's.\n\tbesti, bestj, bestsize := alo, blo, 0\n\n\t// find longest junk-free match\n\t// during an iteration of the loop, j2len[j] = length of longest\n\t// junk-free match ending with a[i-1] and b[j]\n\tj2len := map[int]int{}\n\tfor i := alo; i != ahi; i++ {\n\t\t// look at all instances of a[i] in b; note that because\n\t\t// b2j has no junk keys, the loop is skipped if a[i] is junk\n\t\tnewj2len := map[int]int{}\n\t\tfor _, j := range m.b2j[m.a[i]] {\n\t\t\t// a[i] matches b[j]\n\t\t\tif j < blo {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif j >= bhi {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tk := j2len[j-1] + 1\n\t\t\tnewj2len[j] = k\n\t\t\tif k > bestsize {\n\t\t\t\tbesti, bestj, bestsize = i-k+1, j-k+1, k\n\t\t\t}\n\t\t}\n\t\tj2len = newj2len\n\t}\n\n\t// Extend the best by non-junk elements on each end.  In particular,\n\t// \"popular\" non-junk elements aren't in b2j, which greatly speeds\n\t// the inner loop above, but also means \"the best\" match so far\n\t// doesn't contain any junk *or* popular non-junk elements.\n\tfor besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) &&\n\t\tm.a[besti-1] == m.b[bestj-1] {\n\t\tbesti, bestj, bestsize = besti-1, bestj-1, bestsize+1\n\t}\n\tfor besti+bestsize < ahi && bestj+bestsize < bhi &&\n\t\t!m.isBJunk(m.b[bestj+bestsize]) &&\n\t\tm.a[besti+bestsize] == m.b[bestj+bestsize] {\n\t\tbestsize += 1\n\t}\n\n\t// Now that we have a wholly interesting match (albeit possibly\n\t// empty!), we may as well suck up the matching junk on each\n\t// side of it too.  Can't think of a good reason not to, and it\n\t// saves post-processing the (possibly considerable) expense of\n\t// figuring out what to do with it.  In the case of an empty\n\t// interesting match, this is clearly the right thing to do,\n\t// because no other kind of match is possible in the regions.\n\tfor besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) &&\n\t\tm.a[besti-1] == m.b[bestj-1] {\n\t\tbesti, bestj, bestsize = besti-1, bestj-1, bestsize+1\n\t}\n\tfor besti+bestsize < ahi && bestj+bestsize < bhi &&\n\t\tm.isBJunk(m.b[bestj+bestsize]) &&\n\t\tm.a[besti+bestsize] == m.b[bestj+bestsize] {\n\t\tbestsize += 1\n\t}\n\n\treturn Match{A: besti, B: bestj, Size: bestsize}\n}\n\n// Return list of triples describing matching subsequences.\n//\n// Each triple is of the form (i, j, n), and means that\n// a[i:i+n] == b[j:j+n].  The triples are monotonically increasing in\n// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are\n// adjacent triples in the list, and the second is not the last triple in the\n// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe\n// adjacent equal blocks.\n//\n// The last triple is a dummy, (len(a), len(b), 0), and is the only\n// triple with n==0.\nfunc (m *SequenceMatcher) GetMatchingBlocks() []Match {\n\tif m.matchingBlocks != nil {\n\t\treturn m.matchingBlocks\n\t}\n\n\tvar matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match\n\tmatchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match {\n\t\tmatch := m.findLongestMatch(alo, ahi, blo, bhi)\n\t\ti, j, k := match.A, match.B, match.Size\n\t\tif match.Size > 0 {\n\t\t\tif alo < i && blo < j {\n\t\t\t\tmatched = matchBlocks(alo, i, blo, j, matched)\n\t\t\t}\n\t\t\tmatched = append(matched, match)\n\t\t\tif i+k < ahi && j+k < bhi {\n\t\t\t\tmatched = matchBlocks(i+k, ahi, j+k, bhi, matched)\n\t\t\t}\n\t\t}\n\t\treturn matched\n\t}\n\tmatched := matchBlocks(0, len(m.a), 0, len(m.b), nil)\n\n\t// It's possible that we have adjacent equal blocks in the\n\t// matching_blocks list now.\n\tnonAdjacent := []Match{}\n\ti1, j1, k1 := 0, 0, 0\n\tfor _, b := range matched {\n\t\t// Is this block adjacent to i1, j1, k1?\n\t\ti2, j2, k2 := b.A, b.B, b.Size\n\t\tif i1+k1 == i2 && j1+k1 == j2 {\n\t\t\t// Yes, so collapse them -- this just increases the length of\n\t\t\t// the first block by the length of the second, and the first\n\t\t\t// block so lengthened remains the block to compare against.\n\t\t\tk1 += k2\n\t\t} else {\n\t\t\t// Not adjacent.  Remember the first block (k1==0 means it's\n\t\t\t// the dummy we started with), and make the second block the\n\t\t\t// new block to compare against.\n\t\t\tif k1 > 0 {\n\t\t\t\tnonAdjacent = append(nonAdjacent, Match{i1, j1, k1})\n\t\t\t}\n\t\t\ti1, j1, k1 = i2, j2, k2\n\t\t}\n\t}\n\tif k1 > 0 {\n\t\tnonAdjacent = append(nonAdjacent, Match{i1, j1, k1})\n\t}\n\n\tnonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0})\n\tm.matchingBlocks = nonAdjacent\n\treturn m.matchingBlocks\n}\n\n// Return list of 5-tuples describing how to turn a into b.\n//\n// Each tuple is of the form (tag, i1, i2, j1, j2).  The first tuple\n// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the\n// tuple preceding it, and likewise for j1 == the previous j2.\n//\n// The tags are characters, with these meanings:\n//\n// 'r' (replace):  a[i1:i2] should be replaced by b[j1:j2]\n//\n// 'd' (delete):   a[i1:i2] should be deleted, j1==j2 in this case.\n//\n// 'i' (insert):   b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case.\n//\n// 'e' (equal):    a[i1:i2] == b[j1:j2]\nfunc (m *SequenceMatcher) GetOpCodes() []OpCode {\n\tif m.opCodes != nil {\n\t\treturn m.opCodes\n\t}\n\ti, j := 0, 0\n\tmatching := m.GetMatchingBlocks()\n\topCodes := make([]OpCode, 0, len(matching))\n\tfor _, m := range matching {\n\t\t//  invariant:  we've pumped out correct diffs to change\n\t\t//  a[:i] into b[:j], and the next matching block is\n\t\t//  a[ai:ai+size] == b[bj:bj+size]. So we need to pump\n\t\t//  out a diff to change a[i:ai] into b[j:bj], pump out\n\t\t//  the matching block, and move (i,j) beyond the match\n\t\tai, bj, size := m.A, m.B, m.Size\n\t\ttag := byte(0)\n\t\tif i < ai && j < bj {\n\t\t\ttag = 'r'\n\t\t} else if i < ai {\n\t\t\ttag = 'd'\n\t\t} else if j < bj {\n\t\t\ttag = 'i'\n\t\t}\n\t\tif tag > 0 {\n\t\t\topCodes = append(opCodes, OpCode{tag, i, ai, j, bj})\n\t\t}\n\t\ti, j = ai+size, bj+size\n\t\t// the list of matching blocks is terminated by a\n\t\t// sentinel with size 0\n\t\tif size > 0 {\n\t\t\topCodes = append(opCodes, OpCode{'e', ai, i, bj, j})\n\t\t}\n\t}\n\tm.opCodes = opCodes\n\treturn m.opCodes\n}\n\n// Isolate change clusters by eliminating ranges with no changes.\n//\n// Return a generator of groups with up to n lines of context.\n// Each group is in the same format as returned by GetOpCodes().\nfunc (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {\n\tif n < 0 {\n\t\tn = 3\n\t}\n\tcodes := m.GetOpCodes()\n\tif len(codes) == 0 {\n\t\tcodes = []OpCode{OpCode{'e', 0, 1, 0, 1}}\n\t}\n\t// Fixup leading and trailing groups if they show no changes.\n\tif codes[0].Tag == 'e' {\n\t\tc := codes[0]\n\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\tcodes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2}\n\t}\n\tif codes[len(codes)-1].Tag == 'e' {\n\t\tc := codes[len(codes)-1]\n\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\tcodes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)}\n\t}\n\tnn := n + n\n\tgroups := [][]OpCode{}\n\tgroup := []OpCode{}\n\tfor _, c := range codes {\n\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\t// End the current group and start a new one whenever\n\t\t// there is a large range with no changes.\n\t\tif c.Tag == 'e' && i2-i1 > nn {\n\t\t\tgroup = append(group, OpCode{c.Tag, i1, min(i2, i1+n),\n\t\t\t\tj1, min(j2, j1+n)})\n\t\t\tgroups = append(groups, group)\n\t\t\tgroup = []OpCode{}\n\t\t\ti1, j1 = max(i1, i2-n), max(j1, j2-n)\n\t\t}\n\t\tgroup = append(group, OpCode{c.Tag, i1, i2, j1, j2})\n\t}\n\tif len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') {\n\t\tgroups = append(groups, group)\n\t}\n\treturn groups\n}\n\n// Convert range to the \"ed\" format\nfunc formatRangeUnified(start, stop int) string {\n\t// Per the diff spec at http://www.unix.org/single_unix_specification/\n\tbeginning := start + 1 // lines start numbering with one\n\tlength := stop - start\n\tif length == 1 {\n\t\treturn fmt.Sprintf(\"%d\", beginning)\n\t}\n\tif length == 0 {\n\t\tbeginning -= 1 // empty ranges begin at line just before the range\n\t}\n\treturn fmt.Sprintf(\"%d,%d\", beginning, length)\n}\n\n// Unified diff parameters\ntype UnifiedDiff struct {\n\tA        []string // First sequence lines\n\tFromFile string   // First file name\n\tFromDate string   // First file time\n\tB        []string // Second sequence lines\n\tToFile   string   // Second file name\n\tToDate   string   // Second file time\n\tEol      string   // Headers end of line, defaults to LF\n\tContext  int      // Number of context lines\n}\n\n// Compare two sequences of lines; generate the delta as a unified diff.\n//\n// Unified diffs are a compact way of showing line changes and a few\n// lines of context.  The number of context lines is set by 'n' which\n// defaults to three.\n//\n// By default, the diff control lines (those with ---, +++, or @@) are\n// created with a trailing newline.  This is helpful so that inputs\n// created from file.readlines() result in diffs that are suitable for\n// file.writelines() since both the inputs and outputs have trailing\n// newlines.\n//\n// For inputs that do not have trailing newlines, set the lineterm\n// argument to \"\" so that the output will be uniformly newline free.\n//\n// The unidiff format normally has a header for filenames and modification\n// times.  Any or all of these may be specified using strings for\n// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.\n// The modification times are normally expressed in the ISO 8601 format.\nfunc WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {\n\tbuf := bufio.NewWriter(writer)\n\tdefer buf.Flush()\n\twf := func(format string, args ...interface{}) error {\n\t\t_, err := buf.WriteString(fmt.Sprintf(format, args...))\n\t\treturn err\n\t}\n\tws := func(s string) error {\n\t\t_, err := buf.WriteString(s)\n\t\treturn err\n\t}\n\n\tif len(diff.Eol) == 0 {\n\t\tdiff.Eol = \"\\n\"\n\t}\n\n\tstarted := false\n\tm := NewMatcher(diff.A, diff.B)\n\tfor _, g := range m.GetGroupedOpCodes(diff.Context) {\n\t\tif !started {\n\t\t\tstarted = true\n\t\t\tfromDate := \"\"\n\t\t\tif len(diff.FromDate) > 0 {\n\t\t\t\tfromDate = \"\\t\" + diff.FromDate\n\t\t\t}\n\t\t\ttoDate := \"\"\n\t\t\tif len(diff.ToDate) > 0 {\n\t\t\t\ttoDate = \"\\t\" + diff.ToDate\n\t\t\t}\n\t\t\tif diff.FromFile != \"\" || diff.ToFile != \"\" {\n\t\t\t\terr := wf(\"--- %s%s%s\", diff.FromFile, fromDate, diff.Eol)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\terr = wf(\"+++ %s%s%s\", diff.ToFile, toDate, diff.Eol)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfirst, last := g[0], g[len(g)-1]\n\t\trange1 := formatRangeUnified(first.I1, last.I2)\n\t\trange2 := formatRangeUnified(first.J1, last.J2)\n\t\tif err := wf(\"@@ -%s +%s @@%s\", range1, range2, diff.Eol); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, c := range g {\n\t\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\t\tif c.Tag == 'e' {\n\t\t\t\tfor _, line := range diff.A[i1:i2] {\n\t\t\t\t\tif err := ws(\" \" + line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif c.Tag == 'r' || c.Tag == 'd' {\n\t\t\t\tfor _, line := range diff.A[i1:i2] {\n\t\t\t\t\tif err := ws(\"-\" + line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif c.Tag == 'r' || c.Tag == 'i' {\n\t\t\t\tfor _, line := range diff.B[j1:j2] {\n\t\t\t\t\tif err := ws(\"+\" + line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// Like WriteUnifiedDiff but returns the diff a string.\nfunc GetUnifiedDiffString(diff UnifiedDiff) (string, error) {\n\tw := &bytes.Buffer{}\n\terr := WriteUnifiedDiff(w, diff)\n\treturn string(w.Bytes()), err\n}\n\n// Convert range to the \"ed\" format.\nfunc formatRangeContext(start, stop int) string {\n\t// Per the diff spec at http://www.unix.org/single_unix_specification/\n\tbeginning := start + 1 // lines start numbering with one\n\tlength := stop - start\n\tif length == 0 {\n\t\tbeginning -= 1 // empty ranges begin at line just before the range\n\t}\n\tif length <= 1 {\n\t\treturn fmt.Sprintf(\"%d\", beginning)\n\t}\n\treturn fmt.Sprintf(\"%d,%d\", beginning, beginning+length-1)\n}\n\n// Split a string on \"\\n\" while preserving them. The output can be used\n// as input for UnifiedDiff and ContextDiff structures.\nfunc SplitLines(s string) []string {\n\tlines := strings.SplitAfter(s, \"\\n\")\n\tlines[len(lines)-1] += \"\\n\"\n\treturn lines\n}\n"
  },
  {
    "path": "internal/difflib/difflib_test.go",
    "content": "package difflib\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"math\"\n\t\"reflect\"\n\t\"strings\"\n\t\"testing\"\n)\n\nfunc assertAlmostEqual(t *testing.T, a, b float64, places int) {\n\tif math.Abs(a-b) > math.Pow10(-places) {\n\t\tt.Errorf(\"%.7f != %.7f\", a, b)\n\t}\n}\n\nfunc assertEqual(t *testing.T, a, b interface{}) {\n\tif !reflect.DeepEqual(a, b) {\n\t\tt.Errorf(\"%v != %v\", a, b)\n\t}\n}\n\nfunc splitChars(s string) []string {\n\tchars := make([]string, 0, len(s))\n\t// Assume ASCII inputs\n\tfor i := 0; i != len(s); i++ {\n\t\tchars = append(chars, string(s[i]))\n\t}\n\treturn chars\n}\n\nfunc TestGetOptCodes(t *testing.T) {\n\ta := \"qabxcd\"\n\tb := \"abycdf\"\n\ts := NewMatcher(splitChars(a), splitChars(b))\n\tw := &bytes.Buffer{}\n\tfor _, op := range s.GetOpCodes() {\n\t\tfmt.Fprintf(w, \"%s a[%d:%d], (%s) b[%d:%d] (%s)\\n\", string(op.Tag),\n\t\t\top.I1, op.I2, a[op.I1:op.I2], op.J1, op.J2, b[op.J1:op.J2])\n\t}\n\tresult := string(w.Bytes())\n\texpected := `d a[0:1], (q) b[0:0] ()\ne a[1:3], (ab) b[0:2] (ab)\nr a[3:4], (x) b[2:3] (y)\ne a[4:6], (cd) b[3:5] (cd)\ni a[6:6], () b[5:6] (f)\n`\n\tif expected != result {\n\t\tt.Errorf(\"unexpected op codes: \\n%s\", result)\n\t}\n}\n\nfunc TestGroupedOpCodes(t *testing.T) {\n\ta := []string{}\n\tfor i := 0; i != 39; i++ {\n\t\ta = append(a, fmt.Sprintf(\"%02d\", i))\n\t}\n\tb := []string{}\n\tb = append(b, a[:8]...)\n\tb = append(b, \" i\")\n\tb = append(b, a[8:19]...)\n\tb = append(b, \" x\")\n\tb = append(b, a[20:22]...)\n\tb = append(b, a[27:34]...)\n\tb = append(b, \" y\")\n\tb = append(b, a[35:]...)\n\ts := NewMatcher(a, b)\n\tw := &bytes.Buffer{}\n\tfor _, g := range s.GetGroupedOpCodes(-1) {\n\t\tfmt.Fprintf(w, \"group\\n\")\n\t\tfor _, op := range g {\n\t\t\tfmt.Fprintf(w, \"  %s, %d, %d, %d, %d\\n\", string(op.Tag),\n\t\t\t\top.I1, op.I2, op.J1, op.J2)\n\t\t}\n\t}\n\tresult := string(w.Bytes())\n\texpected := `group\n  e, 5, 8, 5, 8\n  i, 8, 8, 8, 9\n  e, 8, 11, 9, 12\ngroup\n  e, 16, 19, 17, 20\n  r, 19, 20, 20, 21\n  e, 20, 22, 21, 23\n  d, 22, 27, 23, 23\n  e, 27, 30, 23, 26\ngroup\n  e, 31, 34, 27, 30\n  r, 34, 35, 30, 31\n  e, 35, 38, 31, 34\n`\n\tif expected != result {\n\t\tt.Errorf(\"unexpected op codes: \\n%s\", result)\n\t}\n}\n\nfunc rep(s string, count int) string {\n\treturn strings.Repeat(s, count)\n}\n\nfunc TestWithAsciiOneInsert(t *testing.T) {\n\tsm := NewMatcher(splitChars(rep(\"b\", 100)),\n\t\tsplitChars(\"a\"+rep(\"b\", 100)))\n\tassertEqual(t, sm.GetOpCodes(),\n\t\t[]OpCode{{'i', 0, 0, 0, 1}, {'e', 0, 100, 1, 101}})\n\tassertEqual(t, len(sm.bPopular), 0)\n\n\tsm = NewMatcher(splitChars(rep(\"b\", 100)),\n\t\tsplitChars(rep(\"b\", 50)+\"a\"+rep(\"b\", 50)))\n\tassertEqual(t, sm.GetOpCodes(),\n\t\t[]OpCode{{'e', 0, 50, 0, 50}, {'i', 50, 50, 50, 51}, {'e', 50, 100, 51, 101}})\n\tassertEqual(t, len(sm.bPopular), 0)\n}\n\nfunc TestWithAsciiOnDelete(t *testing.T) {\n\tsm := NewMatcher(splitChars(rep(\"a\", 40)+\"c\"+rep(\"b\", 40)),\n\t\tsplitChars(rep(\"a\", 40)+rep(\"b\", 40)))\n\tassertEqual(t, sm.GetOpCodes(),\n\t\t[]OpCode{{'e', 0, 40, 0, 40}, {'d', 40, 41, 40, 40}, {'e', 41, 81, 40, 80}})\n}\n\nfunc TestSFBugsComparingEmptyLists(t *testing.T) {\n\tgroups := NewMatcher(nil, nil).GetGroupedOpCodes(-1)\n\tassertEqual(t, len(groups), 0)\n\tdiff := UnifiedDiff{\n\t\tFromFile: \"Original\",\n\t\tToFile:   \"Current\",\n\t\tContext:  3,\n\t}\n\tresult, err := GetUnifiedDiffString(diff)\n\tassertEqual(t, err, nil)\n\tassertEqual(t, result, \"\")\n}\n\nfunc TestOutputFormatRangeFormatUnified(t *testing.T) {\n\t// Per the diff spec at http://www.unix.org/single_unix_specification/\n\t//\n\t// Each <range> field shall be of the form:\n\t//   %1d\", <beginning line number>  if the range contains exactly one line,\n\t// and:\n\t//  \"%1d,%1d\", <beginning line number>, <number of lines> otherwise.\n\t// If a range is empty, its beginning line number shall be the number of\n\t// the line just before the range, or 0 if the empty range starts the file.\n\tfm := formatRangeUnified\n\tassertEqual(t, fm(3, 3), \"3,0\")\n\tassertEqual(t, fm(3, 4), \"4\")\n\tassertEqual(t, fm(3, 5), \"4,2\")\n\tassertEqual(t, fm(3, 6), \"4,3\")\n\tassertEqual(t, fm(0, 0), \"0,0\")\n}\n\nfunc TestOutputFormatRangeFormatContext(t *testing.T) {\n\t// Per the diff spec at http://www.unix.org/single_unix_specification/\n\t//\n\t// The range of lines in file1 shall be written in the following format\n\t// if the range contains two or more lines:\n\t//     \"*** %d,%d ****\\n\", <beginning line number>, <ending line number>\n\t// and the following format otherwise:\n\t//     \"*** %d ****\\n\", <ending line number>\n\t// The ending line number of an empty range shall be the number of the preceding line,\n\t// or 0 if the range is at the start of the file.\n\t//\n\t// Next, the range of lines in file2 shall be written in the following format\n\t// if the range contains two or more lines:\n\t//     \"--- %d,%d ----\\n\", <beginning line number>, <ending line number>\n\t// and the following format otherwise:\n\t//     \"--- %d ----\\n\", <ending line number>\n\tfm := formatRangeContext\n\tassertEqual(t, fm(3, 3), \"3\")\n\tassertEqual(t, fm(3, 4), \"4\")\n\tassertEqual(t, fm(3, 5), \"4,5\")\n\tassertEqual(t, fm(3, 6), \"4,6\")\n\tassertEqual(t, fm(0, 0), \"0\")\n}\n\nfunc TestOutputFormatTabDelimiter(t *testing.T) {\n\tdiff := UnifiedDiff{\n\t\tA:        splitChars(\"one\"),\n\t\tB:        splitChars(\"two\"),\n\t\tFromFile: \"Original\",\n\t\tFromDate: \"2005-01-26 23:30:50\",\n\t\tToFile:   \"Current\",\n\t\tToDate:   \"2010-04-12 10:20:52\",\n\t\tEol:      \"\\n\",\n\t}\n\tud, err := GetUnifiedDiffString(diff)\n\tassertEqual(t, err, nil)\n\tassertEqual(t, SplitLines(ud)[:2], []string{\n\t\t\"--- Original\\t2005-01-26 23:30:50\\n\",\n\t\t\"+++ Current\\t2010-04-12 10:20:52\\n\",\n\t})\n}\n\nfunc TestOutputFormatNoTrailingTabOnEmptyFiledate(t *testing.T) {\n\tdiff := UnifiedDiff{\n\t\tA:        splitChars(\"one\"),\n\t\tB:        splitChars(\"two\"),\n\t\tFromFile: \"Original\",\n\t\tToFile:   \"Current\",\n\t\tEol:      \"\\n\",\n\t}\n\tud, err := GetUnifiedDiffString(diff)\n\tassertEqual(t, err, nil)\n\tassertEqual(t, SplitLines(ud)[:2], []string{\"--- Original\\n\", \"+++ Current\\n\"})\n}\n\nfunc TestOmitFilenames(t *testing.T) {\n\tdiff := UnifiedDiff{\n\t\tA:   SplitLines(\"o\\nn\\ne\\n\"),\n\t\tB:   SplitLines(\"t\\nw\\no\\n\"),\n\t\tEol: \"\\n\",\n\t}\n\tud, err := GetUnifiedDiffString(diff)\n\tassertEqual(t, err, nil)\n\tassertEqual(t, SplitLines(ud), []string{\n\t\t\"@@ -0,0 +1,2 @@\\n\",\n\t\t\"+t\\n\",\n\t\t\"+w\\n\",\n\t\t\"@@ -2,2 +3,0 @@\\n\",\n\t\t\"-n\\n\",\n\t\t\"-e\\n\",\n\t\t\"\\n\",\n\t})\n}\n\nfunc TestSplitLines(t *testing.T) {\n\tallTests := []struct {\n\t\tinput string\n\t\twant  []string\n\t}{\n\t\t{\"foo\", []string{\"foo\\n\"}},\n\t\t{\"foo\\nbar\", []string{\"foo\\n\", \"bar\\n\"}},\n\t\t{\"foo\\nbar\\n\", []string{\"foo\\n\", \"bar\\n\", \"\\n\"}},\n\t}\n\tfor _, test := range allTests {\n\t\tassertEqual(t, SplitLines(test.input), test.want)\n\t}\n}\n\nfunc benchmarkSplitLines(b *testing.B, count int) {\n\tstr := strings.Repeat(\"foo\\n\", count)\n\n\tb.ResetTimer()\n\n\tn := 0\n\tfor i := 0; i < b.N; i++ {\n\t\tn += len(SplitLines(str))\n\t}\n}\n\nfunc BenchmarkSplitLines100(b *testing.B) {\n\tbenchmarkSplitLines(b, 100)\n}\n\nfunc BenchmarkSplitLines10000(b *testing.B) {\n\tbenchmarkSplitLines(b, 10000)\n}\n"
  },
  {
    "path": "internal/spew/LICENSE",
    "content": "ISC License\n\nCopyright (c) 2012-2016 Dave Collins <dave@davec.name>\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n"
  },
  {
    "path": "internal/spew/README.md",
    "content": "go-spew\n=======\n\n[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)\n\nGo-spew implements a deep pretty printer for Go data structures to aid in\ndebugging.  A comprehensive suite of tests with 100% test coverage is provided\nto ensure proper functionality.\n\n## License\n\nGo-spew is licensed under the [copyfree](http://copyfree.org) ISC License.\n"
  },
  {
    "path": "internal/spew/bypass.go",
    "content": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when the code is not running on Google App Engine, compiled by GopherJS, and\n// \"-tags safe\" is not added to the go build command line.  The \"disableunsafe\"\n// tag is deprecated and thus should not be used.\n// Go versions prior to 1.4 are disabled because they use a different layout\n// for interfaces which make the implementation of unsafeReflectValue more complex.\n//go:build !js && !appengine && !safe && !disableunsafe && go1.4\n// +build !js,!appengine,!safe,!disableunsafe,go1.4\n\npackage spew\n\nimport (\n\t\"reflect\"\n\t\"unsafe\"\n)\n\nconst (\n\t// UnsafeDisabled is a build-time constant which specifies whether or\n\t// not access to the unsafe package is available.\n\tUnsafeDisabled = false\n\n\t// ptrSize is the size of a pointer on the current arch.\n\tptrSize = unsafe.Sizeof((*byte)(nil))\n)\n\ntype flag uintptr\n\nvar (\n\t// flagRO indicates whether the value field of a reflect.Value\n\t// is read-only.\n\tflagRO flag\n\n\t// flagAddr indicates whether the address of the reflect.Value's\n\t// value may be taken.\n\tflagAddr flag\n)\n\n// flagKindMask holds the bits that make up the kind\n// part of the flags field. In all the supported versions,\n// it is in the lower 5 bits.\nconst flagKindMask = flag(0x1f)\n\n// Different versions of Go have used different\n// bit layouts for the flags type. This table\n// records the known combinations.\nvar okFlags = []struct {\n\tro, addr flag\n}{{\n\t// From Go 1.4 to 1.5\n\tro:   1 << 5,\n\taddr: 1 << 7,\n}, {\n\t// Up to Go tip.\n\tro:   1<<5 | 1<<6,\n\taddr: 1 << 8,\n}}\n\nvar flagValOffset = func() uintptr {\n\tfield, ok := reflect.TypeOf(reflect.Value{}).FieldByName(\"flag\")\n\tif !ok {\n\t\tpanic(\"reflect.Value has no flag field\")\n\t}\n\treturn field.Offset\n}()\n\n// flagField returns a pointer to the flag field of a reflect.Value.\nfunc flagField(v *reflect.Value) *flag {\n\treturn (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset))\n}\n\n// unsafeReflectValue converts the passed reflect.Value into a one that bypasses\n// the typical safety restrictions preventing access to unaddressable and\n// unexported data.  It works by digging the raw pointer to the underlying\n// value out of the protected value and generating a new unprotected (unsafe)\n// reflect.Value to it.\n//\n// This allows us to check for implementations of the Stringer and error\n// interfaces to be used for pretty printing ordinarily unaddressable and\n// inaccessible values such as unexported struct fields.\nfunc unsafeReflectValue(v reflect.Value) reflect.Value {\n\tif !v.IsValid() || (v.CanInterface() && v.CanAddr()) {\n\t\treturn v\n\t}\n\tflagFieldPtr := flagField(&v)\n\t*flagFieldPtr &^= flagRO\n\t*flagFieldPtr |= flagAddr\n\treturn v\n}\n\n// Sanity checks against future reflect package changes\n// to the type or semantics of the Value.flag field.\nfunc init() {\n\tfield, ok := reflect.TypeOf(reflect.Value{}).FieldByName(\"flag\")\n\tif !ok {\n\t\tpanic(\"reflect.Value has no flag field\")\n\t}\n\tif field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() {\n\t\tpanic(\"reflect.Value flag field has changed kind\")\n\t}\n\ttype t0 int\n\tvar t struct {\n\t\tA t0\n\t\t// t0 will have flagEmbedRO set.\n\t\tt0\n\t\t// a will have flagStickyRO set\n\t\ta t0\n\t}\n\tvA := reflect.ValueOf(t).FieldByName(\"A\")\n\tva := reflect.ValueOf(t).FieldByName(\"a\")\n\tvt0 := reflect.ValueOf(t).FieldByName(\"t0\")\n\n\t// Infer flagRO from the difference between the flags\n\t// for the (otherwise identical) fields in t.\n\tflagPublic := *flagField(&vA)\n\tflagWithRO := *flagField(&va) | *flagField(&vt0)\n\tflagRO = flagPublic ^ flagWithRO\n\n\t// Infer flagAddr from the difference between a value\n\t// taken from a pointer and not.\n\tvPtrA := reflect.ValueOf(&t).Elem().FieldByName(\"A\")\n\tflagNoPtr := *flagField(&vA)\n\tflagPtr := *flagField(&vPtrA)\n\tflagAddr = flagNoPtr ^ flagPtr\n\n\t// Check that the inferred flags tally with one of the known versions.\n\tfor _, f := range okFlags {\n\t\tif flagRO == f.ro && flagAddr == f.addr {\n\t\t\treturn\n\t\t}\n\t}\n\tpanic(\"reflect.Value read-only flag has changed semantics\")\n}\n"
  },
  {
    "path": "internal/spew/bypasssafe.go",
    "content": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when the code is running on Google App Engine, compiled by GopherJS, or\n// \"-tags safe\" is added to the go build command line.  The \"disableunsafe\"\n// tag is deprecated and thus should not be used.\n//go:build js || appengine || safe || disableunsafe || !go1.4\n// +build js appengine safe disableunsafe !go1.4\n\npackage spew\n\nimport \"reflect\"\n\nconst (\n\t// UnsafeDisabled is a build-time constant which specifies whether or\n\t// not access to the unsafe package is available.\n\tUnsafeDisabled = true\n)\n\n// unsafeReflectValue typically converts the passed reflect.Value into a one\n// that bypasses the typical safety restrictions preventing access to\n// unaddressable and unexported data.  However, doing this relies on access to\n// the unsafe package.  This is a stub version which simply returns the passed\n// reflect.Value when the unsafe package is not available.\nfunc unsafeReflectValue(v reflect.Value) reflect.Value {\n\treturn v\n}\n"
  },
  {
    "path": "internal/spew/common.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strconv\"\n)\n\n// Some constants in the form of bytes to avoid string overhead.  This mirrors\n// the technique used in the fmt package.\nvar (\n\tpanicBytes            = []byte(\"(PANIC=\")\n\tplusBytes             = []byte(\"+\")\n\tiBytes                = []byte(\"i\")\n\ttrueBytes             = []byte(\"true\")\n\tfalseBytes            = []byte(\"false\")\n\tinterfaceBytes        = []byte(\"(interface {})\")\n\tcommaNewlineBytes     = []byte(\",\\n\")\n\tnewlineBytes          = []byte(\"\\n\")\n\topenBraceBytes        = []byte(\"{\")\n\topenBraceNewlineBytes = []byte(\"{\\n\")\n\tcloseBraceBytes       = []byte(\"}\")\n\tasteriskBytes         = []byte(\"*\")\n\tcolonBytes            = []byte(\":\")\n\tcolonSpaceBytes       = []byte(\": \")\n\topenParenBytes        = []byte(\"(\")\n\tcloseParenBytes       = []byte(\")\")\n\tspaceBytes            = []byte(\" \")\n\tpointerChainBytes     = []byte(\"->\")\n\tnilAngleBytes         = []byte(\"<nil>\")\n\tmaxNewlineBytes       = []byte(\"<max depth reached>\\n\")\n\tmaxShortBytes         = []byte(\"<max>\")\n\tcircularBytes         = []byte(\"<already shown>\")\n\tcircularShortBytes    = []byte(\"<shown>\")\n\tinvalidAngleBytes     = []byte(\"<invalid>\")\n\topenBracketBytes      = []byte(\"[\")\n\tcloseBracketBytes     = []byte(\"]\")\n\tpercentBytes          = []byte(\"%\")\n\tprecisionBytes        = []byte(\".\")\n\topenAngleBytes        = []byte(\"<\")\n\tcloseAngleBytes       = []byte(\">\")\n\topenMapBytes          = []byte(\"map[\")\n\tcloseMapBytes         = []byte(\"]\")\n\tlenEqualsBytes        = []byte(\"len=\")\n\tcapEqualsBytes        = []byte(\"cap=\")\n)\n\n// hexDigits is used to map a decimal value to a hex digit.\nvar hexDigits = \"0123456789abcdef\"\n\n// catchPanic handles any panics that might occur during the handleMethods\n// calls.\nfunc catchPanic(w io.Writer, v reflect.Value) {\n\tif err := recover(); err != nil {\n\t\tw.Write(panicBytes)\n\t\tfmt.Fprintf(w, \"%v\", err)\n\t\tw.Write(closeParenBytes)\n\t}\n}\n\n// handleMethods attempts to call the Error and String methods on the underlying\n// type the passed reflect.Value represents and outputes the result to Writer w.\n//\n// It handles panics in any called methods by catching and displaying the error\n// as the formatted value.\nfunc handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) {\n\t// We need an interface to check if the type implements the error or\n\t// Stringer interface.  However, the reflect package won't give us an\n\t// interface on certain things like unexported struct fields in order\n\t// to enforce visibility rules.  We use unsafe, when it's available,\n\t// to bypass these restrictions since this package does not mutate the\n\t// values.\n\tif !v.CanInterface() {\n\t\tif UnsafeDisabled {\n\t\t\treturn false\n\t\t}\n\n\t\tv = unsafeReflectValue(v)\n\t}\n\n\t// Choose whether or not to do error and Stringer interface lookups against\n\t// the base type or a pointer to the base type depending on settings.\n\t// Technically calling one of these methods with a pointer receiver can\n\t// mutate the value, however, types which choose to satisify an error or\n\t// Stringer interface with a pointer receiver should not be mutating their\n\t// state inside these interface methods.\n\tif !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() {\n\t\tv = unsafeReflectValue(v)\n\t}\n\tif v.CanAddr() {\n\t\tv = v.Addr()\n\t}\n\n\t// Is it an error or Stringer?\n\tswitch iface := v.Interface().(type) {\n\tcase error:\n\t\tdefer catchPanic(w, v)\n\t\tif cs.ContinueOnMethod {\n\t\t\tw.Write(openParenBytes)\n\t\t\tw.Write([]byte(iface.Error()))\n\t\t\tw.Write(closeParenBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\treturn false\n\t\t}\n\n\t\tw.Write([]byte(iface.Error()))\n\t\treturn true\n\n\tcase fmt.Stringer:\n\t\tdefer catchPanic(w, v)\n\t\tif cs.ContinueOnMethod {\n\t\t\tw.Write(openParenBytes)\n\t\t\tw.Write([]byte(iface.String()))\n\t\t\tw.Write(closeParenBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\treturn false\n\t\t}\n\t\tw.Write([]byte(iface.String()))\n\t\treturn true\n\t}\n\treturn false\n}\n\n// printBool outputs a boolean value as true or false to Writer w.\nfunc printBool(w io.Writer, val bool) {\n\tif val {\n\t\tw.Write(trueBytes)\n\t} else {\n\t\tw.Write(falseBytes)\n\t}\n}\n\n// printInt outputs a signed integer value to Writer w.\nfunc printInt(w io.Writer, val int64, base int) {\n\tw.Write([]byte(strconv.FormatInt(val, base)))\n}\n\n// printUint outputs an unsigned integer value to Writer w.\nfunc printUint(w io.Writer, val uint64, base int) {\n\tw.Write([]byte(strconv.FormatUint(val, base)))\n}\n\n// printFloat outputs a floating point value using the specified precision,\n// which is expected to be 32 or 64bit, to Writer w.\nfunc printFloat(w io.Writer, val float64, precision int) {\n\tw.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision)))\n}\n\n// printComplex outputs a complex value using the specified float precision\n// for the real and imaginary parts to Writer w.\nfunc printComplex(w io.Writer, c complex128, floatPrecision int) {\n\tr := real(c)\n\tw.Write(openParenBytes)\n\tw.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision)))\n\ti := imag(c)\n\tif i >= 0 {\n\t\tw.Write(plusBytes)\n\t}\n\tw.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision)))\n\tw.Write(iBytes)\n\tw.Write(closeParenBytes)\n}\n\n// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x'\n// prefix to Writer w.\nfunc printHexPtr(w io.Writer, p uintptr) {\n\t// Null pointer.\n\tnum := uint64(p)\n\tif num == 0 {\n\t\tw.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\t// Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix\n\tbuf := make([]byte, 18)\n\n\t// It's simpler to construct the hex string right to left.\n\tbase := uint64(16)\n\ti := len(buf) - 1\n\tfor num >= base {\n\t\tbuf[i] = hexDigits[num%base]\n\t\tnum /= base\n\t\ti--\n\t}\n\tbuf[i] = hexDigits[num]\n\n\t// Add '0x' prefix.\n\ti--\n\tbuf[i] = 'x'\n\ti--\n\tbuf[i] = '0'\n\n\t// Strip unused leading bytes.\n\tbuf = buf[i:]\n\tw.Write(buf)\n}\n\n// valuesSorter implements sort.Interface to allow a slice of reflect.Value\n// elements to be sorted.\ntype valuesSorter struct {\n\tvalues  []reflect.Value\n\tstrings []string // either nil or same len and values\n\tcs      *ConfigState\n}\n\n// newValuesSorter initializes a valuesSorter instance, which holds a set of\n// surrogate keys on which the data should be sorted.  It uses flags in\n// ConfigState to decide if and how to populate those surrogate keys.\nfunc newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface {\n\tvs := &valuesSorter{values: values, cs: cs}\n\tif canSortSimply(vs.values[0].Kind()) {\n\t\treturn vs\n\t}\n\tif !cs.DisableMethods {\n\t\tvs.strings = make([]string, len(values))\n\t\tfor i := range vs.values {\n\t\t\tb := bytes.Buffer{}\n\t\t\tif !handleMethods(cs, &b, vs.values[i]) {\n\t\t\t\tvs.strings = nil\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvs.strings[i] = b.String()\n\t\t}\n\t}\n\tif vs.strings == nil && cs.SpewKeys {\n\t\tvs.strings = make([]string, len(values))\n\t\tfor i := range vs.values {\n\t\t\tvs.strings[i] = Sprintf(\"%#v\", vs.values[i].Interface())\n\t\t}\n\t}\n\treturn vs\n}\n\n// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted\n// directly, or whether it should be considered for sorting by surrogate keys\n// (if the ConfigState allows it).\nfunc canSortSimply(kind reflect.Kind) bool {\n\t// This switch parallels valueSortLess, except for the default case.\n\tswitch kind {\n\tcase reflect.Bool:\n\t\treturn true\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\treturn true\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\treturn true\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn true\n\tcase reflect.String:\n\t\treturn true\n\tcase reflect.Uintptr:\n\t\treturn true\n\tcase reflect.Array:\n\t\treturn true\n\t}\n\treturn false\n}\n\n// Len returns the number of values in the slice.  It is part of the\n// sort.Interface implementation.\nfunc (s *valuesSorter) Len() int {\n\treturn len(s.values)\n}\n\n// Swap swaps the values at the passed indices.  It is part of the\n// sort.Interface implementation.\nfunc (s *valuesSorter) Swap(i, j int) {\n\ts.values[i], s.values[j] = s.values[j], s.values[i]\n\tif s.strings != nil {\n\t\ts.strings[i], s.strings[j] = s.strings[j], s.strings[i]\n\t}\n}\n\n// valueSortLess returns whether the first value should sort before the second\n// value.  It is used by valueSorter.Less as part of the sort.Interface\n// implementation.\nfunc valueSortLess(a, b reflect.Value) bool {\n\tswitch a.Kind() {\n\tcase reflect.Bool:\n\t\treturn !a.Bool() && b.Bool()\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\treturn a.Int() < b.Int()\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\treturn a.Uint() < b.Uint()\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn a.Float() < b.Float()\n\tcase reflect.String:\n\t\treturn a.String() < b.String()\n\tcase reflect.Uintptr:\n\t\treturn a.Uint() < b.Uint()\n\tcase reflect.Array:\n\t\t// Compare the contents of both arrays.\n\t\tl := a.Len()\n\t\tfor i := 0; i < l; i++ {\n\t\t\tav := a.Index(i)\n\t\t\tbv := b.Index(i)\n\t\t\tif av.Interface() == bv.Interface() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn valueSortLess(av, bv)\n\t\t}\n\t}\n\treturn a.String() < b.String()\n}\n\n// Less returns whether the value at index i should sort before the\n// value at index j.  It is part of the sort.Interface implementation.\nfunc (s *valuesSorter) Less(i, j int) bool {\n\tif s.strings == nil {\n\t\treturn valueSortLess(s.values[i], s.values[j])\n\t}\n\treturn s.strings[i] < s.strings[j]\n}\n\n// sortValues is a sort function that handles both native types and any type that\n// can be converted to error or Stringer.  Other inputs are sorted according to\n// their Value.String() value to ensure display stability.\nfunc sortValues(values []reflect.Value, cs *ConfigState) {\n\tif len(values) == 0 {\n\t\treturn\n\t}\n\tsort.Sort(newValuesSorter(values, cs))\n}\n"
  },
  {
    "path": "internal/spew/common_test.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew_test\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/internal/spew\"\n)\n\n// custom type to test Stinger interface on non-pointer receiver.\ntype stringer string\n\n// String implements the Stringer interface for testing invocation of custom\n// stringers on types with non-pointer receivers.\nfunc (s stringer) String() string {\n\treturn \"stringer \" + string(s)\n}\n\n// custom type to test Stinger interface on pointer receiver.\ntype pstringer string\n\n// String implements the Stringer interface for testing invocation of custom\n// stringers on types with only pointer receivers.\nfunc (s *pstringer) String() string {\n\treturn \"stringer \" + string(*s)\n}\n\n// xref1 and xref2 are cross referencing structs for testing circular reference\n// detection.\ntype xref1 struct {\n\tps2 *xref2\n}\ntype xref2 struct {\n\tps1 *xref1\n}\n\n// indirCir1, indirCir2, and indirCir3 are used to generate an indirect circular\n// reference for testing detection.\ntype indirCir1 struct {\n\tps2 *indirCir2\n}\ntype indirCir2 struct {\n\tps3 *indirCir3\n}\ntype indirCir3 struct {\n\tps1 *indirCir1\n}\n\n// embed is used to test embedded structures.\ntype embed struct {\n\ta string\n}\n\n// embedwrap is used to test embedded structures.\ntype embedwrap struct {\n\t*embed\n\te *embed\n}\n\n// panicer is used to intentionally cause a panic for testing spew properly\n// handles them\ntype panicer int\n\nfunc (p panicer) String() string {\n\tpanic(\"test panic\")\n}\n\n// customError is used to test custom error interface invocation.\ntype customError int\n\nfunc (e customError) Error() string {\n\treturn fmt.Sprintf(\"error: %d\", int(e))\n}\n\n// stringizeWants converts a slice of wanted test output into a format suitable\n// for a test error message.\nfunc stringizeWants(wants []string) string {\n\ts := \"\"\n\tfor i, want := range wants {\n\t\tif i > 0 {\n\t\t\ts += fmt.Sprintf(\"want%d: %s\", i+1, want)\n\t\t} else {\n\t\t\ts += \"want: \" + want\n\t\t}\n\t}\n\treturn s\n}\n\n// testFailed returns whether or not a test failed by checking if the result\n// of the test is in the slice of wanted strings.\nfunc testFailed(result string, wants []string) bool {\n\tfor _, want := range wants {\n\t\tif result == want {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\ntype sortableStruct struct {\n\tx int\n}\n\nfunc (ss sortableStruct) String() string {\n\treturn fmt.Sprintf(\"ss.%d\", ss.x)\n}\n\ntype unsortableStruct struct {\n\tx int\n}\n\ntype sortTestCase struct {\n\tinput    []reflect.Value\n\texpected []reflect.Value\n}\n\nfunc helpTestSortValues(tests []sortTestCase, cs *spew.ConfigState, t *testing.T) {\n\tgetInterfaces := func(values []reflect.Value) []interface{} {\n\t\tinterfaces := []interface{}{}\n\t\tfor _, v := range values {\n\t\t\tinterfaces = append(interfaces, v.Interface())\n\t\t}\n\t\treturn interfaces\n\t}\n\n\tfor _, test := range tests {\n\t\tspew.SortValues(test.input, cs)\n\t\t// reflect.DeepEqual cannot really make sense of reflect.Value,\n\t\t// probably because of all the pointer tricks. For instance,\n\t\t// v(2.0) != v(2.0) on a 32-bits system. Turn them into interface{}\n\t\t// instead.\n\t\tinput := getInterfaces(test.input)\n\t\texpected := getInterfaces(test.expected)\n\t\tif !reflect.DeepEqual(input, expected) {\n\t\t\tt.Errorf(\"Sort mismatch:\\n %v != %v\", input, expected)\n\t\t}\n\t}\n}\n\n// TestSortValues ensures the sort functionality for relect.Value based sorting\n// works as intended.\nfunc TestSortValues(t *testing.T) {\n\tv := reflect.ValueOf\n\n\ta := v(\"a\")\n\tb := v(\"b\")\n\tc := v(\"c\")\n\tembedA := v(embed{\"a\"})\n\tembedB := v(embed{\"b\"})\n\tembedC := v(embed{\"c\"})\n\ttests := []sortTestCase{\n\t\t// No values.\n\t\t{\n\t\t\t[]reflect.Value{},\n\t\t\t[]reflect.Value{},\n\t\t},\n\t\t// Bools.\n\t\t{\n\t\t\t[]reflect.Value{v(false), v(true), v(false)},\n\t\t\t[]reflect.Value{v(false), v(false), v(true)},\n\t\t},\n\t\t// Ints.\n\t\t{\n\t\t\t[]reflect.Value{v(2), v(1), v(3)},\n\t\t\t[]reflect.Value{v(1), v(2), v(3)},\n\t\t},\n\t\t// Uints.\n\t\t{\n\t\t\t[]reflect.Value{v(uint8(2)), v(uint8(1)), v(uint8(3))},\n\t\t\t[]reflect.Value{v(uint8(1)), v(uint8(2)), v(uint8(3))},\n\t\t},\n\t\t// Floats.\n\t\t{\n\t\t\t[]reflect.Value{v(2.0), v(1.0), v(3.0)},\n\t\t\t[]reflect.Value{v(1.0), v(2.0), v(3.0)},\n\t\t},\n\t\t// Strings.\n\t\t{\n\t\t\t[]reflect.Value{b, a, c},\n\t\t\t[]reflect.Value{a, b, c},\n\t\t},\n\t\t// Array\n\t\t{\n\t\t\t[]reflect.Value{v([3]int{3, 2, 1}), v([3]int{1, 3, 2}), v([3]int{1, 2, 3})},\n\t\t\t[]reflect.Value{v([3]int{1, 2, 3}), v([3]int{1, 3, 2}), v([3]int{3, 2, 1})},\n\t\t},\n\t\t// Uintptrs.\n\t\t{\n\t\t\t[]reflect.Value{v(uintptr(2)), v(uintptr(1)), v(uintptr(3))},\n\t\t\t[]reflect.Value{v(uintptr(1)), v(uintptr(2)), v(uintptr(3))},\n\t\t},\n\t\t// SortableStructs.\n\t\t{\n\t\t\t// Note: not sorted - DisableMethods is set.\n\t\t\t[]reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},\n\t\t\t[]reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},\n\t\t},\n\t\t// UnsortableStructs.\n\t\t{\n\t\t\t// Note: not sorted - SpewKeys is false.\n\t\t\t[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},\n\t\t\t[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},\n\t\t},\n\t\t// Invalid.\n\t\t{\n\t\t\t[]reflect.Value{embedB, embedA, embedC},\n\t\t\t[]reflect.Value{embedB, embedA, embedC},\n\t\t},\n\t}\n\tcs := spew.ConfigState{DisableMethods: true, SpewKeys: false}\n\thelpTestSortValues(tests, &cs, t)\n}\n\n// TestSortValuesWithMethods ensures the sort functionality for relect.Value\n// based sorting works as intended when using string methods.\nfunc TestSortValuesWithMethods(t *testing.T) {\n\tv := reflect.ValueOf\n\n\ta := v(\"a\")\n\tb := v(\"b\")\n\tc := v(\"c\")\n\ttests := []sortTestCase{\n\t\t// Ints.\n\t\t{\n\t\t\t[]reflect.Value{v(2), v(1), v(3)},\n\t\t\t[]reflect.Value{v(1), v(2), v(3)},\n\t\t},\n\t\t// Strings.\n\t\t{\n\t\t\t[]reflect.Value{b, a, c},\n\t\t\t[]reflect.Value{a, b, c},\n\t\t},\n\t\t// SortableStructs.\n\t\t{\n\t\t\t[]reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},\n\t\t\t[]reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})},\n\t\t},\n\t\t// UnsortableStructs.\n\t\t{\n\t\t\t// Note: not sorted - SpewKeys is false.\n\t\t\t[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},\n\t\t\t[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},\n\t\t},\n\t}\n\tcs := spew.ConfigState{DisableMethods: false, SpewKeys: false}\n\thelpTestSortValues(tests, &cs, t)\n}\n\n// TestSortValuesWithSpew ensures the sort functionality for relect.Value\n// based sorting works as intended when using spew to stringify keys.\nfunc TestSortValuesWithSpew(t *testing.T) {\n\tv := reflect.ValueOf\n\n\ta := v(\"a\")\n\tb := v(\"b\")\n\tc := v(\"c\")\n\ttests := []sortTestCase{\n\t\t// Ints.\n\t\t{\n\t\t\t[]reflect.Value{v(2), v(1), v(3)},\n\t\t\t[]reflect.Value{v(1), v(2), v(3)},\n\t\t},\n\t\t// Strings.\n\t\t{\n\t\t\t[]reflect.Value{b, a, c},\n\t\t\t[]reflect.Value{a, b, c},\n\t\t},\n\t\t// SortableStructs.\n\t\t{\n\t\t\t[]reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},\n\t\t\t[]reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})},\n\t\t},\n\t\t// UnsortableStructs.\n\t\t{\n\t\t\t[]reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},\n\t\t\t[]reflect.Value{v(unsortableStruct{1}), v(unsortableStruct{2}), v(unsortableStruct{3})},\n\t\t},\n\t}\n\tcs := spew.ConfigState{DisableMethods: true, SpewKeys: true}\n\thelpTestSortValues(tests, &cs, t)\n}\n"
  },
  {
    "path": "internal/spew/config.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n)\n\n// ConfigState houses the configuration options used by spew to format and\n// display values.  There is a global instance, Config, that is used to control\n// all top-level Formatter and Dump functionality.  Each ConfigState instance\n// provides methods equivalent to the top-level functions.\n//\n// The zero value for ConfigState provides no indentation.  You would typically\n// want to set it to a space or a tab.\n//\n// Alternatively, you can use NewDefaultConfig to get a ConfigState instance\n// with default settings.  See the documentation of NewDefaultConfig for default\n// values.\ntype ConfigState struct {\n\t// Indent specifies the string to use for each indentation level.  The\n\t// global config instance that all top-level functions use set this to a\n\t// single space by default.  If you would like more indentation, you might\n\t// set this to a tab with \"\\t\" or perhaps two spaces with \"  \".\n\tIndent string\n\n\t// MaxDepth controls the maximum number of levels to descend into nested\n\t// data structures.  The default, 0, means there is no limit.\n\t//\n\t// NOTE: Circular data structures are properly detected, so it is not\n\t// necessary to set this value unless you specifically want to limit deeply\n\t// nested data structures.\n\tMaxDepth int\n\n\t// DisableMethods specifies whether or not error and Stringer interfaces are\n\t// invoked for types that implement them.\n\tDisableMethods bool\n\n\t// DisablePointerMethods specifies whether or not to check for and invoke\n\t// error and Stringer interfaces on types which only accept a pointer\n\t// receiver when the current type is not a pointer.\n\t//\n\t// NOTE: This might be an unsafe action since calling one of these methods\n\t// with a pointer receiver could technically mutate the value, however,\n\t// in practice, types which choose to satisify an error or Stringer\n\t// interface with a pointer receiver should not be mutating their state\n\t// inside these interface methods.  As a result, this option relies on\n\t// access to the unsafe package, so it will not have any effect when\n\t// running in environments without access to the unsafe package such as\n\t// Google App Engine or with the \"safe\" build tag specified.\n\tDisablePointerMethods bool\n\n\t// DisablePointerAddresses specifies whether to disable the printing of\n\t// pointer addresses. This is useful when diffing data structures in tests.\n\tDisablePointerAddresses bool\n\n\t// DisableCapacities specifies whether to disable the printing of capacities\n\t// for arrays, slices, maps and channels. This is useful when diffing\n\t// data structures in tests.\n\tDisableCapacities bool\n\n\t// ContinueOnMethod specifies whether or not recursion should continue once\n\t// a custom error or Stringer interface is invoked.  The default, false,\n\t// means it will print the results of invoking the custom error or Stringer\n\t// interface and return immediately instead of continuing to recurse into\n\t// the internals of the data type.\n\t//\n\t// NOTE: This flag does not have any effect if method invocation is disabled\n\t// via the DisableMethods or DisablePointerMethods options.\n\tContinueOnMethod bool\n\n\t// SortKeys specifies map keys should be sorted before being printed. Use\n\t// this to have a more deterministic, diffable output.  Note that only\n\t// native types (bool, int, uint, floats, uintptr and string) and types\n\t// that support the error or Stringer interfaces (if methods are\n\t// enabled) are supported, with other types sorted according to the\n\t// reflect.Value.String() output which guarantees display stability.\n\tSortKeys bool\n\n\t// SpewKeys specifies that, as a last resort attempt, map keys should\n\t// be spewed to strings and sorted by those strings.  This is only\n\t// considered if SortKeys is true.\n\tSpewKeys bool\n}\n\n// Config is the active configuration of the top-level functions.\n// The configuration can be changed by modifying the contents of spew.Config.\nvar Config = ConfigState{Indent: \" \"}\n\n// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the formatted string as a value that satisfies error.  See NewFormatter\n// for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Errorf(format string, a ...interface{}) (err error) {\n\treturn fmt.Errorf(format, c.convertArgs(a)...)\n}\n\n// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprint(w, c.convertArgs(a)...)\n}\n\n// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintf(w, format, c.convertArgs(a)...)\n}\n\n// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it\n// passed with a Formatter interface returned by c.NewFormatter.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintln(w, c.convertArgs(a)...)\n}\n\n// Print is a wrapper for fmt.Print that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Print(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(c.convertArgs(a)...)\n}\n\n// Printf is a wrapper for fmt.Printf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Printf(format, c.convertArgs(a)...)\n}\n\n// Println is a wrapper for fmt.Println that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Println(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Println(a ...interface{}) (n int, err error) {\n\treturn fmt.Println(c.convertArgs(a)...)\n}\n\n// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprint(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprint(a ...interface{}) string {\n\treturn fmt.Sprint(c.convertArgs(a)...)\n}\n\n// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprintf(format string, a ...interface{}) string {\n\treturn fmt.Sprintf(format, c.convertArgs(a)...)\n}\n\n// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it\n// were passed with a Formatter interface returned by c.NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprintln(a ...interface{}) string {\n\treturn fmt.Sprintln(c.convertArgs(a)...)\n}\n\n/*\nNewFormatter returns a custom formatter that satisfies the fmt.Formatter\ninterface.  As a result, it integrates cleanly with standard fmt package\nprinting functions.  The formatter is useful for inline printing of smaller data\ntypes similar to the standard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nTypically this function shouldn't be called directly.  It is much easier to make\nuse of the custom formatter by calling one of the convenience functions such as\nc.Printf, c.Println, or c.Printf.\n*/\nfunc (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {\n\treturn newFormatter(c, v)\n}\n\n// Fdump formats and displays the passed arguments to io.Writer w.  It formats\n// exactly the same as Dump.\nfunc (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {\n\tfdump(c, w, a...)\n}\n\n/*\nDump displays the passed parameters to standard out with newlines, customizable\nindentation, and additional debug information such as complete types and all\npointer addresses used to indirect to the final value.  It provides the\nfollowing features over the built-in printing facilities provided by the fmt\npackage:\n\n  - Pointers are dereferenced and followed\n  - Circular data structures are detected and handled properly\n  - Custom Stringer/error interfaces are optionally invoked, including\n    on unexported types\n  - Custom types which only implement the Stringer/error interfaces via\n    a pointer receiver are optionally invoked when passing non-pointer\n    variables\n  - Byte arrays and slices are dumped like the hexdump -C command which\n    includes offsets, byte values in hex, and ASCII output\n\nThe configuration options are controlled by modifying the public members\nof c.  See ConfigState for options documentation.\n\nSee Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to\nget the formatted result as a string.\n*/\nfunc (c *ConfigState) Dump(a ...interface{}) {\n\tfdump(c, os.Stdout, a...)\n}\n\n// Sdump returns a string with the passed arguments formatted exactly the same\n// as Dump.\nfunc (c *ConfigState) Sdump(a ...interface{}) string {\n\tvar buf bytes.Buffer\n\tfdump(c, &buf, a...)\n\treturn buf.String()\n}\n\n// convertArgs accepts a slice of arguments and returns a slice of the same\n// length with each argument converted to a spew Formatter interface using\n// the ConfigState associated with s.\nfunc (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) {\n\tformatters = make([]interface{}, len(args))\n\tfor index, arg := range args {\n\t\tformatters[index] = newFormatter(c, arg)\n\t}\n\treturn formatters\n}\n\n// NewDefaultConfig returns a ConfigState with the following default settings.\n//\n//\tIndent: \" \"\n//\tMaxDepth: 0\n//\tDisableMethods: false\n//\tDisablePointerMethods: false\n//\tContinueOnMethod: false\n//\tSortKeys: false\nfunc NewDefaultConfig() *ConfigState {\n\treturn &ConfigState{Indent: \" \"}\n}\n"
  },
  {
    "path": "internal/spew/doc.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*\nPackage spew implements a deep pretty printer for Go data structures to aid in\ndebugging.\n\nA quick overview of the additional features spew provides over the built-in\nprinting facilities for Go data types are as follows:\n\n  - Pointers are dereferenced and followed\n  - Circular data structures are detected and handled properly\n  - Custom Stringer/error interfaces are optionally invoked, including\n    on unexported types\n  - Custom types which only implement the Stringer/error interfaces via\n    a pointer receiver are optionally invoked when passing non-pointer\n    variables\n  - Byte arrays and slices are dumped like the hexdump -C command which\n    includes offsets, byte values in hex, and ASCII output (only when using\n    Dump style)\n\nThere are two different approaches spew allows for dumping Go data structures:\n\n  - Dump style which prints with newlines, customizable indentation,\n    and additional debug information such as types and all pointer addresses\n    used to indirect to the final value\n  - A custom Formatter interface that integrates cleanly with the standard fmt\n    package and replaces %v, %+v, %#v, and %#+v to provide inline printing\n    similar to the default %v while providing the additional functionality\n    outlined above and passing unsupported format verbs such as %x and %q\n    along to fmt\n\n# Quick Start\n\nThis section demonstrates how to quickly get started with spew.  See the\nsections below for further details on formatting and configuration options.\n\nTo dump a variable with full newlines, indentation, type, and pointer\ninformation use Dump, Fdump, or Sdump:\n\n\tspew.Dump(myVar1, myVar2, ...)\n\tspew.Fdump(someWriter, myVar1, myVar2, ...)\n\tstr := spew.Sdump(myVar1, myVar2, ...)\n\nAlternatively, if you would prefer to use format strings with a compacted inline\nprinting style, use the convenience wrappers Printf, Fprintf, etc with\n%v (most compact), %+v (adds pointer addresses), %#v (adds types), or\n%#+v (adds types and pointer addresses):\n\n\tspew.Printf(\"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Printf(\"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\tspew.Fprintf(someWriter, \"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Fprintf(someWriter, \"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\n# Configuration Options\n\nConfiguration of spew is handled by fields in the ConfigState type.  For\nconvenience, all of the top-level functions use a global state available\nvia the spew.Config global.\n\nIt is also possible to create a ConfigState instance that provides methods\nequivalent to the top-level functions.  This allows concurrent configuration\noptions.  See the ConfigState documentation for more details.\n\nThe following configuration options are available:\n\n  - Indent\n    String to use for each indentation level for Dump functions.\n    It is a single space by default.  A popular alternative is \"\\t\".\n\n  - MaxDepth\n    Maximum number of levels to descend into nested data structures.\n    There is no limit by default.\n\n  - DisableMethods\n    Disables invocation of error and Stringer interface methods.\n    Method invocation is enabled by default.\n\n  - DisablePointerMethods\n    Disables invocation of error and Stringer interface methods on types\n    which only accept pointer receivers from non-pointer variables.\n    Pointer method invocation is enabled by default.\n\n  - DisablePointerAddresses\n    DisablePointerAddresses specifies whether to disable the printing of\n    pointer addresses. This is useful when diffing data structures in tests.\n\n  - DisableCapacities\n    DisableCapacities specifies whether to disable the printing of\n    capacities for arrays, slices, maps and channels. This is useful when\n    diffing data structures in tests.\n\n  - ContinueOnMethod\n    Enables recursion into types after invoking error and Stringer interface\n    methods. Recursion after method invocation is disabled by default.\n\n  - SortKeys\n    Specifies map keys should be sorted before being printed. Use\n    this to have a more deterministic, diffable output.  Note that\n    only native types (bool, int, uint, floats, uintptr and string)\n    and types which implement error or Stringer interfaces are\n    supported with other types sorted according to the\n    reflect.Value.String() output which guarantees display\n    stability.  Natural map order is used by default.\n\n  - SpewKeys\n    Specifies that, as a last resort attempt, map keys should be\n    spewed to strings and sorted by those strings.  This is only\n    considered if SortKeys is true.\n\n# Dump Usage\n\nSimply call spew.Dump with a list of variables you want to dump:\n\n\tspew.Dump(myVar1, myVar2, ...)\n\nYou may also call spew.Fdump if you would prefer to output to an arbitrary\nio.Writer.  For example, to dump to standard error:\n\n\tspew.Fdump(os.Stderr, myVar1, myVar2, ...)\n\nA third option is to call spew.Sdump to get the formatted output as a string:\n\n\tstr := spew.Sdump(myVar1, myVar2, ...)\n\n# Sample Dump Output\n\nSee the Dump example for details on the setup of the types and variables being\nshown here.\n\n\t(main.Foo) {\n\t unexportedField: (*main.Bar)(0xf84002e210)({\n\t  flag: (main.Flag) flagTwo,\n\t  data: (uintptr) <nil>\n\t }),\n\t ExportedField: (map[interface {}]interface {}) (len=1) {\n\t  (string) (len=3) \"one\": (bool) true\n\t }\n\t}\n\nByte (and uint8) arrays and slices are displayed uniquely like the hexdump -C\ncommand as shown.\n\n\t([]uint8) (len=32 cap=32) {\n\t 00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20  |............... |\n\t 00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30  |!\"#$%&'()*+,-./0|\n\t 00000020  31 32                                             |12|\n\t}\n\n# Custom Formatter\n\nSpew provides a custom formatter that implements the fmt.Formatter interface\nso that it integrates cleanly with standard fmt package printing functions. The\nformatter is useful for inline printing of smaller data types similar to the\nstandard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\n# Custom Formatter Usage\n\nThe simplest way to make use of the spew custom formatter is to call one of the\nconvenience functions such as spew.Printf, spew.Println, or spew.Printf.  The\nfunctions have syntax you are most likely already familiar with:\n\n\tspew.Printf(\"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Printf(\"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\tspew.Println(myVar, myVar2)\n\tspew.Fprintf(os.Stderr, \"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Fprintf(os.Stderr, \"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\nSee the Index for the full list convenience functions.\n\n# Sample Formatter Output\n\nDouble pointer to a uint8:\n\n\t  %v: <**>5\n\t %+v: <**>(0xf8400420d0->0xf8400420c8)5\n\t %#v: (**uint8)5\n\t%#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5\n\nPointer to circular struct with a uint8 field and a pointer to itself:\n\n\t  %v: <*>{1 <*><shown>}\n\t %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>}\n\t %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>}\n\t%#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>}\n\nSee the Printf example for details on the setup of variables being shown\nhere.\n\n# Errors\n\nSince it is possible for custom Stringer/error interfaces to panic, spew\ndetects them and handles them internally by printing the panic information\ninline with the output.  Since spew is intended to provide deep pretty printing\ncapabilities on structures, it intentionally does not return any errors.\n*/\npackage spew\n"
  },
  {
    "path": "internal/spew/dump.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n)\n\nvar (\n\t// uint8Type is a reflect.Type representing a uint8.  It is used to\n\t// convert cgo types to uint8 slices for hexdumping.\n\tuint8Type = reflect.TypeOf(uint8(0))\n\n\t// cCharRE is a regular expression that matches a cgo char.\n\t// It is used to detect character arrays to hexdump them.\n\tcCharRE = regexp.MustCompile(`^.*\\._Ctype_char$`)\n\n\t// cUnsignedCharRE is a regular expression that matches a cgo unsigned\n\t// char.  It is used to detect unsigned character arrays to hexdump\n\t// them.\n\tcUnsignedCharRE = regexp.MustCompile(`^.*\\._Ctype_unsignedchar$`)\n\n\t// cUint8tCharRE is a regular expression that matches a cgo uint8_t.\n\t// It is used to detect uint8_t arrays to hexdump them.\n\tcUint8tCharRE = regexp.MustCompile(`^.*\\._Ctype_uint8_t$`)\n)\n\n// dumpState contains information about the state of a dump operation.\ntype dumpState struct {\n\tw                io.Writer\n\tdepth            int\n\tpointers         map[uintptr]int\n\tignoreNextType   bool\n\tignoreNextIndent bool\n\tcs               *ConfigState\n}\n\n// indent performs indentation according to the depth level and cs.Indent\n// option.\nfunc (d *dumpState) indent() {\n\tif d.ignoreNextIndent {\n\t\td.ignoreNextIndent = false\n\t\treturn\n\t}\n\td.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth))\n}\n\n// unpackValue returns values inside of non-nil interfaces when possible.\n// This is useful for data types like structs, arrays, slices, and maps which\n// can contain varying types packed inside an interface.\nfunc (d *dumpState) unpackValue(v reflect.Value) reflect.Value {\n\tif v.Kind() == reflect.Interface && !v.IsNil() {\n\t\tv = v.Elem()\n\t}\n\treturn v\n}\n\n// dumpPtr handles formatting of pointers by indirecting them as necessary.\nfunc (d *dumpState) dumpPtr(v reflect.Value) {\n\t// Remove pointers at or below the current depth from map used to detect\n\t// circular refs.\n\tfor k, depth := range d.pointers {\n\t\tif depth >= d.depth {\n\t\t\tdelete(d.pointers, k)\n\t\t}\n\t}\n\n\t// Keep list of all dereferenced pointers to show later.\n\tpointerChain := make([]uintptr, 0)\n\n\t// Figure out how many levels of indirection there are by dereferencing\n\t// pointers and unpacking interfaces down the chain while detecting circular\n\t// references.\n\tnilFound := false\n\tcycleFound := false\n\tindirects := 0\n\tve := v\n\tfor ve.Kind() == reflect.Ptr {\n\t\tif ve.IsNil() {\n\t\t\tnilFound = true\n\t\t\tbreak\n\t\t}\n\t\tindirects++\n\t\taddr := ve.Pointer()\n\t\tpointerChain = append(pointerChain, addr)\n\t\tif pd, ok := d.pointers[addr]; ok && pd < d.depth {\n\t\t\tcycleFound = true\n\t\t\tindirects--\n\t\t\tbreak\n\t\t}\n\t\td.pointers[addr] = d.depth\n\n\t\tve = ve.Elem()\n\t\tif ve.Kind() == reflect.Interface {\n\t\t\tif ve.IsNil() {\n\t\t\t\tnilFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tve = ve.Elem()\n\t\t}\n\t}\n\n\t// Display type information.\n\td.w.Write(openParenBytes)\n\td.w.Write(bytes.Repeat(asteriskBytes, indirects))\n\td.w.Write([]byte(ve.Type().String()))\n\td.w.Write(closeParenBytes)\n\n\t// Display pointer information.\n\tif !d.cs.DisablePointerAddresses && len(pointerChain) > 0 {\n\t\td.w.Write(openParenBytes)\n\t\tfor i, addr := range pointerChain {\n\t\t\tif i > 0 {\n\t\t\t\td.w.Write(pointerChainBytes)\n\t\t\t}\n\t\t\tprintHexPtr(d.w, addr)\n\t\t}\n\t\td.w.Write(closeParenBytes)\n\t}\n\n\t// Display dereferenced value.\n\td.w.Write(openParenBytes)\n\tswitch {\n\tcase nilFound:\n\t\td.w.Write(nilAngleBytes)\n\n\tcase cycleFound:\n\t\td.w.Write(circularBytes)\n\n\tdefault:\n\t\td.ignoreNextType = true\n\t\td.dump(ve)\n\t}\n\td.w.Write(closeParenBytes)\n}\n\n// dumpSlice handles formatting of arrays and slices.  Byte (uint8 under\n// reflection) arrays and slices are dumped in hexdump -C fashion.\nfunc (d *dumpState) dumpSlice(v reflect.Value) {\n\t// Determine whether this type should be hex dumped or not.  Also,\n\t// for types which should be hexdumped, try to use the underlying data\n\t// first, then fall back to trying to convert them to a uint8 slice.\n\tvar buf []uint8\n\tdoConvert := false\n\tdoHexDump := false\n\tnumEntries := v.Len()\n\tif numEntries > 0 {\n\t\tvt := v.Index(0).Type()\n\t\tvts := vt.String()\n\t\tswitch {\n\t\t// C types that need to be converted.\n\t\tcase cCharRE.MatchString(vts):\n\t\t\tfallthrough\n\t\tcase cUnsignedCharRE.MatchString(vts):\n\t\t\tfallthrough\n\t\tcase cUint8tCharRE.MatchString(vts):\n\t\t\tdoConvert = true\n\n\t\t// Try to use existing uint8 slices and fall back to converting\n\t\t// and copying if that fails.\n\t\tcase vt.Kind() == reflect.Uint8:\n\t\t\t// We need an addressable interface to convert the type\n\t\t\t// to a byte slice.  However, the reflect package won't\n\t\t\t// give us an interface on certain things like\n\t\t\t// unexported struct fields in order to enforce\n\t\t\t// visibility rules.  We use unsafe, when available, to\n\t\t\t// bypass these restrictions since this package does not\n\t\t\t// mutate the values.\n\t\t\tvs := v\n\t\t\tif !vs.CanInterface() || !vs.CanAddr() {\n\t\t\t\tvs = unsafeReflectValue(vs)\n\t\t\t}\n\t\t\tif !UnsafeDisabled {\n\t\t\t\tvs = vs.Slice(0, numEntries)\n\n\t\t\t\t// Use the existing uint8 slice if it can be\n\t\t\t\t// type asserted.\n\t\t\t\tiface := vs.Interface()\n\t\t\t\tif slice, ok := iface.([]uint8); ok {\n\t\t\t\t\tbuf = slice\n\t\t\t\t\tdoHexDump = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// The underlying data needs to be converted if it can't\n\t\t\t// be type asserted to a uint8 slice.\n\t\t\tdoConvert = true\n\t\t}\n\n\t\t// Copy and convert the underlying type if needed.\n\t\tif doConvert && vt.ConvertibleTo(uint8Type) {\n\t\t\t// Convert and copy each element into a uint8 byte\n\t\t\t// slice.\n\t\t\tbuf = make([]uint8, numEntries)\n\t\t\tfor i := 0; i < numEntries; i++ {\n\t\t\t\tvv := v.Index(i)\n\t\t\t\tbuf[i] = uint8(vv.Convert(uint8Type).Uint())\n\t\t\t}\n\t\t\tdoHexDump = true\n\t\t}\n\t}\n\n\t// Hexdump the entire slice as needed.\n\tif doHexDump {\n\t\tindent := strings.Repeat(d.cs.Indent, d.depth)\n\t\tstr := indent + hex.Dump(buf)\n\t\tstr = strings.Replace(str, \"\\n\", \"\\n\"+indent, -1)\n\t\tstr = strings.TrimRight(str, d.cs.Indent)\n\t\td.w.Write([]byte(str))\n\t\treturn\n\t}\n\n\t// Recursively call dump for each item.\n\tfor i := 0; i < numEntries; i++ {\n\t\td.dump(d.unpackValue(v.Index(i)))\n\t\tif i < (numEntries - 1) {\n\t\t\td.w.Write(commaNewlineBytes)\n\t\t} else {\n\t\t\td.w.Write(newlineBytes)\n\t\t}\n\t}\n}\n\n// dump is the main workhorse for dumping a value.  It uses the passed reflect\n// value to figure out what kind of object we are dealing with and formats it\n// appropriately.  It is a recursive function, however circular data structures\n// are detected and handled properly.\nfunc (d *dumpState) dump(v reflect.Value) {\n\t// Handle invalid reflect values immediately.\n\tkind := v.Kind()\n\tif kind == reflect.Invalid {\n\t\td.w.Write(invalidAngleBytes)\n\t\treturn\n\t}\n\n\t// Handle pointers specially.\n\tif kind == reflect.Ptr {\n\t\td.indent()\n\t\td.dumpPtr(v)\n\t\treturn\n\t}\n\n\t// Print type information unless already handled elsewhere.\n\tif !d.ignoreNextType {\n\t\td.indent()\n\t\td.w.Write(openParenBytes)\n\t\td.w.Write([]byte(v.Type().String()))\n\t\td.w.Write(closeParenBytes)\n\t\td.w.Write(spaceBytes)\n\t}\n\td.ignoreNextType = false\n\n\t// Display length and capacity if the built-in len and cap functions\n\t// work with the value's kind and the len/cap itself is non-zero.\n\tvalueLen, valueCap := 0, 0\n\tswitch v.Kind() {\n\tcase reflect.Array, reflect.Slice, reflect.Chan:\n\t\tvalueLen, valueCap = v.Len(), v.Cap()\n\tcase reflect.Map, reflect.String:\n\t\tvalueLen = v.Len()\n\t}\n\tif valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 {\n\t\td.w.Write(openParenBytes)\n\t\tif valueLen != 0 {\n\t\t\td.w.Write(lenEqualsBytes)\n\t\t\tprintInt(d.w, int64(valueLen), 10)\n\t\t}\n\t\tif !d.cs.DisableCapacities && valueCap != 0 {\n\t\t\tif valueLen != 0 {\n\t\t\t\td.w.Write(spaceBytes)\n\t\t\t}\n\t\t\td.w.Write(capEqualsBytes)\n\t\t\tprintInt(d.w, int64(valueCap), 10)\n\t\t}\n\t\td.w.Write(closeParenBytes)\n\t\td.w.Write(spaceBytes)\n\t}\n\n\t// Call Stringer/error interfaces if they exist and the handle methods flag\n\t// is enabled\n\tif !d.cs.DisableMethods {\n\t\tif (kind != reflect.Invalid) && (kind != reflect.Interface) {\n\t\t\tif handled := handleMethods(d.cs, d.w, v); handled {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch kind {\n\tcase reflect.Invalid:\n\t\t// Do nothing.  We should never get here since invalid has already\n\t\t// been handled above.\n\n\tcase reflect.Bool:\n\t\tprintBool(d.w, v.Bool())\n\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\tprintInt(d.w, v.Int(), 10)\n\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\tprintUint(d.w, v.Uint(), 10)\n\n\tcase reflect.Float32:\n\t\tprintFloat(d.w, v.Float(), 32)\n\n\tcase reflect.Float64:\n\t\tprintFloat(d.w, v.Float(), 64)\n\n\tcase reflect.Complex64:\n\t\tprintComplex(d.w, v.Complex(), 32)\n\n\tcase reflect.Complex128:\n\t\tprintComplex(d.w, v.Complex(), 64)\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\t\tfallthrough\n\n\tcase reflect.Array:\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\td.dumpSlice(v)\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.String:\n\t\td.w.Write([]byte(strconv.Quote(v.String())))\n\n\tcase reflect.Interface:\n\t\t// The only time we should get here is for nil interfaces due to\n\t\t// unpackValue calls.\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// Do nothing.  We should never get here since pointers have already\n\t\t// been handled above.\n\n\tcase reflect.Map:\n\t\t// nil maps should be indicated as different than empty maps\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\tnumEntries := v.Len()\n\t\t\tkeys := v.MapKeys()\n\t\t\tif d.cs.SortKeys {\n\t\t\t\tsortValues(keys, d.cs)\n\t\t\t}\n\t\t\tfor i, key := range keys {\n\t\t\t\td.dump(d.unpackValue(key))\n\t\t\t\td.w.Write(colonSpaceBytes)\n\t\t\t\td.ignoreNextIndent = true\n\t\t\t\td.dump(d.unpackValue(v.MapIndex(key)))\n\t\t\t\tif i < (numEntries - 1) {\n\t\t\t\t\td.w.Write(commaNewlineBytes)\n\t\t\t\t} else {\n\t\t\t\t\td.w.Write(newlineBytes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.Struct:\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\tvt := v.Type()\n\t\t\tnumFields := v.NumField()\n\t\t\tfor i := 0; i < numFields; i++ {\n\t\t\t\td.indent()\n\t\t\t\tvtf := vt.Field(i)\n\t\t\t\td.w.Write([]byte(vtf.Name))\n\t\t\t\td.w.Write(colonSpaceBytes)\n\t\t\t\td.ignoreNextIndent = true\n\t\t\t\td.dump(d.unpackValue(v.Field(i)))\n\t\t\t\tif i < (numFields - 1) {\n\t\t\t\t\td.w.Write(commaNewlineBytes)\n\t\t\t\t} else {\n\t\t\t\t\td.w.Write(newlineBytes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.Uintptr:\n\t\tprintHexPtr(d.w, uintptr(v.Uint()))\n\n\tcase reflect.UnsafePointer, reflect.Chan, reflect.Func:\n\t\tprintHexPtr(d.w, v.Pointer())\n\n\t// There were not any other types at the time this code was written, but\n\t// fall back to letting the default fmt package handle it in case any new\n\t// types are added.\n\tdefault:\n\t\tif v.CanInterface() {\n\t\t\tfmt.Fprintf(d.w, \"%v\", v.Interface())\n\t\t} else {\n\t\t\tfmt.Fprintf(d.w, \"%v\", v.String())\n\t\t}\n\t}\n}\n\n// fdump is a helper function to consolidate the logic from the various public\n// methods which take varying writers and config states.\nfunc fdump(cs *ConfigState, w io.Writer, a ...interface{}) {\n\tfor _, arg := range a {\n\t\tif arg == nil {\n\t\t\tw.Write(interfaceBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\tw.Write(nilAngleBytes)\n\t\t\tw.Write(newlineBytes)\n\t\t\tcontinue\n\t\t}\n\n\t\td := dumpState{w: w, cs: cs}\n\t\td.pointers = make(map[uintptr]int)\n\t\td.dump(reflect.ValueOf(arg))\n\t\td.w.Write(newlineBytes)\n\t}\n}\n\n// Fdump formats and displays the passed arguments to io.Writer w.  It formats\n// exactly the same as Dump.\nfunc Fdump(w io.Writer, a ...interface{}) {\n\tfdump(&Config, w, a...)\n}\n\n// Sdump returns a string with the passed arguments formatted exactly the same\n// as Dump.\nfunc Sdump(a ...interface{}) string {\n\tvar buf bytes.Buffer\n\tfdump(&Config, &buf, a...)\n\treturn buf.String()\n}\n\n/*\nDump displays the passed parameters to standard out with newlines, customizable\nindentation, and additional debug information such as complete types and all\npointer addresses used to indirect to the final value.  It provides the\nfollowing features over the built-in printing facilities provided by the fmt\npackage:\n\n  - Pointers are dereferenced and followed\n  - Circular data structures are detected and handled properly\n  - Custom Stringer/error interfaces are optionally invoked, including\n    on unexported types\n  - Custom types which only implement the Stringer/error interfaces via\n    a pointer receiver are optionally invoked when passing non-pointer\n    variables\n  - Byte arrays and slices are dumped like the hexdump -C command which\n    includes offsets, byte values in hex, and ASCII output\n\nThe configuration options are controlled by an exported package global,\nspew.Config.  See ConfigState for options documentation.\n\nSee Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to\nget the formatted result as a string.\n*/\nfunc Dump(a ...interface{}) {\n\tfdump(&Config, os.Stdout, a...)\n}\n"
  },
  {
    "path": "internal/spew/dump_test.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*\nTest Summary:\nNOTE: For each test, a nil pointer, a single pointer and double pointer to the\nbase test element are also tested to ensure proper indirection across all types.\n\n- Max int8, int16, int32, int64, int\n- Max uint8, uint16, uint32, uint64, uint\n- Boolean true and false\n- Standard complex64 and complex128\n- Array containing standard ints\n- Array containing type with custom formatter on pointer receiver only\n- Array containing interfaces\n- Array containing bytes\n- Slice containing standard float32 values\n- Slice containing type with custom formatter on pointer receiver only\n- Slice containing interfaces\n- Slice containing bytes\n- Nil slice\n- Standard string\n- Nil interface\n- Sub-interface\n- Map with string keys and int vals\n- Map with custom formatter type on pointer receiver only keys and vals\n- Map with interface keys and values\n- Map with nil interface value\n- Struct with primitives\n- Struct that contains another struct\n- Struct that contains custom type with Stringer pointer interface via both\n  exported and unexported fields\n- Struct that contains embedded struct and field to same struct\n- Uintptr to 0 (null pointer)\n- Uintptr address of real variable\n- Unsafe.Pointer to 0 (null pointer)\n- Unsafe.Pointer to address of real variable\n- Nil channel\n- Standard int channel\n- Function with no params and no returns\n- Function with param and no returns\n- Function with multiple params and multiple returns\n- Struct that is circular through self referencing\n- Structs that are circular through cross referencing\n- Structs that are indirectly circular\n- Type that panics in its Stringer interface\n*/\n\npackage spew_test\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"testing\"\n\t\"unsafe\"\n\n\t\"github.com/stretchr/testify/internal/spew\"\n)\n\n// dumpTest is used to describe a test to be performed against the Dump method.\ntype dumpTest struct {\n\tin    interface{}\n\twants []string\n}\n\n// dumpTests houses all of the tests to be performed against the Dump method.\nvar dumpTests = make([]dumpTest, 0)\n\n// addDumpTest is a helper method to append the passed input and desired result\n// to dumpTests\nfunc addDumpTest(in interface{}, wants ...string) {\n\ttest := dumpTest{in, wants}\n\tdumpTests = append(dumpTests, test)\n}\n\nfunc addIntDumpTests() {\n\t// Max int8.\n\tv := int8(127)\n\tnv := (*int8)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"int8\"\n\tvs := \"127\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Max int16.\n\tv2 := int16(32767)\n\tnv2 := (*int16)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"int16\"\n\tv2s := \"32767\"\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(nv2, \"(*\"+v2t+\")(<nil>)\\n\")\n\n\t// Max int32.\n\tv3 := int32(2147483647)\n\tnv3 := (*int32)(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"int32\"\n\tv3s := \"2147483647\"\n\taddDumpTest(v3, \"(\"+v3t+\") \"+v3s+\"\\n\")\n\taddDumpTest(pv3, \"(*\"+v3t+\")(\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(&pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(nv3, \"(*\"+v3t+\")(<nil>)\\n\")\n\n\t// Max int64.\n\tv4 := int64(9223372036854775807)\n\tnv4 := (*int64)(nil)\n\tpv4 := &v4\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"int64\"\n\tv4s := \"9223372036854775807\"\n\taddDumpTest(v4, \"(\"+v4t+\") \"+v4s+\"\\n\")\n\taddDumpTest(pv4, \"(*\"+v4t+\")(\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(&pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(nv4, \"(*\"+v4t+\")(<nil>)\\n\")\n\n\t// Max int.\n\tv5 := int(2147483647)\n\tnv5 := (*int)(nil)\n\tpv5 := &v5\n\tv5Addr := fmt.Sprintf(\"%p\", pv5)\n\tpv5Addr := fmt.Sprintf(\"%p\", &pv5)\n\tv5t := \"int\"\n\tv5s := \"2147483647\"\n\taddDumpTest(v5, \"(\"+v5t+\") \"+v5s+\"\\n\")\n\taddDumpTest(pv5, \"(*\"+v5t+\")(\"+v5Addr+\")(\"+v5s+\")\\n\")\n\taddDumpTest(&pv5, \"(**\"+v5t+\")(\"+pv5Addr+\"->\"+v5Addr+\")(\"+v5s+\")\\n\")\n\taddDumpTest(nv5, \"(*\"+v5t+\")(<nil>)\\n\")\n}\n\nfunc addUintDumpTests() {\n\t// Max uint8.\n\tv := uint8(255)\n\tnv := (*uint8)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"uint8\"\n\tvs := \"255\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Max uint16.\n\tv2 := uint16(65535)\n\tnv2 := (*uint16)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"uint16\"\n\tv2s := \"65535\"\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(nv2, \"(*\"+v2t+\")(<nil>)\\n\")\n\n\t// Max uint32.\n\tv3 := uint32(4294967295)\n\tnv3 := (*uint32)(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"uint32\"\n\tv3s := \"4294967295\"\n\taddDumpTest(v3, \"(\"+v3t+\") \"+v3s+\"\\n\")\n\taddDumpTest(pv3, \"(*\"+v3t+\")(\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(&pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(nv3, \"(*\"+v3t+\")(<nil>)\\n\")\n\n\t// Max uint64.\n\tv4 := uint64(18446744073709551615)\n\tnv4 := (*uint64)(nil)\n\tpv4 := &v4\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"uint64\"\n\tv4s := \"18446744073709551615\"\n\taddDumpTest(v4, \"(\"+v4t+\") \"+v4s+\"\\n\")\n\taddDumpTest(pv4, \"(*\"+v4t+\")(\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(&pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(nv4, \"(*\"+v4t+\")(<nil>)\\n\")\n\n\t// Max uint.\n\tv5 := uint(4294967295)\n\tnv5 := (*uint)(nil)\n\tpv5 := &v5\n\tv5Addr := fmt.Sprintf(\"%p\", pv5)\n\tpv5Addr := fmt.Sprintf(\"%p\", &pv5)\n\tv5t := \"uint\"\n\tv5s := \"4294967295\"\n\taddDumpTest(v5, \"(\"+v5t+\") \"+v5s+\"\\n\")\n\taddDumpTest(pv5, \"(*\"+v5t+\")(\"+v5Addr+\")(\"+v5s+\")\\n\")\n\taddDumpTest(&pv5, \"(**\"+v5t+\")(\"+pv5Addr+\"->\"+v5Addr+\")(\"+v5s+\")\\n\")\n\taddDumpTest(nv5, \"(*\"+v5t+\")(<nil>)\\n\")\n}\n\nfunc addBoolDumpTests() {\n\t// Boolean true.\n\tv := bool(true)\n\tnv := (*bool)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"bool\"\n\tvs := \"true\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Boolean false.\n\tv2 := bool(false)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"bool\"\n\tv2s := \"false\"\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n}\n\nfunc addFloatDumpTests() {\n\t// Standard float32.\n\tv := float32(3.1415)\n\tnv := (*float32)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"float32\"\n\tvs := \"3.1415\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Standard float64.\n\tv2 := float64(3.1415926)\n\tnv2 := (*float64)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"float64\"\n\tv2s := \"3.1415926\"\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(nv2, \"(*\"+v2t+\")(<nil>)\\n\")\n}\n\nfunc addComplexDumpTests() {\n\t// Standard complex64.\n\tv := complex(float32(6), -2)\n\tnv := (*complex64)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"complex64\"\n\tvs := \"(6-2i)\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Standard complex128.\n\tv2 := complex(float64(-6), 2)\n\tnv2 := (*complex128)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"complex128\"\n\tv2s := \"(-6+2i)\"\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(nv2, \"(*\"+v2t+\")(<nil>)\\n\")\n}\n\nfunc addArrayDumpTests() {\n\t// Array containing standard ints.\n\tv := [3]int{1, 2, 3}\n\tvLen := fmt.Sprintf(\"%d\", len(v))\n\tvCap := fmt.Sprintf(\"%d\", cap(v))\n\tnv := (*[3]int)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"int\"\n\tvs := \"(len=\" + vLen + \" cap=\" + vCap + \") {\\n (\" + vt + \") 1,\\n (\" +\n\t\tvt + \") 2,\\n (\" + vt + \") 3\\n}\"\n\taddDumpTest(v, \"([3]\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*[3]\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**[3]\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*[3]\"+vt+\")(<nil>)\\n\")\n\n\t// Array containing type with custom formatter on pointer receiver only.\n\tv2i0 := pstringer(\"1\")\n\tv2i1 := pstringer(\"2\")\n\tv2i2 := pstringer(\"3\")\n\tv2 := [3]pstringer{v2i0, v2i1, v2i2}\n\tv2i0Len := fmt.Sprintf(\"%d\", len(v2i0))\n\tv2i1Len := fmt.Sprintf(\"%d\", len(v2i1))\n\tv2i2Len := fmt.Sprintf(\"%d\", len(v2i2))\n\tv2Len := fmt.Sprintf(\"%d\", len(v2))\n\tv2Cap := fmt.Sprintf(\"%d\", cap(v2))\n\tnv2 := (*[3]pstringer)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"spew_test.pstringer\"\n\tv2sp := \"(len=\" + v2Len + \" cap=\" + v2Cap + \") {\\n (\" + v2t +\n\t\t\") (len=\" + v2i0Len + \") stringer 1,\\n (\" + v2t +\n\t\t\") (len=\" + v2i1Len + \") stringer 2,\\n (\" + v2t +\n\t\t\") (len=\" + v2i2Len + \") \" + \"stringer 3\\n}\"\n\tv2s := v2sp\n\tif spew.UnsafeDisabled {\n\t\tv2s = \"(len=\" + v2Len + \" cap=\" + v2Cap + \") {\\n (\" + v2t +\n\t\t\t\") (len=\" + v2i0Len + \") \\\"1\\\",\\n (\" + v2t + \") (len=\" +\n\t\t\tv2i1Len + \") \\\"2\\\",\\n (\" + v2t + \") (len=\" + v2i2Len +\n\t\t\t\") \" + \"\\\"3\\\"\\n}\"\n\t}\n\taddDumpTest(v2, \"([3]\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*[3]\"+v2t+\")(\"+v2Addr+\")(\"+v2sp+\")\\n\")\n\taddDumpTest(&pv2, \"(**[3]\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2sp+\")\\n\")\n\taddDumpTest(nv2, \"(*[3]\"+v2t+\")(<nil>)\\n\")\n\n\t// Array containing interfaces.\n\tv3i0 := \"one\"\n\tv3 := [3]interface{}{v3i0, int(2), uint(3)}\n\tv3i0Len := fmt.Sprintf(\"%d\", len(v3i0))\n\tv3Len := fmt.Sprintf(\"%d\", len(v3))\n\tv3Cap := fmt.Sprintf(\"%d\", cap(v3))\n\tnv3 := (*[3]interface{})(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"[3]interface {}\"\n\tv3t2 := \"string\"\n\tv3t3 := \"int\"\n\tv3t4 := \"uint\"\n\tv3s := \"(len=\" + v3Len + \" cap=\" + v3Cap + \") {\\n (\" + v3t2 + \") \" +\n\t\t\"(len=\" + v3i0Len + \") \\\"one\\\",\\n (\" + v3t3 + \") 2,\\n (\" +\n\t\tv3t4 + \") 3\\n}\"\n\taddDumpTest(v3, \"(\"+v3t+\") \"+v3s+\"\\n\")\n\taddDumpTest(pv3, \"(*\"+v3t+\")(\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(&pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(nv3, \"(*\"+v3t+\")(<nil>)\\n\")\n\n\t// Array containing bytes.\n\tv4 := [34]byte{\n\t\t0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,\n\t\t0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,\n\t\t0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,\n\t\t0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,\n\t\t0x31, 0x32,\n\t}\n\tv4Len := fmt.Sprintf(\"%d\", len(v4))\n\tv4Cap := fmt.Sprintf(\"%d\", cap(v4))\n\tnv4 := (*[34]byte)(nil)\n\tpv4 := &v4\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"[34]uint8\"\n\tv4s := \"(len=\" + v4Len + \" cap=\" + v4Cap + \") \" +\n\t\t\"{\\n 00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20\" +\n\t\t\"  |............... |\\n\" +\n\t\t\" 00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30\" +\n\t\t\"  |!\\\"#$%&'()*+,-./0|\\n\" +\n\t\t\" 00000020  31 32                                           \" +\n\t\t\"  |12|\\n}\"\n\taddDumpTest(v4, \"(\"+v4t+\") \"+v4s+\"\\n\")\n\taddDumpTest(pv4, \"(*\"+v4t+\")(\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(&pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(nv4, \"(*\"+v4t+\")(<nil>)\\n\")\n}\n\nfunc addSliceDumpTests() {\n\t// Slice containing standard float32 values.\n\tv := []float32{3.14, 6.28, 12.56}\n\tvLen := fmt.Sprintf(\"%d\", len(v))\n\tvCap := fmt.Sprintf(\"%d\", cap(v))\n\tnv := (*[]float32)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"float32\"\n\tvs := \"(len=\" + vLen + \" cap=\" + vCap + \") {\\n (\" + vt + \") 3.14,\\n (\" +\n\t\tvt + \") 6.28,\\n (\" + vt + \") 12.56\\n}\"\n\taddDumpTest(v, \"([]\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*[]\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**[]\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*[]\"+vt+\")(<nil>)\\n\")\n\n\t// Slice containing type with custom formatter on pointer receiver only.\n\tv2i0 := pstringer(\"1\")\n\tv2i1 := pstringer(\"2\")\n\tv2i2 := pstringer(\"3\")\n\tv2 := []pstringer{v2i0, v2i1, v2i2}\n\tv2i0Len := fmt.Sprintf(\"%d\", len(v2i0))\n\tv2i1Len := fmt.Sprintf(\"%d\", len(v2i1))\n\tv2i2Len := fmt.Sprintf(\"%d\", len(v2i2))\n\tv2Len := fmt.Sprintf(\"%d\", len(v2))\n\tv2Cap := fmt.Sprintf(\"%d\", cap(v2))\n\tnv2 := (*[]pstringer)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"spew_test.pstringer\"\n\tv2s := \"(len=\" + v2Len + \" cap=\" + v2Cap + \") {\\n (\" + v2t + \") (len=\" +\n\t\tv2i0Len + \") stringer 1,\\n (\" + v2t + \") (len=\" + v2i1Len +\n\t\t\") stringer 2,\\n (\" + v2t + \") (len=\" + v2i2Len + \") \" +\n\t\t\"stringer 3\\n}\"\n\taddDumpTest(v2, \"([]\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*[]\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**[]\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(nv2, \"(*[]\"+v2t+\")(<nil>)\\n\")\n\n\t// Slice containing interfaces.\n\tv3i0 := \"one\"\n\tv3 := []interface{}{v3i0, int(2), uint(3), nil}\n\tv3i0Len := fmt.Sprintf(\"%d\", len(v3i0))\n\tv3Len := fmt.Sprintf(\"%d\", len(v3))\n\tv3Cap := fmt.Sprintf(\"%d\", cap(v3))\n\tnv3 := (*[]interface{})(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"[]interface {}\"\n\tv3t2 := \"string\"\n\tv3t3 := \"int\"\n\tv3t4 := \"uint\"\n\tv3t5 := \"interface {}\"\n\tv3s := \"(len=\" + v3Len + \" cap=\" + v3Cap + \") {\\n (\" + v3t2 + \") \" +\n\t\t\"(len=\" + v3i0Len + \") \\\"one\\\",\\n (\" + v3t3 + \") 2,\\n (\" +\n\t\tv3t4 + \") 3,\\n (\" + v3t5 + \") <nil>\\n}\"\n\taddDumpTest(v3, \"(\"+v3t+\") \"+v3s+\"\\n\")\n\taddDumpTest(pv3, \"(*\"+v3t+\")(\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(&pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(nv3, \"(*\"+v3t+\")(<nil>)\\n\")\n\n\t// Slice containing bytes.\n\tv4 := []byte{\n\t\t0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,\n\t\t0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,\n\t\t0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,\n\t\t0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,\n\t\t0x31, 0x32,\n\t}\n\tv4Len := fmt.Sprintf(\"%d\", len(v4))\n\tv4Cap := fmt.Sprintf(\"%d\", cap(v4))\n\tnv4 := (*[]byte)(nil)\n\tpv4 := &v4\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"[]uint8\"\n\tv4s := \"(len=\" + v4Len + \" cap=\" + v4Cap + \") \" +\n\t\t\"{\\n 00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20\" +\n\t\t\"  |............... |\\n\" +\n\t\t\" 00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30\" +\n\t\t\"  |!\\\"#$%&'()*+,-./0|\\n\" +\n\t\t\" 00000020  31 32                                           \" +\n\t\t\"  |12|\\n}\"\n\taddDumpTest(v4, \"(\"+v4t+\") \"+v4s+\"\\n\")\n\taddDumpTest(pv4, \"(*\"+v4t+\")(\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(&pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(nv4, \"(*\"+v4t+\")(<nil>)\\n\")\n\n\t// Nil slice.\n\tv5 := []int(nil)\n\tnv5 := (*[]int)(nil)\n\tpv5 := &v5\n\tv5Addr := fmt.Sprintf(\"%p\", pv5)\n\tpv5Addr := fmt.Sprintf(\"%p\", &pv5)\n\tv5t := \"[]int\"\n\tv5s := \"<nil>\"\n\taddDumpTest(v5, \"(\"+v5t+\") \"+v5s+\"\\n\")\n\taddDumpTest(pv5, \"(*\"+v5t+\")(\"+v5Addr+\")(\"+v5s+\")\\n\")\n\taddDumpTest(&pv5, \"(**\"+v5t+\")(\"+pv5Addr+\"->\"+v5Addr+\")(\"+v5s+\")\\n\")\n\taddDumpTest(nv5, \"(*\"+v5t+\")(<nil>)\\n\")\n}\n\nfunc addStringDumpTests() {\n\t// Standard string.\n\tv := \"test\"\n\tvLen := fmt.Sprintf(\"%d\", len(v))\n\tnv := (*string)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"string\"\n\tvs := \"(len=\" + vLen + \") \\\"test\\\"\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n}\n\nfunc addInterfaceDumpTests() {\n\t// Nil interface.\n\tvar v interface{}\n\tnv := (*interface{})(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"interface {}\"\n\tvs := \"<nil>\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Sub-interface.\n\tv2 := interface{}(uint16(65535))\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"uint16\"\n\tv2s := \"65535\"\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n}\n\nfunc addMapDumpTests() {\n\t// Map with string keys and int vals.\n\tk := \"one\"\n\tkk := \"two\"\n\tm := map[string]int{k: 1, kk: 2}\n\tklen := fmt.Sprintf(\"%d\", len(k)) // not kLen to shut golint up\n\tkkLen := fmt.Sprintf(\"%d\", len(kk))\n\tmLen := fmt.Sprintf(\"%d\", len(m))\n\tnilMap := map[string]int(nil)\n\tnm := (*map[string]int)(nil)\n\tpm := &m\n\tmAddr := fmt.Sprintf(\"%p\", pm)\n\tpmAddr := fmt.Sprintf(\"%p\", &pm)\n\tmt := \"map[string]int\"\n\tmt1 := \"string\"\n\tmt2 := \"int\"\n\tms := \"(len=\" + mLen + \") {\\n (\" + mt1 + \") (len=\" + klen + \") \" +\n\t\t\"\\\"one\\\": (\" + mt2 + \") 1,\\n (\" + mt1 + \") (len=\" + kkLen +\n\t\t\") \\\"two\\\": (\" + mt2 + \") 2\\n}\"\n\tms2 := \"(len=\" + mLen + \") {\\n (\" + mt1 + \") (len=\" + kkLen + \") \" +\n\t\t\"\\\"two\\\": (\" + mt2 + \") 2,\\n (\" + mt1 + \") (len=\" + klen +\n\t\t\") \\\"one\\\": (\" + mt2 + \") 1\\n}\"\n\taddDumpTest(m, \"(\"+mt+\") \"+ms+\"\\n\", \"(\"+mt+\") \"+ms2+\"\\n\")\n\taddDumpTest(pm, \"(*\"+mt+\")(\"+mAddr+\")(\"+ms+\")\\n\",\n\t\t\"(*\"+mt+\")(\"+mAddr+\")(\"+ms2+\")\\n\")\n\taddDumpTest(&pm, \"(**\"+mt+\")(\"+pmAddr+\"->\"+mAddr+\")(\"+ms+\")\\n\",\n\t\t\"(**\"+mt+\")(\"+pmAddr+\"->\"+mAddr+\")(\"+ms2+\")\\n\")\n\taddDumpTest(nm, \"(*\"+mt+\")(<nil>)\\n\")\n\taddDumpTest(nilMap, \"(\"+mt+\") <nil>\\n\")\n\n\t// Map with custom formatter type on pointer receiver only keys and vals.\n\tk2 := pstringer(\"one\")\n\tv2 := pstringer(\"1\")\n\tm2 := map[pstringer]pstringer{k2: v2}\n\tk2Len := fmt.Sprintf(\"%d\", len(k2))\n\tv2Len := fmt.Sprintf(\"%d\", len(v2))\n\tm2Len := fmt.Sprintf(\"%d\", len(m2))\n\tnilMap2 := map[pstringer]pstringer(nil)\n\tnm2 := (*map[pstringer]pstringer)(nil)\n\tpm2 := &m2\n\tm2Addr := fmt.Sprintf(\"%p\", pm2)\n\tpm2Addr := fmt.Sprintf(\"%p\", &pm2)\n\tm2t := \"map[spew_test.pstringer]spew_test.pstringer\"\n\tm2t1 := \"spew_test.pstringer\"\n\tm2t2 := \"spew_test.pstringer\"\n\tm2s := \"(len=\" + m2Len + \") {\\n (\" + m2t1 + \") (len=\" + k2Len + \") \" +\n\t\t\"stringer one: (\" + m2t2 + \") (len=\" + v2Len + \") stringer 1\\n}\"\n\tif spew.UnsafeDisabled {\n\t\tm2s = \"(len=\" + m2Len + \") {\\n (\" + m2t1 + \") (len=\" + k2Len +\n\t\t\t\") \" + \"\\\"one\\\": (\" + m2t2 + \") (len=\" + v2Len +\n\t\t\t\") \\\"1\\\"\\n}\"\n\t}\n\taddDumpTest(m2, \"(\"+m2t+\") \"+m2s+\"\\n\")\n\taddDumpTest(pm2, \"(*\"+m2t+\")(\"+m2Addr+\")(\"+m2s+\")\\n\")\n\taddDumpTest(&pm2, \"(**\"+m2t+\")(\"+pm2Addr+\"->\"+m2Addr+\")(\"+m2s+\")\\n\")\n\taddDumpTest(nm2, \"(*\"+m2t+\")(<nil>)\\n\")\n\taddDumpTest(nilMap2, \"(\"+m2t+\") <nil>\\n\")\n\n\t// Map with interface keys and values.\n\tk3 := \"one\"\n\tk3Len := fmt.Sprintf(\"%d\", len(k3))\n\tm3 := map[interface{}]interface{}{k3: 1}\n\tm3Len := fmt.Sprintf(\"%d\", len(m3))\n\tnilMap3 := map[interface{}]interface{}(nil)\n\tnm3 := (*map[interface{}]interface{})(nil)\n\tpm3 := &m3\n\tm3Addr := fmt.Sprintf(\"%p\", pm3)\n\tpm3Addr := fmt.Sprintf(\"%p\", &pm3)\n\tm3t := \"map[interface {}]interface {}\"\n\tm3t1 := \"string\"\n\tm3t2 := \"int\"\n\tm3s := \"(len=\" + m3Len + \") {\\n (\" + m3t1 + \") (len=\" + k3Len + \") \" +\n\t\t\"\\\"one\\\": (\" + m3t2 + \") 1\\n}\"\n\taddDumpTest(m3, \"(\"+m3t+\") \"+m3s+\"\\n\")\n\taddDumpTest(pm3, \"(*\"+m3t+\")(\"+m3Addr+\")(\"+m3s+\")\\n\")\n\taddDumpTest(&pm3, \"(**\"+m3t+\")(\"+pm3Addr+\"->\"+m3Addr+\")(\"+m3s+\")\\n\")\n\taddDumpTest(nm3, \"(*\"+m3t+\")(<nil>)\\n\")\n\taddDumpTest(nilMap3, \"(\"+m3t+\") <nil>\\n\")\n\n\t// Map with nil interface value.\n\tk4 := \"nil\"\n\tk4Len := fmt.Sprintf(\"%d\", len(k4))\n\tm4 := map[string]interface{}{k4: nil}\n\tm4Len := fmt.Sprintf(\"%d\", len(m4))\n\tnilMap4 := map[string]interface{}(nil)\n\tnm4 := (*map[string]interface{})(nil)\n\tpm4 := &m4\n\tm4Addr := fmt.Sprintf(\"%p\", pm4)\n\tpm4Addr := fmt.Sprintf(\"%p\", &pm4)\n\tm4t := \"map[string]interface {}\"\n\tm4t1 := \"string\"\n\tm4t2 := \"interface {}\"\n\tm4s := \"(len=\" + m4Len + \") {\\n (\" + m4t1 + \") (len=\" + k4Len + \")\" +\n\t\t\" \\\"nil\\\": (\" + m4t2 + \") <nil>\\n}\"\n\taddDumpTest(m4, \"(\"+m4t+\") \"+m4s+\"\\n\")\n\taddDumpTest(pm4, \"(*\"+m4t+\")(\"+m4Addr+\")(\"+m4s+\")\\n\")\n\taddDumpTest(&pm4, \"(**\"+m4t+\")(\"+pm4Addr+\"->\"+m4Addr+\")(\"+m4s+\")\\n\")\n\taddDumpTest(nm4, \"(*\"+m4t+\")(<nil>)\\n\")\n\taddDumpTest(nilMap4, \"(\"+m4t+\") <nil>\\n\")\n}\n\nfunc addStructDumpTests() {\n\t// Struct with primitives.\n\ttype s1 struct {\n\t\ta int8\n\t\tb uint8\n\t}\n\tv := s1{127, 255}\n\tnv := (*s1)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"spew_test.s1\"\n\tvt2 := \"int8\"\n\tvt3 := \"uint8\"\n\tvs := \"{\\n a: (\" + vt2 + \") 127,\\n b: (\" + vt3 + \") 255\\n}\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Struct that contains another struct.\n\ttype s2 struct {\n\t\ts1 s1\n\t\tb  bool\n\t}\n\tv2 := s2{s1{127, 255}, true}\n\tnv2 := (*s2)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"spew_test.s2\"\n\tv2t2 := \"spew_test.s1\"\n\tv2t3 := \"int8\"\n\tv2t4 := \"uint8\"\n\tv2t5 := \"bool\"\n\tv2s := \"{\\n s1: (\" + v2t2 + \") {\\n  a: (\" + v2t3 + \") 127,\\n  b: (\" +\n\t\tv2t4 + \") 255\\n },\\n b: (\" + v2t5 + \") true\\n}\"\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(nv2, \"(*\"+v2t+\")(<nil>)\\n\")\n\n\t// Struct that contains custom type with Stringer pointer interface via both\n\t// exported and unexported fields.\n\ttype s3 struct {\n\t\ts pstringer\n\t\tS pstringer\n\t}\n\tv3 := s3{\"test\", \"test2\"}\n\tnv3 := (*s3)(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"spew_test.s3\"\n\tv3t2 := \"spew_test.pstringer\"\n\tv3s := \"{\\n s: (\" + v3t2 + \") (len=4) stringer test,\\n S: (\" + v3t2 +\n\t\t\") (len=5) stringer test2\\n}\"\n\tv3sp := v3s\n\tif spew.UnsafeDisabled {\n\t\tv3s = \"{\\n s: (\" + v3t2 + \") (len=4) \\\"test\\\",\\n S: (\" +\n\t\t\tv3t2 + \") (len=5) \\\"test2\\\"\\n}\"\n\t\tv3sp = \"{\\n s: (\" + v3t2 + \") (len=4) \\\"test\\\",\\n S: (\" +\n\t\t\tv3t2 + \") (len=5) stringer test2\\n}\"\n\t}\n\taddDumpTest(v3, \"(\"+v3t+\") \"+v3s+\"\\n\")\n\taddDumpTest(pv3, \"(*\"+v3t+\")(\"+v3Addr+\")(\"+v3sp+\")\\n\")\n\taddDumpTest(&pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")(\"+v3sp+\")\\n\")\n\taddDumpTest(nv3, \"(*\"+v3t+\")(<nil>)\\n\")\n\n\t// Struct that contains embedded struct and field to same struct.\n\te := embed{\"embedstr\"}\n\teLen := fmt.Sprintf(\"%d\", len(\"embedstr\"))\n\tv4 := embedwrap{embed: &e, e: &e}\n\tnv4 := (*embedwrap)(nil)\n\tpv4 := &v4\n\teAddr := fmt.Sprintf(\"%p\", &e)\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"spew_test.embedwrap\"\n\tv4t2 := \"spew_test.embed\"\n\tv4t3 := \"string\"\n\tv4s := \"{\\n embed: (*\" + v4t2 + \")(\" + eAddr + \")({\\n  a: (\" + v4t3 +\n\t\t\") (len=\" + eLen + \") \\\"embedstr\\\"\\n }),\\n e: (*\" + v4t2 +\n\t\t\")(\" + eAddr + \")({\\n  a: (\" + v4t3 + \") (len=\" + eLen + \")\" +\n\t\t\" \\\"embedstr\\\"\\n })\\n}\"\n\taddDumpTest(v4, \"(\"+v4t+\") \"+v4s+\"\\n\")\n\taddDumpTest(pv4, \"(*\"+v4t+\")(\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(&pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")(\"+v4s+\")\\n\")\n\taddDumpTest(nv4, \"(*\"+v4t+\")(<nil>)\\n\")\n}\n\nfunc addUintptrDumpTests() {\n\t// Null pointer.\n\tv := uintptr(0)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"uintptr\"\n\tvs := \"<nil>\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\n\t// Address of real variable.\n\ti := 1\n\tv2 := uintptr(unsafe.Pointer(&i))\n\tnv2 := (*uintptr)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"uintptr\"\n\tv2s := fmt.Sprintf(\"%p\", &i)\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(nv2, \"(*\"+v2t+\")(<nil>)\\n\")\n}\n\nfunc addUnsafePointerDumpTests() {\n\t// Null pointer.\n\tv := unsafe.Pointer(nil)\n\tnv := (*unsafe.Pointer)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"unsafe.Pointer\"\n\tvs := \"<nil>\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Address of real variable.\n\ti := 1\n\tv2 := unsafe.Pointer(&i)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"unsafe.Pointer\"\n\tv2s := fmt.Sprintf(\"%p\", &i)\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n}\n\nfunc addChanDumpTests() {\n\t// Nil channel.\n\tvar v chan int\n\tpv := &v\n\tnv := (*chan int)(nil)\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"chan int\"\n\tvs := \"<nil>\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Real channel.\n\tv2 := make(chan int)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"chan int\"\n\tv2s := fmt.Sprintf(\"%p\", v2)\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n}\n\nfunc addFuncDumpTests() {\n\t// Function with no params and no returns.\n\tv := addIntDumpTests\n\tnv := (*func())(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"func()\"\n\tvs := fmt.Sprintf(\"%p\", v)\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n\n\t// Function with param and no returns.\n\tv2 := TestDump\n\tnv2 := (*func(*testing.T))(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"func(*testing.T)\"\n\tv2s := fmt.Sprintf(\"%p\", v2)\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s+\")\\n\")\n\taddDumpTest(nv2, \"(*\"+v2t+\")(<nil>)\\n\")\n\n\t// Function with multiple params and multiple returns.\n\tvar v3 = func(i int, s string) (b bool, err error) {\n\t\treturn true, nil\n\t}\n\tnv3 := (*func(int, string) (bool, error))(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"func(int, string) (bool, error)\"\n\tv3s := fmt.Sprintf(\"%p\", v3)\n\taddDumpTest(v3, \"(\"+v3t+\") \"+v3s+\"\\n\")\n\taddDumpTest(pv3, \"(*\"+v3t+\")(\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(&pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")(\"+v3s+\")\\n\")\n\taddDumpTest(nv3, \"(*\"+v3t+\")(<nil>)\\n\")\n}\n\nfunc addCircularDumpTests() {\n\t// Struct that is circular through self referencing.\n\ttype circular struct {\n\t\tc *circular\n\t}\n\tv := circular{nil}\n\tv.c = &v\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"spew_test.circular\"\n\tvs := \"{\\n c: (*\" + vt + \")(\" + vAddr + \")({\\n  c: (*\" + vt + \")(\" +\n\t\tvAddr + \")(<already shown>)\\n })\\n}\"\n\tvs2 := \"{\\n c: (*\" + vt + \")(\" + vAddr + \")(<already shown>)\\n}\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs2+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs2+\")\\n\")\n\n\t// Structs that are circular through cross referencing.\n\tv2 := xref1{nil}\n\tts2 := xref2{&v2}\n\tv2.ps2 = &ts2\n\tpv2 := &v2\n\tts2Addr := fmt.Sprintf(\"%p\", &ts2)\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"spew_test.xref1\"\n\tv2t2 := \"spew_test.xref2\"\n\tv2s := \"{\\n ps2: (*\" + v2t2 + \")(\" + ts2Addr + \")({\\n  ps1: (*\" + v2t +\n\t\t\")(\" + v2Addr + \")({\\n   ps2: (*\" + v2t2 + \")(\" + ts2Addr +\n\t\t\")(<already shown>)\\n  })\\n })\\n}\"\n\tv2s2 := \"{\\n ps2: (*\" + v2t2 + \")(\" + ts2Addr + \")({\\n  ps1: (*\" + v2t +\n\t\t\")(\" + v2Addr + \")(<already shown>)\\n })\\n}\"\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\taddDumpTest(pv2, \"(*\"+v2t+\")(\"+v2Addr+\")(\"+v2s2+\")\\n\")\n\taddDumpTest(&pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")(\"+v2s2+\")\\n\")\n\n\t// Structs that are indirectly circular.\n\tv3 := indirCir1{nil}\n\ttic2 := indirCir2{nil}\n\ttic3 := indirCir3{&v3}\n\ttic2.ps3 = &tic3\n\tv3.ps2 = &tic2\n\tpv3 := &v3\n\ttic2Addr := fmt.Sprintf(\"%p\", &tic2)\n\ttic3Addr := fmt.Sprintf(\"%p\", &tic3)\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"spew_test.indirCir1\"\n\tv3t2 := \"spew_test.indirCir2\"\n\tv3t3 := \"spew_test.indirCir3\"\n\tv3s := \"{\\n ps2: (*\" + v3t2 + \")(\" + tic2Addr + \")({\\n  ps3: (*\" + v3t3 +\n\t\t\")(\" + tic3Addr + \")({\\n   ps1: (*\" + v3t + \")(\" + v3Addr +\n\t\t\")({\\n    ps2: (*\" + v3t2 + \")(\" + tic2Addr +\n\t\t\")(<already shown>)\\n   })\\n  })\\n })\\n}\"\n\tv3s2 := \"{\\n ps2: (*\" + v3t2 + \")(\" + tic2Addr + \")({\\n  ps3: (*\" + v3t3 +\n\t\t\")(\" + tic3Addr + \")({\\n   ps1: (*\" + v3t + \")(\" + v3Addr +\n\t\t\")(<already shown>)\\n  })\\n })\\n}\"\n\taddDumpTest(v3, \"(\"+v3t+\") \"+v3s+\"\\n\")\n\taddDumpTest(pv3, \"(*\"+v3t+\")(\"+v3Addr+\")(\"+v3s2+\")\\n\")\n\taddDumpTest(&pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")(\"+v3s2+\")\\n\")\n}\n\nfunc addPanicDumpTests() {\n\t// Type that panics in its Stringer interface.\n\tv := panicer(127)\n\tnv := (*panicer)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"spew_test.panicer\"\n\tvs := \"(PANIC=test panic)127\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n}\n\nfunc addErrorDumpTests() {\n\t// Type that has a custom Error interface.\n\tv := customError(127)\n\tnv := (*customError)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"spew_test.customError\"\n\tvs := \"error: 127\"\n\taddDumpTest(v, \"(\"+vt+\") \"+vs+\"\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(*\"+vt+\")(<nil>)\\n\")\n}\n\n// TestDump executes all of the tests described by dumpTests.\nfunc TestDump(t *testing.T) {\n\t// Setup tests.\n\taddIntDumpTests()\n\taddUintDumpTests()\n\taddBoolDumpTests()\n\taddFloatDumpTests()\n\taddComplexDumpTests()\n\taddArrayDumpTests()\n\taddSliceDumpTests()\n\taddStringDumpTests()\n\taddInterfaceDumpTests()\n\taddMapDumpTests()\n\taddStructDumpTests()\n\taddUintptrDumpTests()\n\taddUnsafePointerDumpTests()\n\taddChanDumpTests()\n\taddFuncDumpTests()\n\taddCircularDumpTests()\n\taddPanicDumpTests()\n\taddErrorDumpTests()\n\taddCgoDumpTests()\n\n\tt.Logf(\"Running %d tests\", len(dumpTests))\n\tfor i, test := range dumpTests {\n\t\tbuf := new(bytes.Buffer)\n\t\tspew.Fdump(buf, test.in)\n\t\ts := buf.String()\n\t\tif testFailed(s, test.wants) {\n\t\t\tt.Errorf(\"Dump #%d\\n got: %s %s\", i, s, stringizeWants(test.wants))\n\t\t\tcontinue\n\t\t}\n\t}\n}\n\nfunc TestDumpSortedKeys(t *testing.T) {\n\tcfg := spew.ConfigState{SortKeys: true}\n\ts := cfg.Sdump(map[int]string{1: \"1\", 3: \"3\", 2: \"2\"})\n\texpected := \"(map[int]string) (len=3) {\\n(int) 1: (string) (len=1) \" +\n\t\t\"\\\"1\\\",\\n(int) 2: (string) (len=1) \\\"2\\\",\\n(int) 3: (string) \" +\n\t\t\"(len=1) \\\"3\\\"\\n\" +\n\t\t\"}\\n\"\n\tif s != expected {\n\t\tt.Errorf(\"Sorted keys mismatch:\\n  %v %v\", s, expected)\n\t}\n\n\ts = cfg.Sdump(map[stringer]int{\"1\": 1, \"3\": 3, \"2\": 2})\n\texpected = \"(map[spew_test.stringer]int) (len=3) {\\n\" +\n\t\t\"(spew_test.stringer) (len=1) stringer 1: (int) 1,\\n\" +\n\t\t\"(spew_test.stringer) (len=1) stringer 2: (int) 2,\\n\" +\n\t\t\"(spew_test.stringer) (len=1) stringer 3: (int) 3\\n\" +\n\t\t\"}\\n\"\n\tif s != expected {\n\t\tt.Errorf(\"Sorted keys mismatch:\\n  %v %v\", s, expected)\n\t}\n\n\ts = cfg.Sdump(map[pstringer]int{pstringer(\"1\"): 1, pstringer(\"3\"): 3, pstringer(\"2\"): 2})\n\texpected = \"(map[spew_test.pstringer]int) (len=3) {\\n\" +\n\t\t\"(spew_test.pstringer) (len=1) stringer 1: (int) 1,\\n\" +\n\t\t\"(spew_test.pstringer) (len=1) stringer 2: (int) 2,\\n\" +\n\t\t\"(spew_test.pstringer) (len=1) stringer 3: (int) 3\\n\" +\n\t\t\"}\\n\"\n\tif spew.UnsafeDisabled {\n\t\texpected = \"(map[spew_test.pstringer]int) (len=3) {\\n\" +\n\t\t\t\"(spew_test.pstringer) (len=1) \\\"1\\\": (int) 1,\\n\" +\n\t\t\t\"(spew_test.pstringer) (len=1) \\\"2\\\": (int) 2,\\n\" +\n\t\t\t\"(spew_test.pstringer) (len=1) \\\"3\\\": (int) 3\\n\" +\n\t\t\t\"}\\n\"\n\t}\n\tif s != expected {\n\t\tt.Errorf(\"Sorted keys mismatch:\\n  %v %v\", s, expected)\n\t}\n\n\ts = cfg.Sdump(map[customError]int{customError(1): 1, customError(3): 3, customError(2): 2})\n\texpected = \"(map[spew_test.customError]int) (len=3) {\\n\" +\n\t\t\"(spew_test.customError) error: 1: (int) 1,\\n\" +\n\t\t\"(spew_test.customError) error: 2: (int) 2,\\n\" +\n\t\t\"(spew_test.customError) error: 3: (int) 3\\n\" +\n\t\t\"}\\n\"\n\tif s != expected {\n\t\tt.Errorf(\"Sorted keys mismatch:\\n  %v %v\", s, expected)\n\t}\n\n}\n"
  },
  {
    "path": "internal/spew/dumpcgo_test.go",
    "content": "// Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when both cgo is supported and \"-tags testcgo\" is added to the go test\n// command line.  This means the cgo tests are only added (and hence run) when\n// specifially requested.  This configuration is used because spew itself\n// does not require cgo to run even though it does handle certain cgo types\n// specially.  Rather than forcing all clients to require cgo and an external\n// C compiler just to run the tests, this scheme makes them optional.\n//\n//go:build cgo && testcgo\n// +build cgo,testcgo\n\npackage spew_test\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/stretchr/testify/internal/spew/testdata\"\n)\n\nfunc addCgoDumpTests() {\n\t// C char pointer.\n\tv := testdata.GetCgoCharPointer()\n\tnv := testdata.GetCgoNullCharPointer()\n\tpv := &v\n\tvcAddr := fmt.Sprintf(\"%p\", v)\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"*testdata._Ctype_char\"\n\tvs := \"116\"\n\taddDumpTest(v, \"(\"+vt+\")(\"+vcAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(pv, \"(*\"+vt+\")(\"+vAddr+\"->\"+vcAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(&pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\"->\"+vcAddr+\")(\"+vs+\")\\n\")\n\taddDumpTest(nv, \"(\"+vt+\")(<nil>)\\n\")\n\n\t// C char array.\n\tv2, v2l, v2c := testdata.GetCgoCharArray()\n\tv2Len := fmt.Sprintf(\"%d\", v2l)\n\tv2Cap := fmt.Sprintf(\"%d\", v2c)\n\tv2t := \"[6]testdata._Ctype_char\"\n\tv2s := \"(len=\" + v2Len + \" cap=\" + v2Cap + \") \" +\n\t\t\"{\\n 00000000  74 65 73 74 32 00                               \" +\n\t\t\"  |test2.|\\n}\"\n\taddDumpTest(v2, \"(\"+v2t+\") \"+v2s+\"\\n\")\n\n\t// C unsigned char array.\n\tv3, v3l, v3c := testdata.GetCgoUnsignedCharArray()\n\tv3Len := fmt.Sprintf(\"%d\", v3l)\n\tv3Cap := fmt.Sprintf(\"%d\", v3c)\n\tv3t := \"[6]testdata._Ctype_unsignedchar\"\n\tv3t2 := \"[6]testdata._Ctype_uchar\"\n\tv3s := \"(len=\" + v3Len + \" cap=\" + v3Cap + \") \" +\n\t\t\"{\\n 00000000  74 65 73 74 33 00                               \" +\n\t\t\"  |test3.|\\n}\"\n\taddDumpTest(v3, \"(\"+v3t+\") \"+v3s+\"\\n\", \"(\"+v3t2+\") \"+v3s+\"\\n\")\n\n\t// C signed char array.\n\tv4, v4l, v4c := testdata.GetCgoSignedCharArray()\n\tv4Len := fmt.Sprintf(\"%d\", v4l)\n\tv4Cap := fmt.Sprintf(\"%d\", v4c)\n\tv4t := \"[6]testdata._Ctype_schar\"\n\tv4t2 := \"testdata._Ctype_schar\"\n\tv4s := \"(len=\" + v4Len + \" cap=\" + v4Cap + \") \" +\n\t\t\"{\\n (\" + v4t2 + \") 116,\\n (\" + v4t2 + \") 101,\\n (\" + v4t2 +\n\t\t\") 115,\\n (\" + v4t2 + \") 116,\\n (\" + v4t2 + \") 52,\\n (\" + v4t2 +\n\t\t\") 0\\n}\"\n\taddDumpTest(v4, \"(\"+v4t+\") \"+v4s+\"\\n\")\n\n\t// C uint8_t array.\n\tv5, v5l, v5c := testdata.GetCgoUint8tArray()\n\tv5Len := fmt.Sprintf(\"%d\", v5l)\n\tv5Cap := fmt.Sprintf(\"%d\", v5c)\n\tv5t := \"[6]testdata._Ctype_uint8_t\"\n\tv5t2 := \"[6]testdata._Ctype_uchar\"\n\tv5s := \"(len=\" + v5Len + \" cap=\" + v5Cap + \") \" +\n\t\t\"{\\n 00000000  74 65 73 74 35 00                               \" +\n\t\t\"  |test5.|\\n}\"\n\taddDumpTest(v5, \"(\"+v5t+\") \"+v5s+\"\\n\", \"(\"+v5t2+\") \"+v5s+\"\\n\")\n\n\t// C typedefed unsigned char array.\n\tv6, v6l, v6c := testdata.GetCgoTypdefedUnsignedCharArray()\n\tv6Len := fmt.Sprintf(\"%d\", v6l)\n\tv6Cap := fmt.Sprintf(\"%d\", v6c)\n\tv6t := \"[6]testdata._Ctype_custom_uchar_t\"\n\tv6t2 := \"[6]testdata._Ctype_uchar\"\n\tv6s := \"(len=\" + v6Len + \" cap=\" + v6Cap + \") \" +\n\t\t\"{\\n 00000000  74 65 73 74 36 00                               \" +\n\t\t\"  |test6.|\\n}\"\n\taddDumpTest(v6, \"(\"+v6t+\") \"+v6s+\"\\n\", \"(\"+v6t2+\") \"+v6s+\"\\n\")\n}\n"
  },
  {
    "path": "internal/spew/dumpnocgo_test.go",
    "content": "// Copyright (c) 2013 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when either cgo is not supported or \"-tags testcgo\" is not added to the go\n// test command line.  This file intentionally does not setup any cgo tests in\n// this scenario.\n//go:build !cgo || !testcgo\n// +build !cgo !testcgo\n\npackage spew_test\n\nfunc addCgoDumpTests() {\n\t// Don't add any tests for cgo since this file is only compiled when\n\t// there should not be any cgo tests.\n}\n"
  },
  {
    "path": "internal/spew/format.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// supportedFlags is a list of all the character flags supported by fmt package.\nconst supportedFlags = \"0-+# \"\n\n// formatState implements the fmt.Formatter interface and contains information\n// about the state of a formatting operation.  The NewFormatter function can\n// be used to get a new Formatter which can be used directly as arguments\n// in standard fmt package printing calls.\ntype formatState struct {\n\tvalue          interface{}\n\tfs             fmt.State\n\tdepth          int\n\tpointers       map[uintptr]int\n\tignoreNextType bool\n\tcs             *ConfigState\n}\n\n// buildDefaultFormat recreates the original format string without precision\n// and width information to pass in to fmt.Sprintf in the case of an\n// unrecognized type.  Unless new types are added to the language, this\n// function won't ever be called.\nfunc (f *formatState) buildDefaultFormat() (format string) {\n\tbuf := bytes.NewBuffer(percentBytes)\n\n\tfor _, flag := range supportedFlags {\n\t\tif f.fs.Flag(int(flag)) {\n\t\t\tbuf.WriteRune(flag)\n\t\t}\n\t}\n\n\tbuf.WriteRune('v')\n\n\tformat = buf.String()\n\treturn format\n}\n\n// constructOrigFormat recreates the original format string including precision\n// and width information to pass along to the standard fmt package.  This allows\n// automatic deferral of all format strings this package doesn't support.\nfunc (f *formatState) constructOrigFormat(verb rune) (format string) {\n\tbuf := bytes.NewBuffer(percentBytes)\n\n\tfor _, flag := range supportedFlags {\n\t\tif f.fs.Flag(int(flag)) {\n\t\t\tbuf.WriteRune(flag)\n\t\t}\n\t}\n\n\tif width, ok := f.fs.Width(); ok {\n\t\tbuf.WriteString(strconv.Itoa(width))\n\t}\n\n\tif precision, ok := f.fs.Precision(); ok {\n\t\tbuf.Write(precisionBytes)\n\t\tbuf.WriteString(strconv.Itoa(precision))\n\t}\n\n\tbuf.WriteRune(verb)\n\n\tformat = buf.String()\n\treturn format\n}\n\n// unpackValue returns values inside of non-nil interfaces when possible and\n// ensures that types for values which have been unpacked from an interface\n// are displayed when the show types flag is also set.\n// This is useful for data types like structs, arrays, slices, and maps which\n// can contain varying types packed inside an interface.\nfunc (f *formatState) unpackValue(v reflect.Value) reflect.Value {\n\tif v.Kind() == reflect.Interface {\n\t\tf.ignoreNextType = false\n\t\tif !v.IsNil() {\n\t\t\tv = v.Elem()\n\t\t}\n\t}\n\treturn v\n}\n\n// formatPtr handles formatting of pointers by indirecting them as necessary.\nfunc (f *formatState) formatPtr(v reflect.Value) {\n\t// Display nil if top level pointer is nil.\n\tshowTypes := f.fs.Flag('#')\n\tif v.IsNil() && (!showTypes || f.ignoreNextType) {\n\t\tf.fs.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\t// Remove pointers at or below the current depth from map used to detect\n\t// circular refs.\n\tfor k, depth := range f.pointers {\n\t\tif depth >= f.depth {\n\t\t\tdelete(f.pointers, k)\n\t\t}\n\t}\n\n\t// Keep list of all dereferenced pointers to possibly show later.\n\tpointerChain := make([]uintptr, 0)\n\n\t// Figure out how many levels of indirection there are by derferencing\n\t// pointers and unpacking interfaces down the chain while detecting circular\n\t// references.\n\tnilFound := false\n\tcycleFound := false\n\tindirects := 0\n\tve := v\n\tfor ve.Kind() == reflect.Ptr {\n\t\tif ve.IsNil() {\n\t\t\tnilFound = true\n\t\t\tbreak\n\t\t}\n\t\tindirects++\n\t\taddr := ve.Pointer()\n\t\tpointerChain = append(pointerChain, addr)\n\t\tif pd, ok := f.pointers[addr]; ok && pd < f.depth {\n\t\t\tcycleFound = true\n\t\t\tindirects--\n\t\t\tbreak\n\t\t}\n\t\tf.pointers[addr] = f.depth\n\n\t\tve = ve.Elem()\n\t\tif ve.Kind() == reflect.Interface {\n\t\t\tif ve.IsNil() {\n\t\t\t\tnilFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tve = ve.Elem()\n\t\t}\n\t}\n\n\t// Display type or indirection level depending on flags.\n\tif showTypes && !f.ignoreNextType {\n\t\tf.fs.Write(openParenBytes)\n\t\tf.fs.Write(bytes.Repeat(asteriskBytes, indirects))\n\t\tf.fs.Write([]byte(ve.Type().String()))\n\t\tf.fs.Write(closeParenBytes)\n\t} else {\n\t\tif nilFound || cycleFound {\n\t\t\tindirects += strings.Count(ve.Type().String(), \"*\")\n\t\t}\n\t\tf.fs.Write(openAngleBytes)\n\t\tf.fs.Write([]byte(strings.Repeat(\"*\", indirects)))\n\t\tf.fs.Write(closeAngleBytes)\n\t}\n\n\t// Display pointer information depending on flags.\n\tif f.fs.Flag('+') && (len(pointerChain) > 0) {\n\t\tf.fs.Write(openParenBytes)\n\t\tfor i, addr := range pointerChain {\n\t\t\tif i > 0 {\n\t\t\t\tf.fs.Write(pointerChainBytes)\n\t\t\t}\n\t\t\tprintHexPtr(f.fs, addr)\n\t\t}\n\t\tf.fs.Write(closeParenBytes)\n\t}\n\n\t// Display dereferenced value.\n\tswitch {\n\tcase nilFound:\n\t\tf.fs.Write(nilAngleBytes)\n\n\tcase cycleFound:\n\t\tf.fs.Write(circularShortBytes)\n\n\tdefault:\n\t\tf.ignoreNextType = true\n\t\tf.format(ve)\n\t}\n}\n\n// format is the main workhorse for providing the Formatter interface.  It\n// uses the passed reflect value to figure out what kind of object we are\n// dealing with and formats it appropriately.  It is a recursive function,\n// however circular data structures are detected and handled properly.\nfunc (f *formatState) format(v reflect.Value) {\n\t// Handle invalid reflect values immediately.\n\tkind := v.Kind()\n\tif kind == reflect.Invalid {\n\t\tf.fs.Write(invalidAngleBytes)\n\t\treturn\n\t}\n\n\t// Handle pointers specially.\n\tif kind == reflect.Ptr {\n\t\tf.formatPtr(v)\n\t\treturn\n\t}\n\n\t// Print type information unless already handled elsewhere.\n\tif !f.ignoreNextType && f.fs.Flag('#') {\n\t\tf.fs.Write(openParenBytes)\n\t\tf.fs.Write([]byte(v.Type().String()))\n\t\tf.fs.Write(closeParenBytes)\n\t}\n\tf.ignoreNextType = false\n\n\t// Call Stringer/error interfaces if they exist and the handle methods\n\t// flag is enabled.\n\tif !f.cs.DisableMethods {\n\t\tif (kind != reflect.Invalid) && (kind != reflect.Interface) {\n\t\t\tif handled := handleMethods(f.cs, f.fs, v); handled {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch kind {\n\tcase reflect.Invalid:\n\t\t// Do nothing.  We should never get here since invalid has already\n\t\t// been handled above.\n\n\tcase reflect.Bool:\n\t\tprintBool(f.fs, v.Bool())\n\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\tprintInt(f.fs, v.Int(), 10)\n\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\tprintUint(f.fs, v.Uint(), 10)\n\n\tcase reflect.Float32:\n\t\tprintFloat(f.fs, v.Float(), 32)\n\n\tcase reflect.Float64:\n\t\tprintFloat(f.fs, v.Float(), 64)\n\n\tcase reflect.Complex64:\n\t\tprintComplex(f.fs, v.Complex(), 32)\n\n\tcase reflect.Complex128:\n\t\tprintComplex(f.fs, v.Complex(), 64)\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\t\tfallthrough\n\n\tcase reflect.Array:\n\t\tf.fs.Write(openBracketBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tnumEntries := v.Len()\n\t\t\tfor i := 0; i < numEntries; i++ {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(v.Index(i)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeBracketBytes)\n\n\tcase reflect.String:\n\t\tf.fs.Write([]byte(v.String()))\n\n\tcase reflect.Interface:\n\t\t// The only time we should get here is for nil interfaces due to\n\t\t// unpackValue calls.\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// Do nothing.  We should never get here since pointers have already\n\t\t// been handled above.\n\n\tcase reflect.Map:\n\t\t// nil maps should be indicated as different than empty maps\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\n\t\tf.fs.Write(openMapBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tkeys := v.MapKeys()\n\t\t\tif f.cs.SortKeys {\n\t\t\t\tsortValues(keys, f.cs)\n\t\t\t}\n\t\t\tfor i, key := range keys {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(key))\n\t\t\t\tf.fs.Write(colonBytes)\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(v.MapIndex(key)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeMapBytes)\n\n\tcase reflect.Struct:\n\t\tnumFields := v.NumField()\n\t\tf.fs.Write(openBraceBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tvt := v.Type()\n\t\t\tfor i := 0; i < numFields; i++ {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tvtf := vt.Field(i)\n\t\t\t\tif f.fs.Flag('+') || f.fs.Flag('#') {\n\t\t\t\t\tf.fs.Write([]byte(vtf.Name))\n\t\t\t\t\tf.fs.Write(colonBytes)\n\t\t\t\t}\n\t\t\t\tf.format(f.unpackValue(v.Field(i)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeBraceBytes)\n\n\tcase reflect.Uintptr:\n\t\tprintHexPtr(f.fs, uintptr(v.Uint()))\n\n\tcase reflect.UnsafePointer, reflect.Chan, reflect.Func:\n\t\tprintHexPtr(f.fs, v.Pointer())\n\n\t// There were not any other types at the time this code was written, but\n\t// fall back to letting the default fmt package handle it if any get added.\n\tdefault:\n\t\tformat := f.buildDefaultFormat()\n\t\tif v.CanInterface() {\n\t\t\tfmt.Fprintf(f.fs, format, v.Interface())\n\t\t} else {\n\t\t\tfmt.Fprintf(f.fs, format, v.String())\n\t\t}\n\t}\n}\n\n// Format satisfies the fmt.Formatter interface. See NewFormatter for usage\n// details.\nfunc (f *formatState) Format(fs fmt.State, verb rune) {\n\tf.fs = fs\n\n\t// Use standard formatting for verbs that are not v.\n\tif verb != 'v' {\n\t\tformat := f.constructOrigFormat(verb)\n\t\tfmt.Fprintf(fs, format, f.value)\n\t\treturn\n\t}\n\n\tif f.value == nil {\n\t\tif fs.Flag('#') {\n\t\t\tfs.Write(interfaceBytes)\n\t\t}\n\t\tfs.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\tf.format(reflect.ValueOf(f.value))\n}\n\n// newFormatter is a helper function to consolidate the logic from the various\n// public methods which take varying config states.\nfunc newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {\n\tfs := &formatState{value: v, cs: cs}\n\tfs.pointers = make(map[uintptr]int)\n\treturn fs\n}\n\n/*\nNewFormatter returns a custom formatter that satisfies the fmt.Formatter\ninterface.  As a result, it integrates cleanly with standard fmt package\nprinting functions.  The formatter is useful for inline printing of smaller data\ntypes similar to the standard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nTypically this function shouldn't be called directly.  It is much easier to make\nuse of the custom formatter by calling one of the convenience functions such as\nPrintf, Println, or Fprintf.\n*/\nfunc NewFormatter(v interface{}) fmt.Formatter {\n\treturn newFormatter(&Config, v)\n}\n"
  },
  {
    "path": "internal/spew/format_test.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*\nTest Summary:\nNOTE: For each test, a nil pointer, a single pointer and double pointer to the\nbase test element are also tested to ensure proper indirection across all types.\n\n- Max int8, int16, int32, int64, int\n- Max uint8, uint16, uint32, uint64, uint\n- Boolean true and false\n- Standard complex64 and complex128\n- Array containing standard ints\n- Array containing type with custom formatter on pointer receiver only\n- Array containing interfaces\n- Slice containing standard float32 values\n- Slice containing type with custom formatter on pointer receiver only\n- Slice containing interfaces\n- Nil slice\n- Standard string\n- Nil interface\n- Sub-interface\n- Map with string keys and int vals\n- Map with custom formatter type on pointer receiver only keys and vals\n- Map with interface keys and values\n- Map with nil interface value\n- Struct with primitives\n- Struct that contains another struct\n- Struct that contains custom type with Stringer pointer interface via both\n  exported and unexported fields\n- Struct that contains embedded struct and field to same struct\n- Uintptr to 0 (null pointer)\n- Uintptr address of real variable\n- Unsafe.Pointer to 0 (null pointer)\n- Unsafe.Pointer to address of real variable\n- Nil channel\n- Standard int channel\n- Function with no params and no returns\n- Function with param and no returns\n- Function with multiple params and multiple returns\n- Struct that is circular through self referencing\n- Structs that are circular through cross referencing\n- Structs that are indirectly circular\n- Type that panics in its Stringer interface\n- Type that has a custom Error interface\n- %x passthrough with uint\n- %#x passthrough with uint\n- %f passthrough with precision\n- %f passthrough with width and precision\n- %d passthrough with width\n- %q passthrough with string\n*/\n\npackage spew_test\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"testing\"\n\t\"unsafe\"\n\n\t\"github.com/stretchr/testify/internal/spew\"\n)\n\n// formatterTest is used to describe a test to be performed against NewFormatter.\ntype formatterTest struct {\n\tformat string\n\tin     interface{}\n\twants  []string\n}\n\n// formatterTests houses all of the tests to be performed against NewFormatter.\nvar formatterTests = make([]formatterTest, 0)\n\n// addFormatterTest is a helper method to append the passed input and desired\n// result to formatterTests.\nfunc addFormatterTest(format string, in interface{}, wants ...string) {\n\ttest := formatterTest{format, in, wants}\n\tformatterTests = append(formatterTests, test)\n}\n\nfunc addIntFormatterTests() {\n\t// Max int8.\n\tv := int8(127)\n\tnv := (*int8)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"int8\"\n\tvs := \"127\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Max int16.\n\tv2 := int16(32767)\n\tnv2 := (*int16)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"int16\"\n\tv2s := \"32767\"\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\n\t// Max int32.\n\tv3 := int32(2147483647)\n\tnv3 := (*int32)(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"int32\"\n\tv3s := \"2147483647\"\n\taddFormatterTest(\"%v\", v3, v3s)\n\taddFormatterTest(\"%v\", pv3, \"<*>\"+v3s)\n\taddFormatterTest(\"%v\", &pv3, \"<**>\"+v3s)\n\taddFormatterTest(\"%v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%+v\", v3, v3s)\n\taddFormatterTest(\"%+v\", pv3, \"<*>(\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", &pv3, \"<**>(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%#v\", v3, \"(\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#v\", pv3, \"(*\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#v\", &pv3, \"(**\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v3, \"(\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#+v\", pv3, \"(*\"+v3t+\")(\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%#+v\", &pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%#v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\n\t// Max int64.\n\tv4 := int64(9223372036854775807)\n\tnv4 := (*int64)(nil)\n\tpv4 := &v4\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"int64\"\n\tv4s := \"9223372036854775807\"\n\taddFormatterTest(\"%v\", v4, v4s)\n\taddFormatterTest(\"%v\", pv4, \"<*>\"+v4s)\n\taddFormatterTest(\"%v\", &pv4, \"<**>\"+v4s)\n\taddFormatterTest(\"%v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%+v\", v4, v4s)\n\taddFormatterTest(\"%+v\", pv4, \"<*>(\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%+v\", &pv4, \"<**>(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%+v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%#v\", v4, \"(\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#v\", pv4, \"(*\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#v\", &pv4, \"(**\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v4, \"(\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#+v\", pv4, \"(*\"+v4t+\")(\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%#+v\", &pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%#+v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n\n\t// Max int.\n\tv5 := int(2147483647)\n\tnv5 := (*int)(nil)\n\tpv5 := &v5\n\tv5Addr := fmt.Sprintf(\"%p\", pv5)\n\tpv5Addr := fmt.Sprintf(\"%p\", &pv5)\n\tv5t := \"int\"\n\tv5s := \"2147483647\"\n\taddFormatterTest(\"%v\", v5, v5s)\n\taddFormatterTest(\"%v\", pv5, \"<*>\"+v5s)\n\taddFormatterTest(\"%v\", &pv5, \"<**>\"+v5s)\n\taddFormatterTest(\"%v\", nv5, \"<nil>\")\n\taddFormatterTest(\"%+v\", v5, v5s)\n\taddFormatterTest(\"%+v\", pv5, \"<*>(\"+v5Addr+\")\"+v5s)\n\taddFormatterTest(\"%+v\", &pv5, \"<**>(\"+pv5Addr+\"->\"+v5Addr+\")\"+v5s)\n\taddFormatterTest(\"%+v\", nv5, \"<nil>\")\n\taddFormatterTest(\"%#v\", v5, \"(\"+v5t+\")\"+v5s)\n\taddFormatterTest(\"%#v\", pv5, \"(*\"+v5t+\")\"+v5s)\n\taddFormatterTest(\"%#v\", &pv5, \"(**\"+v5t+\")\"+v5s)\n\taddFormatterTest(\"%#v\", nv5, \"(*\"+v5t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v5, \"(\"+v5t+\")\"+v5s)\n\taddFormatterTest(\"%#+v\", pv5, \"(*\"+v5t+\")(\"+v5Addr+\")\"+v5s)\n\taddFormatterTest(\"%#+v\", &pv5, \"(**\"+v5t+\")(\"+pv5Addr+\"->\"+v5Addr+\")\"+v5s)\n\taddFormatterTest(\"%#+v\", nv5, \"(*\"+v5t+\")\"+\"<nil>\")\n}\n\nfunc addUintFormatterTests() {\n\t// Max uint8.\n\tv := uint8(255)\n\tnv := (*uint8)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"uint8\"\n\tvs := \"255\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Max uint16.\n\tv2 := uint16(65535)\n\tnv2 := (*uint16)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"uint16\"\n\tv2s := \"65535\"\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\n\t// Max uint32.\n\tv3 := uint32(4294967295)\n\tnv3 := (*uint32)(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"uint32\"\n\tv3s := \"4294967295\"\n\taddFormatterTest(\"%v\", v3, v3s)\n\taddFormatterTest(\"%v\", pv3, \"<*>\"+v3s)\n\taddFormatterTest(\"%v\", &pv3, \"<**>\"+v3s)\n\taddFormatterTest(\"%v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%+v\", v3, v3s)\n\taddFormatterTest(\"%+v\", pv3, \"<*>(\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", &pv3, \"<**>(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%#v\", v3, \"(\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#v\", pv3, \"(*\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#v\", &pv3, \"(**\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v3, \"(\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#+v\", pv3, \"(*\"+v3t+\")(\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%#+v\", &pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%#v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\n\t// Max uint64.\n\tv4 := uint64(18446744073709551615)\n\tnv4 := (*uint64)(nil)\n\tpv4 := &v4\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"uint64\"\n\tv4s := \"18446744073709551615\"\n\taddFormatterTest(\"%v\", v4, v4s)\n\taddFormatterTest(\"%v\", pv4, \"<*>\"+v4s)\n\taddFormatterTest(\"%v\", &pv4, \"<**>\"+v4s)\n\taddFormatterTest(\"%v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%+v\", v4, v4s)\n\taddFormatterTest(\"%+v\", pv4, \"<*>(\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%+v\", &pv4, \"<**>(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%+v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%#v\", v4, \"(\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#v\", pv4, \"(*\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#v\", &pv4, \"(**\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v4, \"(\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#+v\", pv4, \"(*\"+v4t+\")(\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%#+v\", &pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%#+v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n\n\t// Max uint.\n\tv5 := uint(4294967295)\n\tnv5 := (*uint)(nil)\n\tpv5 := &v5\n\tv5Addr := fmt.Sprintf(\"%p\", pv5)\n\tpv5Addr := fmt.Sprintf(\"%p\", &pv5)\n\tv5t := \"uint\"\n\tv5s := \"4294967295\"\n\taddFormatterTest(\"%v\", v5, v5s)\n\taddFormatterTest(\"%v\", pv5, \"<*>\"+v5s)\n\taddFormatterTest(\"%v\", &pv5, \"<**>\"+v5s)\n\taddFormatterTest(\"%v\", nv5, \"<nil>\")\n\taddFormatterTest(\"%+v\", v5, v5s)\n\taddFormatterTest(\"%+v\", pv5, \"<*>(\"+v5Addr+\")\"+v5s)\n\taddFormatterTest(\"%+v\", &pv5, \"<**>(\"+pv5Addr+\"->\"+v5Addr+\")\"+v5s)\n\taddFormatterTest(\"%+v\", nv5, \"<nil>\")\n\taddFormatterTest(\"%#v\", v5, \"(\"+v5t+\")\"+v5s)\n\taddFormatterTest(\"%#v\", pv5, \"(*\"+v5t+\")\"+v5s)\n\taddFormatterTest(\"%#v\", &pv5, \"(**\"+v5t+\")\"+v5s)\n\taddFormatterTest(\"%#v\", nv5, \"(*\"+v5t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v5, \"(\"+v5t+\")\"+v5s)\n\taddFormatterTest(\"%#+v\", pv5, \"(*\"+v5t+\")(\"+v5Addr+\")\"+v5s)\n\taddFormatterTest(\"%#+v\", &pv5, \"(**\"+v5t+\")(\"+pv5Addr+\"->\"+v5Addr+\")\"+v5s)\n\taddFormatterTest(\"%#v\", nv5, \"(*\"+v5t+\")\"+\"<nil>\")\n}\n\nfunc addBoolFormatterTests() {\n\t// Boolean true.\n\tv := bool(true)\n\tnv := (*bool)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"bool\"\n\tvs := \"true\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Boolean false.\n\tv2 := bool(false)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"bool\"\n\tv2s := \"false\"\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n}\n\nfunc addFloatFormatterTests() {\n\t// Standard float32.\n\tv := float32(3.1415)\n\tnv := (*float32)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"float32\"\n\tvs := \"3.1415\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Standard float64.\n\tv2 := float64(3.1415926)\n\tnv2 := (*float64)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"float64\"\n\tv2s := \"3.1415926\"\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n}\n\nfunc addComplexFormatterTests() {\n\t// Standard complex64.\n\tv := complex(float32(6), -2)\n\tnv := (*complex64)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"complex64\"\n\tvs := \"(6-2i)\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Standard complex128.\n\tv2 := complex(float64(-6), 2)\n\tnv2 := (*complex128)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"complex128\"\n\tv2s := \"(-6+2i)\"\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n}\n\nfunc addArrayFormatterTests() {\n\t// Array containing standard ints.\n\tv := [3]int{1, 2, 3}\n\tnv := (*[3]int)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"[3]int\"\n\tvs := \"[1 2 3]\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Array containing type with custom formatter on pointer receiver only.\n\tv2 := [3]pstringer{\"1\", \"2\", \"3\"}\n\tnv2 := (*[3]pstringer)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"[3]spew_test.pstringer\"\n\tv2sp := \"[stringer 1 stringer 2 stringer 3]\"\n\tv2s := v2sp\n\tif spew.UnsafeDisabled {\n\t\tv2s = \"[1 2 3]\"\n\t}\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2sp)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2sp)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2sp)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2sp)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2sp)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2sp)\n\taddFormatterTest(\"%#v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2sp)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2sp)\n\taddFormatterTest(\"%#+v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\n\t// Array containing interfaces.\n\tv3 := [3]interface{}{\"one\", int(2), uint(3)}\n\tnv3 := (*[3]interface{})(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"[3]interface {}\"\n\tv3t2 := \"string\"\n\tv3t3 := \"int\"\n\tv3t4 := \"uint\"\n\tv3s := \"[one 2 3]\"\n\tv3s2 := \"[(\" + v3t2 + \")one (\" + v3t3 + \")2 (\" + v3t4 + \")3]\"\n\taddFormatterTest(\"%v\", v3, v3s)\n\taddFormatterTest(\"%v\", pv3, \"<*>\"+v3s)\n\taddFormatterTest(\"%v\", &pv3, \"<**>\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%+v\", v3, v3s)\n\taddFormatterTest(\"%+v\", pv3, \"<*>(\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", &pv3, \"<**>(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%#v\", v3, \"(\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#v\", pv3, \"(*\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#v\", &pv3, \"(**\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v3, \"(\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#+v\", pv3, \"(*\"+v3t+\")(\"+v3Addr+\")\"+v3s2)\n\taddFormatterTest(\"%#+v\", &pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s2)\n\taddFormatterTest(\"%#+v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n}\n\nfunc addSliceFormatterTests() {\n\t// Slice containing standard float32 values.\n\tv := []float32{3.14, 6.28, 12.56}\n\tnv := (*[]float32)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"[]float32\"\n\tvs := \"[3.14 6.28 12.56]\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Slice containing type with custom formatter on pointer receiver only.\n\tv2 := []pstringer{\"1\", \"2\", \"3\"}\n\tnv2 := (*[]pstringer)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"[]spew_test.pstringer\"\n\tv2s := \"[stringer 1 stringer 2 stringer 3]\"\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\n\t// Slice containing interfaces.\n\tv3 := []interface{}{\"one\", int(2), uint(3), nil}\n\tnv3 := (*[]interface{})(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"[]interface {}\"\n\tv3t2 := \"string\"\n\tv3t3 := \"int\"\n\tv3t4 := \"uint\"\n\tv3t5 := \"interface {}\"\n\tv3s := \"[one 2 3 <nil>]\"\n\tv3s2 := \"[(\" + v3t2 + \")one (\" + v3t3 + \")2 (\" + v3t4 + \")3 (\" + v3t5 +\n\t\t\")<nil>]\"\n\taddFormatterTest(\"%v\", v3, v3s)\n\taddFormatterTest(\"%v\", pv3, \"<*>\"+v3s)\n\taddFormatterTest(\"%v\", &pv3, \"<**>\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%+v\", v3, v3s)\n\taddFormatterTest(\"%+v\", pv3, \"<*>(\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", &pv3, \"<**>(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%#v\", v3, \"(\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#v\", pv3, \"(*\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#v\", &pv3, \"(**\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v3, \"(\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#+v\", pv3, \"(*\"+v3t+\")(\"+v3Addr+\")\"+v3s2)\n\taddFormatterTest(\"%#+v\", &pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s2)\n\taddFormatterTest(\"%#+v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\n\t// Nil slice.\n\tvar v4 []int\n\tnv4 := (*[]int)(nil)\n\tpv4 := &v4\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"[]int\"\n\tv4s := \"<nil>\"\n\taddFormatterTest(\"%v\", v4, v4s)\n\taddFormatterTest(\"%v\", pv4, \"<*>\"+v4s)\n\taddFormatterTest(\"%v\", &pv4, \"<**>\"+v4s)\n\taddFormatterTest(\"%+v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%+v\", v4, v4s)\n\taddFormatterTest(\"%+v\", pv4, \"<*>(\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%+v\", &pv4, \"<**>(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%+v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%#v\", v4, \"(\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#v\", pv4, \"(*\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#v\", &pv4, \"(**\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v4, \"(\"+v4t+\")\"+v4s)\n\taddFormatterTest(\"%#+v\", pv4, \"(*\"+v4t+\")(\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%#+v\", &pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%#+v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n}\n\nfunc addStringFormatterTests() {\n\t// Standard string.\n\tv := \"test\"\n\tnv := (*string)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"string\"\n\tvs := \"test\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n}\n\nfunc addInterfaceFormatterTests() {\n\t// Nil interface.\n\tvar v interface{}\n\tnv := (*interface{})(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"interface {}\"\n\tvs := \"<nil>\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Sub-interface.\n\tv2 := interface{}(uint16(65535))\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"uint16\"\n\tv2s := \"65535\"\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n}\n\nfunc addMapFormatterTests() {\n\t// Map with string keys and int vals.\n\tv := map[string]int{\"one\": 1, \"two\": 2}\n\tnilMap := map[string]int(nil)\n\tnv := (*map[string]int)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"map[string]int\"\n\tvs := \"map[one:1 two:2]\"\n\tvs2 := \"map[two:2 one:1]\"\n\taddFormatterTest(\"%v\", v, vs, vs2)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs, \"<*>\"+vs2)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs, \"<**>\"+vs2)\n\taddFormatterTest(\"%+v\", nilMap, \"<nil>\")\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs, vs2)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs, \"<*>(\"+vAddr+\")\"+vs2)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs,\n\t\t\"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs2)\n\taddFormatterTest(\"%+v\", nilMap, \"<nil>\")\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs, \"(\"+vt+\")\"+vs2)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs, \"(*\"+vt+\")\"+vs2)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs, \"(**\"+vt+\")\"+vs2)\n\taddFormatterTest(\"%#v\", nilMap, \"(\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs, \"(\"+vt+\")\"+vs2)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs,\n\t\t\"(*\"+vt+\")(\"+vAddr+\")\"+vs2)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs,\n\t\t\"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs2)\n\taddFormatterTest(\"%#+v\", nilMap, \"(\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Map with custom formatter type on pointer receiver only keys and vals.\n\tv2 := map[pstringer]pstringer{\"one\": \"1\"}\n\tnv2 := (*map[pstringer]pstringer)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"map[spew_test.pstringer]spew_test.pstringer\"\n\tv2s := \"map[stringer one:stringer 1]\"\n\tif spew.UnsafeDisabled {\n\t\tv2s = \"map[one:1]\"\n\t}\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\n\t// Map with interface keys and values.\n\tv3 := map[interface{}]interface{}{\"one\": 1}\n\tnv3 := (*map[interface{}]interface{})(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"map[interface {}]interface {}\"\n\tv3t1 := \"string\"\n\tv3t2 := \"int\"\n\tv3s := \"map[one:1]\"\n\tv3s2 := \"map[(\" + v3t1 + \")one:(\" + v3t2 + \")1]\"\n\taddFormatterTest(\"%v\", v3, v3s)\n\taddFormatterTest(\"%v\", pv3, \"<*>\"+v3s)\n\taddFormatterTest(\"%v\", &pv3, \"<**>\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%+v\", v3, v3s)\n\taddFormatterTest(\"%+v\", pv3, \"<*>(\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", &pv3, \"<**>(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%#v\", v3, \"(\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#v\", pv3, \"(*\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#v\", &pv3, \"(**\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v3, \"(\"+v3t+\")\"+v3s2)\n\taddFormatterTest(\"%#+v\", pv3, \"(*\"+v3t+\")(\"+v3Addr+\")\"+v3s2)\n\taddFormatterTest(\"%#+v\", &pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s2)\n\taddFormatterTest(\"%#+v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\n\t// Map with nil interface value\n\tv4 := map[string]interface{}{\"nil\": nil}\n\tnv4 := (*map[string]interface{})(nil)\n\tpv4 := &v4\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"map[string]interface {}\"\n\tv4t1 := \"interface {}\"\n\tv4s := \"map[nil:<nil>]\"\n\tv4s2 := \"map[nil:(\" + v4t1 + \")<nil>]\"\n\taddFormatterTest(\"%v\", v4, v4s)\n\taddFormatterTest(\"%v\", pv4, \"<*>\"+v4s)\n\taddFormatterTest(\"%v\", &pv4, \"<**>\"+v4s)\n\taddFormatterTest(\"%+v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%+v\", v4, v4s)\n\taddFormatterTest(\"%+v\", pv4, \"<*>(\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%+v\", &pv4, \"<**>(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s)\n\taddFormatterTest(\"%+v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%#v\", v4, \"(\"+v4t+\")\"+v4s2)\n\taddFormatterTest(\"%#v\", pv4, \"(*\"+v4t+\")\"+v4s2)\n\taddFormatterTest(\"%#v\", &pv4, \"(**\"+v4t+\")\"+v4s2)\n\taddFormatterTest(\"%#v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v4, \"(\"+v4t+\")\"+v4s2)\n\taddFormatterTest(\"%#+v\", pv4, \"(*\"+v4t+\")(\"+v4Addr+\")\"+v4s2)\n\taddFormatterTest(\"%#+v\", &pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s2)\n\taddFormatterTest(\"%#+v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n}\n\nfunc addStructFormatterTests() {\n\t// Struct with primitives.\n\ttype s1 struct {\n\t\ta int8\n\t\tb uint8\n\t}\n\tv := s1{127, 255}\n\tnv := (*s1)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"spew_test.s1\"\n\tvt2 := \"int8\"\n\tvt3 := \"uint8\"\n\tvs := \"{127 255}\"\n\tvs2 := \"{a:127 b:255}\"\n\tvs3 := \"{a:(\" + vt2 + \")127 b:(\" + vt3 + \")255}\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs2)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs2)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs2)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs3)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs3)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs3)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs3)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs3)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs3)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Struct that contains another struct.\n\ttype s2 struct {\n\t\ts1 s1\n\t\tb  bool\n\t}\n\tv2 := s2{s1{127, 255}, true}\n\tnv2 := (*s2)(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"spew_test.s2\"\n\tv2t2 := \"spew_test.s1\"\n\tv2t3 := \"int8\"\n\tv2t4 := \"uint8\"\n\tv2t5 := \"bool\"\n\tv2s := \"{{127 255} true}\"\n\tv2s2 := \"{s1:{a:127 b:255} b:true}\"\n\tv2s3 := \"{s1:(\" + v2t2 + \"){a:(\" + v2t3 + \")127 b:(\" + v2t4 + \")255} b:(\" +\n\t\tv2t5 + \")true}\"\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%+v\", v2, v2s2)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s2)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s2)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s3)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s3)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s3)\n\taddFormatterTest(\"%#v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s3)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s3)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s3)\n\taddFormatterTest(\"%#+v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\n\t// Struct that contains custom type with Stringer pointer interface via both\n\t// exported and unexported fields.\n\ttype s3 struct {\n\t\ts pstringer\n\t\tS pstringer\n\t}\n\tv3 := s3{\"test\", \"test2\"}\n\tnv3 := (*s3)(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"spew_test.s3\"\n\tv3t2 := \"spew_test.pstringer\"\n\tv3s := \"{stringer test stringer test2}\"\n\tv3sp := v3s\n\tv3s2 := \"{s:stringer test S:stringer test2}\"\n\tv3s2p := v3s2\n\tv3s3 := \"{s:(\" + v3t2 + \")stringer test S:(\" + v3t2 + \")stringer test2}\"\n\tv3s3p := v3s3\n\tif spew.UnsafeDisabled {\n\t\tv3s = \"{test test2}\"\n\t\tv3sp = \"{test stringer test2}\"\n\t\tv3s2 = \"{s:test S:test2}\"\n\t\tv3s2p = \"{s:test S:stringer test2}\"\n\t\tv3s3 = \"{s:(\" + v3t2 + \")test S:(\" + v3t2 + \")test2}\"\n\t\tv3s3p = \"{s:(\" + v3t2 + \")test S:(\" + v3t2 + \")stringer test2}\"\n\t}\n\taddFormatterTest(\"%v\", v3, v3s)\n\taddFormatterTest(\"%v\", pv3, \"<*>\"+v3sp)\n\taddFormatterTest(\"%v\", &pv3, \"<**>\"+v3sp)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%+v\", v3, v3s2)\n\taddFormatterTest(\"%+v\", pv3, \"<*>(\"+v3Addr+\")\"+v3s2p)\n\taddFormatterTest(\"%+v\", &pv3, \"<**>(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s2p)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%#v\", v3, \"(\"+v3t+\")\"+v3s3)\n\taddFormatterTest(\"%#v\", pv3, \"(*\"+v3t+\")\"+v3s3p)\n\taddFormatterTest(\"%#v\", &pv3, \"(**\"+v3t+\")\"+v3s3p)\n\taddFormatterTest(\"%#v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v3, \"(\"+v3t+\")\"+v3s3)\n\taddFormatterTest(\"%#+v\", pv3, \"(*\"+v3t+\")(\"+v3Addr+\")\"+v3s3p)\n\taddFormatterTest(\"%#+v\", &pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s3p)\n\taddFormatterTest(\"%#+v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\n\t// Struct that contains embedded struct and field to same struct.\n\te := embed{\"embedstr\"}\n\tv4 := embedwrap{embed: &e, e: &e}\n\tnv4 := (*embedwrap)(nil)\n\tpv4 := &v4\n\teAddr := fmt.Sprintf(\"%p\", &e)\n\tv4Addr := fmt.Sprintf(\"%p\", pv4)\n\tpv4Addr := fmt.Sprintf(\"%p\", &pv4)\n\tv4t := \"spew_test.embedwrap\"\n\tv4t2 := \"spew_test.embed\"\n\tv4t3 := \"string\"\n\tv4s := \"{<*>{embedstr} <*>{embedstr}}\"\n\tv4s2 := \"{embed:<*>(\" + eAddr + \"){a:embedstr} e:<*>(\" + eAddr +\n\t\t\"){a:embedstr}}\"\n\tv4s3 := \"{embed:(*\" + v4t2 + \"){a:(\" + v4t3 + \")embedstr} e:(*\" + v4t2 +\n\t\t\"){a:(\" + v4t3 + \")embedstr}}\"\n\tv4s4 := \"{embed:(*\" + v4t2 + \")(\" + eAddr + \"){a:(\" + v4t3 +\n\t\t\")embedstr} e:(*\" + v4t2 + \")(\" + eAddr + \"){a:(\" + v4t3 + \")embedstr}}\"\n\taddFormatterTest(\"%v\", v4, v4s)\n\taddFormatterTest(\"%v\", pv4, \"<*>\"+v4s)\n\taddFormatterTest(\"%v\", &pv4, \"<**>\"+v4s)\n\taddFormatterTest(\"%+v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%+v\", v4, v4s2)\n\taddFormatterTest(\"%+v\", pv4, \"<*>(\"+v4Addr+\")\"+v4s2)\n\taddFormatterTest(\"%+v\", &pv4, \"<**>(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s2)\n\taddFormatterTest(\"%+v\", nv4, \"<nil>\")\n\taddFormatterTest(\"%#v\", v4, \"(\"+v4t+\")\"+v4s3)\n\taddFormatterTest(\"%#v\", pv4, \"(*\"+v4t+\")\"+v4s3)\n\taddFormatterTest(\"%#v\", &pv4, \"(**\"+v4t+\")\"+v4s3)\n\taddFormatterTest(\"%#v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v4, \"(\"+v4t+\")\"+v4s4)\n\taddFormatterTest(\"%#+v\", pv4, \"(*\"+v4t+\")(\"+v4Addr+\")\"+v4s4)\n\taddFormatterTest(\"%#+v\", &pv4, \"(**\"+v4t+\")(\"+pv4Addr+\"->\"+v4Addr+\")\"+v4s4)\n\taddFormatterTest(\"%#+v\", nv4, \"(*\"+v4t+\")\"+\"<nil>\")\n}\n\nfunc addUintptrFormatterTests() {\n\t// Null pointer.\n\tv := uintptr(0)\n\tnv := (*uintptr)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"uintptr\"\n\tvs := \"<nil>\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Address of real variable.\n\ti := 1\n\tv2 := uintptr(unsafe.Pointer(&i))\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"uintptr\"\n\tv2s := fmt.Sprintf(\"%p\", &i)\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n}\n\nfunc addUnsafePointerFormatterTests() {\n\t// Null pointer.\n\tv := unsafe.Pointer(nil)\n\tnv := (*unsafe.Pointer)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"unsafe.Pointer\"\n\tvs := \"<nil>\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Address of real variable.\n\ti := 1\n\tv2 := unsafe.Pointer(&i)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"unsafe.Pointer\"\n\tv2s := fmt.Sprintf(\"%p\", &i)\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n}\n\nfunc addChanFormatterTests() {\n\t// Nil channel.\n\tvar v chan int\n\tpv := &v\n\tnv := (*chan int)(nil)\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"chan int\"\n\tvs := \"<nil>\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Real channel.\n\tv2 := make(chan int)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"chan int\"\n\tv2s := fmt.Sprintf(\"%p\", v2)\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n}\n\nfunc addFuncFormatterTests() {\n\t// Function with no params and no returns.\n\tv := addIntFormatterTests\n\tnv := (*func())(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"func()\"\n\tvs := fmt.Sprintf(\"%p\", v)\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\n\t// Function with param and no returns.\n\tv2 := TestFormatter\n\tnv2 := (*func(*testing.T))(nil)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"func(*testing.T)\"\n\tv2s := fmt.Sprintf(\"%p\", v2)\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%+v\", v2, v2s)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%+v\", nv2, \"<nil>\")\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s)\n\taddFormatterTest(\"%#+v\", nv2, \"(*\"+v2t+\")\"+\"<nil>\")\n\n\t// Function with multiple params and multiple returns.\n\tvar v3 = func(i int, s string) (b bool, err error) {\n\t\treturn true, nil\n\t}\n\tnv3 := (*func(int, string) (bool, error))(nil)\n\tpv3 := &v3\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"func(int, string) (bool, error)\"\n\tv3s := fmt.Sprintf(\"%p\", v3)\n\taddFormatterTest(\"%v\", v3, v3s)\n\taddFormatterTest(\"%v\", pv3, \"<*>\"+v3s)\n\taddFormatterTest(\"%v\", &pv3, \"<**>\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%+v\", v3, v3s)\n\taddFormatterTest(\"%+v\", pv3, \"<*>(\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", &pv3, \"<**>(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%+v\", nv3, \"<nil>\")\n\taddFormatterTest(\"%#v\", v3, \"(\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#v\", pv3, \"(*\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#v\", &pv3, \"(**\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v3, \"(\"+v3t+\")\"+v3s)\n\taddFormatterTest(\"%#+v\", pv3, \"(*\"+v3t+\")(\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%#+v\", &pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s)\n\taddFormatterTest(\"%#+v\", nv3, \"(*\"+v3t+\")\"+\"<nil>\")\n}\n\nfunc addCircularFormatterTests() {\n\t// Struct that is circular through self referencing.\n\ttype circular struct {\n\t\tc *circular\n\t}\n\tv := circular{nil}\n\tv.c = &v\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"spew_test.circular\"\n\tvs := \"{<*>{<*><shown>}}\"\n\tvs2 := \"{<*><shown>}\"\n\tvs3 := \"{c:<*>(\" + vAddr + \"){c:<*>(\" + vAddr + \")<shown>}}\"\n\tvs4 := \"{c:<*>(\" + vAddr + \")<shown>}\"\n\tvs5 := \"{c:(*\" + vt + \"){c:(*\" + vt + \")<shown>}}\"\n\tvs6 := \"{c:(*\" + vt + \")<shown>}\"\n\tvs7 := \"{c:(*\" + vt + \")(\" + vAddr + \"){c:(*\" + vt + \")(\" + vAddr +\n\t\t\")<shown>}}\"\n\tvs8 := \"{c:(*\" + vt + \")(\" + vAddr + \")<shown>}\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs2)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs2)\n\taddFormatterTest(\"%+v\", v, vs3)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs4)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs4)\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs5)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs6)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs6)\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs7)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs8)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs8)\n\n\t// Structs that are circular through cross referencing.\n\tv2 := xref1{nil}\n\tts2 := xref2{&v2}\n\tv2.ps2 = &ts2\n\tpv2 := &v2\n\tts2Addr := fmt.Sprintf(\"%p\", &ts2)\n\tv2Addr := fmt.Sprintf(\"%p\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%p\", &pv2)\n\tv2t := \"spew_test.xref1\"\n\tv2t2 := \"spew_test.xref2\"\n\tv2s := \"{<*>{<*>{<*><shown>}}}\"\n\tv2s2 := \"{<*>{<*><shown>}}\"\n\tv2s3 := \"{ps2:<*>(\" + ts2Addr + \"){ps1:<*>(\" + v2Addr + \"){ps2:<*>(\" +\n\t\tts2Addr + \")<shown>}}}\"\n\tv2s4 := \"{ps2:<*>(\" + ts2Addr + \"){ps1:<*>(\" + v2Addr + \")<shown>}}\"\n\tv2s5 := \"{ps2:(*\" + v2t2 + \"){ps1:(*\" + v2t + \"){ps2:(*\" + v2t2 +\n\t\t\")<shown>}}}\"\n\tv2s6 := \"{ps2:(*\" + v2t2 + \"){ps1:(*\" + v2t + \")<shown>}}\"\n\tv2s7 := \"{ps2:(*\" + v2t2 + \")(\" + ts2Addr + \"){ps1:(*\" + v2t +\n\t\t\")(\" + v2Addr + \"){ps2:(*\" + v2t2 + \")(\" + ts2Addr +\n\t\t\")<shown>}}}\"\n\tv2s8 := \"{ps2:(*\" + v2t2 + \")(\" + ts2Addr + \"){ps1:(*\" + v2t +\n\t\t\")(\" + v2Addr + \")<shown>}}\"\n\taddFormatterTest(\"%v\", v2, v2s)\n\taddFormatterTest(\"%v\", pv2, \"<*>\"+v2s2)\n\taddFormatterTest(\"%v\", &pv2, \"<**>\"+v2s2)\n\taddFormatterTest(\"%+v\", v2, v2s3)\n\taddFormatterTest(\"%+v\", pv2, \"<*>(\"+v2Addr+\")\"+v2s4)\n\taddFormatterTest(\"%+v\", &pv2, \"<**>(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s4)\n\taddFormatterTest(\"%#v\", v2, \"(\"+v2t+\")\"+v2s5)\n\taddFormatterTest(\"%#v\", pv2, \"(*\"+v2t+\")\"+v2s6)\n\taddFormatterTest(\"%#v\", &pv2, \"(**\"+v2t+\")\"+v2s6)\n\taddFormatterTest(\"%#+v\", v2, \"(\"+v2t+\")\"+v2s7)\n\taddFormatterTest(\"%#+v\", pv2, \"(*\"+v2t+\")(\"+v2Addr+\")\"+v2s8)\n\taddFormatterTest(\"%#+v\", &pv2, \"(**\"+v2t+\")(\"+pv2Addr+\"->\"+v2Addr+\")\"+v2s8)\n\n\t// Structs that are indirectly circular.\n\tv3 := indirCir1{nil}\n\ttic2 := indirCir2{nil}\n\ttic3 := indirCir3{&v3}\n\ttic2.ps3 = &tic3\n\tv3.ps2 = &tic2\n\tpv3 := &v3\n\ttic2Addr := fmt.Sprintf(\"%p\", &tic2)\n\ttic3Addr := fmt.Sprintf(\"%p\", &tic3)\n\tv3Addr := fmt.Sprintf(\"%p\", pv3)\n\tpv3Addr := fmt.Sprintf(\"%p\", &pv3)\n\tv3t := \"spew_test.indirCir1\"\n\tv3t2 := \"spew_test.indirCir2\"\n\tv3t3 := \"spew_test.indirCir3\"\n\tv3s := \"{<*>{<*>{<*>{<*><shown>}}}}\"\n\tv3s2 := \"{<*>{<*>{<*><shown>}}}\"\n\tv3s3 := \"{ps2:<*>(\" + tic2Addr + \"){ps3:<*>(\" + tic3Addr + \"){ps1:<*>(\" +\n\t\tv3Addr + \"){ps2:<*>(\" + tic2Addr + \")<shown>}}}}\"\n\tv3s4 := \"{ps2:<*>(\" + tic2Addr + \"){ps3:<*>(\" + tic3Addr + \"){ps1:<*>(\" +\n\t\tv3Addr + \")<shown>}}}\"\n\tv3s5 := \"{ps2:(*\" + v3t2 + \"){ps3:(*\" + v3t3 + \"){ps1:(*\" + v3t +\n\t\t\"){ps2:(*\" + v3t2 + \")<shown>}}}}\"\n\tv3s6 := \"{ps2:(*\" + v3t2 + \"){ps3:(*\" + v3t3 + \"){ps1:(*\" + v3t +\n\t\t\")<shown>}}}\"\n\tv3s7 := \"{ps2:(*\" + v3t2 + \")(\" + tic2Addr + \"){ps3:(*\" + v3t3 + \")(\" +\n\t\ttic3Addr + \"){ps1:(*\" + v3t + \")(\" + v3Addr + \"){ps2:(*\" + v3t2 +\n\t\t\")(\" + tic2Addr + \")<shown>}}}}\"\n\tv3s8 := \"{ps2:(*\" + v3t2 + \")(\" + tic2Addr + \"){ps3:(*\" + v3t3 + \")(\" +\n\t\ttic3Addr + \"){ps1:(*\" + v3t + \")(\" + v3Addr + \")<shown>}}}\"\n\taddFormatterTest(\"%v\", v3, v3s)\n\taddFormatterTest(\"%v\", pv3, \"<*>\"+v3s2)\n\taddFormatterTest(\"%v\", &pv3, \"<**>\"+v3s2)\n\taddFormatterTest(\"%+v\", v3, v3s3)\n\taddFormatterTest(\"%+v\", pv3, \"<*>(\"+v3Addr+\")\"+v3s4)\n\taddFormatterTest(\"%+v\", &pv3, \"<**>(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s4)\n\taddFormatterTest(\"%#v\", v3, \"(\"+v3t+\")\"+v3s5)\n\taddFormatterTest(\"%#v\", pv3, \"(*\"+v3t+\")\"+v3s6)\n\taddFormatterTest(\"%#v\", &pv3, \"(**\"+v3t+\")\"+v3s6)\n\taddFormatterTest(\"%#+v\", v3, \"(\"+v3t+\")\"+v3s7)\n\taddFormatterTest(\"%#+v\", pv3, \"(*\"+v3t+\")(\"+v3Addr+\")\"+v3s8)\n\taddFormatterTest(\"%#+v\", &pv3, \"(**\"+v3t+\")(\"+pv3Addr+\"->\"+v3Addr+\")\"+v3s8)\n}\n\nfunc addPanicFormatterTests() {\n\t// Type that panics in its Stringer interface.\n\tv := panicer(127)\n\tnv := (*panicer)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"spew_test.panicer\"\n\tvs := \"(PANIC=test panic)127\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n}\n\nfunc addErrorFormatterTests() {\n\t// Type that has a custom Error interface.\n\tv := customError(127)\n\tnv := (*customError)(nil)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%p\", pv)\n\tpvAddr := fmt.Sprintf(\"%p\", &pv)\n\tvt := \"spew_test.customError\"\n\tvs := \"error: 127\"\n\taddFormatterTest(\"%v\", v, vs)\n\taddFormatterTest(\"%v\", pv, \"<*>\"+vs)\n\taddFormatterTest(\"%v\", &pv, \"<**>\"+vs)\n\taddFormatterTest(\"%v\", nv, \"<nil>\")\n\taddFormatterTest(\"%+v\", v, vs)\n\taddFormatterTest(\"%+v\", pv, \"<*>(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", &pv, \"<**>(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%+v\", nv, \"<nil>\")\n\taddFormatterTest(\"%#v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", pv, \"(*\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", &pv, \"(**\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n\taddFormatterTest(\"%#+v\", v, \"(\"+vt+\")\"+vs)\n\taddFormatterTest(\"%#+v\", pv, \"(*\"+vt+\")(\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", &pv, \"(**\"+vt+\")(\"+pvAddr+\"->\"+vAddr+\")\"+vs)\n\taddFormatterTest(\"%#+v\", nv, \"(*\"+vt+\")\"+\"<nil>\")\n}\n\nfunc addPassthroughFormatterTests() {\n\t// %x passthrough with uint.\n\tv := uint(4294967295)\n\tpv := &v\n\tvAddr := fmt.Sprintf(\"%x\", pv)\n\tpvAddr := fmt.Sprintf(\"%x\", &pv)\n\tvs := \"ffffffff\"\n\taddFormatterTest(\"%x\", v, vs)\n\taddFormatterTest(\"%x\", pv, vAddr)\n\taddFormatterTest(\"%x\", &pv, pvAddr)\n\n\t// %#x passthrough with uint.\n\tv2 := int(2147483647)\n\tpv2 := &v2\n\tv2Addr := fmt.Sprintf(\"%#x\", pv2)\n\tpv2Addr := fmt.Sprintf(\"%#x\", &pv2)\n\tv2s := \"0x7fffffff\"\n\taddFormatterTest(\"%#x\", v2, v2s)\n\taddFormatterTest(\"%#x\", pv2, v2Addr)\n\taddFormatterTest(\"%#x\", &pv2, pv2Addr)\n\n\t// %f passthrough with precision.\n\taddFormatterTest(\"%.2f\", 3.1415, \"3.14\")\n\taddFormatterTest(\"%.3f\", 3.1415, \"3.142\")\n\taddFormatterTest(\"%.4f\", 3.1415, \"3.1415\")\n\n\t// %f passthrough with width and precision.\n\taddFormatterTest(\"%5.2f\", 3.1415, \" 3.14\")\n\taddFormatterTest(\"%6.3f\", 3.1415, \" 3.142\")\n\taddFormatterTest(\"%7.4f\", 3.1415, \" 3.1415\")\n\n\t// %d passthrough with width.\n\taddFormatterTest(\"%3d\", 127, \"127\")\n\taddFormatterTest(\"%4d\", 127, \" 127\")\n\taddFormatterTest(\"%5d\", 127, \"  127\")\n\n\t// %q passthrough with string.\n\taddFormatterTest(\"%q\", \"test\", \"\\\"test\\\"\")\n}\n\n// TestFormatter executes all of the tests described by formatterTests.\nfunc TestFormatter(t *testing.T) {\n\t// Setup tests.\n\taddIntFormatterTests()\n\taddUintFormatterTests()\n\taddBoolFormatterTests()\n\taddFloatFormatterTests()\n\taddComplexFormatterTests()\n\taddArrayFormatterTests()\n\taddSliceFormatterTests()\n\taddStringFormatterTests()\n\taddInterfaceFormatterTests()\n\taddMapFormatterTests()\n\taddStructFormatterTests()\n\taddUintptrFormatterTests()\n\taddUnsafePointerFormatterTests()\n\taddChanFormatterTests()\n\taddFuncFormatterTests()\n\taddCircularFormatterTests()\n\taddPanicFormatterTests()\n\taddErrorFormatterTests()\n\taddPassthroughFormatterTests()\n\n\tt.Logf(\"Running %d tests\", len(formatterTests))\n\tfor i, test := range formatterTests {\n\t\tbuf := new(bytes.Buffer)\n\t\tspew.Fprintf(buf, test.format, test.in)\n\t\ts := buf.String()\n\t\tif testFailed(s, test.wants) {\n\t\t\tt.Errorf(\"Formatter #%d format: %s got: %s %s\", i, test.format, s,\n\t\t\t\tstringizeWants(test.wants))\n\t\t\tcontinue\n\t\t}\n\t}\n}\n\ntype testStruct struct {\n\tx int\n}\n\nfunc (ts testStruct) String() string {\n\treturn fmt.Sprintf(\"ts.%d\", ts.x)\n}\n\ntype testStructP struct {\n\tx int\n}\n\nfunc (ts *testStructP) String() string {\n\treturn fmt.Sprintf(\"ts.%d\", ts.x)\n}\n\nfunc TestPrintSortedKeys(t *testing.T) {\n\tcfg := spew.ConfigState{SortKeys: true}\n\ts := cfg.Sprint(map[int]string{1: \"1\", 3: \"3\", 2: \"2\"})\n\texpected := \"map[1:1 2:2 3:3]\"\n\tif s != expected {\n\t\tt.Errorf(\"Sorted keys mismatch 1:\\n  %v %v\", s, expected)\n\t}\n\n\ts = cfg.Sprint(map[stringer]int{\"1\": 1, \"3\": 3, \"2\": 2})\n\texpected = \"map[stringer 1:1 stringer 2:2 stringer 3:3]\"\n\tif s != expected {\n\t\tt.Errorf(\"Sorted keys mismatch 2:\\n  %v %v\", s, expected)\n\t}\n\n\ts = cfg.Sprint(map[pstringer]int{pstringer(\"1\"): 1, pstringer(\"3\"): 3, pstringer(\"2\"): 2})\n\texpected = \"map[stringer 1:1 stringer 2:2 stringer 3:3]\"\n\tif spew.UnsafeDisabled {\n\t\texpected = \"map[1:1 2:2 3:3]\"\n\t}\n\tif s != expected {\n\t\tt.Errorf(\"Sorted keys mismatch 3:\\n  %v %v\", s, expected)\n\t}\n\n\ts = cfg.Sprint(map[testStruct]int{{1}: 1, {3}: 3, {2}: 2})\n\texpected = \"map[ts.1:1 ts.2:2 ts.3:3]\"\n\tif s != expected {\n\t\tt.Errorf(\"Sorted keys mismatch 4:\\n  %v %v\", s, expected)\n\t}\n\n\tif !spew.UnsafeDisabled {\n\t\ts = cfg.Sprint(map[testStructP]int{{1}: 1, {3}: 3, {2}: 2})\n\t\texpected = \"map[ts.1:1 ts.2:2 ts.3:3]\"\n\t\tif s != expected {\n\t\t\tt.Errorf(\"Sorted keys mismatch 5:\\n  %v %v\", s, expected)\n\t\t}\n\t}\n\n\ts = cfg.Sprint(map[customError]int{customError(1): 1, customError(3): 3, customError(2): 2})\n\texpected = \"map[error: 1:1 error: 2:2 error: 3:3]\"\n\tif s != expected {\n\t\tt.Errorf(\"Sorted keys mismatch 6:\\n  %v %v\", s, expected)\n\t}\n}\n"
  },
  {
    "path": "internal/spew/internal_test.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*\nThis test file is part of the spew package rather than than the spew_test\npackage because it needs access to internals to properly test certain cases\nwhich are not possible via the public interface since they should never happen.\n*/\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"reflect\"\n\t\"testing\"\n)\n\n// dummyFmtState implements a fake fmt.State to use for testing invalid\n// reflect.Value handling.  This is necessary because the fmt package catches\n// invalid values before invoking the formatter on them.\ntype dummyFmtState struct {\n\tbytes.Buffer\n}\n\nfunc (dfs *dummyFmtState) Flag(f int) bool {\n\treturn f == int('+')\n}\n\nfunc (dfs *dummyFmtState) Precision() (int, bool) {\n\treturn 0, false\n}\n\nfunc (dfs *dummyFmtState) Width() (int, bool) {\n\treturn 0, false\n}\n\n// TestInvalidReflectValue ensures the dump and formatter code handles an\n// invalid reflect value properly.  This needs access to internal state since it\n// should never happen in real code and therefore can't be tested via the public\n// API.\nfunc TestInvalidReflectValue(t *testing.T) {\n\ti := 1\n\n\t// Dump invalid reflect value.\n\tv := new(reflect.Value)\n\tbuf := new(bytes.Buffer)\n\td := dumpState{w: buf, cs: &Config}\n\td.dump(*v)\n\ts := buf.String()\n\twant := \"<invalid>\"\n\tif s != want {\n\t\tt.Errorf(\"InvalidReflectValue #%d\\n got: %s want: %s\", i, s, want)\n\t}\n\ti++\n\n\t// Formatter invalid reflect value.\n\tbuf2 := new(dummyFmtState)\n\tf := formatState{value: *v, cs: &Config, fs: buf2}\n\tf.format(*v)\n\ts = buf2.String()\n\twant = \"<invalid>\"\n\tif s != want {\n\t\tt.Errorf(\"InvalidReflectValue #%d got: %s want: %s\", i, s, want)\n\t}\n}\n\n// SortValues makes the internal sortValues function available to the test\n// package.\nfunc SortValues(values []reflect.Value, cs *ConfigState) {\n\tsortValues(values, cs)\n}\n"
  },
  {
    "path": "internal/spew/internalunsafe_test.go",
    "content": "// Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when the code is not running on Google App Engine, compiled by GopherJS, and\n// \"-tags safe\" is not added to the go build command line.  The \"disableunsafe\"\n// tag is deprecated and thus should not be used.\n//go:build !js && !appengine && !safe && !disableunsafe && go1.4\n// +build !js,!appengine,!safe,!disableunsafe,go1.4\n\n/*\nThis test file is part of the spew package rather than than the spew_test\npackage because it needs access to internals to properly test certain cases\nwhich are not possible via the public interface since they should never happen.\n*/\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"reflect\"\n\t\"testing\"\n)\n\n// changeKind uses unsafe to intentionally change the kind of a reflect.Value to\n// the maximum kind value which does not exist.  This is needed to test the\n// fallback code which punts to the standard fmt library for new types that\n// might get added to the language.\nfunc changeKind(v *reflect.Value, readOnly bool) {\n\tflags := flagField(v)\n\tif readOnly {\n\t\t*flags |= flagRO\n\t} else {\n\t\t*flags &^= flagRO\n\t}\n\t*flags |= flagKindMask\n}\n\n// TestAddedReflectValue tests functionaly of the dump and formatter code which\n// falls back to the standard fmt library for new types that might get added to\n// the language.\nfunc TestAddedReflectValue(t *testing.T) {\n\ti := 1\n\n\t// Dump using a reflect.Value that is exported.\n\tv := reflect.ValueOf(int8(5))\n\tchangeKind(&v, false)\n\tbuf := new(bytes.Buffer)\n\td := dumpState{w: buf, cs: &Config}\n\td.dump(v)\n\ts := buf.String()\n\twant := \"(int8) 5\"\n\tif s != want {\n\t\tt.Errorf(\"TestAddedReflectValue #%d\\n got: %s want: %s\", i, s, want)\n\t}\n\ti++\n\n\t// Dump using a reflect.Value that is not exported.\n\tchangeKind(&v, true)\n\tbuf.Reset()\n\td.dump(v)\n\ts = buf.String()\n\twant = \"(int8) <int8 Value>\"\n\tif s != want {\n\t\tt.Errorf(\"TestAddedReflectValue #%d\\n got: %s want: %s\", i, s, want)\n\t}\n\ti++\n\n\t// Formatter using a reflect.Value that is exported.\n\tchangeKind(&v, false)\n\tbuf2 := new(dummyFmtState)\n\tf := formatState{value: v, cs: &Config, fs: buf2}\n\tf.format(v)\n\ts = buf2.String()\n\twant = \"5\"\n\tif s != want {\n\t\tt.Errorf(\"TestAddedReflectValue #%d got: %s want: %s\", i, s, want)\n\t}\n\ti++\n\n\t// Formatter using a reflect.Value that is not exported.\n\tchangeKind(&v, true)\n\tbuf2.Reset()\n\tf = formatState{value: v, cs: &Config, fs: buf2}\n\tf.format(v)\n\ts = buf2.String()\n\twant = \"<int8 Value>\"\n\tif s != want {\n\t\tt.Errorf(\"TestAddedReflectValue #%d got: %s want: %s\", i, s, want)\n\t}\n}\n"
  },
  {
    "path": "internal/spew/spew.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"fmt\"\n\t\"io\"\n)\n\n// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the formatted string as a value that satisfies error.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Errorf(format string, a ...interface{}) (err error) {\n\treturn fmt.Errorf(format, convertArgs(a)...)\n}\n\n// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprint(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprint(w, convertArgs(a)...)\n}\n\n// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintf(w, format, convertArgs(a)...)\n}\n\n// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it\n// passed with a default Formatter interface returned by NewFormatter.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprintln(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintln(w, convertArgs(a)...)\n}\n\n// Print is a wrapper for fmt.Print that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Print(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(convertArgs(a)...)\n}\n\n// Printf is a wrapper for fmt.Printf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Printf(format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Printf(format, convertArgs(a)...)\n}\n\n// Println is a wrapper for fmt.Println that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Println(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Println(a ...interface{}) (n int, err error) {\n\treturn fmt.Println(convertArgs(a)...)\n}\n\n// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprint(a ...interface{}) string {\n\treturn fmt.Sprint(convertArgs(a)...)\n}\n\n// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprintf(format string, a ...interface{}) string {\n\treturn fmt.Sprintf(format, convertArgs(a)...)\n}\n\n// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it\n// were passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprintln(a ...interface{}) string {\n\treturn fmt.Sprintln(convertArgs(a)...)\n}\n\n// convertArgs accepts a slice of arguments and returns a slice of the same\n// length with each argument converted to a default spew Formatter interface.\nfunc convertArgs(args []interface{}) (formatters []interface{}) {\n\tformatters = make([]interface{}, len(args))\n\tfor index, arg := range args {\n\t\tformatters[index] = NewFormatter(arg)\n\t}\n\treturn formatters\n}\n"
  },
  {
    "path": "internal/spew/spew_test.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew_test\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/internal/spew\"\n)\n\n// spewFunc is used to identify which public function of the spew package or\n// ConfigState a test applies to.\ntype spewFunc int\n\nconst (\n\tfCSFdump spewFunc = iota\n\tfCSFprint\n\tfCSFprintf\n\tfCSFprintln\n\tfCSPrint\n\tfCSPrintln\n\tfCSSdump\n\tfCSSprint\n\tfCSSprintf\n\tfCSSprintln\n\tfCSErrorf\n\tfCSNewFormatter\n\tfErrorf\n\tfFprint\n\tfFprintln\n\tfPrint\n\tfPrintln\n\tfSdump\n\tfSprint\n\tfSprintf\n\tfSprintln\n)\n\n// Map of spewFunc values to names for pretty printing.\nvar spewFuncStrings = map[spewFunc]string{\n\tfCSFdump:        \"ConfigState.Fdump\",\n\tfCSFprint:       \"ConfigState.Fprint\",\n\tfCSFprintf:      \"ConfigState.Fprintf\",\n\tfCSFprintln:     \"ConfigState.Fprintln\",\n\tfCSSdump:        \"ConfigState.Sdump\",\n\tfCSPrint:        \"ConfigState.Print\",\n\tfCSPrintln:      \"ConfigState.Println\",\n\tfCSSprint:       \"ConfigState.Sprint\",\n\tfCSSprintf:      \"ConfigState.Sprintf\",\n\tfCSSprintln:     \"ConfigState.Sprintln\",\n\tfCSErrorf:       \"ConfigState.Errorf\",\n\tfCSNewFormatter: \"ConfigState.NewFormatter\",\n\tfErrorf:         \"spew.Errorf\",\n\tfFprint:         \"spew.Fprint\",\n\tfFprintln:       \"spew.Fprintln\",\n\tfPrint:          \"spew.Print\",\n\tfPrintln:        \"spew.Println\",\n\tfSdump:          \"spew.Sdump\",\n\tfSprint:         \"spew.Sprint\",\n\tfSprintf:        \"spew.Sprintf\",\n\tfSprintln:       \"spew.Sprintln\",\n}\n\nfunc (f spewFunc) String() string {\n\tif s, ok := spewFuncStrings[f]; ok {\n\t\treturn s\n\t}\n\treturn fmt.Sprintf(\"Unknown spewFunc (%d)\", int(f))\n}\n\n// spewTest is used to describe a test to be performed against the public\n// functions of the spew package or ConfigState.\ntype spewTest struct {\n\tcs     *spew.ConfigState\n\tf      spewFunc\n\tformat string\n\tin     interface{}\n\twant   string\n}\n\n// spewTests houses the tests to be performed against the public functions of\n// the spew package and ConfigState.\n//\n// These tests are only intended to ensure the public functions are exercised\n// and are intentionally not exhaustive of types.  The exhaustive type\n// tests are handled in the dump and format tests.\nvar spewTests []spewTest\n\n// redirStdout is a helper function to return the standard output from f as a\n// byte slice.\nfunc redirStdout(f func()) ([]byte, error) {\n\ttempFile, err := ioutil.TempFile(\"\", \"ss-test\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfileName := tempFile.Name()\n\tdefer os.Remove(fileName) // Ignore error\n\n\torigStdout := os.Stdout\n\tos.Stdout = tempFile\n\tf()\n\tos.Stdout = origStdout\n\ttempFile.Close()\n\n\treturn ioutil.ReadFile(fileName)\n}\n\nfunc initSpewTests() {\n\t// Config states with various settings.\n\tscsDefault := spew.NewDefaultConfig()\n\tscsNoMethods := &spew.ConfigState{Indent: \" \", DisableMethods: true}\n\tscsNoPmethods := &spew.ConfigState{Indent: \" \", DisablePointerMethods: true}\n\tscsMaxDepth := &spew.ConfigState{Indent: \" \", MaxDepth: 1}\n\tscsContinue := &spew.ConfigState{Indent: \" \", ContinueOnMethod: true}\n\tscsNoPtrAddr := &spew.ConfigState{DisablePointerAddresses: true}\n\tscsNoCap := &spew.ConfigState{DisableCapacities: true}\n\n\t// Variables for tests on types which implement Stringer interface with and\n\t// without a pointer receiver.\n\tts := stringer(\"test\")\n\ttps := pstringer(\"test\")\n\n\ttype ptrTester struct {\n\t\ts *struct{}\n\t}\n\ttptr := &ptrTester{s: &struct{}{}}\n\n\t// depthTester is used to test max depth handling for structs, array, slices\n\t// and maps.\n\ttype depthTester struct {\n\t\tic    indirCir1\n\t\tarr   [1]string\n\t\tslice []string\n\t\tm     map[string]int\n\t}\n\tdt := depthTester{indirCir1{nil}, [1]string{\"arr\"}, []string{\"slice\"},\n\t\tmap[string]int{\"one\": 1}}\n\n\t// Variable for tests on types which implement error interface.\n\tte := customError(10)\n\n\tspewTests = []spewTest{\n\t\t{scsDefault, fCSFdump, \"\", int8(127), \"(int8) 127\\n\"},\n\t\t{scsDefault, fCSFprint, \"\", int16(32767), \"32767\"},\n\t\t{scsDefault, fCSFprintf, \"%v\", int32(2147483647), \"2147483647\"},\n\t\t{scsDefault, fCSFprintln, \"\", int(2147483647), \"2147483647\\n\"},\n\t\t{scsDefault, fCSPrint, \"\", int64(9223372036854775807), \"9223372036854775807\"},\n\t\t{scsDefault, fCSPrintln, \"\", uint8(255), \"255\\n\"},\n\t\t{scsDefault, fCSSdump, \"\", uint8(64), \"(uint8) 64\\n\"},\n\t\t{scsDefault, fCSSprint, \"\", complex(1, 2), \"(1+2i)\"},\n\t\t{scsDefault, fCSSprintf, \"%v\", complex(float32(3), 4), \"(3+4i)\"},\n\t\t{scsDefault, fCSSprintln, \"\", complex(float64(5), 6), \"(5+6i)\\n\"},\n\t\t{scsDefault, fCSErrorf, \"%#v\", uint16(65535), \"(uint16)65535\"},\n\t\t{scsDefault, fCSNewFormatter, \"%v\", uint32(4294967295), \"4294967295\"},\n\t\t{scsDefault, fErrorf, \"%v\", uint64(18446744073709551615), \"18446744073709551615\"},\n\t\t{scsDefault, fFprint, \"\", float32(3.14), \"3.14\"},\n\t\t{scsDefault, fFprintln, \"\", float64(6.28), \"6.28\\n\"},\n\t\t{scsDefault, fPrint, \"\", true, \"true\"},\n\t\t{scsDefault, fPrintln, \"\", false, \"false\\n\"},\n\t\t{scsDefault, fSdump, \"\", complex(-10, -20), \"(complex128) (-10-20i)\\n\"},\n\t\t{scsDefault, fSprint, \"\", complex(-1, -2), \"(-1-2i)\"},\n\t\t{scsDefault, fSprintf, \"%v\", complex(float32(-3), -4), \"(-3-4i)\"},\n\t\t{scsDefault, fSprintln, \"\", complex(float64(-5), -6), \"(-5-6i)\\n\"},\n\t\t{scsNoMethods, fCSFprint, \"\", ts, \"test\"},\n\t\t{scsNoMethods, fCSFprint, \"\", &ts, \"<*>test\"},\n\t\t{scsNoMethods, fCSFprint, \"\", tps, \"test\"},\n\t\t{scsNoMethods, fCSFprint, \"\", &tps, \"<*>test\"},\n\t\t{scsNoPmethods, fCSFprint, \"\", ts, \"stringer test\"},\n\t\t{scsNoPmethods, fCSFprint, \"\", &ts, \"<*>stringer test\"},\n\t\t{scsNoPmethods, fCSFprint, \"\", tps, \"test\"},\n\t\t{scsNoPmethods, fCSFprint, \"\", &tps, \"<*>stringer test\"},\n\t\t{scsMaxDepth, fCSFprint, \"\", dt, \"{{<max>} [<max>] [<max>] map[<max>]}\"},\n\t\t{scsMaxDepth, fCSFdump, \"\", dt, \"(spew_test.depthTester) {\\n\" +\n\t\t\t\" ic: (spew_test.indirCir1) {\\n  <max depth reached>\\n },\\n\" +\n\t\t\t\" arr: ([1]string) (len=1 cap=1) {\\n  <max depth reached>\\n },\\n\" +\n\t\t\t\" slice: ([]string) (len=1 cap=1) {\\n  <max depth reached>\\n },\\n\" +\n\t\t\t\" m: (map[string]int) (len=1) {\\n  <max depth reached>\\n }\\n}\\n\"},\n\t\t{scsContinue, fCSFprint, \"\", ts, \"(stringer test) test\"},\n\t\t{scsContinue, fCSFdump, \"\", ts, \"(spew_test.stringer) \" +\n\t\t\t\"(len=4) (stringer test) \\\"test\\\"\\n\"},\n\t\t{scsContinue, fCSFprint, \"\", te, \"(error: 10) 10\"},\n\t\t{scsContinue, fCSFdump, \"\", te, \"(spew_test.customError) \" +\n\t\t\t\"(error: 10) 10\\n\"},\n\t\t{scsNoPtrAddr, fCSFprint, \"\", tptr, \"<*>{<*>{}}\"},\n\t\t{scsNoPtrAddr, fCSSdump, \"\", tptr, \"(*spew_test.ptrTester)({\\ns: (*struct {})({\\n})\\n})\\n\"},\n\t\t{scsNoCap, fCSSdump, \"\", make([]string, 0, 10), \"([]string) {\\n}\\n\"},\n\t\t{scsNoCap, fCSSdump, \"\", make([]string, 1, 10), \"([]string) (len=1) {\\n(string) \\\"\\\"\\n}\\n\"},\n\t}\n}\n\n// TestSpew executes all of the tests described by spewTests.\nfunc TestSpew(t *testing.T) {\n\tinitSpewTests()\n\n\tt.Logf(\"Running %d tests\", len(spewTests))\n\tfor i, test := range spewTests {\n\t\tbuf := new(bytes.Buffer)\n\t\tswitch test.f {\n\t\tcase fCSFdump:\n\t\t\ttest.cs.Fdump(buf, test.in)\n\n\t\tcase fCSFprint:\n\t\t\ttest.cs.Fprint(buf, test.in)\n\n\t\tcase fCSFprintf:\n\t\t\ttest.cs.Fprintf(buf, test.format, test.in)\n\n\t\tcase fCSFprintln:\n\t\t\ttest.cs.Fprintln(buf, test.in)\n\n\t\tcase fCSPrint:\n\t\t\tb, err := redirStdout(func() { test.cs.Print(test.in) })\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"%v #%d %v\", test.f, i, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbuf.Write(b)\n\n\t\tcase fCSPrintln:\n\t\t\tb, err := redirStdout(func() { test.cs.Println(test.in) })\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"%v #%d %v\", test.f, i, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbuf.Write(b)\n\n\t\tcase fCSSdump:\n\t\t\tstr := test.cs.Sdump(test.in)\n\t\t\tbuf.WriteString(str)\n\n\t\tcase fCSSprint:\n\t\t\tstr := test.cs.Sprint(test.in)\n\t\t\tbuf.WriteString(str)\n\n\t\tcase fCSSprintf:\n\t\t\tstr := test.cs.Sprintf(test.format, test.in)\n\t\t\tbuf.WriteString(str)\n\n\t\tcase fCSSprintln:\n\t\t\tstr := test.cs.Sprintln(test.in)\n\t\t\tbuf.WriteString(str)\n\n\t\tcase fCSErrorf:\n\t\t\terr := test.cs.Errorf(test.format, test.in)\n\t\t\tbuf.WriteString(err.Error())\n\n\t\tcase fCSNewFormatter:\n\t\t\tfmt.Fprintf(buf, test.format, test.cs.NewFormatter(test.in))\n\n\t\tcase fErrorf:\n\t\t\terr := spew.Errorf(test.format, test.in)\n\t\t\tbuf.WriteString(err.Error())\n\n\t\tcase fFprint:\n\t\t\tspew.Fprint(buf, test.in)\n\n\t\tcase fFprintln:\n\t\t\tspew.Fprintln(buf, test.in)\n\n\t\tcase fPrint:\n\t\t\tb, err := redirStdout(func() { spew.Print(test.in) })\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"%v #%d %v\", test.f, i, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbuf.Write(b)\n\n\t\tcase fPrintln:\n\t\t\tb, err := redirStdout(func() { spew.Println(test.in) })\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"%v #%d %v\", test.f, i, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbuf.Write(b)\n\n\t\tcase fSdump:\n\t\t\tstr := spew.Sdump(test.in)\n\t\t\tbuf.WriteString(str)\n\n\t\tcase fSprint:\n\t\t\tstr := spew.Sprint(test.in)\n\t\t\tbuf.WriteString(str)\n\n\t\tcase fSprintf:\n\t\t\tstr := spew.Sprintf(test.format, test.in)\n\t\t\tbuf.WriteString(str)\n\n\t\tcase fSprintln:\n\t\t\tstr := spew.Sprintln(test.in)\n\t\t\tbuf.WriteString(str)\n\n\t\tdefault:\n\t\t\tt.Errorf(\"%v #%d unrecognized function\", test.f, i)\n\t\t\tcontinue\n\t\t}\n\t\ts := buf.String()\n\t\tif test.want != s {\n\t\t\tt.Errorf(\"ConfigState #%d\\n got: %s want: %s\", i, s, test.want)\n\t\t\tcontinue\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "internal/spew/testdata/dumpcgo.go",
    "content": "// Copyright (c) 2013 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when both cgo is supported and \"-tags testcgo\" is added to the go test\n// command line.  This code should really only be in the dumpcgo_test.go file,\n// but unfortunately Go will not allow cgo in test files, so this is a\n// workaround to allow cgo types to be tested.  This configuration is used\n// because spew itself does not require cgo to run even though it does handle\n// certain cgo types specially.  Rather than forcing all clients to require cgo\n// and an external C compiler just to run the tests, this scheme makes them\n// optional.\n//\n//go:build cgo && testcgo\n// +build cgo,testcgo\n\npackage testdata\n\n/*\n#include <stdint.h>\ntypedef unsigned char custom_uchar_t;\n\nchar            *ncp = 0;\nchar            *cp = \"test\";\nchar             ca[6] = {'t', 'e', 's', 't', '2', '\\0'};\nunsigned char    uca[6] = {'t', 'e', 's', 't', '3', '\\0'};\nsigned char      sca[6] = {'t', 'e', 's', 't', '4', '\\0'};\nuint8_t          ui8ta[6] = {'t', 'e', 's', 't', '5', '\\0'};\ncustom_uchar_t   tuca[6] = {'t', 'e', 's', 't', '6', '\\0'};\n*/\nimport \"C\"\n\n// GetCgoNullCharPointer returns a null char pointer via cgo.  This is only\n// used for tests.\nfunc GetCgoNullCharPointer() interface{} {\n\treturn C.ncp\n}\n\n// GetCgoCharPointer returns a char pointer via cgo.  This is only used for\n// tests.\nfunc GetCgoCharPointer() interface{} {\n\treturn C.cp\n}\n\n// GetCgoCharArray returns a char array via cgo and the array's len and cap.\n// This is only used for tests.\nfunc GetCgoCharArray() (interface{}, int, int) {\n\treturn C.ca, len(C.ca), cap(C.ca)\n}\n\n// GetCgoUnsignedCharArray returns an unsigned char array via cgo and the\n// array's len and cap.  This is only used for tests.\nfunc GetCgoUnsignedCharArray() (interface{}, int, int) {\n\treturn C.uca, len(C.uca), cap(C.uca)\n}\n\n// GetCgoSignedCharArray returns a signed char array via cgo and the array's len\n// and cap.  This is only used for tests.\nfunc GetCgoSignedCharArray() (interface{}, int, int) {\n\treturn C.sca, len(C.sca), cap(C.sca)\n}\n\n// GetCgoUint8tArray returns a uint8_t array via cgo and the array's len and\n// cap.  This is only used for tests.\nfunc GetCgoUint8tArray() (interface{}, int, int) {\n\treturn C.ui8ta, len(C.ui8ta), cap(C.ui8ta)\n}\n\n// GetCgoTypdefedUnsignedCharArray returns a typedefed unsigned char array via\n// cgo and the array's len and cap.  This is only used for tests.\nfunc GetCgoTypdefedUnsignedCharArray() (interface{}, int, int) {\n\treturn C.tuca, len(C.tuca), cap(C.tuca)\n}\n"
  },
  {
    "path": "mock/doc.go",
    "content": "// Package mock provides a system by which it is possible to mock your objects\n// and verify calls are happening as expected.\n//\n// # Example Usage\n//\n// The mock package provides an object, Mock, that tracks activity on another object.  It is usually\n// embedded into a test object as shown below:\n//\n//\ttype MyTestObject struct {\n//\t  // add a Mock object instance\n//\t  mock.Mock\n//\n//\t  // other fields go here as normal\n//\t}\n//\n// When implementing the methods of an interface, you wire your functions up\n// to call the Mock.Called(args...) method, and return the appropriate values.\n//\n// For example, to mock a method that saves the name and age of a person and returns\n// the year of their birth or an error, you might write this:\n//\n//\tfunc (o *MyTestObject) SavePersonDetails(firstname, lastname string, age int) (int, error) {\n//\t  args := o.Called(firstname, lastname, age)\n//\t  return args.Int(0), args.Error(1)\n//\t}\n//\n// The Int, Error and Bool methods are examples of strongly typed getters that take the argument\n// index position. Given this argument list:\n//\n//\t(12, true, \"Something\")\n//\n// You could read them out strongly typed like this:\n//\n//\targs.Int(0)\n//\targs.Bool(1)\n//\targs.String(2)\n//\n// For objects of your own type, use the generic Arguments.Get(index) method and make a type assertion:\n//\n//\treturn args.Get(0).(*MyObject), args.Get(1).(*AnotherObjectOfMine)\n//\n// This may cause a panic if the object you are getting is nil (the type assertion will fail), in those\n// cases you should check for nil first.\npackage mock\n"
  },
  {
    "path": "mock/mock.go",
    "content": "package mock\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"path\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/stretchr/objx\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/internal/difflib\"\n\t\"github.com/stretchr/testify/internal/spew\"\n)\n\n// regex for GCCGO functions\nvar gccgoRE = regexp.MustCompile(`\\.pN\\d+_`)\n\n// TestingT is an interface wrapper around *testing.T\ntype TestingT interface {\n\tLogf(format string, args ...interface{})\n\tErrorf(format string, args ...interface{})\n\tFailNow()\n}\n\n/*\n\tCall\n*/\n\n// Call represents a method call and is used for setting expectations,\n// as well as recording activity.\ntype Call struct {\n\tParent *Mock\n\n\t// The name of the method that was or will be called.\n\tMethod string\n\n\t// Holds the arguments of the method.\n\tArguments Arguments\n\n\t// Holds the arguments that should be returned when\n\t// this method is called.\n\tReturnArguments Arguments\n\n\t// Holds the caller info for the On() call\n\tcallerInfo []string\n\n\t// The number of times to return the return arguments when setting\n\t// expectations. 0 means to always return the value.\n\tRepeatability int\n\n\t// Amount of times this call has been called\n\ttotalCalls int\n\n\t// Call to this method can be optional\n\toptional bool\n\n\t// Holds a channel that will be used to block the Return until it either\n\t// receives a message or is closed. nil means it returns immediately.\n\tWaitFor <-chan time.Time\n\n\twaitTime time.Duration\n\n\t// Holds a handler used to manipulate arguments content that are passed by\n\t// reference. It's useful when mocking methods such as unmarshalers or\n\t// decoders.\n\tRunFn func(Arguments)\n\n\t// PanicMsg holds msg to be used to mock panic on the function call\n\t//  if the PanicMsg is set to a non nil string the function call will panic\n\t// irrespective of other settings\n\tPanicMsg *string\n\n\t// Calls which must be satisfied before this call can be\n\trequires []*Call\n}\n\nfunc newCall(parent *Mock, methodName string, callerInfo []string, methodArguments Arguments, returnArguments Arguments) *Call {\n\treturn &Call{\n\t\tParent:          parent,\n\t\tMethod:          methodName,\n\t\tArguments:       methodArguments,\n\t\tReturnArguments: returnArguments,\n\t\tcallerInfo:      callerInfo,\n\t\tRepeatability:   0,\n\t\tWaitFor:         nil,\n\t\tRunFn:           nil,\n\t\tPanicMsg:        nil,\n\t}\n}\n\nfunc (c *Call) lock() {\n\tc.Parent.mutex.Lock()\n}\n\nfunc (c *Call) unlock() {\n\tc.Parent.mutex.Unlock()\n}\n\n// Return specifies the return arguments for the expectation.\n//\n//\tMock.On(\"DoSomething\").Return(errors.New(\"failed\"))\nfunc (c *Call) Return(returnArguments ...interface{}) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\n\tc.ReturnArguments = returnArguments\n\n\treturn c\n}\n\n// Panic specifies if the function call should fail and the panic message\n//\n//\tMock.On(\"DoSomething\").Panic(\"test panic\")\nfunc (c *Call) Panic(msg string) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\n\tc.PanicMsg = &msg\n\n\treturn c\n}\n\n// Once indicates that the mock should only return the value once.\n//\n//\tMock.On(\"MyMethod\", arg1, arg2).Return(returnArg1, returnArg2).Once()\nfunc (c *Call) Once() *Call {\n\treturn c.Times(1)\n}\n\n// Twice indicates that the mock should only return the value twice.\n//\n//\tMock.On(\"MyMethod\", arg1, arg2).Return(returnArg1, returnArg2).Twice()\nfunc (c *Call) Twice() *Call {\n\treturn c.Times(2)\n}\n\n// Times indicates that the mock should only return the indicated number\n// of times.\n//\n//\tMock.On(\"MyMethod\", arg1, arg2).Return(returnArg1, returnArg2).Times(5)\nfunc (c *Call) Times(i int) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.Repeatability = i\n\treturn c\n}\n\n// WaitUntil sets the channel that will block the mock's return until its closed\n// or a message is received.\n//\n//\tMock.On(\"MyMethod\", arg1, arg2).WaitUntil(time.After(time.Second))\nfunc (c *Call) WaitUntil(w <-chan time.Time) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.WaitFor = w\n\treturn c\n}\n\n// After sets how long to block until the call returns\n//\n//\tMock.On(\"MyMethod\", arg1, arg2).After(time.Second)\nfunc (c *Call) After(d time.Duration) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.waitTime = d\n\treturn c\n}\n\n// Run sets a handler to be called before returning. It can be used when\n// mocking a method (such as an unmarshaler) that takes a pointer to a struct and\n// sets properties in such struct\n//\n//\tMock.On(\"Unmarshal\", AnythingOfType(\"*map[string]interface{}\")).Return().Run(func(args Arguments) {\n//\t\targ := args.Get(0).(*map[string]interface{})\n//\t\targ[\"foo\"] = \"bar\"\n//\t})\nfunc (c *Call) Run(fn func(args Arguments)) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.RunFn = fn\n\treturn c\n}\n\n// Maybe allows the method call to be optional. Not calling an optional method\n// will not cause an error while asserting expectations\nfunc (c *Call) Maybe() *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.optional = true\n\treturn c\n}\n\n// On chains a new expectation description onto the mocked interface. This\n// allows syntax like.\n//\n//\tMock.\n//\t   On(\"MyMethod\", 1).Return(nil).\n//\t   On(\"MyOtherMethod\", 'a', 'b', 'c').Return(errors.New(\"Some Error\"))\n//\n//go:noinline\nfunc (c *Call) On(methodName string, arguments ...interface{}) *Call {\n\treturn c.Parent.On(methodName, arguments...)\n}\n\n// Unset removes all mock handlers that satisfy the call instance arguments from being\n// called. Only supported on call instances with static input arguments.\n//\n// For example, the only handler remaining after the following would be \"MyMethod(2, 2)\":\n//\n//\tMock.\n//\t   On(\"MyMethod\", 2, 2).Return(0).\n//\t   On(\"MyMethod\", 3, 3).Return(0).\n//\t   On(\"MyMethod\", Anything, Anything).Return(0)\n//\tMock.On(\"MyMethod\", 3, 3).Unset()\nfunc (c *Call) Unset() *Call {\n\tvar unlockOnce sync.Once\n\n\tfor _, arg := range c.Arguments {\n\t\tif v := reflect.ValueOf(arg); v.Kind() == reflect.Func {\n\t\t\tpanic(fmt.Sprintf(\"cannot use Func in expectations. Use mock.AnythingOfType(\\\"%T\\\")\", arg))\n\t\t}\n\t}\n\n\tc.lock()\n\tdefer unlockOnce.Do(c.unlock)\n\n\tfoundMatchingCall := false\n\n\t// in-place filter slice for calls to be removed - iterate from 0'th to last skipping unnecessary ones\n\tvar index int // write index\n\tfor _, call := range c.Parent.ExpectedCalls {\n\t\tif call.Method == c.Method {\n\t\t\t_, diffCount := call.Arguments.Diff(c.Arguments)\n\t\t\tif diffCount == 0 {\n\t\t\t\tfoundMatchingCall = true\n\t\t\t\t// Remove from ExpectedCalls - just skip it\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tc.Parent.ExpectedCalls[index] = call\n\t\tindex++\n\t}\n\t// trim slice up to last copied index\n\tc.Parent.ExpectedCalls = c.Parent.ExpectedCalls[:index]\n\n\tif !foundMatchingCall {\n\t\tunlockOnce.Do(c.unlock)\n\t\tc.Parent.fail(\"\\n\\nmock: Could not find expected call\\n-----------------------------\\n\\n%s\\n\\n\",\n\t\t\tcallString(c.Method, c.Arguments, true),\n\t\t)\n\t}\n\n\treturn c\n}\n\n// NotBefore indicates that the mock should only be called after the referenced\n// calls have been called as expected. The referenced calls may be from the\n// same mock instance and/or other mock instances.\n//\n//\tMock.On(\"Do\").Return(nil).NotBefore(\n//\t    Mock.On(\"Init\").Return(nil)\n//\t)\nfunc (c *Call) NotBefore(calls ...*Call) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\n\tfor _, call := range calls {\n\t\tif call.Parent == nil {\n\t\t\tpanic(\"not before calls must be created with Mock.On()\")\n\t\t}\n\t}\n\n\tc.requires = append(c.requires, calls...)\n\treturn c\n}\n\n// InOrder defines the order in which the calls should be made\n//\n//\tFor example:\n//\n//\tInOrder(\n//\t\tMock.On(\"init\").Return(nil),\n//\t\tMock.On(\"Do\").Return(nil),\n//\t)\nfunc InOrder(calls ...*Call) {\n\tfor i := 1; i < len(calls); i++ {\n\t\tcalls[i].NotBefore(calls[i-1])\n\t}\n}\n\n// Mock is the workhorse used to track activity on another object.\n// For an example of its usage, refer to the \"Example Usage\" section at the top\n// of this document.\ntype Mock struct {\n\t// Represents the calls that are expected of\n\t// an object.\n\tExpectedCalls []*Call\n\n\t// Holds the calls that were made to this mocked object.\n\tCalls []Call\n\n\t// test is An optional variable that holds the test struct, to be used when an\n\t// invalid mock call was made.\n\ttest TestingT\n\n\t// TestData holds any data that might be useful for testing.  Testify ignores\n\t// this data completely allowing you to do whatever you like with it.\n\ttestData objx.Map\n\n\tmutex sync.Mutex\n}\n\n// String provides a %v format string for Mock.\n// Note: this is used implicitly by Arguments.Diff if a Mock is passed.\n// It exists because go's default %v formatting traverses the struct\n// without acquiring the mutex, which is detected by go test -race.\nfunc (m *Mock) String() string {\n\treturn fmt.Sprintf(\"%[1]T<%[1]p>\", m)\n}\n\n// TestData holds any data that might be useful for testing.  Testify ignores\n// this data completely allowing you to do whatever you like with it.\nfunc (m *Mock) TestData() objx.Map {\n\tif m.testData == nil {\n\t\tm.testData = make(objx.Map)\n\t}\n\n\treturn m.testData\n}\n\n/*\n\tSetting expectations\n*/\n\n// Test sets the [TestingT] on which errors will be reported, otherwise errors\n// will cause a panic.\n// Test should not be called on an object that is going to be used in a\n// goroutine other than the one running the test function.\nfunc (m *Mock) Test(t TestingT) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.test = t\n}\n\n// fail fails the current test with the given formatted format and args.\n// In case that a test was defined, it uses the test APIs for failing a test,\n// otherwise it uses panic.\nfunc (m *Mock) fail(format string, args ...interface{}) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tif m.test == nil {\n\t\tpanic(fmt.Sprintf(format, args...))\n\t}\n\tm.test.Errorf(format, args...)\n\tm.test.FailNow()\n}\n\n// On starts a description of an expectation of the specified method\n// being called.\n//\n//\tMock.On(\"MyMethod\", arg1, arg2)\nfunc (m *Mock) On(methodName string, arguments ...interface{}) *Call {\n\tfor _, arg := range arguments {\n\t\tif v := reflect.ValueOf(arg); v.Kind() == reflect.Func {\n\t\t\tpanic(fmt.Sprintf(\"cannot use Func in expectations. Use mock.AnythingOfType(\\\"%T\\\")\", arg))\n\t\t}\n\t}\n\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tc := newCall(m, methodName, assert.CallerInfo(), arguments, make([]interface{}, 0))\n\tm.ExpectedCalls = append(m.ExpectedCalls, c)\n\treturn c\n}\n\n// /*\n// \tRecording and responding to activity\n// */\n\nfunc (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) {\n\tvar expectedCall *Call\n\n\tfor i, call := range m.ExpectedCalls {\n\t\tif call.Method == method {\n\t\t\t_, diffCount := call.Arguments.Diff(arguments)\n\t\t\tif diffCount == 0 {\n\t\t\t\texpectedCall = call\n\t\t\t\tif call.Repeatability > -1 {\n\t\t\t\t\treturn i, call\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1, expectedCall\n}\n\ntype matchCandidate struct {\n\tcall      *Call\n\tmismatch  string\n\tdiffCount int\n}\n\nfunc (c matchCandidate) isBetterMatchThan(other matchCandidate) bool {\n\tif c.call == nil {\n\t\treturn false\n\t}\n\tif other.call == nil {\n\t\treturn true\n\t}\n\n\tif c.diffCount > other.diffCount {\n\t\treturn false\n\t}\n\tif c.diffCount < other.diffCount {\n\t\treturn true\n\t}\n\n\tif c.call.Repeatability > 0 && other.call.Repeatability <= 0 {\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc (m *Mock) findClosestCall(method string, arguments ...interface{}) (*Call, string) {\n\tvar bestMatch matchCandidate\n\n\tfor _, call := range m.expectedCalls() {\n\t\tif call.Method == method {\n\n\t\t\terrInfo, tempDiffCount := call.Arguments.Diff(arguments)\n\t\t\ttempCandidate := matchCandidate{\n\t\t\t\tcall:      call,\n\t\t\t\tmismatch:  errInfo,\n\t\t\t\tdiffCount: tempDiffCount,\n\t\t\t}\n\t\t\tif tempCandidate.isBetterMatchThan(bestMatch) {\n\t\t\t\tbestMatch = tempCandidate\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bestMatch.call, bestMatch.mismatch\n}\n\nfunc callString(method string, arguments Arguments, includeArgumentValues bool) string {\n\tvar argValsString string\n\tif includeArgumentValues {\n\t\tvar argVals []string\n\t\tfor argIndex, arg := range arguments {\n\t\t\tif _, ok := arg.(*FunctionalOptionsArgument); ok {\n\t\t\t\targVals = append(argVals, fmt.Sprintf(\"%d: %s\", argIndex, arg))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\targVals = append(argVals, fmt.Sprintf(\"%d: %#v\", argIndex, arg))\n\t\t}\n\t\targValsString = fmt.Sprintf(\"\\n\\t\\t%s\", strings.Join(argVals, \"\\n\\t\\t\"))\n\t}\n\n\treturn fmt.Sprintf(\"%s(%s)%s\", method, arguments.String(), argValsString)\n}\n\n// Called tells the mock object that a method has been called, and gets an array\n// of arguments to return.  Panics if the call is unexpected (i.e. not preceded by\n// appropriate .On .Return() calls)\n// If Call.WaitFor is set, blocks until the channel is closed or receives a message.\nfunc (m *Mock) Called(arguments ...interface{}) Arguments {\n\t// get the calling function's name\n\tpc, _, _, ok := runtime.Caller(1)\n\tif !ok {\n\t\tpanic(\"Couldn't get the caller information\")\n\t}\n\tfunctionPath := runtime.FuncForPC(pc).Name()\n\t// Next four lines are required to use GCCGO function naming conventions.\n\t// For Ex:  github_com_docker_libkv_store_mock.WatchTree.pN39_github_com_docker_libkv_store_mock.Mock\n\t// uses interface information unlike golang github.com/docker/libkv/store/mock.(*Mock).WatchTree\n\t// With GCCGO we need to remove interface information starting from pN<dd>.\n\tif gccgoRE.MatchString(functionPath) {\n\t\tfunctionPath = gccgoRE.Split(functionPath, -1)[0]\n\t}\n\tparts := strings.Split(functionPath, \".\")\n\tfunctionName := parts[len(parts)-1]\n\treturn m.MethodCalled(functionName, arguments...)\n}\n\n// MethodCalled tells the mock object that the given method has been called, and gets\n// an array of arguments to return. Panics if the call is unexpected (i.e. not preceded\n// by appropriate .On .Return() calls)\n// If Call.WaitFor is set, blocks until the channel is closed or receives a message.\nfunc (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Arguments {\n\tm.mutex.Lock()\n\t// TODO: could combine expected and closes in single loop\n\tfound, call := m.findExpectedCall(methodName, arguments...)\n\n\tif found < 0 {\n\t\t// expected call found, but it has already been called with repeatable times\n\t\tif call != nil {\n\t\t\tm.mutex.Unlock()\n\t\t\tm.fail(\"\\nassert: mock: The method has been called over %d times.\\n\\tEither do one more Mock.On(%#v).Return(...), or remove extra call.\\n\\tThis call was unexpected:\\n\\t\\t%s\\n\\tat: %s\", call.totalCalls, methodName, callString(methodName, arguments, true), assert.CallerInfo())\n\t\t}\n\t\t// we have to fail here - because we don't know what to do\n\t\t// as the return arguments.  This is because:\n\t\t//\n\t\t//   a) this is a totally unexpected call to this method,\n\t\t//   b) the arguments are not what was expected, or\n\t\t//   c) the developer has forgotten to add an accompanying On...Return pair.\n\t\tclosestCall, mismatch := m.findClosestCall(methodName, arguments...)\n\t\tm.mutex.Unlock()\n\n\t\tif closestCall != nil {\n\t\t\tm.fail(\"\\n\\nmock: Unexpected Method Call\\n-----------------------------\\n\\n%s\\n\\nThe closest call I have is: \\n\\n%s\\n\\n%s\\nDiff: %s\\nat: %s\\n\",\n\t\t\t\tcallString(methodName, arguments, true),\n\t\t\t\tcallString(methodName, closestCall.Arguments, true),\n\t\t\t\tdiffArguments(closestCall.Arguments, arguments),\n\t\t\t\tstrings.TrimSpace(mismatch),\n\t\t\t\tassert.CallerInfo(),\n\t\t\t)\n\t\t} else {\n\t\t\tm.fail(\"\\nassert: mock: I don't know what to return because the method call was unexpected.\\n\\tEither do Mock.On(%#v).Return(...) first, or remove the %s() call.\\n\\tThis method was unexpected:\\n\\t\\t%s\\n\\tat: %s\", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo())\n\t\t}\n\t}\n\n\tfor _, requirement := range call.requires {\n\t\tif satisfied, _ := requirement.Parent.checkExpectation(requirement); !satisfied {\n\t\t\tm.mutex.Unlock()\n\t\t\tm.fail(\"mock: Unexpected Method Call\\n-----------------------------\\n\\n%s\\n\\nMust not be called before%s:\\n\\n%s\",\n\t\t\t\tcallString(call.Method, call.Arguments, true),\n\t\t\t\tfunc() (s string) {\n\t\t\t\t\tif requirement.totalCalls > 0 {\n\t\t\t\t\t\ts = \" another call of\"\n\t\t\t\t\t}\n\t\t\t\t\tif call.Parent != requirement.Parent {\n\t\t\t\t\t\ts += \" method from another mock instance\"\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}(),\n\t\t\t\tcallString(requirement.Method, requirement.Arguments, true),\n\t\t\t)\n\t\t}\n\t}\n\n\tif call.Repeatability == 1 {\n\t\tcall.Repeatability = -1\n\t} else if call.Repeatability > 1 {\n\t\tcall.Repeatability--\n\t}\n\tcall.totalCalls++\n\n\t// add the call\n\tm.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments, call.ReturnArguments))\n\tm.mutex.Unlock()\n\n\t// block if specified\n\tif call.WaitFor != nil {\n\t\t<-call.WaitFor\n\t} else {\n\t\ttime.Sleep(call.waitTime)\n\t}\n\n\tm.mutex.Lock()\n\tpanicMsg := call.PanicMsg\n\tm.mutex.Unlock()\n\tif panicMsg != nil {\n\t\tpanic(*panicMsg)\n\t}\n\n\tm.mutex.Lock()\n\trunFn := call.RunFn\n\tm.mutex.Unlock()\n\n\tif runFn != nil {\n\t\trunFn(arguments)\n\t}\n\n\tm.mutex.Lock()\n\treturnArgs := call.ReturnArguments\n\tm.mutex.Unlock()\n\n\treturn returnArgs\n}\n\n/*\n\tAssertions\n*/\n\ntype assertExpectationiser interface {\n\tAssertExpectations(TestingT) bool\n}\n\n// AssertExpectationsForObjects asserts that everything specified with On and Return\n// of the specified objects was in fact called as expected.\n//\n// Calls may have occurred in any order.\nfunc AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tfor _, obj := range testObjects {\n\t\tm, ok := obj.(assertExpectationiser)\n\t\tif !ok {\n\t\t\tt.Errorf(\"Invalid test object type %T. Expected reference to a mock.Mock, eg: 'AssertExpectationsForObjects(t, myMock)' or 'AssertExpectationsForObjects(t, &myMock.Mock)'\", obj)\n\t\t\tcontinue\n\n\t\t}\n\t\tif !m.AssertExpectations(t) {\n\t\t\tt.Logf(\"Expectations didn't match for Mock: %+v\", reflect.TypeOf(m))\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// AssertExpectations asserts that everything specified with On and Return was\n// in fact called as expected.  Calls may have occurred in any order.\nfunc (m *Mock) AssertExpectations(t TestingT) bool {\n\tif s, ok := t.(interface{ Skipped() bool }); ok && s.Skipped() {\n\t\treturn true\n\t}\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tvar failedExpectations int\n\n\t// iterate through each expectation\n\texpectedCalls := m.expectedCalls()\n\tfor _, expectedCall := range expectedCalls {\n\t\tsatisfied, reason := m.checkExpectation(expectedCall)\n\t\tif !satisfied {\n\t\t\tfailedExpectations++\n\t\t\tt.Logf(reason)\n\t\t}\n\t}\n\n\tif failedExpectations != 0 {\n\t\tt.Errorf(\"FAIL: %d out of %d expectation(s) were met.\\n\\tThe code you are testing needs to make %d more call(s).\\n\\tat: %s\", len(expectedCalls)-failedExpectations, len(expectedCalls), failedExpectations, assert.CallerInfo())\n\t}\n\n\treturn failedExpectations == 0\n}\n\nfunc (m *Mock) checkExpectation(call *Call) (bool, string) {\n\tif !call.optional && !m.methodWasCalled(call.Method, call.Arguments) && call.totalCalls == 0 {\n\t\treturn false, fmt.Sprintf(\"FAIL:\\t%s(%s)\\n\\t\\tat: %s\", call.Method, call.Arguments.String(), call.callerInfo)\n\t}\n\tif call.Repeatability > 0 {\n\t\treturn false, fmt.Sprintf(\"FAIL:\\t%s(%s)\\n\\t\\tat: %s\", call.Method, call.Arguments.String(), call.callerInfo)\n\t}\n\treturn true, fmt.Sprintf(\"PASS:\\t%s(%s)\", call.Method, call.Arguments.String())\n}\n\n// AssertNumberOfCalls asserts that the method was called expectedCalls times.\nfunc (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tvar actualCalls int\n\tfor _, call := range m.calls() {\n\t\tif call.Method == methodName {\n\t\t\tactualCalls++\n\t\t}\n\t}\n\treturn assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf(\"Expected number of calls (%d) of method %s does not match the actual number of calls (%d).\", expectedCalls, methodName, actualCalls))\n}\n\n// AssertCalled asserts that the method was called.\n// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.\nfunc (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tif !m.methodWasCalled(methodName, arguments) {\n\t\tvar calledWithArgs []string\n\t\tfor _, call := range m.calls() {\n\t\t\tcalledWithArgs = append(calledWithArgs, fmt.Sprintf(\"%v\", call.Arguments))\n\t\t}\n\t\tif len(calledWithArgs) == 0 {\n\t\t\treturn assert.Fail(t, \"Should have called with given arguments\",\n\t\t\t\tfmt.Sprintf(\"Expected %q to have been called with:\\n%v\\nbut no actual calls happened\", methodName, arguments))\n\t\t}\n\t\treturn assert.Fail(t, \"Should have called with given arguments\",\n\t\t\tfmt.Sprintf(\"Expected %q to have been called with:\\n%v\\nbut actual calls were:\\n        %v\", methodName, arguments, strings.Join(calledWithArgs, \"\\n\")))\n\t}\n\treturn true\n}\n\n// AssertNotCalled asserts that the method was not called.\n// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.\nfunc (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tif m.methodWasCalled(methodName, arguments) {\n\t\treturn assert.Fail(t, \"Should not have called with given arguments\",\n\t\t\tfmt.Sprintf(\"Expected %q to not have been called with:\\n%v\\nbut actually it was.\", methodName, arguments))\n\t}\n\treturn true\n}\n\n// IsMethodCallable returns true if given methodName and arguments have an\n// unsatisfied expected call registered in the Mock.\nfunc (m *Mock) IsMethodCallable(t TestingT, methodName string, arguments ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tfor _, v := range m.ExpectedCalls {\n\t\tif v.Method != methodName {\n\t\t\tcontinue\n\t\t}\n\t\tif len(arguments) != len(v.Arguments) {\n\t\t\tcontinue\n\t\t}\n\t\tif v.Repeatability < v.totalCalls {\n\t\t\tcontinue\n\t\t}\n\t\tif isArgsEqual(v.Arguments, arguments) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// isArgsEqual compares arguments\nfunc isArgsEqual(expected Arguments, args []interface{}) bool {\n\tif len(expected) != len(args) {\n\t\treturn false\n\t}\n\tfor i, v := range args {\n\t\tif !reflect.DeepEqual(expected[i], v) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc (m *Mock) methodWasCalled(methodName string, expected []interface{}) bool {\n\tfor _, call := range m.calls() {\n\t\tif call.Method == methodName {\n\n\t\t\t_, differences := Arguments(expected).Diff(call.Arguments)\n\n\t\t\tif differences == 0 {\n\t\t\t\t// found the expected call\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t}\n\t}\n\t// we didn't find the expected call\n\treturn false\n}\n\nfunc (m *Mock) expectedCalls() []*Call {\n\treturn append([]*Call{}, m.ExpectedCalls...)\n}\n\nfunc (m *Mock) calls() []Call {\n\treturn append([]Call{}, m.Calls...)\n}\n\n/*\n\tArguments\n*/\n\n// Arguments holds an array of method arguments or return values.\ntype Arguments []interface{}\n\nconst (\n\t// Anything is used in Diff and Assert when the argument being tested\n\t// shouldn't be taken into consideration.\n\tAnything = \"mock.Anything\"\n)\n\n// AnythingOfTypeArgument contains the type of an argument\n// for use when type checking.  Used in [Arguments.Diff] and [Arguments.Assert].\n//\n// Deprecated: this is an implementation detail that must not be used. Use the [AnythingOfType] constructor instead, example:\n//\n//\tm.On(\"Do\", mock.AnythingOfType(\"string\"))\n//\n// All explicit type declarations can be replaced with interface{} as is expected by [Mock.On], example:\n//\n//\tfunc anyString interface{} {\n//\t\treturn mock.AnythingOfType(\"string\")\n//\t}\ntype AnythingOfTypeArgument = anythingOfTypeArgument\n\n// anythingOfTypeArgument is a string that contains the type of an argument\n// for use when type checking.  Used in Diff and Assert.\ntype anythingOfTypeArgument string\n\n// AnythingOfType returns a special value containing the\n// name of the type to check for. The type name will be matched against the type name returned by [reflect.Type.String].\n//\n// Used in Diff and Assert.\n//\n// For example:\n//\n//\targs.Assert(t, AnythingOfType(\"string\"), AnythingOfType(\"int\"))\nfunc AnythingOfType(t string) AnythingOfTypeArgument {\n\treturn anythingOfTypeArgument(t)\n}\n\n// IsTypeArgument is a struct that contains the type of an argument\n// for use when type checking.  This is an alternative to [AnythingOfType].\n// Used in [Arguments.Diff] and [Arguments.Assert].\ntype IsTypeArgument struct {\n\tt reflect.Type\n}\n\n// IsType returns an IsTypeArgument object containing the type to check for.\n// You can provide a zero-value of the type to check.  This is an\n// alternative to [AnythingOfType].  Used in [Arguments.Diff] and [Arguments.Assert].\n//\n// For example:\n//\n//\targs.Assert(t, IsType(\"\"), IsType(0))\n//\n// Mock cannot match interface types because the contained type will be  passed\n// to both IsType and Mock.Called, for the zero value of all interfaces this\n// will be <nil> type.\nfunc IsType(t interface{}) *IsTypeArgument {\n\treturn &IsTypeArgument{t: reflect.TypeOf(t)}\n}\n\n// FunctionalOptionsArgument contains a list of functional options arguments\n// expected for use when matching a list of arguments.\ntype FunctionalOptionsArgument struct {\n\tvalues []interface{}\n}\n\n// String returns the string representation of FunctionalOptionsArgument\nfunc (f *FunctionalOptionsArgument) String() string {\n\tvar name string\n\tif len(f.values) > 0 {\n\t\tname = \"[]\" + reflect.TypeOf(f.values[0]).String()\n\t}\n\n\treturn strings.Replace(fmt.Sprintf(\"%#v\", f.values), \"[]interface {}\", name, 1)\n}\n\n// FunctionalOptions returns an [FunctionalOptionsArgument] object containing\n// the expected functional-options to check for.\n//\n// For example:\n//\n//\targs.Assert(t, FunctionalOptions(foo.Opt1(\"strValue\"), foo.Opt2(613)))\nfunc FunctionalOptions(values ...interface{}) *FunctionalOptionsArgument {\n\treturn &FunctionalOptionsArgument{\n\t\tvalues: values,\n\t}\n}\n\n// argumentMatcher performs custom argument matching, returning whether or\n// not the argument is matched by the expectation fixture function.\ntype argumentMatcher struct {\n\t// fn is a function which accepts one argument, and returns a bool.\n\tfn reflect.Value\n}\n\nfunc (f argumentMatcher) Matches(argument interface{}) bool {\n\texpectType := f.fn.Type().In(0)\n\texpectTypeNilSupported := false\n\tswitch expectType.Kind() {\n\tcase reflect.Interface, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Ptr:\n\t\texpectTypeNilSupported = true\n\t}\n\n\targType := reflect.TypeOf(argument)\n\tvar arg reflect.Value\n\tif argType == nil {\n\t\targ = reflect.New(expectType).Elem()\n\t} else {\n\t\targ = reflect.ValueOf(argument)\n\t}\n\n\tif argType == nil && !expectTypeNilSupported {\n\t\tpanic(errors.New(\"attempting to call matcher with nil for non-nil expected type\"))\n\t}\n\tif argType == nil || argType.AssignableTo(expectType) {\n\t\tresult := f.fn.Call([]reflect.Value{arg})\n\t\treturn result[0].Bool()\n\t}\n\treturn false\n}\n\nfunc (f argumentMatcher) String() string {\n\treturn fmt.Sprintf(\"func(%s) bool\", f.fn.Type().In(0).String())\n}\n\n// MatchedBy can be used to match a mock call based on only certain properties\n// from a complex struct or some calculation. It takes a function that will be\n// evaluated with the called argument and will return true when there's a match\n// and false otherwise.\n//\n// Example:\n//\n//\tm.On(\"Do\", MatchedBy(func(req *http.Request) bool { return req.Host == \"example.com\" }))\n//\n// fn must be a function accepting a single argument (of the expected type)\n// which returns a bool. If fn doesn't match the required signature,\n// MatchedBy() panics.\nfunc MatchedBy(fn interface{}) argumentMatcher {\n\tfnType := reflect.TypeOf(fn)\n\n\tif fnType.Kind() != reflect.Func {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: %s is not a func\", fn))\n\t}\n\tif fnType.NumIn() != 1 {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: %s does not take exactly one argument\", fn))\n\t}\n\tif fnType.NumOut() != 1 || fnType.Out(0).Kind() != reflect.Bool {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: %s does not return a bool\", fn))\n\t}\n\n\treturn argumentMatcher{fn: reflect.ValueOf(fn)}\n}\n\n// Get Returns the argument at the specified index.\nfunc (args Arguments) Get(index int) interface{} {\n\tif index+1 > len(args) {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: Cannot call Get(%d) because there are %d argument(s).\", index, len(args)))\n\t}\n\treturn args[index]\n}\n\n// Is gets whether the objects match the arguments specified.\nfunc (args Arguments) Is(objects ...interface{}) bool {\n\tfor i, obj := range args {\n\t\tif obj != objects[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// Diff gets a string describing the differences between the arguments\n// and the specified objects.\n//\n// Returns the diff string and number of differences found.\nfunc (args Arguments) Diff(objects []interface{}) (string, int) {\n\t// TODO: could return string as error and nil for No difference\n\n\toutput := \"\\n\"\n\tvar differences int\n\n\tmaxArgCount := len(args)\n\tif len(objects) > maxArgCount {\n\t\tmaxArgCount = len(objects)\n\t}\n\n\tfor i := 0; i < maxArgCount; i++ {\n\t\tvar actual, expected interface{}\n\t\tvar actualFmt, expectedFmt string\n\n\t\tif len(objects) <= i {\n\t\t\tactual = \"(Missing)\"\n\t\t\tactualFmt = \"(Missing)\"\n\t\t} else {\n\t\t\tactual = objects[i]\n\t\t\tactualFmt = fmt.Sprintf(\"(%[1]T=%[1]v)\", actual)\n\t\t}\n\n\t\tif len(args) <= i {\n\t\t\texpected = \"(Missing)\"\n\t\t\texpectedFmt = \"(Missing)\"\n\t\t} else {\n\t\t\texpected = args[i]\n\t\t\texpectedFmt = fmt.Sprintf(\"(%[1]T=%[1]v)\", expected)\n\t\t}\n\n\t\tif matcher, ok := expected.(argumentMatcher); ok {\n\t\t\tvar matches bool\n\t\t\tfunc() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\t\tactualFmt = fmt.Sprintf(\"panic in argument matcher: %v\", r)\n\t\t\t\t\t}\n\t\t\t\t}()\n\t\t\t\tmatches = matcher.Matches(actual)\n\t\t\t}()\n\t\t\tif matches {\n\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: PASS:  %s matched by %s\\n\", output, i, actualFmt, matcher)\n\t\t\t} else {\n\t\t\t\tdifferences++\n\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: FAIL:  %s not matched by %s\\n\", output, i, actualFmt, matcher)\n\t\t\t}\n\t\t} else {\n\t\t\tswitch expected := expected.(type) {\n\t\t\tcase anythingOfTypeArgument:\n\t\t\t\t// type checking\n\t\t\t\tif reflect.TypeOf(actual).Name() != string(expected) && reflect.TypeOf(actual).String() != string(expected) {\n\t\t\t\t\t// not match\n\t\t\t\t\tdifferences++\n\t\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: FAIL:  type %s != type %s - %s\\n\", output, i, expected, reflect.TypeOf(actual).Name(), actualFmt)\n\t\t\t\t}\n\t\t\tcase *IsTypeArgument:\n\t\t\t\tactualT := reflect.TypeOf(actual)\n\t\t\t\tif actualT != expected.t {\n\t\t\t\t\tdifferences++\n\t\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: FAIL:  type %s != type %s - %s\\n\", output, i, safeTypeName(expected.t), safeTypeName(actualT), actualFmt)\n\t\t\t\t}\n\t\t\tcase *FunctionalOptionsArgument:\n\t\t\t\tvar name string\n\t\t\t\tif len(expected.values) > 0 {\n\t\t\t\t\tname = \"[]\" + reflect.TypeOf(expected.values[0]).String()\n\t\t\t\t}\n\n\t\t\t\tconst tName = \"[]interface{}\"\n\t\t\t\tif name != reflect.TypeOf(actual).String() && len(expected.values) != 0 {\n\t\t\t\t\tdifferences++\n\t\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: FAIL:  type %s != type %s - %s\\n\", output, i, tName, reflect.TypeOf(actual).Name(), actualFmt)\n\t\t\t\t} else {\n\t\t\t\t\tif ef, af := assertOpts(expected.values, actual); ef == \"\" && af == \"\" {\n\t\t\t\t\t\t// match\n\t\t\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: PASS:  %s == %s\\n\", output, i, tName, tName)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// not match\n\t\t\t\t\t\tdifferences++\n\t\t\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: FAIL:  %s != %s\\n\", output, i, af, ef)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tif assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) {\n\t\t\t\t\t// match\n\t\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: PASS:  %s == %s\\n\", output, i, actualFmt, expectedFmt)\n\t\t\t\t} else {\n\t\t\t\t\t// not match\n\t\t\t\t\tdifferences++\n\t\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: FAIL:  %s != %s\\n\", output, i, actualFmt, expectedFmt)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif differences == 0 {\n\t\treturn \"No differences.\", differences\n\t}\n\n\treturn output, differences\n}\n\n// Assert compares the arguments with the specified objects and fails if\n// they do not exactly match.\nfunc (args Arguments) Assert(t TestingT, objects ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\t// get the differences\n\tdiff, diffCount := args.Diff(objects)\n\n\tif diffCount == 0 {\n\t\treturn true\n\t}\n\n\t// there are differences... report them...\n\tt.Logf(diff)\n\tt.Errorf(\"%sArguments do not match.\", assert.CallerInfo())\n\n\treturn false\n}\n\n// String gets the argument at the specified index. Panics if there is no argument, or\n// if the argument is of the wrong type.\n//\n// If no index is provided, String() returns a complete string representation\n// of the arguments.\nfunc (args Arguments) String(indexOrNil ...int) string {\n\tif len(indexOrNil) == 0 {\n\t\t// normal String() method - return a string representation of the args\n\t\tvar argsStr []string\n\t\tfor _, arg := range args {\n\t\t\targsStr = append(argsStr, fmt.Sprintf(\"%T\", arg)) // handles nil nicely\n\t\t}\n\t\treturn strings.Join(argsStr, \",\")\n\t} else if len(indexOrNil) == 1 {\n\t\t// Index has been specified - get the argument at that index\n\t\tindex := indexOrNil[0]\n\t\tvar s string\n\t\tvar ok bool\n\t\tif s, ok = args.Get(index).(string); !ok {\n\t\t\tpanic(fmt.Sprintf(\"assert: arguments: String(%d) failed because object wasn't correct type: %s\", index, args.Get(index)))\n\t\t}\n\t\treturn s\n\t}\n\n\tpanic(fmt.Sprintf(\"assert: arguments: Wrong number of arguments passed to String.  Must be 0 or 1, not %d\", len(indexOrNil)))\n}\n\n// Int gets the argument at the specified index. Panics if there is no argument, or\n// if the argument is of the wrong type.\nfunc (args Arguments) Int(index int) int {\n\tvar s int\n\tvar ok bool\n\tif s, ok = args.Get(index).(int); !ok {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: Int(%d) failed because object wasn't correct type: %v\", index, args.Get(index)))\n\t}\n\treturn s\n}\n\n// Error gets the argument at the specified index. Panics if there is no argument, or\n// if the argument is of the wrong type.\nfunc (args Arguments) Error(index int) error {\n\tobj := args.Get(index)\n\tvar s error\n\tvar ok bool\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif s, ok = obj.(error); !ok {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: Error(%d) failed because object wasn't correct type: %v\", index, obj))\n\t}\n\treturn s\n}\n\n// Bool gets the argument at the specified index. Panics if there is no argument, or\n// if the argument is of the wrong type.\nfunc (args Arguments) Bool(index int) bool {\n\tvar s bool\n\tvar ok bool\n\tif s, ok = args.Get(index).(bool); !ok {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: Bool(%d) failed because object wasn't correct type: %v\", index, args.Get(index)))\n\t}\n\treturn s\n}\n\n// safeTypeName returns the reflect.Type's name without causing a panic.\n// If the provided reflect.Type is nil, it returns the placeholder string \"<nil>\"\nfunc safeTypeName(t reflect.Type) string {\n\tif t == nil {\n\t\treturn \"<nil>\"\n\t}\n\treturn t.Name()\n}\n\nfunc typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {\n\tt := reflect.TypeOf(v)\n\tk := t.Kind()\n\n\tif k == reflect.Ptr {\n\t\tt = t.Elem()\n\t\tk = t.Kind()\n\t}\n\treturn t, k\n}\n\nfunc diffArguments(expected Arguments, actual Arguments) string {\n\tif len(expected) != len(actual) {\n\t\treturn fmt.Sprintf(\"Provided %v arguments, mocked for %v arguments\", len(expected), len(actual))\n\t}\n\n\tfor x := range expected {\n\t\tif diffString := diff(expected[x], actual[x]); diffString != \"\" {\n\t\t\treturn fmt.Sprintf(\"Difference found in argument %v:\\n\\n%s\", x, diffString)\n\t\t}\n\t}\n\n\treturn \"\"\n}\n\n// diff returns a diff of both values as long as both are of the same type and\n// are a struct, map, slice or array. Otherwise it returns an empty string.\nfunc diff(expected interface{}, actual interface{}) string {\n\tif expected == nil || actual == nil {\n\t\treturn \"\"\n\t}\n\n\tet, ek := typeAndKind(expected)\n\tat, _ := typeAndKind(actual)\n\n\tif et != at {\n\t\treturn \"\"\n\t}\n\n\tif ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array {\n\t\treturn \"\"\n\t}\n\n\te := spewConfig.Sdump(expected)\n\ta := spewConfig.Sdump(actual)\n\n\tdiff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{\n\t\tA:        difflib.SplitLines(e),\n\t\tB:        difflib.SplitLines(a),\n\t\tFromFile: \"Expected\",\n\t\tFromDate: \"\",\n\t\tToFile:   \"Actual\",\n\t\tToDate:   \"\",\n\t\tContext:  1,\n\t})\n\n\treturn diff\n}\n\nvar spewConfig = spew.ConfigState{\n\tIndent:                  \" \",\n\tDisablePointerAddresses: true,\n\tDisableCapacities:       true,\n\tSortKeys:                true,\n}\n\ntype tHelper interface {\n\tHelper()\n}\n\nfunc assertOpts(expected, actual interface{}) (expectedFmt, actualFmt string) {\n\texpectedOpts := reflect.ValueOf(expected)\n\tactualOpts := reflect.ValueOf(actual)\n\n\tvar expectedFuncs []*runtime.Func\n\tvar expectedNames []string\n\tfor i := 0; i < expectedOpts.Len(); i++ {\n\t\tf := runtimeFunc(expectedOpts.Index(i).Interface())\n\t\texpectedFuncs = append(expectedFuncs, f)\n\t\texpectedNames = append(expectedNames, funcName(f))\n\t}\n\tvar actualFuncs []*runtime.Func\n\tvar actualNames []string\n\tfor i := 0; i < actualOpts.Len(); i++ {\n\t\tf := runtimeFunc(actualOpts.Index(i).Interface())\n\t\tactualFuncs = append(actualFuncs, f)\n\t\tactualNames = append(actualNames, funcName(f))\n\t}\n\n\tif expectedOpts.Len() != actualOpts.Len() {\n\t\texpectedFmt = fmt.Sprintf(\"%v\", expectedNames)\n\t\tactualFmt = fmt.Sprintf(\"%v\", actualNames)\n\t\treturn\n\t}\n\n\tfor i := 0; i < expectedOpts.Len(); i++ {\n\t\tif !isFuncSame(expectedFuncs[i], actualFuncs[i]) {\n\t\t\texpectedFmt = expectedNames[i]\n\t\t\tactualFmt = actualNames[i]\n\t\t\treturn\n\t\t}\n\n\t\texpectedOpt := expectedOpts.Index(i).Interface()\n\t\tactualOpt := actualOpts.Index(i).Interface()\n\n\t\tot := reflect.TypeOf(expectedOpt)\n\t\tvar expectedValues []reflect.Value\n\t\tvar actualValues []reflect.Value\n\t\tif ot.NumIn() == 0 {\n\t\t\treturn\n\t\t}\n\n\t\tfor i := 0; i < ot.NumIn(); i++ {\n\t\t\tvt := ot.In(i).Elem()\n\t\t\texpectedValues = append(expectedValues, reflect.New(vt))\n\t\t\tactualValues = append(actualValues, reflect.New(vt))\n\t\t}\n\n\t\treflect.ValueOf(expectedOpt).Call(expectedValues)\n\t\treflect.ValueOf(actualOpt).Call(actualValues)\n\n\t\tfor i := 0; i < ot.NumIn(); i++ {\n\t\t\tif expectedArg, actualArg := expectedValues[i].Interface(), actualValues[i].Interface(); !assert.ObjectsAreEqual(expectedArg, actualArg) {\n\t\t\t\texpectedFmt = fmt.Sprintf(\"%s(%T) -> %#v\", expectedNames[i], expectedArg, expectedArg)\n\t\t\t\tactualFmt = fmt.Sprintf(\"%s(%T) -> %#v\", expectedNames[i], actualArg, actualArg)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\", \"\"\n}\n\nfunc runtimeFunc(opt interface{}) *runtime.Func {\n\treturn runtime.FuncForPC(reflect.ValueOf(opt).Pointer())\n}\n\nfunc funcName(f *runtime.Func) string {\n\tname := f.Name()\n\ttrimmed := strings.TrimSuffix(path.Base(name), path.Ext(name))\n\tsplitted := strings.Split(trimmed, \".\")\n\n\tif len(splitted) == 0 {\n\t\treturn trimmed\n\t}\n\n\treturn splitted[len(splitted)-1]\n}\n\nfunc isFuncSame(f1, f2 *runtime.Func) bool {\n\tf1File, f1Loc := f1.FileLine(f1.Entry())\n\tf2File, f2Loc := f2.FileLine(f2.Entry())\n\n\treturn f1File == f2File && f1Loc == f2Loc\n}\n"
  },
  {
    "path": "mock/mock_test.go",
    "content": "package mock\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strconv\"\n\t\"sync\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n)\n\n/*\n\tTest objects\n*/\n\n// ExampleInterface represents an example interface.\ntype ExampleInterface interface {\n\tTheExampleMethod(a, b, c int) (int, error)\n}\n\n// TestExampleImplementation is a test implementation of ExampleInterface\ntype TestExampleImplementation struct {\n\tMock\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod(a, b, c int) (int, error) {\n\targs := i.Called(a, b, c)\n\treturn args.Int(0), errors.New(\"Whoops\")\n}\n\ntype options struct {\n\tnum int\n\tstr string\n}\n\ntype OptionFn func(*options)\n\nfunc OpNum(n int) OptionFn {\n\treturn func(o *options) {\n\t\to.num = n\n\t}\n}\n\nfunc OpStr(s string) OptionFn {\n\treturn func(o *options) {\n\t\to.str = s\n\t}\n}\n\nfunc OpBytes(b []byte) OptionFn {\n\treturn func(m *options) {\n\t\tm.str = string(b)\n\t}\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethodFunctionalOptions(x string, opts ...OptionFn) error {\n\targs := i.Called(x, opts)\n\treturn args.Error(0)\n}\n\nfunc TheExampleMethodFunctionalOptionsIndirect(i *TestExampleImplementation) {\n\ti.TheExampleMethodFunctionalOptions(\"test\", OpNum(1), OpStr(\"foo\"))\n}\n\n//go:noinline\nfunc (i *TestExampleImplementation) TheExampleMethod2(yesorno bool) {\n\ti.Called(yesorno)\n}\n\ntype ExampleType struct {\n\tran bool\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod3(et *ExampleType) error {\n\targs := i.Called(et)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod4(v ExampleInterface) error {\n\targs := i.Called(v)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod5(ch chan struct{}) error {\n\targs := i.Called(ch)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod6(m map[string]bool) error {\n\targs := i.Called(m)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod7(slice []bool) error {\n\targs := i.Called(slice)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethodFunc(fn func(string) error) error {\n\targs := i.Called(fn)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethodVariadic(a ...int) error {\n\targs := i.Called(a)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethodVariadicInterface(a ...interface{}) error {\n\targs := i.Called(a)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethodMixedVariadic(a int, b ...int) error {\n\targs := i.Called(a, b)\n\treturn args.Error(0)\n}\n\ntype ExampleFuncType func(string) error\n\nfunc (i *TestExampleImplementation) TheExampleMethodFuncType(fn ExampleFuncType) error {\n\targs := i.Called(fn)\n\treturn args.Error(0)\n}\n\n// MockTestingT mocks a test struct\ntype MockTestingT struct {\n\tlogfCount, errorfCount, failNowCount int\n}\n\n// Helper is like [testing.T.Helper] but does nothing.\nfunc (MockTestingT) Helper() {}\n\nconst mockTestingTFailNowCalled = \"FailNow was called\"\n\nfunc (m *MockTestingT) Logf(string, ...interface{}) {\n\tm.logfCount++\n}\n\nfunc (m *MockTestingT) Errorf(string, ...interface{}) {\n\tm.errorfCount++\n}\n\n// FailNow mocks the FailNow call.\n// It panics in order to mimic the FailNow behavior in the sense that\n// the execution stops.\n// When expecting this method, the call that invokes it should use the following code:\n//\n//\tassert.PanicsWithValue(t, mockTestingTFailNowCalled, func() {...})\nfunc (m *MockTestingT) FailNow() {\n\tm.failNowCount++\n\n\t// this function should panic now to stop the execution as expected\n\tpanic(mockTestingTFailNowCalled)\n}\n\n/*\n\tMock\n*/\n\nfunc Test_Mock_TestData(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tif assert.NotNil(t, mockedService.TestData()) {\n\n\t\tmockedService.TestData().Set(\"something\", 123)\n\t\tassert.Equal(t, 123, mockedService.TestData().Get(\"something\").Data())\n\t}\n}\n\nfunc Test_Mock_On(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.On(\"TheExampleMethod\")\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, \"TheExampleMethod\", c.Method)\n}\n\nfunc Test_Mock_Chained_On(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\t// determine our current line number so we can assert the expected calls callerInfo properly\n\t_, filename, line, _ := runtime.Caller(0)\n\tmockedService.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(0).\n\t\tOn(\"TheExampleMethod3\", AnythingOfType(\"*mock.ExampleType\")).\n\t\tReturn(nil)\n\n\texpectedCalls := []*Call{\n\t\t{\n\t\t\tParent:          &mockedService.Mock,\n\t\t\tMethod:          \"TheExampleMethod\",\n\t\t\tArguments:       []interface{}{1, 2, 3},\n\t\t\tReturnArguments: []interface{}{0},\n\t\t\tcallerInfo:      []string{fmt.Sprintf(\"%s:%d\", filename, line+2)},\n\t\t},\n\t\t{\n\t\t\tParent:          &mockedService.Mock,\n\t\t\tMethod:          \"TheExampleMethod3\",\n\t\t\tArguments:       []interface{}{AnythingOfType(\"*mock.ExampleType\")},\n\t\t\tReturnArguments: []interface{}{nil},\n\t\t\tcallerInfo:      []string{fmt.Sprintf(\"%s:%d\", filename, line+4)},\n\t\t},\n\t}\n\tassert.Equal(t, expectedCalls, mockedService.ExpectedCalls)\n}\n\nfunc Test_Mock_On_WithArgs(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.On(\"TheExampleMethod\", 1, 2, 3, 4)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, \"TheExampleMethod\", c.Method)\n\tassert.Equal(t, Arguments{1, 2, 3, 4}, c.Arguments)\n}\n\nfunc Test_Mock_On_WithFuncArg(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodFunc\", AnythingOfType(\"func(string) error\")).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, \"TheExampleMethodFunc\", c.Method)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, AnythingOfType(\"func(string) error\"), c.Arguments[0])\n\n\tfn := func(string) error { return nil }\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodFunc(fn)\n\t})\n}\n\nfunc Test_Mock_On_WithIntArgMatcher(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod\",\n\t\tMatchedBy(func(a int) bool {\n\t\t\treturn a == 1\n\t\t}), MatchedBy(func(b int) bool {\n\t\t\treturn b == 2\n\t\t}), MatchedBy(func(c int) bool {\n\t\t\treturn c == 3\n\t\t})).Return(0, nil)\n\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 4)\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethod(2, 2, 3)\n\t})\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 3)\n\t})\n}\n\nfunc Test_Mock_On_WithArgMatcherThatPanics(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod2\", MatchedBy(func(_ interface{}) bool {\n\t\tpanic(\"try to lock mockedService\")\n\t})).Return()\n\n\tdefer func() {\n\t\tassertedExpectations := make(chan struct{})\n\t\tgo func() {\n\t\t\ttt := new(testing.T)\n\t\t\tmockedService.AssertExpectations(tt)\n\t\t\tclose(assertedExpectations)\n\t\t}()\n\t\tselect {\n\t\tcase <-assertedExpectations:\n\t\tcase <-time.After(time.Second):\n\t\t\tt.Fatal(\"AssertExpectations() deadlocked, did the panic leave mockedService locked?\")\n\t\t}\n\t}()\n\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethod2(false)\n\t})\n}\n\nfunc TestMock_WithTest(t *testing.T) {\n\tt.Parallel()\n\n\tvar (\n\t\tmockedService TestExampleImplementation\n\t\tmockedTest    MockTestingT\n\t)\n\n\tmockedService.Test(&mockedTest)\n\tmockedService.On(\"TheExampleMethod\", 1, 2, 3).Return(0, nil)\n\n\t// Test that on an expected call, the test was not failed\n\n\tmockedService.TheExampleMethod(1, 2, 3)\n\n\t// Assert that Errorf and FailNow were not called\n\tassert.Equal(t, 0, mockedTest.errorfCount)\n\tassert.Equal(t, 0, mockedTest.failNowCount)\n\n\t// Test that on unexpected call, the mocked test was called to fail the test\n\n\tassert.PanicsWithValue(t, mockTestingTFailNowCalled, func() {\n\t\tmockedService.TheExampleMethod(1, 1, 1)\n\t})\n\n\t// Assert that Errorf and FailNow were called once\n\tassert.Equal(t, 1, mockedTest.errorfCount)\n\tassert.Equal(t, 1, mockedTest.failNowCount)\n}\n\nfunc Test_Mock_On_WithPtrArgMatcher(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod3\",\n\t\tMatchedBy(func(a *ExampleType) bool { return a != nil && a.ran == true }),\n\t).Return(nil)\n\n\tmockedService.On(\"TheExampleMethod3\",\n\t\tMatchedBy(func(a *ExampleType) bool { return a != nil && a.ran == false }),\n\t).Return(errors.New(\"error\"))\n\n\tmockedService.On(\"TheExampleMethod3\",\n\t\tMatchedBy(func(a *ExampleType) bool { return a == nil }),\n\t).Return(errors.New(\"error2\"))\n\n\tassert.Equal(t, mockedService.TheExampleMethod3(&ExampleType{true}), nil)\n\tassert.EqualError(t, mockedService.TheExampleMethod3(&ExampleType{false}), \"error\")\n\tassert.EqualError(t, mockedService.TheExampleMethod3(nil), \"error2\")\n}\n\nfunc Test_Mock_On_WithFuncArgMatcher(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService TestExampleImplementation\n\n\tfixture1, fixture2 := errors.New(\"fixture1\"), errors.New(\"fixture2\")\n\n\tmockedService.On(\"TheExampleMethodFunc\",\n\t\tMatchedBy(func(a func(string) error) bool { return a != nil && a(\"string\") == fixture1 }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tmockedService.On(\"TheExampleMethodFunc\",\n\t\tMatchedBy(func(a func(string) error) bool { return a != nil && a(\"string\") == fixture2 }),\n\t).Return(errors.New(\"fixture2\"))\n\n\tmockedService.On(\"TheExampleMethodFunc\",\n\t\tMatchedBy(func(a func(string) error) bool { return a == nil }),\n\t).Return(errors.New(\"fixture3\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethodFunc(\n\t\tfunc(string) error { return fixture1 }), \"fixture1\")\n\tassert.EqualError(t, mockedService.TheExampleMethodFunc(\n\t\tfunc(string) error { return fixture2 }), \"fixture2\")\n\tassert.EqualError(t, mockedService.TheExampleMethodFunc(nil), \"fixture3\")\n}\n\nfunc Test_Mock_On_WithInterfaceArgMatcher(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod4\",\n\t\tMatchedBy(func(a ExampleInterface) bool { return a == nil }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethod4(nil), \"fixture1\")\n}\n\nfunc Test_Mock_On_WithChannelArgMatcher(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod5\",\n\t\tMatchedBy(func(ch chan struct{}) bool { return ch == nil }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethod5(nil), \"fixture1\")\n}\n\nfunc Test_Mock_On_WithMapArgMatcher(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod6\",\n\t\tMatchedBy(func(m map[string]bool) bool { return m == nil }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethod6(nil), \"fixture1\")\n}\n\nfunc Test_Mock_On_WithSliceArgMatcher(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod7\",\n\t\tMatchedBy(func(slice []bool) bool { return slice == nil }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethod7(nil), \"fixture1\")\n}\n\nfunc Test_Mock_On_WithVariadicFunc(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodVariadic\", []int{1, 2, 3}).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, []int{1, 2, 3}, c.Arguments[0])\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodVariadic(1, 2, 3)\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodVariadic(1, 2)\n\t})\n\n}\n\nfunc Test_Mock_On_WithMixedVariadicFunc(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodMixedVariadic\", 1, []int{2, 3, 4}).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 2, len(c.Arguments))\n\tassert.Equal(t, 1, c.Arguments[0])\n\tassert.Equal(t, []int{2, 3, 4}, c.Arguments[1])\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodMixedVariadic(1, 2, 3, 4)\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodMixedVariadic(1, 2, 3, 5)\n\t})\n\n}\n\nfunc Test_Mock_On_WithVariadicFuncWithInterface(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.On(\"TheExampleMethodVariadicInterface\", []interface{}{1, 2, 3}).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, []interface{}{1, 2, 3}, c.Arguments[0])\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodVariadicInterface(1, 2, 3)\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodVariadicInterface(1, 2)\n\t})\n\n}\n\nfunc Test_Mock_On_WithVariadicFuncWithEmptyInterfaceArray(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tvar expected []interface{}\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodVariadicInterface\", expected).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, expected, c.Arguments[0])\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodVariadicInterface()\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodVariadicInterface(1, 2)\n\t})\n\n}\n\nfunc Test_Mock_On_WithFuncPanics(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tassert.Panics(t, func() {\n\t\tmockedService.On(\"TheExampleMethodFunc\", func(string) error { return nil })\n\t})\n}\n\nfunc Test_Mock_On_WithFuncTypeArg(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodFuncType\", AnythingOfType(\"mock.ExampleFuncType\")).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, AnythingOfType(\"mock.ExampleFuncType\"), c.Arguments[0])\n\n\tfn := func(string) error { return nil }\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodFuncType(fn)\n\t})\n}\n\nfunc Test_Mock_Unset(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tcall := mockedService.\n\t\tOn(\"TheExampleMethodFuncType\", \"argA\").\n\t\tReturn(\"blah\")\n\n\tfound, foundCall := mockedService.findExpectedCall(\"TheExampleMethodFuncType\", \"argA\")\n\trequire.NotEqual(t, -1, found)\n\trequire.Equal(t, foundCall, call)\n\n\tcall.Unset()\n\n\tfound, foundCall = mockedService.findExpectedCall(\"TheExampleMethodFuncType\", \"argA\")\n\trequire.Equal(t, -1, found)\n\n\tvar expectedCall *Call\n\trequire.Equal(t, expectedCall, foundCall)\n\n\tfn := func(string) error { return nil }\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodFuncType(fn)\n\t})\n}\n\n// Since every time you call On it creates a new object\n// the last time you call Unset it will only unset the last call\nfunc Test_Mock_Chained_UnsetOnlyUnsetsLastCall(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\t// determine our current line number so we can assert the expected calls callerInfo properly\n\t_, filename, line, _ := runtime.Caller(0)\n\tmockedService.\n\t\tOn(\"TheExampleMethod1\", 1, 1).\n\t\tReturn(0).\n\t\tOn(\"TheExampleMethod2\", 2, 2).\n\t\tOn(\"TheExampleMethod3\", 3, 3, 3).\n\t\tReturn(nil).\n\t\tUnset()\n\n\texpectedCalls := []*Call{\n\t\t{\n\t\t\tParent:          &mockedService.Mock,\n\t\t\tMethod:          \"TheExampleMethod1\",\n\t\t\tArguments:       []interface{}{1, 1},\n\t\t\tReturnArguments: []interface{}{0},\n\t\t\tcallerInfo:      []string{fmt.Sprintf(\"%s:%d\", filename, line+2)},\n\t\t},\n\t\t{\n\t\t\tParent:          &mockedService.Mock,\n\t\t\tMethod:          \"TheExampleMethod2\",\n\t\t\tArguments:       []interface{}{2, 2},\n\t\t\tReturnArguments: []interface{}{},\n\t\t\tcallerInfo:      []string{fmt.Sprintf(\"%s:%d\", filename, line+4)},\n\t\t},\n\t}\n\tassert.Equal(t, 2, len(expectedCalls))\n\tassert.Equal(t, expectedCalls, mockedService.ExpectedCalls)\n}\n\nfunc Test_Mock_UnsetIfAlreadyUnsetFails(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmock1 := mockedService.\n\t\tOn(\"TheExampleMethod1\", 1, 1).\n\t\tReturn(1)\n\n\tassert.Equal(t, 1, len(mockedService.ExpectedCalls))\n\tmock1.Unset()\n\tassert.Equal(t, 0, len(mockedService.ExpectedCalls))\n\n\tassert.Panics(t, func() {\n\t\tmock1.Unset()\n\t})\n\n\tassert.Equal(t, 0, len(mockedService.ExpectedCalls))\n}\n\nfunc Test_Mock_UnsetByOnMethodSpec(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmock1 := mockedService.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(0, nil)\n\n\tassert.Equal(t, 1, len(mockedService.ExpectedCalls))\n\tmock1.On(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(0, nil).Unset()\n\n\tassert.Equal(t, 0, len(mockedService.ExpectedCalls))\n\n\tassert.Panics(t, func() {\n\t\tmock1.Unset()\n\t})\n\n\tassert.Equal(t, 0, len(mockedService.ExpectedCalls))\n}\n\nfunc Test_Mock_UnsetByOnMethodSpecAmongOthers(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\t_, filename, line, _ := runtime.Caller(0)\n\tmock1 := mockedService.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(0, nil).\n\t\tOn(\"TheExampleMethodVariadic\", 1, 2, 3, 4, 5).Once().\n\t\tReturn(nil)\n\tmock1.\n\t\tOn(\"TheExampleMethodFuncType\", Anything).\n\t\tReturn(nil)\n\n\tassert.Equal(t, 3, len(mockedService.ExpectedCalls))\n\tmock1.On(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(0, nil).Unset()\n\n\tassert.Equal(t, 2, len(mockedService.ExpectedCalls))\n\n\texpectedCalls := []*Call{\n\t\t{\n\t\t\tParent:          &mockedService.Mock,\n\t\t\tMethod:          \"TheExampleMethodVariadic\",\n\t\t\tRepeatability:   1,\n\t\t\tArguments:       []interface{}{1, 2, 3, 4, 5},\n\t\t\tReturnArguments: []interface{}{nil},\n\t\t\tcallerInfo:      []string{fmt.Sprintf(\"%s:%d\", filename, line+4)},\n\t\t},\n\t\t{\n\t\t\tParent:          &mockedService.Mock,\n\t\t\tMethod:          \"TheExampleMethodFuncType\",\n\t\t\tArguments:       []interface{}{Anything},\n\t\t\tReturnArguments: []interface{}{nil},\n\t\t\tcallerInfo:      []string{fmt.Sprintf(\"%s:%d\", filename, line+7)},\n\t\t},\n\t}\n\n\tassert.Equal(t, 2, len(mockedService.ExpectedCalls))\n\tassert.Equal(t, expectedCalls, mockedService.ExpectedCalls)\n}\n\nfunc Test_Mock_Unset_WithFuncPanics(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\tmock1 := mockedService.On(\"TheExampleMethod\", 1)\n\tmock1.Arguments = append(mock1.Arguments, func(string) error { return nil })\n\n\tassert.Panics(t, func() {\n\t\tmock1.Unset()\n\t})\n}\n\nfunc Test_Mock_Return(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.Nil(t, call.WaitFor)\n}\n\nfunc Test_Mock_Panic(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tPanic(\"panic message for example method\")\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.Equal(t, \"panic message for example method\", *call.PanicMsg)\n\tassert.Nil(t, call.WaitFor)\n}\n\nfunc Test_Mock_Return_WaitUntil(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\tch := time.After(time.Second)\n\n\tc := mockedService.Mock.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tWaitUntil(ch).\n\t\tReturn(1, \"two\", true)\n\n\t// assert that the call was created\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.Equal(t, ch, call.WaitFor)\n}\n\nfunc Test_Mock_Return_After(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.Mock.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true).\n\t\tAfter(time.Second)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.Mock.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.NotEqual(t, nil, call.WaitFor)\n\n}\n\nfunc Test_Mock_Return_Run(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tfn := func(args Arguments) {\n\t\targ := args.Get(0).(*ExampleType)\n\t\targ.ran = true\n\t}\n\n\tc := mockedService.Mock.\n\t\tOn(\"TheExampleMethod3\", AnythingOfType(\"*mock.ExampleType\")).\n\t\tReturn(nil).\n\t\tRun(fn)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.Mock.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod3\", call.Method)\n\tassert.Equal(t, AnythingOfType(\"*mock.ExampleType\"), call.Arguments[0])\n\tassert.Equal(t, nil, call.ReturnArguments[0])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.NotEqual(t, nil, call.WaitFor)\n\tassert.NotNil(t, call.Run)\n\n\tet := ExampleType{}\n\tassert.Equal(t, false, et.ran)\n\tmockedService.TheExampleMethod3(&et)\n\tassert.Equal(t, true, et.ran)\n}\n\nfunc Test_Mock_Return_Run_Out_Of_Order(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\tf := func(args Arguments) {\n\t\targ := args.Get(0).(*ExampleType)\n\t\targ.ran = true\n\t}\n\n\tc := mockedService.Mock.\n\t\tOn(\"TheExampleMethod3\", AnythingOfType(\"*mock.ExampleType\")).\n\t\tRun(f).\n\t\tReturn(nil)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.Mock.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod3\", call.Method)\n\tassert.Equal(t, AnythingOfType(\"*mock.ExampleType\"), call.Arguments[0])\n\tassert.Equal(t, nil, call.ReturnArguments[0])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.NotEqual(t, nil, call.WaitFor)\n\tassert.NotNil(t, call.Run)\n}\n\nfunc Test_Mock_Return_Once(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.On(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true).\n\t\tOnce()\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 1, call.Repeatability)\n\tassert.Nil(t, call.WaitFor)\n}\n\nfunc Test_Mock_Return_Twice(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true).\n\t\tTwice()\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 2, call.Repeatability)\n\tassert.Nil(t, call.WaitFor)\n}\n\nfunc Test_Mock_Return_Times(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true).\n\t\tTimes(5)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 5, call.Repeatability)\n\tassert.Nil(t, call.WaitFor)\n}\n\nfunc Test_Mock_Return_Nothing(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn()\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 0, len(call.ReturnArguments))\n}\n\nfunc Test_Mock_Return_NotBefore_In_Order(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tb := mockedService.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(4, nil)\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod2\", true).\n\t\tReturn().\n\t\tNotBefore(b)\n\n\trequire.Equal(t, []*Call{b, c}, mockedService.ExpectedCalls)\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 3)\n\t})\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod2(true)\n\t})\n}\n\nfunc Test_Mock_Return_InOrder_Uses_NotBefore(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tInOrder(\n\t\tmockedService.\n\t\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\t\tReturn(4, nil),\n\t\tmockedService.\n\t\t\tOn(\"TheExampleMethod2\", true).\n\t\t\tReturn(),\n\t)\n\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 3)\n\t})\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod2(true)\n\t})\n}\n\nfunc Test_Mock_Return_NotBefore_Out_Of_Order(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tb := mockedService.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(4, nil).Twice()\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod2\", true).\n\t\tReturn().\n\t\tNotBefore(b)\n\n\trequire.Equal(t, []*Call{b, c}, mockedService.ExpectedCalls)\n\n\texpectedPanicString := `mock: Unexpected Method Call\n-----------------------------\n\nTheExampleMethod2(bool)\n\t\t0: true\n\nMust not be called before:\n\nTheExampleMethod(int,int,int)\n\t\t0: 1\n\t\t1: 2\n\t\t2: 3`\n\trequire.PanicsWithValue(t, expectedPanicString, func() {\n\t\tmockedService.TheExampleMethod2(true)\n\t})\n}\n\nfunc Test_Mock_Return_InOrder_Uses_NotBefore_Out_Of_Order(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tInOrder(\n\t\tmockedService.\n\t\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\t\tReturn(4, nil).Twice(),\n\t\tmockedService.\n\t\t\tOn(\"TheExampleMethod2\", true).\n\t\t\tReturn(),\n\t)\n\n\texpectedPanicString := `mock: Unexpected Method Call\n-----------------------------\n\nTheExampleMethod2(bool)\n\t\t0: true\n\nMust not be called before:\n\nTheExampleMethod(int,int,int)\n\t\t0: 1\n\t\t1: 2\n\t\t2: 3`\n\trequire.PanicsWithValue(t, expectedPanicString, func() {\n\t\tmockedService.TheExampleMethod2(true)\n\t})\n}\n\nfunc Test_Mock_Return_NotBefore_Not_Enough_Times(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tb := mockedService.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(4, nil).Twice()\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod2\", true).\n\t\tReturn().\n\t\tNotBefore(b)\n\n\trequire.Equal(t, []*Call{b, c}, mockedService.ExpectedCalls)\n\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 3)\n\t})\n\texpectedPanicString := `mock: Unexpected Method Call\n-----------------------------\n\nTheExampleMethod2(bool)\n\t\t0: true\n\nMust not be called before another call of:\n\nTheExampleMethod(int,int,int)\n\t\t0: 1\n\t\t1: 2\n\t\t2: 3`\n\trequire.PanicsWithValue(t, expectedPanicString, func() {\n\t\tmockedService.TheExampleMethod2(true)\n\t})\n}\n\nfunc Test_Mock_Return_NotBefore_Different_Mock_In_Order(t *testing.T) {\n\tt.Parallel()\n\n\tvar (\n\t\tmockedService1 = new(TestExampleImplementation)\n\t\tmockedService2 = new(TestExampleImplementation)\n\t)\n\n\tb := mockedService1.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(4, nil)\n\tc := mockedService2.\n\t\tOn(\"TheExampleMethod2\", true).\n\t\tReturn().\n\t\tNotBefore(b)\n\n\trequire.Equal(t, []*Call{c}, mockedService2.ExpectedCalls)\n\trequire.NotPanics(t, func() {\n\t\tmockedService1.TheExampleMethod(1, 2, 3)\n\t})\n\trequire.NotPanics(t, func() {\n\t\tmockedService2.TheExampleMethod2(true)\n\t})\n}\n\nfunc Test_Mock_Return_NotBefore_Different_Mock_Out_Of_Order(t *testing.T) {\n\tt.Parallel()\n\n\tvar (\n\t\tmockedService1 = new(TestExampleImplementation)\n\t\tmockedService2 = new(TestExampleImplementation)\n\t)\n\n\tb := mockedService1.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(4, nil)\n\tc := mockedService2.\n\t\tOn(\"TheExampleMethod2\", true).\n\t\tReturn().\n\t\tNotBefore(b)\n\n\trequire.Equal(t, []*Call{c}, mockedService2.ExpectedCalls)\n\n\texpectedPanicString := `mock: Unexpected Method Call\n-----------------------------\n\nTheExampleMethod2(bool)\n\t\t0: true\n\nMust not be called before method from another mock instance:\n\nTheExampleMethod(int,int,int)\n\t\t0: 1\n\t\t1: 2\n\t\t2: 3`\n\trequire.PanicsWithValue(t, expectedPanicString, func() {\n\t\tmockedService2.TheExampleMethod2(true)\n\t})\n}\n\nfunc Test_Mock_Return_NotBefore_In_Order_With_Non_Dependant(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\ta := mockedService.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(4, nil)\n\tb := mockedService.\n\t\tOn(\"TheExampleMethod\", 4, 5, 6).\n\t\tReturn(4, nil)\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod2\", true).\n\t\tReturn().\n\t\tNotBefore(a, b)\n\td := mockedService.\n\t\tOn(\"TheExampleMethod7\", []bool{}).Return(nil)\n\n\trequire.Equal(t, []*Call{a, b, c, d}, mockedService.ExpectedCalls)\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod7([]bool{})\n\t})\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 3)\n\t})\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod7([]bool{})\n\t})\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod(4, 5, 6)\n\t})\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod7([]bool{})\n\t})\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod2(true)\n\t})\n\trequire.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod7([]bool{})\n\t})\n}\n\nfunc Test_Mock_Return_NotBefore_Orphan_Call(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\trequire.PanicsWithValue(t, \"not before calls must be created with Mock.On()\", func() {\n\t\tmockedService.\n\t\t\tOn(\"TheExampleMethod2\", true).\n\t\t\tReturn().\n\t\t\tNotBefore(&Call{Method: \"Not\", Arguments: Arguments{\"how\", \"it's\"}, ReturnArguments: Arguments{\"done\"}})\n\t})\n}\n\nfunc Test_Mock_findExpectedCall(t *testing.T) {\n\tt.Parallel()\n\n\tm := new(Mock)\n\tm.On(\"One\", 1).Return(\"one\")\n\tm.On(\"Two\", 2).Return(\"two\")\n\tm.On(\"Two\", 3).Return(\"three\")\n\n\tf, c := m.findExpectedCall(\"Two\", 3)\n\n\tif assert.Equal(t, 2, f) {\n\t\tif assert.NotNil(t, c) {\n\t\t\tassert.Equal(t, \"Two\", c.Method)\n\t\t\tassert.Equal(t, 3, c.Arguments[0])\n\t\t\tassert.Equal(t, \"three\", c.ReturnArguments[0])\n\t\t}\n\t}\n\n}\n\nfunc Test_Mock_findExpectedCall_For_Unknown_Method(t *testing.T) {\n\tt.Parallel()\n\n\tm := new(Mock)\n\tm.On(\"One\", 1).Return(\"one\")\n\tm.On(\"Two\", 2).Return(\"two\")\n\tm.On(\"Two\", 3).Return(\"three\")\n\n\tf, _ := m.findExpectedCall(\"Two\")\n\n\tassert.Equal(t, -1, f)\n\n}\n\nfunc Test_Mock_findExpectedCall_Respects_Repeatability(t *testing.T) {\n\tt.Parallel()\n\n\tm := new(Mock)\n\tm.On(\"One\", 1).Return(\"one\")\n\tm.On(\"Two\", 2).Return(\"two\").Once()\n\tm.On(\"Two\", 3).Return(\"three\").Twice()\n\tm.On(\"Two\", 3).Return(\"three\").Times(8)\n\n\tf, c := m.findExpectedCall(\"Two\", 3)\n\n\tif assert.Equal(t, 2, f) {\n\t\tif assert.NotNil(t, c) {\n\t\t\tassert.Equal(t, \"Two\", c.Method)\n\t\t\tassert.Equal(t, 3, c.Arguments[0])\n\t\t\tassert.Equal(t, \"three\", c.ReturnArguments[0])\n\t\t}\n\t}\n\n\tc = m.On(\"Once\", 1).Return(\"one\").Once()\n\tc.Repeatability = -1\n\tf, c = m.findExpectedCall(\"Once\", 1)\n\tif assert.Equal(t, -1, f) {\n\t\tif assert.NotNil(t, c) {\n\t\t\tassert.Equal(t, \"Once\", c.Method)\n\t\t\tassert.Equal(t, 1, c.Arguments[0])\n\t\t\tassert.Equal(t, \"one\", c.ReturnArguments[0])\n\t\t}\n\t}\n}\n\nfunc Test_callString(t *testing.T) {\n\tt.Parallel()\n\n\tassert.Equal(t, `Method(int,bool,string)`, callString(\"Method\", []interface{}{1, true, \"something\"}, false))\n\tassert.Equal(t, `Method(<nil>)`, callString(\"Method\", []interface{}{nil}, false))\n\n}\n\nfunc Test_Mock_Called(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_Called\", 1, 2, 3).Return(5, \"6\", true)\n\n\treturnArguments := mockedService.Called(1, 2, 3)\n\n\tif assert.Equal(t, 1, len(mockedService.Calls)) {\n\t\tassert.Equal(t, \"Test_Mock_Called\", mockedService.Calls[0].Method)\n\t\tassert.Equal(t, 1, mockedService.Calls[0].Arguments[0])\n\t\tassert.Equal(t, 2, mockedService.Calls[0].Arguments[1])\n\t\tassert.Equal(t, 3, mockedService.Calls[0].Arguments[2])\n\t}\n\n\tif assert.Equal(t, 3, len(returnArguments)) {\n\t\tassert.Equal(t, 5, returnArguments[0])\n\t\tassert.Equal(t, \"6\", returnArguments[1])\n\t\tassert.Equal(t, true, returnArguments[2])\n\t}\n\n}\n\nfunc asyncCall(m *Mock, ch chan Arguments) {\n\tch <- m.Called(1, 2, 3)\n}\n\nfunc Test_Mock_Called_blocks(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.Mock.On(\"asyncCall\", 1, 2, 3).Return(5, \"6\", true).After(20 * time.Millisecond)\n\n\tch := make(chan Arguments)\n\n\tgo asyncCall(&mockedService.Mock, ch)\n\n\tselect {\n\tcase <-ch:\n\t\tt.Fatal(\"should have waited\")\n\tcase <-time.After(10 * time.Millisecond):\n\t}\n\n\treturnArguments := <-ch\n\n\tif assert.Equal(t, 1, len(mockedService.Mock.Calls)) {\n\t\tassert.Equal(t, \"asyncCall\", mockedService.Mock.Calls[0].Method)\n\t\tassert.Equal(t, 1, mockedService.Mock.Calls[0].Arguments[0])\n\t\tassert.Equal(t, 2, mockedService.Mock.Calls[0].Arguments[1])\n\t\tassert.Equal(t, 3, mockedService.Mock.Calls[0].Arguments[2])\n\t}\n\n\tif assert.Equal(t, 3, len(returnArguments)) {\n\t\tassert.Equal(t, 5, returnArguments[0])\n\t\tassert.Equal(t, \"6\", returnArguments[1])\n\t\tassert.Equal(t, true, returnArguments[2])\n\t}\n\n}\n\nfunc Test_Mock_Called_For_Bounded_Repeatability(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.\n\t\tOn(\"Test_Mock_Called_For_Bounded_Repeatability\", 1, 2, 3).\n\t\tReturn(5, \"6\", true).\n\t\tOnce()\n\tmockedService.\n\t\tOn(\"Test_Mock_Called_For_Bounded_Repeatability\", 1, 2, 3).\n\t\tReturn(-1, \"hi\", false)\n\n\treturnArguments1 := mockedService.Called(1, 2, 3)\n\treturnArguments2 := mockedService.Called(1, 2, 3)\n\n\tif assert.Equal(t, 2, len(mockedService.Calls)) {\n\t\tassert.Equal(t, \"Test_Mock_Called_For_Bounded_Repeatability\", mockedService.Calls[0].Method)\n\t\tassert.Equal(t, 1, mockedService.Calls[0].Arguments[0])\n\t\tassert.Equal(t, 2, mockedService.Calls[0].Arguments[1])\n\t\tassert.Equal(t, 3, mockedService.Calls[0].Arguments[2])\n\n\t\tassert.Equal(t, \"Test_Mock_Called_For_Bounded_Repeatability\", mockedService.Calls[1].Method)\n\t\tassert.Equal(t, 1, mockedService.Calls[1].Arguments[0])\n\t\tassert.Equal(t, 2, mockedService.Calls[1].Arguments[1])\n\t\tassert.Equal(t, 3, mockedService.Calls[1].Arguments[2])\n\t}\n\n\tif assert.Equal(t, 3, len(returnArguments1)) {\n\t\tassert.Equal(t, 5, returnArguments1[0])\n\t\tassert.Equal(t, \"6\", returnArguments1[1])\n\t\tassert.Equal(t, true, returnArguments1[2])\n\t}\n\n\tif assert.Equal(t, 3, len(returnArguments2)) {\n\t\tassert.Equal(t, -1, returnArguments2[0])\n\t\tassert.Equal(t, \"hi\", returnArguments2[1])\n\t\tassert.Equal(t, false, returnArguments2[2])\n\t}\n\n}\n\nfunc Test_Mock_Called_For_SetTime_Expectation(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"TheExampleMethod\", 1, 2, 3).Return(5, \"6\", true).Times(4)\n\n\tmockedService.TheExampleMethod(1, 2, 3)\n\tmockedService.TheExampleMethod(1, 2, 3)\n\tmockedService.TheExampleMethod(1, 2, 3)\n\tmockedService.TheExampleMethod(1, 2, 3)\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 3)\n\t})\n\n}\n\nfunc Test_Mock_Called_Unexpected(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\t// make sure it panics if no expectation was made\n\tassert.Panics(t, func() {\n\t\tmockedService.Called(1, 2, 3)\n\t}, \"Calling unexpected method should panic\")\n\n}\n\nfunc Test_AssertExpectationsForObjects_Helper(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService1 = new(TestExampleImplementation)\n\tvar mockedService2 = new(TestExampleImplementation)\n\tvar mockedService3 = new(TestExampleImplementation)\n\tvar mockedService4 = new(TestExampleImplementation) // No expectations does not cause a panic\n\n\tmockedService1.On(\"Test_AssertExpectationsForObjects_Helper\", 1).Return()\n\tmockedService2.On(\"Test_AssertExpectationsForObjects_Helper\", 2).Return()\n\tmockedService3.On(\"Test_AssertExpectationsForObjects_Helper\", 3).Return()\n\n\tmockedService1.Called(1)\n\tmockedService2.Called(2)\n\tmockedService3.Called(3)\n\n\tassert.True(t, AssertExpectationsForObjects(t, &mockedService1.Mock, &mockedService2.Mock, &mockedService3.Mock, &mockedService4.Mock))\n\tassert.True(t, AssertExpectationsForObjects(t, mockedService1, mockedService2, mockedService3, mockedService4))\n\n}\n\nfunc Test_AssertExpectationsForObjects_Helper_Failed(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService1 = new(TestExampleImplementation)\n\tvar mockedService2 = new(TestExampleImplementation)\n\tvar mockedService3 = new(TestExampleImplementation)\n\n\tmockedService1.On(\"Test_AssertExpectationsForObjects_Helper_Failed\", 1).Return()\n\tmockedService2.On(\"Test_AssertExpectationsForObjects_Helper_Failed\", 2).Return()\n\tmockedService3.On(\"Test_AssertExpectationsForObjects_Helper_Failed\", 3).Return()\n\n\tmockedService1.Called(1)\n\tmockedService3.Called(3)\n\n\ttt := new(testing.T)\n\tassert.False(t, AssertExpectationsForObjects(tt, &mockedService1.Mock, &mockedService2.Mock, &mockedService3.Mock))\n\tassert.False(t, AssertExpectationsForObjects(tt, mockedService1, mockedService2, mockedService3))\n\n}\n\nfunc Test_Mock_AssertExpectations(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations\", 1, 2, 3).Return(5, 6, 7)\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.Called(1, 2, 3)\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectations_Placeholder_NoArgs(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations_Placeholder_NoArgs\").Return(5, 6, 7).Once()\n\tmockedService.On(\"Test_Mock_AssertExpectations_Placeholder_NoArgs\").Return(7, 6, 5)\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.Called()\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectations_Placeholder(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations_Placeholder\", 1, 2, 3).Return(5, 6, 7).Once()\n\tmockedService.On(\"Test_Mock_AssertExpectations_Placeholder\", 3, 2, 1).Return(7, 6, 5)\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.Called(1, 2, 3)\n\n\t// now assert expectations\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make call to the second expectation\n\tmockedService.Called(3, 2, 1)\n\n\t// now assert expectations again\n\tassert.True(t, mockedService.AssertExpectations(tt))\n}\n\nfunc Test_Mock_AssertExpectations_With_Pointers(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations_With_Pointers\", &struct{ Foo int }{1}).Return(1)\n\tmockedService.On(\"Test_Mock_AssertExpectations_With_Pointers\", &struct{ Foo int }{2}).Return(2)\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\ts := struct{ Foo int }{1}\n\t// make the calls now\n\tmockedService.Called(&s)\n\ts.Foo = 2\n\tmockedService.Called(&s)\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectationsCustomType(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"TheExampleMethod3\", AnythingOfType(\"*mock.ExampleType\")).Return(nil).Once()\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.TheExampleMethod3(&ExampleType{})\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectationsFunctionalOptionsType(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"TheExampleMethodFunctionalOptions\", \"test\", FunctionalOptions(OpNum(1), OpStr(\"foo\"))).Return(nil).Once()\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.TheExampleMethodFunctionalOptions(\"test\", OpNum(1), OpStr(\"foo\"))\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectationsFunctionalOptionsType_Empty(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"TheExampleMethodFunctionalOptions\", \"test\", FunctionalOptions()).Return(nil).Once()\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.TheExampleMethodFunctionalOptions(\"test\")\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectationsFunctionalOptionsType_Indirectly(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"TheExampleMethodFunctionalOptions\", \"test\", FunctionalOptions(OpNum(1), OpStr(\"foo\"))).Return(nil).Once()\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tTheExampleMethodFunctionalOptionsIndirect(mockedService)\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectationsFunctionalOptionsType_Diff_Func(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"TheExampleMethodFunctionalOptions\", \"test\", FunctionalOptions(OpStr(\"this\"))).Return(nil).Once()\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodFunctionalOptions(\"test\", OpBytes([]byte(\"this\")))\n\t})\n}\n\nfunc Test_Mock_AssertExpectationsFunctionalOptionsType_Diff_Arg(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"TheExampleMethodFunctionalOptions\", \"test\", FunctionalOptions(OpStr(\"this\"))).Return(nil).Once()\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodFunctionalOptions(\"test\", OpStr(\"that\"))\n\t})\n}\n\nfunc Test_Mock_AssertExpectations_With_Repeatability(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations_With_Repeatability\", 1, 2, 3).Return(5, 6, 7).Twice()\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.Called(1, 2, 3)\n\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\tmockedService.Called(1, 2, 3)\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectations_Skipped_Test(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations_Skipped_Test\", 1, 2, 3).Return(5, 6, 7)\n\tdefer mockedService.AssertExpectations(t)\n\n\tt.Skip(\"skipping test to ensure AssertExpectations does not fail\")\n}\n\nfunc Test_Mock_TwoCallsWithDifferentArguments(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_TwoCallsWithDifferentArguments\", 1, 2, 3).Return(5, 6, 7)\n\tmockedService.On(\"Test_Mock_TwoCallsWithDifferentArguments\", 4, 5, 6).Return(5, 6, 7)\n\n\targs1 := mockedService.Called(1, 2, 3)\n\tassert.Equal(t, 5, args1.Int(0))\n\tassert.Equal(t, 6, args1.Int(1))\n\tassert.Equal(t, 7, args1.Int(2))\n\n\targs2 := mockedService.Called(4, 5, 6)\n\tassert.Equal(t, 5, args2.Int(0))\n\tassert.Equal(t, 6, args2.Int(1))\n\tassert.Equal(t, 7, args2.Int(2))\n\n}\n\nfunc Test_Mock_AssertNumberOfCalls(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertNumberOfCalls\", 1, 2, 3).Return(5, 6, 7)\n\n\tmockedService.Called(1, 2, 3)\n\tassert.True(t, mockedService.AssertNumberOfCalls(t, \"Test_Mock_AssertNumberOfCalls\", 1))\n\n\tmockedService.Called(1, 2, 3)\n\tassert.True(t, mockedService.AssertNumberOfCalls(t, \"Test_Mock_AssertNumberOfCalls\", 2))\n\n}\n\nfunc Test_Mock_AssertCalled(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertCalled\", 1, 2, 3).Return(5, 6, 7)\n\n\tmockedService.Called(1, 2, 3)\n\n\tassert.True(t, mockedService.AssertCalled(t, \"Test_Mock_AssertCalled\", 1, 2, 3))\n\n}\n\nfunc Test_Mock_AssertCalled_WithAnythingOfTypeArgument(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.\n\t\tOn(\"Test_Mock_AssertCalled_WithAnythingOfTypeArgument\", Anything, Anything, Anything).\n\t\tReturn()\n\n\tmockedService.Called(1, \"two\", []uint8(\"three\"))\n\n\tassert.True(t, mockedService.AssertCalled(t, \"Test_Mock_AssertCalled_WithAnythingOfTypeArgument\", AnythingOfType(\"int\"), AnythingOfType(\"string\"), AnythingOfType(\"[]uint8\")))\n\n}\n\nfunc Test_Mock_AssertCalled_WithArguments(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertCalled_WithArguments\", 1, 2, 3).Return(5, 6, 7)\n\n\tmockedService.Called(1, 2, 3)\n\n\ttt := new(testing.T)\n\tassert.True(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments\", 1, 2, 3))\n\tassert.False(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments\", 2, 3, 4))\n\n}\n\nfunc Test_Mock_AssertCalled_WithArguments_With_Repeatability(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 1, 2, 3).Return(5, 6, 7).Once()\n\tmockedService.On(\"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 2, 3, 4).Return(5, 6, 7).Once()\n\n\tmockedService.Called(1, 2, 3)\n\tmockedService.Called(2, 3, 4)\n\n\ttt := new(testing.T)\n\tassert.True(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 1, 2, 3))\n\tassert.True(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 2, 3, 4))\n\tassert.False(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 3, 4, 5))\n\n}\n\nfunc Test_Mock_AssertNotCalled(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertNotCalled\", 1, 2, 3).Return(5, 6, 7)\n\n\tmockedService.Called(1, 2, 3)\n\n\tassert.True(t, mockedService.AssertNotCalled(t, \"Test_Mock_NotCalled\"))\n\n}\n\nfunc Test_Mock_IsMethodCallable(t *testing.T) {\n\tt.Parallel()\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\targ := []Call{{Repeatability: 1}, {Repeatability: 2}}\n\targ2 := []Call{{Repeatability: 1}, {Repeatability: 1}}\n\targ3 := []Call{{Repeatability: 1}, {Repeatability: 1}}\n\n\tmockedService.On(\"Test_Mock_IsMethodCallable\", arg2).Return(true).Twice()\n\n\tassert.False(t, mockedService.IsMethodCallable(t, \"Test_Mock_IsMethodCallable\", arg))\n\tassert.True(t, mockedService.IsMethodCallable(t, \"Test_Mock_IsMethodCallable\", arg2))\n\tassert.True(t, mockedService.IsMethodCallable(t, \"Test_Mock_IsMethodCallable\", arg3))\n\n\tmockedService.MethodCalled(\"Test_Mock_IsMethodCallable\", arg2)\n\tmockedService.MethodCalled(\"Test_Mock_IsMethodCallable\", arg2)\n\n\tassert.False(t, mockedService.IsMethodCallable(t, \"Test_Mock_IsMethodCallable\", arg2))\n}\n\nfunc TestIsArgsEqual(t *testing.T) {\n\tt.Parallel()\n\n\tvar expected = Arguments{5, 3, 4, 6, 7, 2}\n\n\t// Copy elements 1 to 5\n\targs := append(([]interface{})(nil), expected[1:]...)\n\targs[2] = expected[1]\n\tassert.False(t, isArgsEqual(expected, args))\n\n\t// Clone\n\tarr := append(([]interface{})(nil), expected...)\n\tassert.True(t, isArgsEqual(expected, arr))\n}\n\nfunc Test_Mock_AssertOptional(t *testing.T) {\n\tt.Parallel()\n\n\t// Optional called\n\tvar ms1 = new(TestExampleImplementation)\n\tms1.On(\"TheExampleMethod\", 1, 2, 3).Maybe().Return(4, nil)\n\tms1.TheExampleMethod(1, 2, 3)\n\n\ttt1 := new(testing.T)\n\tassert.Equal(t, true, ms1.AssertExpectations(tt1))\n\n\t// Optional not called\n\tvar ms2 = new(TestExampleImplementation)\n\tms2.On(\"TheExampleMethod\", 1, 2, 3).Maybe().Return(4, nil)\n\n\ttt2 := new(testing.T)\n\tassert.Equal(t, true, ms2.AssertExpectations(tt2))\n\n\t// Non-optional called\n\tvar ms3 = new(TestExampleImplementation)\n\tms3.On(\"TheExampleMethod\", 1, 2, 3).Return(4, nil)\n\tms3.TheExampleMethod(1, 2, 3)\n\n\ttt3 := new(testing.T)\n\tassert.Equal(t, true, ms3.AssertExpectations(tt3))\n}\n\n/*\nArguments helper methods\n*/\nfunc Test_Arguments_Get(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, \"string\", args.Get(0).(string))\n\tassert.Equal(t, 123, args.Get(1).(int))\n\tassert.Equal(t, true, args.Get(2).(bool))\n\n}\n\nfunc Test_Arguments_Is(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\n\tassert.True(t, args.Is(\"string\", 123, true))\n\tassert.False(t, args.Is(\"wrong\", 456, false))\n\n}\n\nfunc Test_Arguments_Diff(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"Hello World\", 123, true})\n\tvar diff string\n\tvar count int\n\tdiff, count = args.Diff([]interface{}{\"Hello World\", 456, \"false\"})\n\n\tassert.Equal(t, 2, count)\n\tassert.Contains(t, diff, `(int=456) != (int=123)`)\n\tassert.Contains(t, diff, `(string=false) != (bool=true)`)\n\n}\n\nfunc Test_Arguments_Diff_DifferentNumberOfArgs(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tvar diff string\n\tvar count int\n\tdiff, count = args.Diff([]interface{}{\"string\", 456, \"false\", \"extra\"})\n\n\tassert.Equal(t, 3, count)\n\tassert.Contains(t, diff, `(string=extra) != (Missing)`)\n\n}\n\nfunc Test_Arguments_Diff_WithAnythingArgument(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tvar count int\n\t_, count = args.Diff([]interface{}{\"string\", Anything, true})\n\n\tassert.Equal(t, 0, count)\n\n}\n\nfunc Test_Arguments_Diff_WithAnythingArgument_InActualToo(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", Anything, true})\n\tvar count int\n\t_, count = args.Diff([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, 0, count)\n\n}\n\nfunc Test_Arguments_Diff_WithAnythingOfTypeArgument(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", AnythingOfType(\"int\"), true})\n\tvar count int\n\t_, count = args.Diff([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, 0, count)\n\n}\n\nfunc Test_Arguments_Diff_WithAnythingOfTypeArgument_Failing(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", AnythingOfType(\"string\"), true})\n\tvar count int\n\tvar diff string\n\tdiff, count = args.Diff([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, 1, count)\n\tassert.Contains(t, diff, `string != type int - (int=123)`)\n\n}\n\nfunc Test_Arguments_Diff_WithIsTypeArgument(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", IsType(0), true})\n\tvar count int\n\t_, count = args.Diff([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, 0, count)\n}\n\nfunc Test_Arguments_Diff_WithIsTypeArgument_Failing(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", IsType(\"\"), true})\n\tvar count int\n\tvar diff string\n\tdiff, count = args.Diff([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, 1, count)\n\tassert.Contains(t, diff, `string != type int - (int=123)`)\n}\n\nfunc Test_Arguments_Diff_WithIsTypeArgument_InterfaceType(t *testing.T) {\n\tt.Parallel()\n\tvar ctx = context.Background()\n\targs := Arguments([]interface{}{IsType(ctx)})\n\t_, count := args.Diff([]interface{}{context.Background()})\n\tassert.Equal(t, 0, count)\n}\n\nfunc Test_Arguments_Diff_WithIsTypeArgument_InterfaceType_Failing(t *testing.T) {\n\tt.Parallel()\n\n\tvar ctx context.Context\n\tvar args = Arguments([]interface{}{IsType(ctx)})\n\tdiff, count := args.Diff([]interface{}{context.Background()})\n\tassert.Equal(t, 1, count)\n\tassert.Contains(t, diff, `type <nil> != type `)\n\n}\n\nfunc Test_Arguments_Diff_WithArgMatcher(t *testing.T) {\n\tt.Parallel()\n\n\tmatchFn := func(a int) bool {\n\t\treturn a == 123\n\t}\n\tvar args = Arguments([]interface{}{\"string\", MatchedBy(matchFn), true})\n\n\tdiff, count := args.Diff([]interface{}{\"string\", 124, true})\n\tassert.Equal(t, 1, count)\n\tassert.Contains(t, diff, `(int=124) not matched by func(int) bool`)\n\n\tdiff, count = args.Diff([]interface{}{\"string\", false, true})\n\tassert.Equal(t, 1, count)\n\tassert.Contains(t, diff, `(bool=false) not matched by func(int) bool`)\n\n\tdiff, count = args.Diff([]interface{}{\"string\", 123, false})\n\tassert.Equal(t, 1, count)\n\tassert.Contains(t, diff, `(int=123) matched by func(int) bool`)\n\n\tdiff, count = args.Diff([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, 0, count)\n\tassert.Contains(t, diff, `No differences.`)\n}\n\nfunc Test_Arguments_Assert(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\n\tassert.True(t, args.Assert(t, \"string\", 123, true))\n\n}\n\nfunc Test_Arguments_String_Representation(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, `string,int,bool`, args.String())\n\n}\n\nfunc Test_Arguments_String(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, \"string\", args.String(0))\n\n}\n\nfunc Test_Arguments_Error(t *testing.T) {\n\tt.Parallel()\n\n\tvar err = errors.New(\"An Error\")\n\tvar args = Arguments([]interface{}{\"string\", 123, true, err})\n\tassert.Equal(t, err, args.Error(3))\n\n}\n\nfunc Test_Arguments_Error_Nil(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true, nil})\n\tassert.Equal(t, nil, args.Error(3))\n\n}\n\nfunc Test_Arguments_Int(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, 123, args.Int(1))\n\n}\n\nfunc Test_Arguments_Bool(t *testing.T) {\n\tt.Parallel()\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, true, args.Bool(2))\n\n}\n\nfunc Test_WaitUntil_Parallel(t *testing.T) {\n\tt.Parallel()\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tch1 := make(chan time.Time)\n\tch2 := make(chan time.Time)\n\n\tmockedService.Mock.On(\"TheExampleMethod2\", true).Return().WaitUntil(ch2).Run(func(args Arguments) {\n\t\tch1 <- time.Now()\n\t})\n\n\tmockedService.Mock.On(\"TheExampleMethod2\", false).Return().WaitUntil(ch1)\n\n\t// Lock both goroutines on the .WaitUntil method\n\tgo func() {\n\t\tmockedService.TheExampleMethod2(false)\n\t}()\n\tgo func() {\n\t\tmockedService.TheExampleMethod2(true)\n\t}()\n\n\t// Allow the first call to execute, so the second one executes afterwards\n\tch2 <- time.Now()\n}\n\nfunc Test_MockMethodCalled(t *testing.T) {\n\tt.Parallel()\n\n\tm := new(Mock)\n\tm.On(\"foo\", \"hello\").Return(\"world\")\n\n\tretArgs := m.MethodCalled(\"foo\", \"hello\")\n\trequire.True(t, len(retArgs) == 1)\n\trequire.Equal(t, \"world\", retArgs[0])\n\tm.AssertExpectations(t)\n}\n\nfunc Test_MockMethodCalled_Panic(t *testing.T) {\n\tt.Parallel()\n\n\tm := new(Mock)\n\tm.On(\"foo\", \"hello\").Panic(\"world panics\")\n\n\trequire.PanicsWithValue(t, \"world panics\", func() { m.MethodCalled(\"foo\", \"hello\") })\n\tm.AssertExpectations(t)\n}\n\n// Test to validate fix for racy concurrent call access in MethodCalled()\nfunc Test_MockReturnAndCalledConcurrent(t *testing.T) {\n\tt.Parallel()\n\n\titerations := 1000\n\tm := &Mock{}\n\tcall := m.On(\"ConcurrencyTestMethod\")\n\n\twg := sync.WaitGroup{}\n\twg.Add(2)\n\n\tgo func() {\n\t\tfor i := 0; i < iterations; i++ {\n\t\t\tcall.Return(10)\n\t\t}\n\t\twg.Done()\n\t}()\n\tgo func() {\n\t\tfor i := 0; i < iterations; i++ {\n\t\t\tConcurrencyTestMethod(m)\n\t\t}\n\t\twg.Done()\n\t}()\n\twg.Wait()\n}\n\ntype timer struct{ Mock }\n\nfunc (s *timer) GetTime(i int) string {\n\treturn s.Called(i).Get(0).(string)\n}\n\nfunc (s *timer) GetTimes(times []int) string {\n\treturn s.Called(times).Get(0).(string)\n}\n\ntype tCustomLogger struct {\n\t*testing.T\n\tlogs []string\n\terrs []string\n}\n\nfunc (tc *tCustomLogger) Logf(format string, args ...interface{}) {\n\ttc.T.Logf(format, args...)\n\ttc.logs = append(tc.logs, fmt.Sprintf(format, args...))\n}\n\nfunc (tc *tCustomLogger) Errorf(format string, args ...interface{}) {\n\ttc.errs = append(tc.errs, fmt.Sprintf(format, args...))\n}\n\nfunc (tc *tCustomLogger) FailNow() {}\n\nfunc TestLoggingAssertExpectations(t *testing.T) {\n\tt.Parallel()\n\n\tm := new(timer)\n\tm.On(\"GetTime\", 0).Return(\"\")\n\ttcl := &tCustomLogger{t, []string{}, []string{}}\n\n\tAssertExpectationsForObjects(tcl, m, new(TestExampleImplementation))\n\n\trequire.Equal(t, 1, len(tcl.errs))\n\tassert.Regexp(t, regexp.MustCompile(\"(?s)FAIL: 0 out of 1 expectation\\\\(s\\\\) were met.*The code you are testing needs to make 1 more call\\\\(s\\\\).*\"), tcl.errs[0])\n\trequire.Equal(t, 2, len(tcl.logs))\n\tassert.Regexp(t, regexp.MustCompile(\"(?s)FAIL:\\tGetTime\\\\(int\\\\).*\"), tcl.logs[0])\n\trequire.Equal(t, \"Expectations didn't match for Mock: *mock.timer\", tcl.logs[1])\n}\n\nfunc TestAfterTotalWaitTimeWhileExecution(t *testing.T) {\n\tt.Parallel()\n\n\twaitDuration := 1\n\ttotal, waitMs := 5, time.Millisecond*time.Duration(waitDuration)\n\taTimer := new(timer)\n\tfor i := 0; i < total; i++ {\n\t\taTimer.On(\"GetTime\", i).After(waitMs).Return(fmt.Sprintf(\"Time%d\", i)).Once()\n\t}\n\ttime.Sleep(waitMs)\n\tstart := time.Now()\n\tvar results []string\n\n\tfor i := 0; i < total; i++ {\n\t\tresults = append(results, aTimer.GetTime(i))\n\t}\n\n\tend := time.Now()\n\telapsedTime := end.Sub(start)\n\tassert.True(t, elapsedTime > waitMs, fmt.Sprintf(\"Total elapsed time:%v should be at least greater than %v\", elapsedTime, waitMs))\n\tassert.Equal(t, total, len(results))\n\tfor i := range results {\n\t\tassert.Equal(t, fmt.Sprintf(\"Time%d\", i), results[i], \"Return value of method should be same\")\n\t}\n}\n\nfunc TestArgumentMatcherToPrintMismatch(t *testing.T) {\n\tt.Parallel()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tmatchingExp := regexp.MustCompile(\n\t\t\t\t`\\s+mock: Unexpected Method Call\\s+-*\\s+GetTime\\(int\\)\\s+0: 1\\s+The closest call I have is:\\s+GetTime\\(mock.argumentMatcher\\)\\s+0: mock.argumentMatcher\\{.*?\\}\\s+Diff:.*\\(int=1\\) not matched by func\\(int\\) bool\\nat: \\[[^\\]]+mock\\/mock_test.go`)\n\t\t\tassert.Regexp(t, matchingExp, r)\n\t\t}\n\t}()\n\n\tm := new(timer)\n\tm.On(\"GetTime\", MatchedBy(func(i int) bool { return false })).Return(\"SomeTime\").Once()\n\n\tres := m.GetTime(1)\n\trequire.Equal(t, \"SomeTime\", res)\n\tm.AssertExpectations(t)\n}\n\nfunc TestArgumentMatcherToPrintMismatchWithReferenceType(t *testing.T) {\n\tt.Parallel()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tmatchingExp := regexp.MustCompile(\n\t\t\t\t`\\s+mock: Unexpected Method Call\\s+-*\\s+GetTimes\\(\\[\\]int\\)\\s+0: \\[\\]int\\{1\\}\\s+The closest call I have is:\\s+GetTimes\\(mock.argumentMatcher\\)\\s+0: mock.argumentMatcher\\{.*?\\}\\s+Diff:.*\\(\\[\\]int=\\[1\\]\\) not matched by func\\(\\[\\]int\\) bool\\nat: \\[[^\\]]+mock\\/mock_test.go`)\n\t\t\tassert.Regexp(t, matchingExp, r)\n\t\t}\n\t}()\n\n\tm := new(timer)\n\tm.On(\"GetTimes\", MatchedBy(func(_ []int) bool { return false })).Return(\"SomeTime\").Once()\n\n\tres := m.GetTimes([]int{1})\n\trequire.Equal(t, \"SomeTime\", res)\n\tm.AssertExpectations(t)\n}\n\nfunc TestClosestCallMismatchedArgumentInformationShowsTheClosest(t *testing.T) {\n\tt.Parallel()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tmatchingExp := regexp.MustCompile(unexpectedCallRegex(`TheExampleMethod(int,int,int)`, `0: 1\\s+1: 1\\s+2: 2`, `0: 1\\s+1: 1\\s+2: 1`, `Diff: 0: PASS:  \\(int=1\\) == \\(int=1\\)\\s+1: PASS:  \\(int=1\\) == \\(int=1\\)\\s+2: FAIL:  \\(int=2\\) != \\(int=1\\)`))\n\t\t\tassert.Regexp(t, matchingExp, r)\n\t\t}\n\t}()\n\n\tm := new(TestExampleImplementation)\n\tm.On(\"TheExampleMethod\", 1, 1, 1).Return(1, nil).Once()\n\tm.On(\"TheExampleMethod\", 2, 2, 2).Return(2, nil).Once()\n\n\tm.TheExampleMethod(1, 1, 2)\n}\n\nfunc TestClosestCallFavorsFirstMock(t *testing.T) {\n\tt.Parallel()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tdiffRegExp := `Difference found in argument 0:\\s+--- Expected\\s+\\+\\+\\+ Actual\\s+@@ -2,4 \\+2,4 @@\\s+\\(bool\\) true,\\s+- \\(bool\\) true,\\s+- \\(bool\\) true\\s+\\+ \\(bool\\) false,\\s+\\+ \\(bool\\) false\\s+}\\s+Diff: 0: FAIL:  \\(\\[\\]bool=\\[(true\\s?|false\\s?){3}]\\) != \\(\\[\\]bool=\\[(true\\s?|false\\s?){3}\\]\\)`\n\t\t\tmatchingExp := regexp.MustCompile(unexpectedCallRegex(`TheExampleMethod7([]bool)`, `0: \\[\\]bool{true, false, false}`, `0: \\[\\]bool{true, true, true}`, diffRegExp))\n\t\t\tassert.Regexp(t, matchingExp, r)\n\t\t}\n\t}()\n\n\tm := new(TestExampleImplementation)\n\tm.On(\"TheExampleMethod7\", []bool{true, true, true}).Return(nil).Once()\n\tm.On(\"TheExampleMethod7\", []bool{false, false, false}).Return(nil).Once()\n\n\tm.TheExampleMethod7([]bool{true, false, false})\n}\n\nfunc TestClosestCallUsesRepeatabilityToFindClosest(t *testing.T) {\n\tt.Parallel()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tdiffRegExp := `Difference found in argument 0:\\s+--- Expected\\s+\\+\\+\\+ Actual\\s+@@ -1,4 \\+1,4 @@\\s+\\(\\[\\]bool\\) \\(len=3\\) {\\s+- \\(bool\\) false,\\s+- \\(bool\\) false,\\s+\\+ \\(bool\\) true,\\s+\\+ \\(bool\\) true,\\s+\\(bool\\) false\\s+Diff: 0: FAIL:  \\(\\[\\]bool=\\[(true\\s?|false\\s?){3}]\\) != \\(\\[\\]bool=\\[(true\\s?|false\\s?){3}\\]\\)`\n\t\t\tmatchingExp := regexp.MustCompile(unexpectedCallRegex(`TheExampleMethod7([]bool)`, `0: \\[\\]bool{true, true, false}`, `0: \\[\\]bool{false, false, false}`, diffRegExp))\n\t\t\tassert.Regexp(t, matchingExp, r)\n\t\t}\n\t}()\n\n\tm := new(TestExampleImplementation)\n\tm.On(\"TheExampleMethod7\", []bool{true, true, true}).Return(nil).Once()\n\tm.On(\"TheExampleMethod7\", []bool{false, false, false}).Return(nil).Once()\n\n\tm.TheExampleMethod7([]bool{true, true, true})\n\n\t// Since the first mocked call has already been used, it now has no repeatability,\n\t// thus the second mock should be shown as the closest match\n\tm.TheExampleMethod7([]bool{true, true, false})\n}\n\nfunc TestClosestCallMismatchedArgumentValueInformation(t *testing.T) {\n\tt.Parallel()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tmatchingExp := regexp.MustCompile(unexpectedCallRegex(`GetTime(int)`, \"0: 1\", \"0: 999\", `Diff: 0: FAIL:  \\(int=1\\) != \\(int=999\\)`))\n\t\t\tassert.Regexp(t, matchingExp, r)\n\t\t}\n\t}()\n\n\tm := new(timer)\n\tm.On(\"GetTime\", 999).Return(\"SomeTime\").Once()\n\n\t_ = m.GetTime(1)\n}\n\nfunc Test_isBetterMatchThanReturnsFalseIfCandidateCallIsNil(t *testing.T) {\n\tt.Parallel()\n\n\tassert.False(t, matchCandidate{}.isBetterMatchThan(matchCandidate{}))\n}\n\nfunc Test_isBetterMatchThanReturnsTrueIfOtherCandidateCallIsNil(t *testing.T) {\n\tt.Parallel()\n\n\tassert.True(t, matchCandidate{call: &Call{}}.isBetterMatchThan(matchCandidate{}))\n}\n\nfunc Test_isBetterMatchThanReturnsFalseIfDiffCountIsGreaterThanOther(t *testing.T) {\n\tt.Parallel()\n\n\tassert.False(t, matchCandidate{call: &Call{}, diffCount: 2}.isBetterMatchThan(matchCandidate{call: &Call{}, diffCount: 1}))\n}\n\nfunc Test_isBetterMatchThanReturnsTrueIfDiffCountIsLessThanOther(t *testing.T) {\n\tt.Parallel()\n\n\tassert.True(t, matchCandidate{call: &Call{}, diffCount: 1}.isBetterMatchThan(matchCandidate{call: &Call{}, diffCount: 2}))\n}\n\nfunc Test_isBetterMatchThanReturnsTrueIfRepeatabilityIsGreaterThanOther(t *testing.T) {\n\tt.Parallel()\n\n\tassert.True(t, matchCandidate{call: &Call{Repeatability: 1}, diffCount: 1}.isBetterMatchThan(matchCandidate{call: &Call{Repeatability: -1}, diffCount: 1}))\n}\n\nfunc Test_isBetterMatchThanReturnsFalseIfRepeatabilityIsLessThanOrEqualToOther(t *testing.T) {\n\tt.Parallel()\n\n\tassert.False(t, matchCandidate{call: &Call{Repeatability: 1}, diffCount: 1}.isBetterMatchThan(matchCandidate{call: &Call{Repeatability: 1}, diffCount: 1}))\n}\n\nfunc unexpectedCallRegex(method, calledArg, expectedArg, diff string) string {\n\trMethod := regexp.QuoteMeta(method)\n\treturn fmt.Sprintf(`\\s+mock: Unexpected Method Call\\s+-*\\s+%s\\s+%s\\s+The closest call I have is:\\s+%s\\s+%s\\s+%s\\nat: \\[[^\\]]+mock\\/mock_test.go`,\n\t\trMethod, calledArg, rMethod, expectedArg, diff)\n}\n\n//go:noinline\nfunc ConcurrencyTestMethod(m *Mock) {\n\tm.Called()\n}\n\nfunc TestConcurrentArgumentRead(t *testing.T) {\n\tt.Parallel()\n\n\tmethodUnderTest := func(c caller, u user) {\n\t\tgo u.Use(c)\n\t\tc.Call()\n\t}\n\n\tc := &mockCaller{}\n\tdefer c.AssertExpectations(t)\n\n\tu := &mockUser{}\n\tdefer u.AssertExpectations(t)\n\n\tdone := make(chan struct{})\n\n\tc.On(\"Call\").Return().Once()\n\tu.On(\"Use\", c).Return().Once().Run(func(args Arguments) { close(done) })\n\n\tmethodUnderTest(c, u)\n\t<-done // wait until Use is called or assertions will fail\n}\n\ntype caller interface {\n\tCall()\n}\n\ntype mockCaller struct{ Mock }\n\nfunc (m *mockCaller) Call() { m.Called() }\n\ntype user interface {\n\tUse(caller)\n}\n\ntype mockUser struct{ Mock }\n\nfunc (m *mockUser) Use(c caller) { m.Called(c) }\n\ntype mutatingStringer struct {\n\tN int\n\ts string\n}\n\nfunc (m *mutatingStringer) String() string {\n\tm.s = strconv.Itoa(m.N)\n\treturn m.s\n}\n\nfunc TestIssue1785ArgumentWithMutatingStringer(t *testing.T) {\n\tm := &Mock{}\n\tm.On(\"Method\", &mutatingStringer{N: 2})\n\tm.On(\"Method\", &mutatingStringer{N: 1})\n\tm.MethodCalled(\"Method\", &mutatingStringer{N: 1})\n\tm.MethodCalled(\"Method\", &mutatingStringer{N: 2})\n\tm.AssertExpectations(t)\n}\n\nfunc TestIssue1227AssertExpectationsForObjectsWithMock(t *testing.T) {\n\tmockT := &MockTestingT{}\n\tAssertExpectationsForObjects(mockT, Mock{})\n\tassert.Equal(t, 1, mockT.errorfCount)\n}\n"
  },
  {
    "path": "package_test.go",
    "content": "package testify\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestImports(t *testing.T) {\n\tif assert.Equal(t, 1, 1) != true {\n\t\tt.Error(\"Something is wrong.\")\n\t}\n}\n"
  },
  {
    "path": "require/doc.go",
    "content": "// Package require implements the same assertions as the assert package but\n// stops test execution when a test fails.\n//\n// # Example Usage\n//\n// The following is a complete example using require in a standard test function:\n//\n//\timport (\n//\t  \"testing\"\n//\t  \"github.com/stretchr/testify/require\"\n//\t)\n//\n//\tfunc TestSomething(t *testing.T) {\n//\n//\t  var a string = \"Hello\"\n//\t  var b string = \"Hello\"\n//\n//\t  require.Equal(t, a, b, \"The two words should be the same.\")\n//\n//\t}\n//\n// # Assertions\n//\n// The require package have same global functions as in the assert package,\n// but instead of returning a boolean result they call [testing.T.FailNow].\n// A consequence of this is that it must be called from the goroutine running\n// the test function, not from other goroutines created during the test.\n//\n// Every assertion function also takes an optional string message as the final argument,\n// allowing custom error messages to be appended to the message the assertion method outputs.\npackage require\n"
  },
  {
    "path": "require/forward_requirements.go",
    "content": "package require\n\n// Assertions provides assertion methods around the\n// TestingT interface.\ntype Assertions struct {\n\tt TestingT\n}\n\n// New makes a new Assertions object for the specified TestingT.\nfunc New(t TestingT) *Assertions {\n\treturn &Assertions{\n\t\tt: t,\n\t}\n}\n\n//go:generate sh -c \"cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require_forward.go.tmpl -include-format-funcs\"\n"
  },
  {
    "path": "require/forward_requirements_test.go",
    "content": "package require\n\nimport (\n\t\"errors\"\n\t\"testing\"\n\t\"time\"\n)\n\nfunc TestImplementsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\n\trequire.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestIsNotTypeWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.IsNotType(new(AssertionTesterNonConformingObject), new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.IsNotType(new(AssertionTesterConformingObject), new(AssertionTesterConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestIsTypeWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.IsType(new(AssertionTesterConformingObject), new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.IsType(new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEqualWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.Equal(1, 1)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Equal(1, 2)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotEqualWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.NotEqual(1, 2)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotEqual(2, 2)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestExactlyWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\n\ta := float32(1)\n\tb := float32(1)\n\tc := float64(1)\n\n\trequire.Exactly(a, b)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Exactly(a, c)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotNilWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.NotNil(t, new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotNil(nil)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNilWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.Nil(nil)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Nil(new(AssertionTesterConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestTrueWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.True(true)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.True(false)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestFalseWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.False(false)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.False(true)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestContainsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.Contains(\"Hello World\", \"Hello\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Contains(\"Hello World\", \"Salut\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotContainsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.NotContains(\"Hello World\", \"Hello!\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotContains(\"Hello World\", \"Hello\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestPanicsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.Panics(func() {\n\t\tpanic(\"Panic!\")\n\t})\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Panics(func() {})\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotPanicsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.NotPanics(func() {})\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotPanics(func() {\n\t\tpanic(\"Panic!\")\n\t})\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNoErrorWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.NoError(nil)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NoError(errors.New(\"some error\"))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestErrorWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.Error(errors.New(\"some error\"))\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Error(nil)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestErrorContainsWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.ErrorContains(errors.New(\"some error: another error\"), \"some error\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.ErrorContains(errors.New(\"some error: another error\"), \"different error\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEqualErrorWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.EqualError(errors.New(\"some error\"), \"some error\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.EqualError(errors.New(\"some error\"), \"Not some error\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEmptyWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.Empty(\"\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Empty(\"x\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotEmptyWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.NotEmpty(\"x\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotEmpty(\"\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestWithinDurationWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\ta := time.Now()\n\tb := a.Add(10 * time.Second)\n\n\trequire.WithinDuration(a, b, 15*time.Second)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.WithinDuration(a, b, 5*time.Second)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestInDeltaWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.InDelta(1.001, 1, 0.01)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.InDelta(1, 2, 0.5)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestZeroWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.Zero(0)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Zero(1)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotZeroWrapper(t *testing.T) {\n\tt.Parallel()\n\n\trequire := New(t)\n\trequire.NotZero(1)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotZero(0)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_EqualSONString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEqWrapper_EquivalentButNotEqual(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEqWrapper_HashOfArraysAndHashes(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]],\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\"\\r\\n}\",\n\t\t\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\",\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]]\\r\\n}\")\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEqWrapper_Array(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEqWrapper_HashAndArrayNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_HashesNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ActualIsNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`{\"foo\": \"bar\"}`, \"Not JSON\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ExpectedIsNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(\"Not JSON\", `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ExpectedAndActualNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(\"Not JSON\", \"Not JSON\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ArraysOfDifferentOrder(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_EqualYAMLString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.YAMLEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_EquivalentButNotEqual(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.YAMLEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_HashOfArraysAndHashes(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\texpected := `\nnumeric: 1.5\narray:\n  - foo: bar\n  - 1\n  - \"string\"\n  - [\"nested\", \"array\", 5.5]\nhash:\n  nested: hash\n  nested_slice: [this, is, nested]\nstring: \"foo\"\n`\n\n\tactual := `\nnumeric: 1.5\nhash:\n  nested: hash\n  nested_slice: [this, is, nested]\nstring: \"foo\"\narray:\n  - foo: bar\n  - 1\n  - \"string\"\n  - [\"nested\", \"array\", 5.5]\n`\n\n\tmockRequire.YAMLEq(expected, actual)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_Array(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.YAMLEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_HashAndArrayNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.YAMLEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_HashesNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.YAMLEq(`{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_ActualIsSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.YAMLEq(`{\"foo\": \"bar\"}`, \"Simple String\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_ExpectedIsSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.YAMLEq(\"Simple String\", `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_ExpectedAndActualSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.YAMLEq(\"Simple String\", \"Simple String\")\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEqWrapper_ArraysOfDifferentOrder(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.YAMLEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n"
  },
  {
    "path": "require/require.go",
    "content": "// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.\n\npackage require\n\nimport (\n\tassert \"github.com/stretchr/testify/assert\"\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Condition uses a Comparison to assert a complex condition.\nfunc Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Condition(t, comp, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Conditionf(t, comp, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//\trequire.Contains(t, \"Hello World\", \"World\")\n//\trequire.Contains(t, [\"Hello\", \"World\"], \"World\")\n//\trequire.Contains(t, {\"Hello\": \"World\"}, \"Hello\")\nfunc Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Contains(t, s, contains, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//\trequire.Containsf(t, \"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//\trequire.Containsf(t, [\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//\trequire.Containsf(t, {\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\nfunc Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Containsf(t, s, contains, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails\n// if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExists(t TestingT, path string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.DirExists(t, path, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails\n// if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExistsf(t TestingT, path string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.DirExistsf(t, path, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// require.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])\nfunc ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.ElementsMatch(t, listA, listB, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// require.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\")\nfunc ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.ElementsMatchf(t, listA, listB, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Empty asserts that the given value is \"empty\".\n//\n// [Zero values] are \"empty\".\n//\n// Arrays are \"empty\" if every element is the zero value of the type (stricter than \"empty\").\n//\n// Slices, maps and channels with zero length are \"empty\".\n//\n// Pointer values are \"empty\" if the pointer is nil or if the pointed value is \"empty\".\n//\n//\trequire.Empty(t, obj)\n//\n// [Zero values]: https://go.dev/ref/spec#The_zero_value\nfunc Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Empty(t, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Emptyf asserts that the given value is \"empty\".\n//\n// [Zero values] are \"empty\".\n//\n// Arrays are \"empty\" if every element is the zero value of the type (stricter than \"empty\").\n//\n// Slices, maps and channels with zero length are \"empty\".\n//\n// Pointer values are \"empty\" if the pointer is nil or if the pointed value is \"empty\".\n//\n//\trequire.Emptyf(t, obj, \"error message %s\", \"formatted\")\n//\n// [Zero values]: https://go.dev/ref/spec#The_zero_value\nfunc Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Emptyf(t, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Equal asserts that two objects are equal.\n//\n//\trequire.Equal(t, 123, 123)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Equal(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// EqualError asserts that a function returned a non-nil error (i.e. an error)\n// and that it is equal to the provided error.\n//\n//\tactualObj, err := SomeFunction()\n//\trequire.EqualError(t, err,  expectedErrorString)\nfunc EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.EqualError(t, theError, errString, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// EqualErrorf asserts that a function returned a non-nil error (i.e. an error)\n// and that it is equal to the provided error.\n//\n//\tactualObj, err := SomeFunction()\n//\trequire.EqualErrorf(t, err,  expectedErrorString, \"error message %s\", \"formatted\")\nfunc EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.EqualErrorf(t, theError, errString, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// EqualExportedValues asserts that the types of two objects are equal and their public\n// fields are also equal. This is useful for comparing structs that have private fields\n// that could potentially differ.\n//\n//\t type S struct {\n//\t\tExported     \tint\n//\t\tnotExported   \tint\n//\t }\n//\t require.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true\n//\t require.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false\nfunc EqualExportedValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.EqualExportedValues(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// EqualExportedValuesf asserts that the types of two objects are equal and their public\n// fields are also equal. This is useful for comparing structs that have private fields\n// that could potentially differ.\n//\n//\t type S struct {\n//\t\tExported     \tint\n//\t\tnotExported   \tint\n//\t }\n//\t require.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, \"error message %s\", \"formatted\") => true\n//\t require.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, \"error message %s\", \"formatted\") => false\nfunc EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.EqualExportedValuesf(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// EqualValues asserts that two objects are equal or convertible to the larger\n// type and equal.\n//\n//\trequire.EqualValues(t, uint32(123), int32(123))\nfunc EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.EqualValues(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// EqualValuesf asserts that two objects are equal or convertible to the larger\n// type and equal.\n//\n//\trequire.EqualValuesf(t, uint32(123), int32(123), \"error message %s\", \"formatted\")\nfunc EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.EqualValuesf(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Equalf asserts that two objects are equal.\n//\n//\trequire.Equalf(t, 123, 123, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Equalf(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Error asserts that a function returned a non-nil error (ie. an error).\n//\n//\tactualObj, err := SomeFunction()\n//\trequire.Error(t, err)\nfunc Error(t TestingT, err error, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Error(t, err, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.\n// This is a wrapper for errors.As.\nfunc ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.ErrorAs(t, err, target, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.\n// This is a wrapper for errors.As.\nfunc ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.ErrorAsf(t, err, target, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// ErrorContains asserts that a function returned a non-nil error (i.e. an\n// error) and that the error contains the specified substring.\n//\n//\tactualObj, err := SomeFunction()\n//\trequire.ErrorContains(t, err,  expectedErrorSubString)\nfunc ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.ErrorContains(t, theError, contains, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// ErrorContainsf asserts that a function returned a non-nil error (i.e. an\n// error) and that the error contains the specified substring.\n//\n//\tactualObj, err := SomeFunction()\n//\trequire.ErrorContainsf(t, err,  expectedErrorSubString, \"error message %s\", \"formatted\")\nfunc ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.ErrorContainsf(t, theError, contains, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// ErrorIs asserts that at least one of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc ErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.ErrorIs(t, err, target, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// ErrorIsf asserts that at least one of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.ErrorIsf(t, err, target, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Errorf asserts that a function returned a non-nil error (ie. an error).\n//\n//\tactualObj, err := SomeFunction()\n//\trequire.Errorf(t, err, \"error message %s\", \"formatted\")\nfunc Errorf(t TestingT, err error, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Errorf(t, err, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Eventually asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick.\n//\n//\trequire.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond)\nfunc Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Eventually(t, condition, waitFor, tick, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// EventuallyWithT asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick. In contrast to Eventually,\n// it supplies a CollectT to the condition function, so that the condition\n// function can use the CollectT to call other assertions.\n// The condition is considered \"met\" if no errors are raised in a tick.\n// The supplied CollectT collects all errors from one tick (if there are any).\n// If the condition is not met before waitFor, the collected errors of\n// the last tick are copied to t.\n//\n//\texternalValue := false\n//\tgo func() {\n//\t\ttime.Sleep(8*time.Second)\n//\t\texternalValue = true\n//\t}()\n//\trequire.EventuallyWithT(t, func(c *assert.CollectT) {\n//\t\t// add assertions as needed; any assertion failure will fail the current tick\n//\t\trequire.True(c, externalValue, \"expected 'externalValue' to be true\")\n//\t}, 10*time.Second, 1*time.Second, \"external state has not changed to 'true'; still false\")\nfunc EventuallyWithT(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.EventuallyWithT(t, condition, waitFor, tick, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// EventuallyWithTf asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick. In contrast to Eventually,\n// it supplies a CollectT to the condition function, so that the condition\n// function can use the CollectT to call other assertions.\n// The condition is considered \"met\" if no errors are raised in a tick.\n// The supplied CollectT collects all errors from one tick (if there are any).\n// If the condition is not met before waitFor, the collected errors of\n// the last tick are copied to t.\n//\n//\texternalValue := false\n//\tgo func() {\n//\t\ttime.Sleep(8*time.Second)\n//\t\texternalValue = true\n//\t}()\n//\trequire.EventuallyWithTf(t, func(c *assert.CollectT) {\n//\t\t// add assertions as needed; any assertion failure will fail the current tick\n//\t\trequire.True(c, externalValue, \"expected 'externalValue' to be true\")\n//\t}, 10*time.Second, 1*time.Second, \"error message %s\", \"formatted\")\nfunc EventuallyWithTf(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.EventuallyWithTf(t, condition, waitFor, tick, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Eventuallyf asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick.\n//\n//\trequire.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, \"error message %s\", \"formatted\")\nfunc Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Eventuallyf(t, condition, waitFor, tick, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//\trequire.Exactly(t, int32(123), int64(123))\nfunc Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Exactly(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//\trequire.Exactlyf(t, int32(123), int64(123), \"error message %s\", \"formatted\")\nfunc Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Exactlyf(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Fail reports a failure through\nfunc Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Fail(t, failureMessage, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// FailNow fails test\nfunc FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.FailNow(t, failureMessage, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// FailNowf fails test\nfunc FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.FailNowf(t, failureMessage, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Failf reports a failure through\nfunc Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Failf(t, failureMessage, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// False asserts that the specified value is false.\n//\n//\trequire.False(t, myBool)\nfunc False(t TestingT, value bool, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.False(t, value, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Falsef asserts that the specified value is false.\n//\n//\trequire.Falsef(t, myBool, \"error message %s\", \"formatted\")\nfunc Falsef(t TestingT, value bool, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Falsef(t, value, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if\n// the path points to a directory or there is an error when trying to check the file.\nfunc FileExists(t TestingT, path string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.FileExists(t, path, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if\n// the path points to a directory or there is an error when trying to check the file.\nfunc FileExistsf(t TestingT, path string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.FileExistsf(t, path, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Greater asserts that the first element is greater than the second\n//\n//\trequire.Greater(t, 2, 1)\n//\trequire.Greater(t, float64(2), float64(1))\n//\trequire.Greater(t, \"b\", \"a\")\nfunc Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Greater(t, e1, e2, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// GreaterOrEqual asserts that the first element is greater than or equal to the second\n//\n//\trequire.GreaterOrEqual(t, 2, 1)\n//\trequire.GreaterOrEqual(t, 2, 2)\n//\trequire.GreaterOrEqual(t, \"b\", \"a\")\n//\trequire.GreaterOrEqual(t, \"b\", \"b\")\nfunc GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.GreaterOrEqual(t, e1, e2, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// GreaterOrEqualf asserts that the first element is greater than or equal to the second\n//\n//\trequire.GreaterOrEqualf(t, 2, 1, \"error message %s\", \"formatted\")\n//\trequire.GreaterOrEqualf(t, 2, 2, \"error message %s\", \"formatted\")\n//\trequire.GreaterOrEqualf(t, \"b\", \"a\", \"error message %s\", \"formatted\")\n//\trequire.GreaterOrEqualf(t, \"b\", \"b\", \"error message %s\", \"formatted\")\nfunc GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.GreaterOrEqualf(t, e1, e2, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Greaterf asserts that the first element is greater than the second\n//\n//\trequire.Greaterf(t, 2, 1, \"error message %s\", \"formatted\")\n//\trequire.Greaterf(t, float64(2), float64(1), \"error message %s\", \"formatted\")\n//\trequire.Greaterf(t, \"b\", \"a\", \"error message %s\", \"formatted\")\nfunc Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Greaterf(t, e1, e2, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//\trequire.HTTPBodyContains(t, myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\")\nfunc HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//\trequire.HTTPBodyContainsf(t, myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\nfunc HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//\trequire.HTTPBodyNotContains(t, myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\")\nfunc HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//\trequire.HTTPBodyNotContainsf(t, myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\nfunc HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//\trequire.HTTPError(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\nfunc HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//\trequire.HTTPErrorf(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\nfunc HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPErrorf(t, handler, method, url, values, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//\trequire.HTTPRedirect(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\nfunc HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//\trequire.HTTPRedirectf(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\nfunc HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPStatusCode asserts that a specified handler returns a specified status code.\n//\n//\trequire.HTTPStatusCode(t, myHandler, \"GET\", \"/notImplemented\", nil, 501)\nfunc HTTPStatusCode(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPStatusCode(t, handler, method, url, values, statuscode, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPStatusCodef asserts that a specified handler returns a specified status code.\n//\n//\trequire.HTTPStatusCodef(t, myHandler, \"GET\", \"/notImplemented\", nil, 501, \"error message %s\", \"formatted\")\nfunc HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPStatusCodef(t, handler, method, url, values, statuscode, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//\trequire.HTTPSuccess(t, myHandler, \"POST\", \"http://www.google.com\", nil)\nfunc HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//\trequire.HTTPSuccessf(t, myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\nfunc HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//\trequire.Implements(t, (*MyInterface)(nil), new(MyObject))\nfunc Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Implements(t, interfaceObject, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//\trequire.Implementsf(t, (*MyInterface)(nil), new(MyObject), \"error message %s\", \"formatted\")\nfunc Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Implementsf(t, interfaceObject, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n//\trequire.InDelta(t, math.Pi, 22/7.0, 0.01)\nfunc InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InDelta(t, expected, actual, delta, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n//\trequire.InDeltaf(t, math.Pi, 22/7.0, 0.01, \"error message %s\", \"formatted\")\nfunc InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InDeltaf(t, expected, actual, delta, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\nfunc InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\nfunc InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsDecreasing asserts that the collection is decreasing\n//\n//\trequire.IsDecreasing(t, []int{2, 1, 0})\n//\trequire.IsDecreasing(t, []float{2, 1})\n//\trequire.IsDecreasing(t, []string{\"b\", \"a\"})\nfunc IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsDecreasing(t, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsDecreasingf asserts that the collection is decreasing\n//\n//\trequire.IsDecreasingf(t, []int{2, 1, 0}, \"error message %s\", \"formatted\")\n//\trequire.IsDecreasingf(t, []float{2, 1}, \"error message %s\", \"formatted\")\n//\trequire.IsDecreasingf(t, []string{\"b\", \"a\"}, \"error message %s\", \"formatted\")\nfunc IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsDecreasingf(t, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsIncreasing asserts that the collection is increasing\n//\n//\trequire.IsIncreasing(t, []int{1, 2, 3})\n//\trequire.IsIncreasing(t, []float{1, 2})\n//\trequire.IsIncreasing(t, []string{\"a\", \"b\"})\nfunc IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsIncreasing(t, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsIncreasingf asserts that the collection is increasing\n//\n//\trequire.IsIncreasingf(t, []int{1, 2, 3}, \"error message %s\", \"formatted\")\n//\trequire.IsIncreasingf(t, []float{1, 2}, \"error message %s\", \"formatted\")\n//\trequire.IsIncreasingf(t, []string{\"a\", \"b\"}, \"error message %s\", \"formatted\")\nfunc IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsIncreasingf(t, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsNonDecreasing asserts that the collection is not decreasing\n//\n//\trequire.IsNonDecreasing(t, []int{1, 1, 2})\n//\trequire.IsNonDecreasing(t, []float{1, 2})\n//\trequire.IsNonDecreasing(t, []string{\"a\", \"b\"})\nfunc IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsNonDecreasing(t, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsNonDecreasingf asserts that the collection is not decreasing\n//\n//\trequire.IsNonDecreasingf(t, []int{1, 1, 2}, \"error message %s\", \"formatted\")\n//\trequire.IsNonDecreasingf(t, []float{1, 2}, \"error message %s\", \"formatted\")\n//\trequire.IsNonDecreasingf(t, []string{\"a\", \"b\"}, \"error message %s\", \"formatted\")\nfunc IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsNonDecreasingf(t, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsNonIncreasing asserts that the collection is not increasing\n//\n//\trequire.IsNonIncreasing(t, []int{2, 1, 1})\n//\trequire.IsNonIncreasing(t, []float{2, 1})\n//\trequire.IsNonIncreasing(t, []string{\"b\", \"a\"})\nfunc IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsNonIncreasing(t, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsNonIncreasingf asserts that the collection is not increasing\n//\n//\trequire.IsNonIncreasingf(t, []int{2, 1, 1}, \"error message %s\", \"formatted\")\n//\trequire.IsNonIncreasingf(t, []float{2, 1}, \"error message %s\", \"formatted\")\n//\trequire.IsNonIncreasingf(t, []string{\"b\", \"a\"}, \"error message %s\", \"formatted\")\nfunc IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsNonIncreasingf(t, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsNotType asserts that the specified objects are not of the same type.\n//\n//\trequire.IsNotType(t, &NotMyStruct{}, &MyStruct{})\nfunc IsNotType(t TestingT, theType interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsNotType(t, theType, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsNotTypef asserts that the specified objects are not of the same type.\n//\n//\trequire.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, \"error message %s\", \"formatted\")\nfunc IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsNotTypef(t, theType, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsType asserts that the specified objects are of the same type.\n//\n//\trequire.IsType(t, &MyStruct{}, &MyStruct{})\nfunc IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsType(t, expectedType, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// IsTypef asserts that the specified objects are of the same type.\n//\n//\trequire.IsTypef(t, &MyStruct{}, &MyStruct{}, \"error message %s\", \"formatted\")\nfunc IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.IsTypef(t, expectedType, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//\trequire.JSONEq(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\nfunc JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.JSONEq(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//\trequire.JSONEqf(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\nfunc JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.JSONEqf(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//\trequire.Len(t, mySlice, 3)\nfunc Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Len(t, object, length, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//\trequire.Lenf(t, mySlice, 3, \"error message %s\", \"formatted\")\nfunc Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Lenf(t, object, length, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Less asserts that the first element is less than the second\n//\n//\trequire.Less(t, 1, 2)\n//\trequire.Less(t, float64(1), float64(2))\n//\trequire.Less(t, \"a\", \"b\")\nfunc Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Less(t, e1, e2, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// LessOrEqual asserts that the first element is less than or equal to the second\n//\n//\trequire.LessOrEqual(t, 1, 2)\n//\trequire.LessOrEqual(t, 2, 2)\n//\trequire.LessOrEqual(t, \"a\", \"b\")\n//\trequire.LessOrEqual(t, \"b\", \"b\")\nfunc LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.LessOrEqual(t, e1, e2, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// LessOrEqualf asserts that the first element is less than or equal to the second\n//\n//\trequire.LessOrEqualf(t, 1, 2, \"error message %s\", \"formatted\")\n//\trequire.LessOrEqualf(t, 2, 2, \"error message %s\", \"formatted\")\n//\trequire.LessOrEqualf(t, \"a\", \"b\", \"error message %s\", \"formatted\")\n//\trequire.LessOrEqualf(t, \"b\", \"b\", \"error message %s\", \"formatted\")\nfunc LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.LessOrEqualf(t, e1, e2, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Lessf asserts that the first element is less than the second\n//\n//\trequire.Lessf(t, 1, 2, \"error message %s\", \"formatted\")\n//\trequire.Lessf(t, float64(1), float64(2), \"error message %s\", \"formatted\")\n//\trequire.Lessf(t, \"a\", \"b\", \"error message %s\", \"formatted\")\nfunc Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Lessf(t, e1, e2, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Negative asserts that the specified element is negative\n//\n//\trequire.Negative(t, -1)\n//\trequire.Negative(t, -1.23)\nfunc Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Negative(t, e, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Negativef asserts that the specified element is negative\n//\n//\trequire.Negativef(t, -1, \"error message %s\", \"formatted\")\n//\trequire.Negativef(t, -1.23, \"error message %s\", \"formatted\")\nfunc Negativef(t TestingT, e interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Negativef(t, e, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Never asserts that the given condition doesn't satisfy in waitFor time,\n// periodically checking the target function each tick.\n//\n//\trequire.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond)\nfunc Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Never(t, condition, waitFor, tick, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Neverf asserts that the given condition doesn't satisfy in waitFor time,\n// periodically checking the target function each tick.\n//\n//\trequire.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, \"error message %s\", \"formatted\")\nfunc Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Neverf(t, condition, waitFor, tick, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Nil asserts that the specified object is nil.\n//\n//\trequire.Nil(t, err)\nfunc Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Nil(t, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//\trequire.Nilf(t, err, \"error message %s\", \"formatted\")\nfunc Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Nilf(t, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NoDirExists checks whether a directory does not exist in the given path.\n// It fails if the path points to an existing _directory_ only.\nfunc NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NoDirExists(t, path, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NoDirExistsf checks whether a directory does not exist in the given path.\n// It fails if the path points to an existing _directory_ only.\nfunc NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NoDirExistsf(t, path, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NoError asserts that a function returned a nil error (ie. no error).\n//\n//\tactualObj, err := SomeFunction()\n//\trequire.NoError(t, err)\n//\trequire.Equal(t, expectedObj, actualObj)\nfunc NoError(t TestingT, err error, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NoError(t, err, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NoErrorf asserts that a function returned a nil error (ie. no error).\n//\n//\tactualObj, err := SomeFunction()\n//\trequire.NoErrorf(t, err, \"error message %s\", \"formatted\")\n//\trequire.Equal(t, expectedObj, actualObj)\nfunc NoErrorf(t TestingT, err error, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NoErrorf(t, err, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NoFileExists checks whether a file does not exist in a given path. It fails\n// if the path points to an existing _file_ only.\nfunc NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NoFileExists(t, path, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NoFileExistsf checks whether a file does not exist in a given path. It fails\n// if the path points to an existing _file_ only.\nfunc NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NoFileExistsf(t, path, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//\trequire.NotContains(t, \"Hello World\", \"Earth\")\n//\trequire.NotContains(t, [\"Hello\", \"World\"], \"Earth\")\n//\trequire.NotContains(t, {\"Hello\": \"World\"}, \"Earth\")\nfunc NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotContains(t, s, contains, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//\trequire.NotContainsf(t, \"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//\trequire.NotContainsf(t, [\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//\trequire.NotContainsf(t, {\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\nfunc NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotContainsf(t, s, contains, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should not match.\n// This is an inverse of ElementsMatch.\n//\n// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false\n//\n// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true\n//\n// require.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true\nfunc NotElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotElementsMatch(t, listA, listB, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should not match.\n// This is an inverse of ElementsMatch.\n//\n// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], \"error message %s\", \"formatted\") -> false\n//\n// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], \"error message %s\", \"formatted\") -> true\n//\n// require.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], \"error message %s\", \"formatted\") -> true\nfunc NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotElementsMatchf(t, listA, listB, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotEmpty asserts that the specified object is NOT [Empty].\n//\n//\trequire.NotEmpty(t, obj)\n//\trequire.Equal(t, \"two\", obj[1])\nfunc NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotEmpty(t, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotEmptyf asserts that the specified object is NOT [Empty].\n//\n//\trequire.NotEmptyf(t, obj, \"error message %s\", \"formatted\")\n//\trequire.Equal(t, \"two\", obj[1])\nfunc NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotEmptyf(t, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//\trequire.NotEqual(t, obj1, obj2)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotEqual(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotEqualValues asserts that two objects are not equal even when converted to the same type\n//\n//\trequire.NotEqualValues(t, obj1, obj2)\nfunc NotEqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotEqualValues(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotEqualValuesf asserts that two objects are not equal even when converted to the same type\n//\n//\trequire.NotEqualValuesf(t, obj1, obj2, \"error message %s\", \"formatted\")\nfunc NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotEqualValuesf(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//\trequire.NotEqualf(t, obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotEqualf(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotErrorAs asserts that none of the errors in err's chain matches target,\n// but if so, sets target to that error value.\nfunc NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotErrorAs(t, err, target, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotErrorAsf asserts that none of the errors in err's chain matches target,\n// but if so, sets target to that error value.\nfunc NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotErrorAsf(t, err, target, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotErrorIs asserts that none of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc NotErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotErrorIs(t, err, target, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotErrorIsf asserts that none of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotErrorIsf(t, err, target, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotImplements asserts that an object does not implement the specified interface.\n//\n//\trequire.NotImplements(t, (*MyInterface)(nil), new(MyObject))\nfunc NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotImplements(t, interfaceObject, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotImplementsf asserts that an object does not implement the specified interface.\n//\n//\trequire.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), \"error message %s\", \"formatted\")\nfunc NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotImplementsf(t, interfaceObject, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//\trequire.NotNil(t, err)\nfunc NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotNil(t, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//\trequire.NotNilf(t, err, \"error message %s\", \"formatted\")\nfunc NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotNilf(t, object, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//\trequire.NotPanics(t, func(){ RemainCalm() })\nfunc NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotPanics(t, f, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//\trequire.NotPanicsf(t, func(){ RemainCalm() }, \"error message %s\", \"formatted\")\nfunc NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotPanicsf(t, f, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//\trequire.NotRegexp(t, regexp.MustCompile(\"starts\"), \"it's starting\")\n//\trequire.NotRegexp(t, \"^start\", \"it's not starting\")\nfunc NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotRegexp(t, rx, str, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//\trequire.NotRegexpf(t, regexp.MustCompile(\"starts\"), \"it's starting\", \"error message %s\", \"formatted\")\n//\trequire.NotRegexpf(t, \"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotRegexpf(t, rx, str, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotSame asserts that two pointers do not reference the same object.\n//\n//\trequire.NotSame(t, ptr1, ptr2)\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc NotSame(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotSame(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotSamef asserts that two pointers do not reference the same object.\n//\n//\trequire.NotSamef(t, ptr1, ptr2, \"error message %s\", \"formatted\")\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotSamef(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotSubset asserts that the list (array, slice, or map) does NOT contain all\n// elements given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\trequire.NotSubset(t, [1, 3, 4], [1, 2])\n//\trequire.NotSubset(t, {\"x\": 1, \"y\": 2}, {\"z\": 3})\n//\trequire.NotSubset(t, [1, 3, 4], {1: \"one\", 2: \"two\"})\n//\trequire.NotSubset(t, {\"x\": 1, \"y\": 2}, [\"z\"])\nfunc NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotSubset(t, list, subset, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all\n// elements given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\trequire.NotSubsetf(t, [1, 3, 4], [1, 2], \"error message %s\", \"formatted\")\n//\trequire.NotSubsetf(t, {\"x\": 1, \"y\": 2}, {\"z\": 3}, \"error message %s\", \"formatted\")\n//\trequire.NotSubsetf(t, [1, 3, 4], {1: \"one\", 2: \"two\"}, \"error message %s\", \"formatted\")\n//\trequire.NotSubsetf(t, {\"x\": 1, \"y\": 2}, [\"z\"], \"error message %s\", \"formatted\")\nfunc NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotSubsetf(t, list, subset, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotZero asserts that i is not the zero value for its type.\nfunc NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotZero(t, i, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// NotZerof asserts that i is not the zero value for its type.\nfunc NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.NotZerof(t, i, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//\trequire.Panics(t, func(){ GoCrazy() })\nfunc Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Panics(t, f, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// PanicsWithError asserts that the code inside the specified PanicTestFunc\n// panics, and that the recovered panic value is an error that satisfies the\n// EqualError comparison.\n//\n//\trequire.PanicsWithError(t, \"crazy error\", func(){ GoCrazy() })\nfunc PanicsWithError(t TestingT, errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.PanicsWithError(t, errString, f, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc\n// panics, and that the recovered panic value is an error that satisfies the\n// EqualError comparison.\n//\n//\trequire.PanicsWithErrorf(t, \"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc PanicsWithErrorf(t TestingT, errString string, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.PanicsWithErrorf(t, errString, f, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//\trequire.PanicsWithValue(t, \"crazy error\", func(){ GoCrazy() })\nfunc PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.PanicsWithValue(t, expected, f, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//\trequire.PanicsWithValuef(t, \"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.PanicsWithValuef(t, expected, f, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//\trequire.Panicsf(t, func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Panicsf(t, f, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Positive asserts that the specified element is positive\n//\n//\trequire.Positive(t, 1)\n//\trequire.Positive(t, 1.23)\nfunc Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Positive(t, e, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Positivef asserts that the specified element is positive\n//\n//\trequire.Positivef(t, 1, \"error message %s\", \"formatted\")\n//\trequire.Positivef(t, 1.23, \"error message %s\", \"formatted\")\nfunc Positivef(t TestingT, e interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Positivef(t, e, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//\trequire.Regexp(t, regexp.MustCompile(\"start\"), \"it's starting\")\n//\trequire.Regexp(t, \"start...$\", \"it's not starting\")\nfunc Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Regexp(t, rx, str, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//\trequire.Regexpf(t, regexp.MustCompile(\"start\"), \"it's starting\", \"error message %s\", \"formatted\")\n//\trequire.Regexpf(t, \"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Regexpf(t, rx, str, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Same asserts that two pointers reference the same object.\n//\n//\trequire.Same(t, ptr1, ptr2)\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc Same(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Same(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Samef asserts that two pointers reference the same object.\n//\n//\trequire.Samef(t, ptr1, ptr2, \"error message %s\", \"formatted\")\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Samef(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Subset asserts that the list (array, slice, or map) contains all elements\n// given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\trequire.Subset(t, [1, 2, 3], [1, 2])\n//\trequire.Subset(t, {\"x\": 1, \"y\": 2}, {\"x\": 1})\n//\trequire.Subset(t, [1, 2, 3], {1: \"one\", 2: \"two\"})\n//\trequire.Subset(t, {\"x\": 1, \"y\": 2}, [\"x\"])\nfunc Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Subset(t, list, subset, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Subsetf asserts that the list (array, slice, or map) contains all elements\n// given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\trequire.Subsetf(t, [1, 2, 3], [1, 2], \"error message %s\", \"formatted\")\n//\trequire.Subsetf(t, {\"x\": 1, \"y\": 2}, {\"x\": 1}, \"error message %s\", \"formatted\")\n//\trequire.Subsetf(t, [1, 2, 3], {1: \"one\", 2: \"two\"}, \"error message %s\", \"formatted\")\n//\trequire.Subsetf(t, {\"x\": 1, \"y\": 2}, [\"x\"], \"error message %s\", \"formatted\")\nfunc Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Subsetf(t, list, subset, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// True asserts that the specified value is true.\n//\n//\trequire.True(t, myBool)\nfunc True(t TestingT, value bool, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.True(t, value, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Truef asserts that the specified value is true.\n//\n//\trequire.Truef(t, myBool, \"error message %s\", \"formatted\")\nfunc Truef(t TestingT, value bool, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Truef(t, value, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//\trequire.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)\nfunc WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//\trequire.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\nfunc WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.WithinDurationf(t, expected, actual, delta, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// WithinRange asserts that a time is within a time range (inclusive).\n//\n//\trequire.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))\nfunc WithinRange(t TestingT, actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.WithinRange(t, actual, start, end, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// WithinRangef asserts that a time is within a time range (inclusive).\n//\n//\trequire.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), \"error message %s\", \"formatted\")\nfunc WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.WithinRangef(t, actual, start, end, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// YAMLEq asserts that the first documents in the two YAML strings are equivalent.\n//\n//\texpected := `---\n//\tkey: value\n//\t---\n//\tkey: this is a second document, it is not evaluated\n//\t`\n//\tactual := `---\n//\tkey: value\n//\t---\n//\tkey: this is a subsequent document, it is not evaluated\n//\t`\n//\trequire.YAMLEq(t, expected, actual)\nfunc YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.YAMLEq(t, expected, actual, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// YAMLEqf asserts that the first documents in the two YAML strings are equivalent.\n//\n//\texpected := `---\n//\tkey: value\n//\t---\n//\tkey: this is a second document, it is not evaluated\n//\t`\n//\tactual := `---\n//\tkey: value\n//\t---\n//\tkey: this is a subsequent document, it is not evaluated\n//\t`\n//\trequire.YAMLEqf(t, expected, actual, \"error message %s\", \"formatted\")\nfunc YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.YAMLEqf(t, expected, actual, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Zero asserts that i is the zero value for its type.\nfunc Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Zero(t, i, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n\n// Zerof asserts that i is the zero value for its type.\nfunc Zerof(t TestingT, i interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Zerof(t, i, msg, args...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}\n"
  },
  {
    "path": "require/require.go.tmpl",
    "content": "{{.CommentRequire}}\nfunc {{.DocInfo.Name}}(t TestingT, {{.Params}}) {\n\tif h, ok := t.(tHelper); ok { h.Helper() }\n\tif assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return }\n\tt.FailNow()\n}\n"
  },
  {
    "path": "require/require_forward.go",
    "content": "// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.\n\npackage require\n\nimport (\n\tassert \"github.com/stretchr/testify/assert\"\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Condition uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tCondition(a.t, comp, msgAndArgs...)\n}\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tConditionf(a.t, comp, msg, args...)\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//\ta.Contains(\"Hello World\", \"World\")\n//\ta.Contains([\"Hello\", \"World\"], \"World\")\n//\ta.Contains({\"Hello\": \"World\"}, \"Hello\")\nfunc (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tContains(a.t, s, contains, msgAndArgs...)\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//\ta.Containsf(\"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//\ta.Containsf([\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//\ta.Containsf({\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tContainsf(a.t, s, contains, msg, args...)\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails\n// if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tDirExists(a.t, path, msgAndArgs...)\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails\n// if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tDirExistsf(a.t, path, msg, args...)\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])\nfunc (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tElementsMatch(a.t, listA, listB, msgAndArgs...)\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\")\nfunc (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tElementsMatchf(a.t, listA, listB, msg, args...)\n}\n\n// Empty asserts that the given value is \"empty\".\n//\n// [Zero values] are \"empty\".\n//\n// Arrays are \"empty\" if every element is the zero value of the type (stricter than \"empty\").\n//\n// Slices, maps and channels with zero length are \"empty\".\n//\n// Pointer values are \"empty\" if the pointer is nil or if the pointed value is \"empty\".\n//\n//\ta.Empty(obj)\n//\n// [Zero values]: https://go.dev/ref/spec#The_zero_value\nfunc (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEmpty(a.t, object, msgAndArgs...)\n}\n\n// Emptyf asserts that the given value is \"empty\".\n//\n// [Zero values] are \"empty\".\n//\n// Arrays are \"empty\" if every element is the zero value of the type (stricter than \"empty\").\n//\n// Slices, maps and channels with zero length are \"empty\".\n//\n// Pointer values are \"empty\" if the pointer is nil or if the pointed value is \"empty\".\n//\n//\ta.Emptyf(obj, \"error message %s\", \"formatted\")\n//\n// [Zero values]: https://go.dev/ref/spec#The_zero_value\nfunc (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEmptyf(a.t, object, msg, args...)\n}\n\n// Equal asserts that two objects are equal.\n//\n//\ta.Equal(123, 123)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqual(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualError asserts that a function returned a non-nil error (i.e. an error)\n// and that it is equal to the provided error.\n//\n//\tactualObj, err := SomeFunction()\n//\ta.EqualError(err,  expectedErrorString)\nfunc (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualError(a.t, theError, errString, msgAndArgs...)\n}\n\n// EqualErrorf asserts that a function returned a non-nil error (i.e. an error)\n// and that it is equal to the provided error.\n//\n//\tactualObj, err := SomeFunction()\n//\ta.EqualErrorf(err,  expectedErrorString, \"error message %s\", \"formatted\")\nfunc (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualErrorf(a.t, theError, errString, msg, args...)\n}\n\n// EqualExportedValues asserts that the types of two objects are equal and their public\n// fields are also equal. This is useful for comparing structs that have private fields\n// that could potentially differ.\n//\n//\t type S struct {\n//\t\tExported     \tint\n//\t\tnotExported   \tint\n//\t }\n//\t a.EqualExportedValues(S{1, 2}, S{1, 3}) => true\n//\t a.EqualExportedValues(S{1, 2}, S{2, 3}) => false\nfunc (a *Assertions) EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualExportedValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualExportedValuesf asserts that the types of two objects are equal and their public\n// fields are also equal. This is useful for comparing structs that have private fields\n// that could potentially differ.\n//\n//\t type S struct {\n//\t\tExported     \tint\n//\t\tnotExported   \tint\n//\t }\n//\t a.EqualExportedValuesf(S{1, 2}, S{1, 3}, \"error message %s\", \"formatted\") => true\n//\t a.EqualExportedValuesf(S{1, 2}, S{2, 3}, \"error message %s\", \"formatted\") => false\nfunc (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualExportedValuesf(a.t, expected, actual, msg, args...)\n}\n\n// EqualValues asserts that two objects are equal or convertible to the larger\n// type and equal.\n//\n//\ta.EqualValues(uint32(123), int32(123))\nfunc (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualValuesf asserts that two objects are equal or convertible to the larger\n// type and equal.\n//\n//\ta.EqualValuesf(uint32(123), int32(123), \"error message %s\", \"formatted\")\nfunc (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualValuesf(a.t, expected, actual, msg, args...)\n}\n\n// Equalf asserts that two objects are equal.\n//\n//\ta.Equalf(123, 123, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualf(a.t, expected, actual, msg, args...)\n}\n\n// Error asserts that a function returned a non-nil error (ie. an error).\n//\n//\tactualObj, err := SomeFunction()\n//\ta.Error(err)\nfunc (a *Assertions) Error(err error, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tError(a.t, err, msgAndArgs...)\n}\n\n// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.\n// This is a wrapper for errors.As.\nfunc (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tErrorAs(a.t, err, target, msgAndArgs...)\n}\n\n// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.\n// This is a wrapper for errors.As.\nfunc (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tErrorAsf(a.t, err, target, msg, args...)\n}\n\n// ErrorContains asserts that a function returned a non-nil error (i.e. an\n// error) and that the error contains the specified substring.\n//\n//\tactualObj, err := SomeFunction()\n//\ta.ErrorContains(err,  expectedErrorSubString)\nfunc (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tErrorContains(a.t, theError, contains, msgAndArgs...)\n}\n\n// ErrorContainsf asserts that a function returned a non-nil error (i.e. an\n// error) and that the error contains the specified substring.\n//\n//\tactualObj, err := SomeFunction()\n//\ta.ErrorContainsf(err,  expectedErrorSubString, \"error message %s\", \"formatted\")\nfunc (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tErrorContainsf(a.t, theError, contains, msg, args...)\n}\n\n// ErrorIs asserts that at least one of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tErrorIs(a.t, err, target, msgAndArgs...)\n}\n\n// ErrorIsf asserts that at least one of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tErrorIsf(a.t, err, target, msg, args...)\n}\n\n// Errorf asserts that a function returned a non-nil error (ie. an error).\n//\n//\tactualObj, err := SomeFunction()\n//\ta.Errorf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Errorf(err error, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tErrorf(a.t, err, msg, args...)\n}\n\n// Eventually asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick.\n//\n//\ta.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond)\nfunc (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEventually(a.t, condition, waitFor, tick, msgAndArgs...)\n}\n\n// EventuallyWithT asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick. In contrast to Eventually,\n// it supplies a CollectT to the condition function, so that the condition\n// function can use the CollectT to call other assertions.\n// The condition is considered \"met\" if no errors are raised in a tick.\n// The supplied CollectT collects all errors from one tick (if there are any).\n// If the condition is not met before waitFor, the collected errors of\n// the last tick are copied to t.\n//\n//\texternalValue := false\n//\tgo func() {\n//\t\ttime.Sleep(8*time.Second)\n//\t\texternalValue = true\n//\t}()\n//\ta.EventuallyWithT(func(c *assert.CollectT) {\n//\t\t// add assertions as needed; any assertion failure will fail the current tick\n//\t\tassert.True(c, externalValue, \"expected 'externalValue' to be true\")\n//\t}, 10*time.Second, 1*time.Second, \"external state has not changed to 'true'; still false\")\nfunc (a *Assertions) EventuallyWithT(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEventuallyWithT(a.t, condition, waitFor, tick, msgAndArgs...)\n}\n\n// EventuallyWithTf asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick. In contrast to Eventually,\n// it supplies a CollectT to the condition function, so that the condition\n// function can use the CollectT to call other assertions.\n// The condition is considered \"met\" if no errors are raised in a tick.\n// The supplied CollectT collects all errors from one tick (if there are any).\n// If the condition is not met before waitFor, the collected errors of\n// the last tick are copied to t.\n//\n//\texternalValue := false\n//\tgo func() {\n//\t\ttime.Sleep(8*time.Second)\n//\t\texternalValue = true\n//\t}()\n//\ta.EventuallyWithTf(func(c *assert.CollectT) {\n//\t\t// add assertions as needed; any assertion failure will fail the current tick\n//\t\tassert.True(c, externalValue, \"expected 'externalValue' to be true\")\n//\t}, 10*time.Second, 1*time.Second, \"error message %s\", \"formatted\")\nfunc (a *Assertions) EventuallyWithTf(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEventuallyWithTf(a.t, condition, waitFor, tick, msg, args...)\n}\n\n// Eventuallyf asserts that given condition will be met in waitFor time,\n// periodically checking target function each tick.\n//\n//\ta.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEventuallyf(a.t, condition, waitFor, tick, msg, args...)\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//\ta.Exactly(int32(123), int64(123))\nfunc (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tExactly(a.t, expected, actual, msgAndArgs...)\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//\ta.Exactlyf(int32(123), int64(123), \"error message %s\", \"formatted\")\nfunc (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tExactlyf(a.t, expected, actual, msg, args...)\n}\n\n// Fail reports a failure through\nfunc (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFail(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNow fails test\nfunc (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFailNow(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNowf fails test\nfunc (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFailNowf(a.t, failureMessage, msg, args...)\n}\n\n// Failf reports a failure through\nfunc (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFailf(a.t, failureMessage, msg, args...)\n}\n\n// False asserts that the specified value is false.\n//\n//\ta.False(myBool)\nfunc (a *Assertions) False(value bool, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFalse(a.t, value, msgAndArgs...)\n}\n\n// Falsef asserts that the specified value is false.\n//\n//\ta.Falsef(myBool, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Falsef(value bool, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFalsef(a.t, value, msg, args...)\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if\n// the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFileExists(a.t, path, msgAndArgs...)\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if\n// the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFileExistsf(a.t, path, msg, args...)\n}\n\n// Greater asserts that the first element is greater than the second\n//\n//\ta.Greater(2, 1)\n//\ta.Greater(float64(2), float64(1))\n//\ta.Greater(\"b\", \"a\")\nfunc (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tGreater(a.t, e1, e2, msgAndArgs...)\n}\n\n// GreaterOrEqual asserts that the first element is greater than or equal to the second\n//\n//\ta.GreaterOrEqual(2, 1)\n//\ta.GreaterOrEqual(2, 2)\n//\ta.GreaterOrEqual(\"b\", \"a\")\n//\ta.GreaterOrEqual(\"b\", \"b\")\nfunc (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tGreaterOrEqual(a.t, e1, e2, msgAndArgs...)\n}\n\n// GreaterOrEqualf asserts that the first element is greater than or equal to the second\n//\n//\ta.GreaterOrEqualf(2, 1, \"error message %s\", \"formatted\")\n//\ta.GreaterOrEqualf(2, 2, \"error message %s\", \"formatted\")\n//\ta.GreaterOrEqualf(\"b\", \"a\", \"error message %s\", \"formatted\")\n//\ta.GreaterOrEqualf(\"b\", \"b\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tGreaterOrEqualf(a.t, e1, e2, msg, args...)\n}\n\n// Greaterf asserts that the first element is greater than the second\n//\n//\ta.Greaterf(2, 1, \"error message %s\", \"formatted\")\n//\ta.Greaterf(float64(2), float64(1), \"error message %s\", \"formatted\")\n//\ta.Greaterf(\"b\", \"a\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tGreaterf(a.t, e1, e2, msg, args...)\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//\ta.HTTPBodyContains(myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\")\nfunc (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//\ta.HTTPBodyContainsf(myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//\ta.HTTPBodyNotContains(myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\")\nfunc (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//\ta.HTTPBodyNotContainsf(myHandler, \"GET\", \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//\ta.HTTPError(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\nfunc (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPError(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//\ta.HTTPErrorf(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\nfunc (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPErrorf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//\ta.HTTPRedirect(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\nfunc (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//\ta.HTTPRedirectf(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\nfunc (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPRedirectf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPStatusCode asserts that a specified handler returns a specified status code.\n//\n//\ta.HTTPStatusCode(myHandler, \"GET\", \"/notImplemented\", nil, 501)\nfunc (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...)\n}\n\n// HTTPStatusCodef asserts that a specified handler returns a specified status code.\n//\n//\ta.HTTPStatusCodef(myHandler, \"GET\", \"/notImplemented\", nil, 501, \"error message %s\", \"formatted\")\nfunc (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...)\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//\ta.HTTPSuccess(myHandler, \"POST\", \"http://www.google.com\", nil)\nfunc (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//\ta.HTTPSuccessf(myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\nfunc (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPSuccessf(a.t, handler, method, url, values, msg, args...)\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//\ta.Implements((*MyInterface)(nil), new(MyObject))\nfunc (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tImplements(a.t, interfaceObject, object, msgAndArgs...)\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//\ta.Implementsf((*MyInterface)(nil), new(MyObject), \"error message %s\", \"formatted\")\nfunc (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tImplementsf(a.t, interfaceObject, object, msg, args...)\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n//\ta.InDelta(math.Pi, 22/7.0, 0.01)\nfunc (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDelta(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaSlicef(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n//\ta.InDeltaf(math.Pi, 22/7.0, 0.01, \"error message %s\", \"formatted\")\nfunc (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\nfunc (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\nfunc (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInEpsilonf(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// IsDecreasing asserts that the collection is decreasing\n//\n//\ta.IsDecreasing([]int{2, 1, 0})\n//\ta.IsDecreasing([]float{2, 1})\n//\ta.IsDecreasing([]string{\"b\", \"a\"})\nfunc (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsDecreasing(a.t, object, msgAndArgs...)\n}\n\n// IsDecreasingf asserts that the collection is decreasing\n//\n//\ta.IsDecreasingf([]int{2, 1, 0}, \"error message %s\", \"formatted\")\n//\ta.IsDecreasingf([]float{2, 1}, \"error message %s\", \"formatted\")\n//\ta.IsDecreasingf([]string{\"b\", \"a\"}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsDecreasingf(a.t, object, msg, args...)\n}\n\n// IsIncreasing asserts that the collection is increasing\n//\n//\ta.IsIncreasing([]int{1, 2, 3})\n//\ta.IsIncreasing([]float{1, 2})\n//\ta.IsIncreasing([]string{\"a\", \"b\"})\nfunc (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsIncreasing(a.t, object, msgAndArgs...)\n}\n\n// IsIncreasingf asserts that the collection is increasing\n//\n//\ta.IsIncreasingf([]int{1, 2, 3}, \"error message %s\", \"formatted\")\n//\ta.IsIncreasingf([]float{1, 2}, \"error message %s\", \"formatted\")\n//\ta.IsIncreasingf([]string{\"a\", \"b\"}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsIncreasingf(a.t, object, msg, args...)\n}\n\n// IsNonDecreasing asserts that the collection is not decreasing\n//\n//\ta.IsNonDecreasing([]int{1, 1, 2})\n//\ta.IsNonDecreasing([]float{1, 2})\n//\ta.IsNonDecreasing([]string{\"a\", \"b\"})\nfunc (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsNonDecreasing(a.t, object, msgAndArgs...)\n}\n\n// IsNonDecreasingf asserts that the collection is not decreasing\n//\n//\ta.IsNonDecreasingf([]int{1, 1, 2}, \"error message %s\", \"formatted\")\n//\ta.IsNonDecreasingf([]float{1, 2}, \"error message %s\", \"formatted\")\n//\ta.IsNonDecreasingf([]string{\"a\", \"b\"}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsNonDecreasingf(a.t, object, msg, args...)\n}\n\n// IsNonIncreasing asserts that the collection is not increasing\n//\n//\ta.IsNonIncreasing([]int{2, 1, 1})\n//\ta.IsNonIncreasing([]float{2, 1})\n//\ta.IsNonIncreasing([]string{\"b\", \"a\"})\nfunc (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsNonIncreasing(a.t, object, msgAndArgs...)\n}\n\n// IsNonIncreasingf asserts that the collection is not increasing\n//\n//\ta.IsNonIncreasingf([]int{2, 1, 1}, \"error message %s\", \"formatted\")\n//\ta.IsNonIncreasingf([]float{2, 1}, \"error message %s\", \"formatted\")\n//\ta.IsNonIncreasingf([]string{\"b\", \"a\"}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsNonIncreasingf(a.t, object, msg, args...)\n}\n\n// IsNotType asserts that the specified objects are not of the same type.\n//\n//\ta.IsNotType(&NotMyStruct{}, &MyStruct{})\nfunc (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsNotType(a.t, theType, object, msgAndArgs...)\n}\n\n// IsNotTypef asserts that the specified objects are not of the same type.\n//\n//\ta.IsNotTypef(&NotMyStruct{}, &MyStruct{}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsNotTypef(a.t, theType, object, msg, args...)\n}\n\n// IsType asserts that the specified objects are of the same type.\n//\n//\ta.IsType(&MyStruct{}, &MyStruct{})\nfunc (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsType(a.t, expectedType, object, msgAndArgs...)\n}\n\n// IsTypef asserts that the specified objects are of the same type.\n//\n//\ta.IsTypef(&MyStruct{}, &MyStruct{}, \"error message %s\", \"formatted\")\nfunc (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsTypef(a.t, expectedType, object, msg, args...)\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//\ta.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\nfunc (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tJSONEq(a.t, expected, actual, msgAndArgs...)\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//\ta.JSONEqf(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\nfunc (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tJSONEqf(a.t, expected, actual, msg, args...)\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//\ta.Len(mySlice, 3)\nfunc (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tLen(a.t, object, length, msgAndArgs...)\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//\ta.Lenf(mySlice, 3, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tLenf(a.t, object, length, msg, args...)\n}\n\n// Less asserts that the first element is less than the second\n//\n//\ta.Less(1, 2)\n//\ta.Less(float64(1), float64(2))\n//\ta.Less(\"a\", \"b\")\nfunc (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tLess(a.t, e1, e2, msgAndArgs...)\n}\n\n// LessOrEqual asserts that the first element is less than or equal to the second\n//\n//\ta.LessOrEqual(1, 2)\n//\ta.LessOrEqual(2, 2)\n//\ta.LessOrEqual(\"a\", \"b\")\n//\ta.LessOrEqual(\"b\", \"b\")\nfunc (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tLessOrEqual(a.t, e1, e2, msgAndArgs...)\n}\n\n// LessOrEqualf asserts that the first element is less than or equal to the second\n//\n//\ta.LessOrEqualf(1, 2, \"error message %s\", \"formatted\")\n//\ta.LessOrEqualf(2, 2, \"error message %s\", \"formatted\")\n//\ta.LessOrEqualf(\"a\", \"b\", \"error message %s\", \"formatted\")\n//\ta.LessOrEqualf(\"b\", \"b\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tLessOrEqualf(a.t, e1, e2, msg, args...)\n}\n\n// Lessf asserts that the first element is less than the second\n//\n//\ta.Lessf(1, 2, \"error message %s\", \"formatted\")\n//\ta.Lessf(float64(1), float64(2), \"error message %s\", \"formatted\")\n//\ta.Lessf(\"a\", \"b\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tLessf(a.t, e1, e2, msg, args...)\n}\n\n// Negative asserts that the specified element is negative\n//\n//\ta.Negative(-1)\n//\ta.Negative(-1.23)\nfunc (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNegative(a.t, e, msgAndArgs...)\n}\n\n// Negativef asserts that the specified element is negative\n//\n//\ta.Negativef(-1, \"error message %s\", \"formatted\")\n//\ta.Negativef(-1.23, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNegativef(a.t, e, msg, args...)\n}\n\n// Never asserts that the given condition doesn't satisfy in waitFor time,\n// periodically checking the target function each tick.\n//\n//\ta.Never(func() bool { return false; }, time.Second, 10*time.Millisecond)\nfunc (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNever(a.t, condition, waitFor, tick, msgAndArgs...)\n}\n\n// Neverf asserts that the given condition doesn't satisfy in waitFor time,\n// periodically checking the target function each tick.\n//\n//\ta.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNeverf(a.t, condition, waitFor, tick, msg, args...)\n}\n\n// Nil asserts that the specified object is nil.\n//\n//\ta.Nil(err)\nfunc (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNil(a.t, object, msgAndArgs...)\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//\ta.Nilf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNilf(a.t, object, msg, args...)\n}\n\n// NoDirExists checks whether a directory does not exist in the given path.\n// It fails if the path points to an existing _directory_ only.\nfunc (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNoDirExists(a.t, path, msgAndArgs...)\n}\n\n// NoDirExistsf checks whether a directory does not exist in the given path.\n// It fails if the path points to an existing _directory_ only.\nfunc (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNoDirExistsf(a.t, path, msg, args...)\n}\n\n// NoError asserts that a function returned a nil error (ie. no error).\n//\n//\tactualObj, err := SomeFunction()\n//\ta.NoError(err)\n//\ta.Equal(expectedObj, actualObj)\nfunc (a *Assertions) NoError(err error, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNoError(a.t, err, msgAndArgs...)\n}\n\n// NoErrorf asserts that a function returned a nil error (ie. no error).\n//\n//\tactualObj, err := SomeFunction()\n//\ta.NoErrorf(err, \"error message %s\", \"formatted\")\n//\ta.Equal(expectedObj, actualObj)\nfunc (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNoErrorf(a.t, err, msg, args...)\n}\n\n// NoFileExists checks whether a file does not exist in a given path. It fails\n// if the path points to an existing _file_ only.\nfunc (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNoFileExists(a.t, path, msgAndArgs...)\n}\n\n// NoFileExistsf checks whether a file does not exist in a given path. It fails\n// if the path points to an existing _file_ only.\nfunc (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNoFileExistsf(a.t, path, msg, args...)\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//\ta.NotContains(\"Hello World\", \"Earth\")\n//\ta.NotContains([\"Hello\", \"World\"], \"Earth\")\n//\ta.NotContains({\"Hello\": \"World\"}, \"Earth\")\nfunc (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotContains(a.t, s, contains, msgAndArgs...)\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//\ta.NotContainsf(\"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//\ta.NotContainsf([\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//\ta.NotContainsf({\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotContainsf(a.t, s, contains, msg, args...)\n}\n\n// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should not match.\n// This is an inverse of ElementsMatch.\n//\n// a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false\n//\n// a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true\n//\n// a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true\nfunc (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotElementsMatch(a.t, listA, listB, msgAndArgs...)\n}\n\n// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should not match.\n// This is an inverse of ElementsMatch.\n//\n// a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], \"error message %s\", \"formatted\") -> false\n//\n// a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], \"error message %s\", \"formatted\") -> true\n//\n// a.NotElementsMatchf([1, 2, 3], [1, 2, 4], \"error message %s\", \"formatted\") -> true\nfunc (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotElementsMatchf(a.t, listA, listB, msg, args...)\n}\n\n// NotEmpty asserts that the specified object is NOT [Empty].\n//\n//\ta.NotEmpty(obj)\n//\ta.Equal(\"two\", obj[1])\nfunc (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEmpty(a.t, object, msgAndArgs...)\n}\n\n// NotEmptyf asserts that the specified object is NOT [Empty].\n//\n//\ta.NotEmptyf(obj, \"error message %s\", \"formatted\")\n//\ta.Equal(\"two\", obj[1])\nfunc (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEmptyf(a.t, object, msg, args...)\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//\ta.NotEqual(obj1, obj2)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEqual(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotEqualValues asserts that two objects are not equal even when converted to the same type\n//\n//\ta.NotEqualValues(obj1, obj2)\nfunc (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEqualValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotEqualValuesf asserts that two objects are not equal even when converted to the same type\n//\n//\ta.NotEqualValuesf(obj1, obj2, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEqualValuesf(a.t, expected, actual, msg, args...)\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//\ta.NotEqualf(obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEqualf(a.t, expected, actual, msg, args...)\n}\n\n// NotErrorAs asserts that none of the errors in err's chain matches target,\n// but if so, sets target to that error value.\nfunc (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotErrorAs(a.t, err, target, msgAndArgs...)\n}\n\n// NotErrorAsf asserts that none of the errors in err's chain matches target,\n// but if so, sets target to that error value.\nfunc (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotErrorAsf(a.t, err, target, msg, args...)\n}\n\n// NotErrorIs asserts that none of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotErrorIs(a.t, err, target, msgAndArgs...)\n}\n\n// NotErrorIsf asserts that none of the errors in err's chain matches target.\n// This is a wrapper for errors.Is.\nfunc (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotErrorIsf(a.t, err, target, msg, args...)\n}\n\n// NotImplements asserts that an object does not implement the specified interface.\n//\n//\ta.NotImplements((*MyInterface)(nil), new(MyObject))\nfunc (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotImplements(a.t, interfaceObject, object, msgAndArgs...)\n}\n\n// NotImplementsf asserts that an object does not implement the specified interface.\n//\n//\ta.NotImplementsf((*MyInterface)(nil), new(MyObject), \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotImplementsf(a.t, interfaceObject, object, msg, args...)\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//\ta.NotNil(err)\nfunc (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotNil(a.t, object, msgAndArgs...)\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//\ta.NotNilf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotNilf(a.t, object, msg, args...)\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//\ta.NotPanics(func(){ RemainCalm() })\nfunc (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotPanics(a.t, f, msgAndArgs...)\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//\ta.NotPanicsf(func(){ RemainCalm() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotPanicsf(a.t, f, msg, args...)\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//\ta.NotRegexp(regexp.MustCompile(\"starts\"), \"it's starting\")\n//\ta.NotRegexp(\"^start\", \"it's not starting\")\nfunc (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotRegexp(a.t, rx, str, msgAndArgs...)\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//\ta.NotRegexpf(regexp.MustCompile(\"starts\"), \"it's starting\", \"error message %s\", \"formatted\")\n//\ta.NotRegexpf(\"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotRegexpf(a.t, rx, str, msg, args...)\n}\n\n// NotSame asserts that two pointers do not reference the same object.\n//\n//\ta.NotSame(ptr1, ptr2)\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotSame(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotSamef asserts that two pointers do not reference the same object.\n//\n//\ta.NotSamef(ptr1, ptr2, \"error message %s\", \"formatted\")\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotSamef(a.t, expected, actual, msg, args...)\n}\n\n// NotSubset asserts that the list (array, slice, or map) does NOT contain all\n// elements given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\ta.NotSubset([1, 3, 4], [1, 2])\n//\ta.NotSubset({\"x\": 1, \"y\": 2}, {\"z\": 3})\n//\ta.NotSubset([1, 3, 4], {1: \"one\", 2: \"two\"})\n//\ta.NotSubset({\"x\": 1, \"y\": 2}, [\"z\"])\nfunc (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotSubset(a.t, list, subset, msgAndArgs...)\n}\n\n// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all\n// elements given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\ta.NotSubsetf([1, 3, 4], [1, 2], \"error message %s\", \"formatted\")\n//\ta.NotSubsetf({\"x\": 1, \"y\": 2}, {\"z\": 3}, \"error message %s\", \"formatted\")\n//\ta.NotSubsetf([1, 3, 4], {1: \"one\", 2: \"two\"}, \"error message %s\", \"formatted\")\n//\ta.NotSubsetf({\"x\": 1, \"y\": 2}, [\"z\"], \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotSubsetf(a.t, list, subset, msg, args...)\n}\n\n// NotZero asserts that i is not the zero value for its type.\nfunc (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotZero(a.t, i, msgAndArgs...)\n}\n\n// NotZerof asserts that i is not the zero value for its type.\nfunc (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotZerof(a.t, i, msg, args...)\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//\ta.Panics(func(){ GoCrazy() })\nfunc (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanics(a.t, f, msgAndArgs...)\n}\n\n// PanicsWithError asserts that the code inside the specified PanicTestFunc\n// panics, and that the recovered panic value is an error that satisfies the\n// EqualError comparison.\n//\n//\ta.PanicsWithError(\"crazy error\", func(){ GoCrazy() })\nfunc (a *Assertions) PanicsWithError(errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanicsWithError(a.t, errString, f, msgAndArgs...)\n}\n\n// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc\n// panics, and that the recovered panic value is an error that satisfies the\n// EqualError comparison.\n//\n//\ta.PanicsWithErrorf(\"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) PanicsWithErrorf(errString string, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanicsWithErrorf(a.t, errString, f, msg, args...)\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//\ta.PanicsWithValue(\"crazy error\", func(){ GoCrazy() })\nfunc (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanicsWithValue(a.t, expected, f, msgAndArgs...)\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//\ta.PanicsWithValuef(\"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanicsWithValuef(a.t, expected, f, msg, args...)\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//\ta.Panicsf(func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanicsf(a.t, f, msg, args...)\n}\n\n// Positive asserts that the specified element is positive\n//\n//\ta.Positive(1)\n//\ta.Positive(1.23)\nfunc (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPositive(a.t, e, msgAndArgs...)\n}\n\n// Positivef asserts that the specified element is positive\n//\n//\ta.Positivef(1, \"error message %s\", \"formatted\")\n//\ta.Positivef(1.23, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPositivef(a.t, e, msg, args...)\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//\ta.Regexp(regexp.MustCompile(\"start\"), \"it's starting\")\n//\ta.Regexp(\"start...$\", \"it's not starting\")\nfunc (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tRegexp(a.t, rx, str, msgAndArgs...)\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//\ta.Regexpf(regexp.MustCompile(\"start\"), \"it's starting\", \"error message %s\", \"formatted\")\n//\ta.Regexpf(\"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tRegexpf(a.t, rx, str, msg, args...)\n}\n\n// Same asserts that two pointers reference the same object.\n//\n//\ta.Same(ptr1, ptr2)\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tSame(a.t, expected, actual, msgAndArgs...)\n}\n\n// Samef asserts that two pointers reference the same object.\n//\n//\ta.Samef(ptr1, ptr2, \"error message %s\", \"formatted\")\n//\n// Both arguments must be pointer variables. Pointer variable sameness is\n// determined based on the equality of both type and value.\nfunc (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tSamef(a.t, expected, actual, msg, args...)\n}\n\n// Subset asserts that the list (array, slice, or map) contains all elements\n// given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\ta.Subset([1, 2, 3], [1, 2])\n//\ta.Subset({\"x\": 1, \"y\": 2}, {\"x\": 1})\n//\ta.Subset([1, 2, 3], {1: \"one\", 2: \"two\"})\n//\ta.Subset({\"x\": 1, \"y\": 2}, [\"x\"])\nfunc (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tSubset(a.t, list, subset, msgAndArgs...)\n}\n\n// Subsetf asserts that the list (array, slice, or map) contains all elements\n// given in the subset (array, slice, or map).\n// Map elements are key-value pairs unless compared with an array or slice where\n// only the map key is evaluated.\n//\n//\ta.Subsetf([1, 2, 3], [1, 2], \"error message %s\", \"formatted\")\n//\ta.Subsetf({\"x\": 1, \"y\": 2}, {\"x\": 1}, \"error message %s\", \"formatted\")\n//\ta.Subsetf([1, 2, 3], {1: \"one\", 2: \"two\"}, \"error message %s\", \"formatted\")\n//\ta.Subsetf({\"x\": 1, \"y\": 2}, [\"x\"], \"error message %s\", \"formatted\")\nfunc (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tSubsetf(a.t, list, subset, msg, args...)\n}\n\n// True asserts that the specified value is true.\n//\n//\ta.True(myBool)\nfunc (a *Assertions) True(value bool, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tTrue(a.t, value, msgAndArgs...)\n}\n\n// Truef asserts that the specified value is true.\n//\n//\ta.Truef(myBool, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Truef(value bool, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tTruef(a.t, value, msg, args...)\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//\ta.WithinDuration(time.Now(), time.Now(), 10*time.Second)\nfunc (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tWithinDuration(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//\ta.WithinDurationf(time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\nfunc (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tWithinDurationf(a.t, expected, actual, delta, msg, args...)\n}\n\n// WithinRange asserts that a time is within a time range (inclusive).\n//\n//\ta.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))\nfunc (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tWithinRange(a.t, actual, start, end, msgAndArgs...)\n}\n\n// WithinRangef asserts that a time is within a time range (inclusive).\n//\n//\ta.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), \"error message %s\", \"formatted\")\nfunc (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tWithinRangef(a.t, actual, start, end, msg, args...)\n}\n\n// YAMLEq asserts that the first documents in the two YAML strings are equivalent.\n//\n//\texpected := `---\n//\tkey: value\n//\t---\n//\tkey: this is a second document, it is not evaluated\n//\t`\n//\tactual := `---\n//\tkey: value\n//\t---\n//\tkey: this is a subsequent document, it is not evaluated\n//\t`\n//\ta.YAMLEq(expected, actual)\nfunc (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tYAMLEq(a.t, expected, actual, msgAndArgs...)\n}\n\n// YAMLEqf asserts that the first documents in the two YAML strings are equivalent.\n//\n//\texpected := `---\n//\tkey: value\n//\t---\n//\tkey: this is a second document, it is not evaluated\n//\t`\n//\tactual := `---\n//\tkey: value\n//\t---\n//\tkey: this is a subsequent document, it is not evaluated\n//\t`\n//\ta.YAMLEqf(expected, actual, \"error message %s\", \"formatted\")\nfunc (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tYAMLEqf(a.t, expected, actual, msg, args...)\n}\n\n// Zero asserts that i is the zero value for its type.\nfunc (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tZero(a.t, i, msgAndArgs...)\n}\n\n// Zerof asserts that i is the zero value for its type.\nfunc (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tZerof(a.t, i, msg, args...)\n}\n"
  },
  {
    "path": "require/require_forward.go.tmpl",
    "content": "{{.CommentRequireWithoutT \"a\"}}\nfunc (a *Assertions) {{.DocInfo.Name}}({{.Params}}) {\n\tif h, ok := a.t.(tHelper); ok { h.Helper() }\n\t{{.DocInfo.Name}}(a.t, {{.ForwardedParams}})\n}\n"
  },
  {
    "path": "require/requirements.go",
    "content": "package require\n\n// TestingT is an interface wrapper around *testing.T\ntype TestingT interface {\n\tErrorf(format string, args ...interface{})\n\tFailNow()\n}\n\ntype tHelper = interface {\n\tHelper()\n}\n\n// ComparisonAssertionFunc is a common function prototype when comparing two values.  Can be useful\n// for table driven tests.\ntype ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{})\n\n// ValueAssertionFunc is a common function prototype when validating a single value.  Can be useful\n// for table driven tests.\ntype ValueAssertionFunc func(TestingT, interface{}, ...interface{})\n\n// BoolAssertionFunc is a common function prototype when validating a bool value.  Can be useful\n// for table driven tests.\ntype BoolAssertionFunc func(TestingT, bool, ...interface{})\n\n// ErrorAssertionFunc is a common function prototype when validating an error value.  Can be useful\n// for table driven tests.\ntype ErrorAssertionFunc func(TestingT, error, ...interface{})\n\n//go:generate sh -c \"cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require.go.tmpl -include-format-funcs\"\n"
  },
  {
    "path": "require/requirements_test.go",
    "content": "package require\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\n// AssertionTesterInterface defines an interface to be used for testing assertion methods\ntype AssertionTesterInterface interface {\n\tTestMethod()\n}\n\n// AssertionTesterConformingObject is an object that conforms to the AssertionTesterInterface interface\ntype AssertionTesterConformingObject struct {\n}\n\nfunc (a *AssertionTesterConformingObject) TestMethod() {\n}\n\n// AssertionTesterNonConformingObject is an object that does not conform to the AssertionTesterInterface interface\ntype AssertionTesterNonConformingObject struct {\n}\n\ntype MockT struct {\n\tFailed bool\n}\n\n// Helper is like [testing.T.Helper] but does nothing.\nfunc (MockT) Helper() {}\n\nfunc (t *MockT) FailNow() {\n\tt.Failed = true\n}\n\nfunc (t *MockT) Errorf(format string, args ...interface{}) {\n\t_, _ = format, args\n}\n\nfunc TestImplements(t *testing.T) {\n\tt.Parallel()\n\n\tImplements(t, (*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tImplements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestIsType(t *testing.T) {\n\tt.Parallel()\n\n\tIsType(t, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tIsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEqual(t *testing.T) {\n\tt.Parallel()\n\n\tEqual(t, 1, 1)\n\n\tmockT := new(MockT)\n\tEqual(mockT, 1, 2)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n\n}\n\nfunc TestNotEqual(t *testing.T) {\n\tt.Parallel()\n\n\tNotEqual(t, 1, 2)\n\tmockT := new(MockT)\n\tNotEqual(mockT, 2, 2)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestExactly(t *testing.T) {\n\tt.Parallel()\n\n\ta := float32(1)\n\tb := float32(1)\n\tc := float64(1)\n\n\tExactly(t, a, b)\n\n\tmockT := new(MockT)\n\tExactly(mockT, a, c)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotNil(t *testing.T) {\n\tt.Parallel()\n\n\tNotNil(t, new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tNotNil(mockT, nil)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNil(t *testing.T) {\n\tt.Parallel()\n\n\tNil(t, nil)\n\n\tmockT := new(MockT)\n\tNil(mockT, new(AssertionTesterConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestTrue(t *testing.T) {\n\tt.Parallel()\n\n\tTrue(t, true)\n\n\tmockT := new(MockT)\n\tTrue(mockT, false)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestFalse(t *testing.T) {\n\tt.Parallel()\n\n\tFalse(t, false)\n\n\tmockT := new(MockT)\n\tFalse(mockT, true)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestContains(t *testing.T) {\n\tt.Parallel()\n\n\tContains(t, \"Hello World\", \"Hello\")\n\n\tmockT := new(MockT)\n\tContains(mockT, \"Hello World\", \"Salut\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotContains(t *testing.T) {\n\tt.Parallel()\n\n\tNotContains(t, \"Hello World\", \"Hello!\")\n\n\tmockT := new(MockT)\n\tNotContains(mockT, \"Hello World\", \"Hello\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestPanics(t *testing.T) {\n\tt.Parallel()\n\n\tPanics(t, func() {\n\t\tpanic(\"Panic!\")\n\t})\n\n\tmockT := new(MockT)\n\tPanics(mockT, func() {})\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotPanics(t *testing.T) {\n\tt.Parallel()\n\n\tNotPanics(t, func() {})\n\n\tmockT := new(MockT)\n\tNotPanics(mockT, func() {\n\t\tpanic(\"Panic!\")\n\t})\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNoError(t *testing.T) {\n\tt.Parallel()\n\n\tNoError(t, nil)\n\n\tmockT := new(MockT)\n\tNoError(mockT, errors.New(\"some error\"))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestError(t *testing.T) {\n\tt.Parallel()\n\n\tError(t, errors.New(\"some error\"))\n\n\tmockT := new(MockT)\n\tError(mockT, nil)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestErrorContains(t *testing.T) {\n\tt.Parallel()\n\n\tErrorContains(t, errors.New(\"some error: another error\"), \"some error\")\n\n\tmockT := new(MockT)\n\tErrorContains(mockT, errors.New(\"some error\"), \"different error\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEqualError(t *testing.T) {\n\tt.Parallel()\n\n\tEqualError(t, errors.New(\"some error\"), \"some error\")\n\n\tmockT := new(MockT)\n\tEqualError(mockT, errors.New(\"some error\"), \"Not some error\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEmpty(t *testing.T) {\n\tt.Parallel()\n\n\tEmpty(t, \"\")\n\n\tmockT := new(MockT)\n\tEmpty(mockT, \"x\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotEmpty(t *testing.T) {\n\tt.Parallel()\n\n\tNotEmpty(t, \"x\")\n\n\tmockT := new(MockT)\n\tNotEmpty(mockT, \"\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestWithinDuration(t *testing.T) {\n\tt.Parallel()\n\n\ta := time.Now()\n\tb := a.Add(10 * time.Second)\n\n\tWithinDuration(t, a, b, 15*time.Second)\n\n\tmockT := new(MockT)\n\tWithinDuration(mockT, a, b, 5*time.Second)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestInDelta(t *testing.T) {\n\tt.Parallel()\n\n\tInDelta(t, 1.001, 1, 0.01)\n\n\tmockT := new(MockT)\n\tInDelta(mockT, 1, 2, 0.5)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestZero(t *testing.T) {\n\tt.Parallel()\n\n\tZero(t, \"\")\n\n\tmockT := new(MockT)\n\tZero(mockT, \"x\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotZero(t *testing.T) {\n\tt.Parallel()\n\n\tNotZero(t, \"x\")\n\n\tmockT := new(MockT)\n\tNotZero(mockT, \"\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_EqualSONString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEq_EquivalentButNotEqual(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEq_HashOfArraysAndHashes(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, \"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]],\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\"\\r\\n}\",\n\t\t\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\",\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]]\\r\\n}\")\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEq_Array(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEq_HashAndArrayNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_HashesNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, `{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_ActualIsNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, `{\"foo\": \"bar\"}`, \"Not JSON\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_ExpectedIsNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, \"Not JSON\", `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_ExpectedAndActualNotJSON(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, \"Not JSON\", \"Not JSON\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_ArraysOfDifferentOrder(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tJSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEq_EqualYAMLString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tYAMLEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEq_EquivalentButNotEqual(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tYAMLEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEq_HashOfArraysAndHashes(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\texpected := `\nnumeric: 1.5\narray:\n  - foo: bar\n  - 1\n  - \"string\"\n  - [\"nested\", \"array\", 5.5]\nhash:\n  nested: hash\n  nested_slice: [this, is, nested]\nstring: \"foo\"\n`\n\n\tactual := `\nnumeric: 1.5\nhash:\n  nested: hash\n  nested_slice: [this, is, nested]\nstring: \"foo\"\narray:\n  - foo: bar\n  - 1\n  - \"string\"\n  - [\"nested\", \"array\", 5.5]\n`\n\tYAMLEq(mockT, expected, actual)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEq_Array(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tYAMLEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEq_HashAndArrayNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tYAMLEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEq_HashesNotEquivalent(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tYAMLEq(mockT, `{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEq_ActualIsSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tYAMLEq(mockT, `{\"foo\": \"bar\"}`, \"Simple String\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEq_ExpectedIsSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tYAMLEq(mockT, \"Simple String\", `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestYAMLEq_ExpectedAndActualSimpleString(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tYAMLEq(mockT, \"Simple String\", \"Simple String\")\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestYAMLEq_ArraysOfDifferentOrder(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\tYAMLEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc ExampleComparisonAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tadder := func(x, y int) int {\n\t\treturn x + y\n\t}\n\n\ttype args struct {\n\t\tx int\n\t\ty int\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targs      args\n\t\texpect    int\n\t\tassertion ComparisonAssertionFunc\n\t}{\n\t\t{\"2+2=4\", args{2, 2}, 4, Equal},\n\t\t{\"2+2!=5\", args{2, 2}, 5, NotEqual},\n\t\t{\"2+3==5\", args{2, 3}, 5, Exactly},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.expect, adder(tt.args.x, tt.args.y))\n\t\t})\n\t}\n}\n\nfunc TestComparisonAssertionFunc(t *testing.T) {\n\tt.Parallel()\n\n\ttype iface interface {\n\t\tName() string\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\texpect    interface{}\n\t\tgot       interface{}\n\t\tassertion ComparisonAssertionFunc\n\t}{\n\t\t{\"implements\", (*iface)(nil), t, Implements},\n\t\t{\"isType\", (*testing.T)(nil), t, IsType},\n\t\t{\"equal\", t, t, Equal},\n\t\t{\"equalValues\", t, t, EqualValues},\n\t\t{\"exactly\", t, t, Exactly},\n\t\t{\"notEqual\", t, nil, NotEqual},\n\t\t{\"NotEqualValues\", t, nil, NotEqualValues},\n\t\t{\"notContains\", []int{1, 2, 3}, 4, NotContains},\n\t\t{\"subset\", []int{1, 2, 3, 4}, []int{2, 3}, Subset},\n\t\t{\"notSubset\", []int{1, 2, 3, 4}, []int{0, 3}, NotSubset},\n\t\t{\"elementsMatch\", []byte(\"abc\"), []byte(\"bac\"), ElementsMatch},\n\t\t{\"regexp\", \"^t.*y$\", \"testify\", Regexp},\n\t\t{\"notRegexp\", \"^t.*y$\", \"Testify\", NotRegexp},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.expect, tt.got)\n\t\t})\n\t}\n}\n\nfunc ExampleValueAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tdumbParse := func(input string) interface{} {\n\t\tvar x interface{}\n\t\tjson.Unmarshal([]byte(input), &x)\n\t\treturn x\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       string\n\t\tassertion ValueAssertionFunc\n\t}{\n\t\t{\"true is not nil\", \"true\", NotNil},\n\t\t{\"empty string is nil\", \"\", Nil},\n\t\t{\"zero is not nil\", \"0\", NotNil},\n\t\t{\"zero is zero\", \"0\", Zero},\n\t\t{\"false is zero\", \"false\", Zero},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, dumbParse(tt.arg))\n\t\t})\n\t}\n}\n\nfunc TestValueAssertionFunc(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname      string\n\t\tvalue     interface{}\n\t\tassertion ValueAssertionFunc\n\t}{\n\t\t{\"notNil\", true, NotNil},\n\t\t{\"nil\", nil, Nil},\n\t\t{\"empty\", []int{}, Empty},\n\t\t{\"notEmpty\", []int{1}, NotEmpty},\n\t\t{\"zero\", false, Zero},\n\t\t{\"notZero\", 42, NotZero},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.value)\n\t\t})\n\t}\n}\n\nfunc ExampleBoolAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tisOkay := func(x int) bool {\n\t\treturn x >= 42\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       int\n\t\tassertion BoolAssertionFunc\n\t}{\n\t\t{\"-1 is bad\", -1, False},\n\t\t{\"42 is good\", 42, True},\n\t\t{\"41 is bad\", 41, False},\n\t\t{\"45 is cool\", 45, True},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, isOkay(tt.arg))\n\t\t})\n\t}\n}\n\nfunc TestBoolAssertionFunc(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname      string\n\t\tvalue     bool\n\t\tassertion BoolAssertionFunc\n\t}{\n\t\t{\"true\", true, True},\n\t\t{\"false\", false, False},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.value)\n\t\t})\n\t}\n}\n\nfunc ExampleErrorAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tdumbParseNum := func(input string, v interface{}) error {\n\t\treturn json.Unmarshal([]byte(input), v)\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       string\n\t\tassertion ErrorAssertionFunc\n\t}{\n\t\t{\"1.2 is number\", \"1.2\", NoError},\n\t\t{\"1.2.3 not number\", \"1.2.3\", Error},\n\t\t{\"true is not number\", \"true\", Error},\n\t\t{\"3 is number\", \"3\", NoError},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tvar x float64\n\t\t\ttt.assertion(t, dumbParseNum(tt.arg, &x))\n\t\t})\n\t}\n}\n\nfunc TestErrorAssertionFunc(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname      string\n\t\terr       error\n\t\tassertion ErrorAssertionFunc\n\t}{\n\t\t{\"noError\", nil, NoError},\n\t\t{\"error\", errors.New(\"whoops\"), Error},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.err)\n\t\t})\n\t}\n}\n\nfunc TestEventuallyWithTFalse(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\n\tcondition := func(collect *assert.CollectT) {\n\t\tTrue(collect, false)\n\t}\n\n\tEventuallyWithT(mockT, condition, 100*time.Millisecond, 20*time.Millisecond)\n\tTrue(t, mockT.Failed, \"Check should fail\")\n}\n\nfunc TestEventuallyWithTTrue(t *testing.T) {\n\tt.Parallel()\n\n\tmockT := new(MockT)\n\n\tcounter := 0\n\tcondition := func(collect *assert.CollectT) {\n\t\tdefer func() {\n\t\t\tcounter += 1\n\t\t}()\n\t\tTrue(collect, counter == 1)\n\t}\n\n\tEventuallyWithT(mockT, condition, 100*time.Millisecond, 20*time.Millisecond)\n\tFalse(t, mockT.Failed, \"Check should pass\")\n\tEqual(t, 2, counter, \"Condition is expected to be called 2 times\")\n}\n"
  },
  {
    "path": "suite/doc.go",
    "content": "// Package suite contains logic for creating testing suite structs\n// and running the methods on those structs as tests.  The most useful\n// piece of this package is that you can create setup/teardown methods\n// on your testing suites, which will run before/after the whole suite\n// or individual tests (depending on which interface(s) you\n// implement).\n//\n// The suite package does not support parallel tests. See [issue 934].\n//\n// A testing suite is usually built by first extending the built-in\n// suite functionality from suite.Suite in testify.  Alternatively,\n// you could reproduce that logic on your own if you wanted (you\n// just need to implement the TestingSuite interface from\n// suite/interfaces.go).\n//\n// After that, you can implement any of the interfaces in\n// suite/interfaces.go to add setup/teardown functionality to your\n// suite, and add any methods that start with \"Test\" to add tests.\n// Methods that do not match any suite interfaces and do not begin\n// with \"Test\" will not be run by testify, and can safely be used as\n// helper methods.\n//\n// Once you've built your testing suite, you need to run the suite\n// (using suite.Run from testify) inside any function that matches the\n// identity that \"go test\" is already looking for (i.e.\n// func(*testing.T)).\n//\n// Regular expression to select test suites specified command-line\n// argument \"-run\". Regular expression to select the methods\n// of test suites specified command-line argument \"-m\".\n// Suite object has assertion methods.\n//\n// A crude example:\n//\n//\t// Basic imports\n//\timport (\n//\t    \"testing\"\n//\t    \"github.com/stretchr/testify/assert\"\n//\t    \"github.com/stretchr/testify/suite\"\n//\t)\n//\n//\t// Define the suite, and absorb the built-in basic suite\n//\t// functionality from testify - including a T() method which\n//\t// returns the current testing context\n//\ttype ExampleTestSuite struct {\n//\t    suite.Suite\n//\t    VariableThatShouldStartAtFive int\n//\t}\n//\n//\t// Make sure that VariableThatShouldStartAtFive is set to five\n//\t// before each test\n//\tfunc (suite *ExampleTestSuite) SetupTest() {\n//\t    suite.VariableThatShouldStartAtFive = 5\n//\t}\n//\n//\t// All methods that begin with \"Test\" are run as tests within a\n//\t// suite.\n//\tfunc (suite *ExampleTestSuite) TestExample() {\n//\t    assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive)\n//\t    suite.Equal(5, suite.VariableThatShouldStartAtFive)\n//\t}\n//\n//\t// In order for 'go test' to run this suite, we need to create\n//\t// a normal test function and pass our suite to suite.Run\n//\tfunc TestExampleTestSuite(t *testing.T) {\n//\t    suite.Run(t, new(ExampleTestSuite))\n//\t}\n//\n// [issue 934]: https://github.com/stretchr/testify/issues/934\npackage suite\n"
  },
  {
    "path": "suite/interfaces.go",
    "content": "package suite\n\nimport \"testing\"\n\n// TestingSuite can store and return the current *testing.T context\n// generated by 'go test'.\ntype TestingSuite interface {\n\tT() *testing.T\n\tSetT(*testing.T)\n\tSetS(suite TestingSuite)\n}\n\n// SetupAllSuite has a SetupSuite method, which will run before the\n// tests in the suite are run.\ntype SetupAllSuite interface {\n\tSetupSuite()\n}\n\n// SetupTestSuite has a SetupTest method, which will run before each\n// test in the suite.\ntype SetupTestSuite interface {\n\tSetupTest()\n}\n\n// TearDownAllSuite has a TearDownSuite method, which will run after\n// all the tests in the suite have been run.\ntype TearDownAllSuite interface {\n\tTearDownSuite()\n}\n\n// TearDownTestSuite has a TearDownTest method, which will run after\n// each test in the suite.\ntype TearDownTestSuite interface {\n\tTearDownTest()\n}\n\n// BeforeTest has a function to be executed right before the test\n// starts and receives the suite and test names as input\ntype BeforeTest interface {\n\tBeforeTest(suiteName, testName string)\n}\n\n// AfterTest has a function to be executed right after the test\n// finishes and receives the suite and test names as input\ntype AfterTest interface {\n\tAfterTest(suiteName, testName string)\n}\n\n// WithStats implements HandleStats, a function that will be executed\n// when a test suite is finished. The stats contain information about\n// the execution of that suite and its tests.\ntype WithStats interface {\n\tHandleStats(suiteName string, stats *SuiteInformation)\n}\n\n// SetupSubTest has a SetupSubTest method, which will run before each\n// subtest in the suite.\ntype SetupSubTest interface {\n\tSetupSubTest()\n}\n\n// TearDownSubTest has a TearDownSubTest method, which will run after\n// each subtest in the suite have been run.\ntype TearDownSubTest interface {\n\tTearDownSubTest()\n}\n"
  },
  {
    "path": "suite/stats.go",
    "content": "package suite\n\nimport \"time\"\n\n// SuiteInformation stats stores stats for the whole suite execution.\ntype SuiteInformation struct {\n\tStart, End time.Time\n\tTestStats  map[string]*TestInformation\n}\n\n// TestInformation stores information about the execution of each test.\ntype TestInformation struct {\n\tTestName   string\n\tStart, End time.Time\n\tPassed     bool\n}\n\nfunc newSuiteInformation() *SuiteInformation {\n\treturn &SuiteInformation{\n\t\tTestStats: make(map[string]*TestInformation),\n\t}\n}\n\nfunc (s *SuiteInformation) start(testName string) {\n\tif s == nil {\n\t\treturn\n\t}\n\ts.TestStats[testName] = &TestInformation{\n\t\tTestName: testName,\n\t\tStart:    time.Now(),\n\t}\n}\n\nfunc (s *SuiteInformation) end(testName string, passed bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\ts.TestStats[testName].End = time.Now()\n\ts.TestStats[testName].Passed = passed\n}\n\nfunc (s *SuiteInformation) Passed() bool {\n\tfor _, stats := range s.TestStats {\n\t\tif !stats.Passed {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n"
  },
  {
    "path": "suite/stats_test.go",
    "content": "package suite\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestPassedReturnsTrueWhenAllTestsPass(t *testing.T) {\n\tsinfo := newSuiteInformation()\n\tsinfo.TestStats = map[string]*TestInformation{\n\t\t\"Test1\": {TestName: \"Test1\", Passed: true},\n\t\t\"Test2\": {TestName: \"Test2\", Passed: true},\n\t\t\"Test3\": {TestName: \"Test3\", Passed: true},\n\t}\n\n\tassert.True(t, sinfo.Passed())\n}\n\nfunc TestPassedReturnsFalseWhenSomeTestFails(t *testing.T) {\n\tsinfo := newSuiteInformation()\n\tsinfo.TestStats = map[string]*TestInformation{\n\t\t\"Test1\": {TestName: \"Test1\", Passed: true},\n\t\t\"Test2\": {TestName: \"Test2\", Passed: false},\n\t\t\"Test3\": {TestName: \"Test3\", Passed: true},\n\t}\n\n\tassert.False(t, sinfo.Passed())\n}\n\nfunc TestPassedReturnsFalseWhenAllTestsFail(t *testing.T) {\n\tsinfo := newSuiteInformation()\n\tsinfo.TestStats = map[string]*TestInformation{\n\t\t\"Test1\": {TestName: \"Test1\", Passed: false},\n\t\t\"Test2\": {TestName: \"Test2\", Passed: false},\n\t\t\"Test3\": {TestName: \"Test3\", Passed: false},\n\t}\n\n\tassert.False(t, sinfo.Passed())\n}\n"
  },
  {
    "path": "suite/suite.go",
    "content": "package suite\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime/debug\"\n\t\"strings\"\n\t\"sync\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n)\n\nvar matchMethod = flag.String(\"testify.m\", \"\", \"regular expression to select tests of the testify suite to run\")\n\n// Suite is a basic testing suite with methods for storing and\n// retrieving the current *testing.T context.\ntype Suite struct {\n\t*assert.Assertions\n\n\tmu      sync.RWMutex\n\trequire *require.Assertions\n\tt       *testing.T\n\n\t// Parent suite to have access to the implemented methods of parent struct\n\ts TestingSuite\n}\n\n// T retrieves the current *testing.T context.\nfunc (suite *Suite) T() *testing.T {\n\tsuite.mu.RLock()\n\tdefer suite.mu.RUnlock()\n\treturn suite.t\n}\n\n// SetT sets the current *testing.T context.\nfunc (suite *Suite) SetT(t *testing.T) {\n\tsuite.mu.Lock()\n\tdefer suite.mu.Unlock()\n\tsuite.t = t\n\tsuite.Assertions = assert.New(t)\n\tsuite.require = require.New(t)\n}\n\n// SetS needs to set the current test suite as parent\n// to get access to the parent methods\nfunc (suite *Suite) SetS(s TestingSuite) {\n\tsuite.s = s\n}\n\n// Require returns a require context for suite.\nfunc (suite *Suite) Require() *require.Assertions {\n\tsuite.mu.Lock()\n\tdefer suite.mu.Unlock()\n\tif suite.require == nil {\n\t\tpanic(\"'Require' must not be called before 'Run' or 'SetT'\")\n\t}\n\treturn suite.require\n}\n\n// Assert returns an assert context for suite. Normally, you can call:\n//\n//\tsuite.NoError(err)\n//\n// But for situations where the embedded methods are overridden (for example,\n// you might want to override assert.Assertions with require.Assertions), this\n// method is provided so you can call:\n//\n//\tsuite.Assert().NoError(err)\nfunc (suite *Suite) Assert() *assert.Assertions {\n\tsuite.mu.Lock()\n\tdefer suite.mu.Unlock()\n\tif suite.Assertions == nil {\n\t\tpanic(\"'Assert' must not be called before 'Run' or 'SetT'\")\n\t}\n\treturn suite.Assertions\n}\n\nfunc recoverAndFailOnPanic(t *testing.T) {\n\tt.Helper()\n\tr := recover()\n\tfailOnPanic(t, r)\n}\n\nfunc failOnPanic(t *testing.T, r interface{}) {\n\tt.Helper()\n\tif r != nil {\n\t\tt.Errorf(\"test panicked: %v\\n%s\", r, debug.Stack())\n\t\tt.FailNow()\n\t}\n}\n\n// Run provides suite functionality around golang subtests.  It should be\n// called in place of t.Run(name, func(t *testing.T)) in test suite code.\n// The passed-in func will be executed as a subtest with a fresh instance of t.\n// Provides compatibility with go test pkg -run TestSuite/TestName/SubTestName.\nfunc (suite *Suite) Run(name string, subtest func()) bool {\n\toldT := suite.T()\n\n\treturn oldT.Run(name, func(t *testing.T) {\n\t\tsuite.SetT(t)\n\t\tdefer suite.SetT(oldT)\n\n\t\tdefer recoverAndFailOnPanic(t)\n\n\t\tif setupSubTest, ok := suite.s.(SetupSubTest); ok {\n\t\t\tsetupSubTest.SetupSubTest()\n\t\t}\n\n\t\tif tearDownSubTest, ok := suite.s.(TearDownSubTest); ok {\n\t\t\tdefer tearDownSubTest.TearDownSubTest()\n\t\t}\n\n\t\tsubtest()\n\t})\n}\n\ntype test = struct {\n\tname string\n\trun  func(t *testing.T)\n}\n\n// Run takes a testing suite and runs all of the tests attached\n// to it.\nfunc Run(t *testing.T, suite TestingSuite) {\n\tdefer recoverAndFailOnPanic(t)\n\n\tsuite.SetT(t)\n\tsuite.SetS(suite)\n\n\tvar stats *SuiteInformation\n\tif _, ok := suite.(WithStats); ok {\n\t\tstats = newSuiteInformation()\n\t}\n\n\tvar tests []test\n\tmethodFinder := reflect.TypeOf(suite)\n\tsuiteName := methodFinder.Elem().Name()\n\n\tvar matchMethodRE *regexp.Regexp\n\tif *matchMethod != \"\" {\n\t\tvar err error\n\t\tmatchMethodRE, err = regexp.Compile(*matchMethod)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"testify: invalid regexp for -m: %s\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\n\tfor i := 0; i < methodFinder.NumMethod(); i++ {\n\t\tmethod := methodFinder.Method(i)\n\n\t\tif !strings.HasPrefix(method.Name, \"Test\") {\n\t\t\tcontinue\n\t\t}\n\t\t// Apply -testify.m filter\n\t\tif matchMethodRE != nil && !matchMethodRE.MatchString(method.Name) {\n\t\t\tcontinue\n\t\t}\n\t\t// Check method signature\n\t\tif method.Type.NumIn() > 1 || method.Type.NumOut() > 0 {\n\t\t\ttests = append(tests, test{\n\t\t\t\tname: method.Name,\n\t\t\t\trun: func(t *testing.T) {\n\t\t\t\t\tt.Errorf(\n\t\t\t\t\t\t\"testify: suite method %q has invalid signature: expected no input or output parameters, method has %d input parameters and %d output parameters\",\n\t\t\t\t\t\tmethod.Name, method.Type.NumIn()-1, method.Type.NumOut(),\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\ttest := test{\n\t\t\tname: method.Name,\n\t\t\trun: func(t *testing.T) {\n\t\t\t\tparentT := suite.T()\n\t\t\t\tsuite.SetT(t)\n\t\t\t\tdefer recoverAndFailOnPanic(t)\n\t\t\t\tdefer func() {\n\t\t\t\t\tt.Helper()\n\n\t\t\t\t\tr := recover()\n\n\t\t\t\t\tstats.end(method.Name, !t.Failed() && r == nil)\n\n\t\t\t\t\tif afterTestSuite, ok := suite.(AfterTest); ok {\n\t\t\t\t\t\tafterTestSuite.AfterTest(suiteName, method.Name)\n\t\t\t\t\t}\n\n\t\t\t\t\tif tearDownTestSuite, ok := suite.(TearDownTestSuite); ok {\n\t\t\t\t\t\ttearDownTestSuite.TearDownTest()\n\t\t\t\t\t}\n\n\t\t\t\t\tsuite.SetT(parentT)\n\t\t\t\t\tfailOnPanic(t, r)\n\t\t\t\t}()\n\n\t\t\t\tif setupTestSuite, ok := suite.(SetupTestSuite); ok {\n\t\t\t\t\tsetupTestSuite.SetupTest()\n\t\t\t\t}\n\t\t\t\tif beforeTestSuite, ok := suite.(BeforeTest); ok {\n\t\t\t\t\tbeforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name)\n\t\t\t\t}\n\n\t\t\t\tstats.start(method.Name)\n\n\t\t\t\tmethod.Func.Call([]reflect.Value{reflect.ValueOf(suite)})\n\t\t\t},\n\t\t}\n\t\ttests = append(tests, test)\n\t}\n\n\tif len(tests) == 0 {\n\t\treturn\n\t}\n\n\tif stats != nil {\n\t\tstats.Start = time.Now()\n\t}\n\n\tif setupAllSuite, ok := suite.(SetupAllSuite); ok {\n\t\tsetupAllSuite.SetupSuite()\n\t}\n\n\tdefer func() {\n\t\tif tearDownAllSuite, ok := suite.(TearDownAllSuite); ok {\n\t\t\ttearDownAllSuite.TearDownSuite()\n\t\t}\n\n\t\tif suiteWithStats, measureStats := suite.(WithStats); measureStats {\n\t\t\tstats.End = time.Now()\n\t\t\tsuiteWithStats.HandleStats(suiteName, stats)\n\t\t}\n\t}()\n\n\trunTests(t, tests)\n}\n\nfunc runTests(t *testing.T, tests []test) {\n\tif len(tests) == 0 {\n\t\tt.Log(\"warning: no tests to run\")\n\t\treturn\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.name, test.run)\n\t}\n}\n"
  },
  {
    "path": "suite/suite_test.go",
    "content": "package suite\n\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"flag\"\n\t\"io\"\n\t\"math/rand\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n)\n\n// allTestsFilter is a yes filter for testing.RunTests\nfunc allTestsFilter(pat, str string) (bool, error) {\n\treturn true, nil\n}\n\n// SuiteRequireTwice is intended to test the usage of suite.Require in two\n// different tests\ntype SuiteRequireTwice struct{ Suite }\n\n// TestSuiteRequireTwice checks for regressions of issue #149 where\n// suite.requirements was not initialized in suite.SetT()\n// A regression would result on these tests panicking rather than failing.\nfunc TestSuiteRequireTwice(t *testing.T) {\n\tok := testing.RunTests(\n\t\tallTestsFilter,\n\t\t[]testing.InternalTest{{\n\t\t\tName: t.Name() + \"/SuiteRequireTwice\",\n\t\t\tF: func(t *testing.T) {\n\t\t\t\tsuite := new(SuiteRequireTwice)\n\t\t\t\tRun(t, suite)\n\t\t\t},\n\t\t}},\n\t)\n\tassert.False(t, ok)\n}\n\nfunc (s *SuiteRequireTwice) TestRequireOne() {\n\tr := s.Require()\n\tr.Equal(1, 2)\n}\n\nfunc (s *SuiteRequireTwice) TestRequireTwo() {\n\tr := s.Require()\n\tr.Equal(1, 2)\n}\n\ntype panickingSuite struct {\n\tSuite\n\tpanicInSetupSuite    bool\n\tpanicInSetupTest     bool\n\tpanicInBeforeTest    bool\n\tpanicInTest          bool\n\tpanicInAfterTest     bool\n\tpanicInTearDownTest  bool\n\tpanicInTearDownSuite bool\n}\n\nfunc (s *panickingSuite) SetupSuite() {\n\tif s.panicInSetupSuite {\n\t\tpanic(\"oops in setup suite\")\n\t}\n}\n\nfunc (s *panickingSuite) SetupTest() {\n\tif s.panicInSetupTest {\n\t\tpanic(\"oops in setup test\")\n\t}\n}\n\nfunc (s *panickingSuite) BeforeTest(_, _ string) {\n\tif s.panicInBeforeTest {\n\t\tpanic(\"oops in before test\")\n\t}\n}\n\nfunc (s *panickingSuite) Test() {\n\tif s.panicInTest {\n\t\tpanic(\"oops in test\")\n\t}\n}\n\nfunc (s *panickingSuite) AfterTest(_, _ string) {\n\tif s.panicInAfterTest {\n\t\tpanic(\"oops in after test\")\n\t}\n}\n\nfunc (s *panickingSuite) TearDownTest() {\n\tif s.panicInTearDownTest {\n\t\tpanic(\"oops in tear down test\")\n\t}\n}\n\nfunc (s *panickingSuite) TearDownSuite() {\n\tif s.panicInTearDownSuite {\n\t\tpanic(\"oops in tear down suite\")\n\t}\n}\n\nfunc TestSuiteRecoverPanic(t *testing.T) {\n\tok := true\n\tpanickingTests := []testing.InternalTest{\n\t\t{\n\t\t\tName: t.Name() + \"/InSetupSuite\",\n\t\t\tF:    func(t *testing.T) { Run(t, &panickingSuite{panicInSetupSuite: true}) },\n\t\t},\n\t\t{\n\t\t\tName: t.Name() + \"/InSetupTest\",\n\t\t\tF:    func(t *testing.T) { Run(t, &panickingSuite{panicInSetupTest: true}) },\n\t\t},\n\t\t{\n\t\t\tName: t.Name() + \"InBeforeTest\",\n\t\t\tF:    func(t *testing.T) { Run(t, &panickingSuite{panicInBeforeTest: true}) },\n\t\t},\n\t\t{\n\t\t\tName: t.Name() + \"/InTest\",\n\t\t\tF:    func(t *testing.T) { Run(t, &panickingSuite{panicInTest: true}) },\n\t\t},\n\t\t{\n\t\t\tName: t.Name() + \"/InAfterTest\",\n\t\t\tF:    func(t *testing.T) { Run(t, &panickingSuite{panicInAfterTest: true}) },\n\t\t},\n\t\t{\n\t\t\tName: t.Name() + \"/InTearDownTest\",\n\t\t\tF:    func(t *testing.T) { Run(t, &panickingSuite{panicInTearDownTest: true}) },\n\t\t},\n\t\t{\n\t\t\tName: t.Name() + \"/InTearDownSuite\",\n\t\t\tF:    func(t *testing.T) { Run(t, &panickingSuite{panicInTearDownSuite: true}) },\n\t\t},\n\t}\n\n\trequire.NotPanics(t, func() {\n\t\tok = testing.RunTests(allTestsFilter, panickingTests)\n\t})\n\n\tassert.False(t, ok)\n}\n\n// This suite is intended to store values to make sure that only\n// testing-suite-related methods are run.  It's also a fully\n// functional example of a testing suite, using setup/teardown methods\n// and a helper method that is ignored by testify.  To make this look\n// more like a real world example, all tests in the suite perform some\n// type of assertion.\ntype SuiteTester struct {\n\t// Include our basic suite logic.\n\tSuite\n\n\t// Keep counts of how many times each method is run.\n\tSetupSuiteRunCount      int\n\tTearDownSuiteRunCount   int\n\tSetupTestRunCount       int\n\tTearDownTestRunCount    int\n\tTestOneRunCount         int\n\tTestTwoRunCount         int\n\tTestSubtestRunCount     int\n\tNonTestMethodRunCount   int\n\tSetupSubTestRunCount    int\n\tTearDownSubTestRunCount int\n\n\tSetupSubTestNames    []string\n\tTearDownSubTestNames []string\n\n\tSuiteNameBefore []string\n\tTestNameBefore  []string\n\n\tSuiteNameAfter []string\n\tTestNameAfter  []string\n\n\tTimeBefore []time.Time\n\tTimeAfter  []time.Time\n}\n\n// The SetupSuite method will be run by testify once, at the very\n// start of the testing suite, before any tests are run.\nfunc (suite *SuiteTester) SetupSuite() {\n\tsuite.SetupSuiteRunCount++\n}\n\nfunc (suite *SuiteTester) BeforeTest(suiteName, testName string) {\n\tsuite.SuiteNameBefore = append(suite.SuiteNameBefore, suiteName)\n\tsuite.TestNameBefore = append(suite.TestNameBefore, testName)\n\tsuite.TimeBefore = append(suite.TimeBefore, time.Now())\n}\n\nfunc (suite *SuiteTester) AfterTest(suiteName, testName string) {\n\tsuite.SuiteNameAfter = append(suite.SuiteNameAfter, suiteName)\n\tsuite.TestNameAfter = append(suite.TestNameAfter, testName)\n\tsuite.TimeAfter = append(suite.TimeAfter, time.Now())\n}\n\n// The TearDownSuite method will be run by testify once, at the very\n// end of the testing suite, after all tests have been run.\nfunc (suite *SuiteTester) TearDownSuite() {\n\tsuite.TearDownSuiteRunCount++\n}\n\n// The SetupTest method will be run before every test in the suite.\nfunc (suite *SuiteTester) SetupTest() {\n\tsuite.SetupTestRunCount++\n}\n\n// The TearDownTest method will be run after every test in the suite.\nfunc (suite *SuiteTester) TearDownTest() {\n\tsuite.TearDownTestRunCount++\n}\n\n// Every method in a testing suite that begins with \"Test\" will be run\n// as a test.  TestOne is an example of a test.  For the purposes of\n// this example, we've included assertions in the tests, since most\n// tests will issue assertions.\nfunc (suite *SuiteTester) TestOne() {\n\tbeforeCount := suite.TestOneRunCount\n\tsuite.TestOneRunCount++\n\tassert.Equal(suite.T(), suite.TestOneRunCount, beforeCount+1)\n\tsuite.Equal(suite.TestOneRunCount, beforeCount+1)\n}\n\n// TestTwo is another example of a test.\nfunc (suite *SuiteTester) TestTwo() {\n\tbeforeCount := suite.TestTwoRunCount\n\tsuite.TestTwoRunCount++\n\tassert.NotEqual(suite.T(), suite.TestTwoRunCount, beforeCount)\n\tsuite.NotEqual(suite.TestTwoRunCount, beforeCount)\n}\n\nfunc (suite *SuiteTester) TestSkip() {\n\tsuite.T().Skip()\n}\n\n// NonTestMethod does not begin with \"Test\", so it will not be run by\n// testify as a test in the suite.  This is useful for creating helper\n// methods for your tests.\nfunc (suite *SuiteTester) NonTestMethod() {\n\tsuite.NonTestMethodRunCount++\n}\n\nfunc (suite *SuiteTester) TestSubtest() {\n\tsuite.TestSubtestRunCount++\n\n\tfor _, t := range []struct {\n\t\ttestName string\n\t}{\n\t\t{\"first\"},\n\t\t{\"second\"},\n\t} {\n\t\tsuiteT := suite.T()\n\t\tsuite.Run(t.testName, func() {\n\t\t\t// We should get a different *testing.T for subtests, so that\n\t\t\t// go test recognizes them as proper subtests for output formatting\n\t\t\t// and running individual subtests\n\t\t\tsubTestT := suite.T()\n\t\t\tsuite.NotEqual(subTestT, suiteT)\n\t\t})\n\t\tsuite.Equal(suiteT, suite.T())\n\t}\n}\n\nfunc (suite *SuiteTester) TearDownSubTest() {\n\tsuite.TearDownSubTestNames = append(suite.TearDownSubTestNames, suite.T().Name())\n\tsuite.TearDownSubTestRunCount++\n}\n\nfunc (suite *SuiteTester) SetupSubTest() {\n\tsuite.SetupSubTestNames = append(suite.SetupSubTestNames, suite.T().Name())\n\tsuite.SetupSubTestRunCount++\n}\n\ntype SuiteSkipTester struct {\n\t// Include our basic suite logic.\n\tSuite\n\n\t// Keep counts of how many times each method is run.\n\tSetupSuiteRunCount    int\n\tTearDownSuiteRunCount int\n}\n\nfunc (suite *SuiteSkipTester) SetupSuite() {\n\tsuite.SetupSuiteRunCount++\n\tsuite.T().Skip()\n}\n\nfunc (suite *SuiteSkipTester) TestNothing() {\n\t// SetupSuite is only called when at least one test satisfies\n\t// test filter. For this suite to be set up (and then tore down)\n\t// it is necessary to add at least one test method.\n}\n\nfunc (suite *SuiteSkipTester) TearDownSuite() {\n\tsuite.TearDownSuiteRunCount++\n}\n\n// TestRunSuite will be run by the 'go test' command, so within it, we\n// can run our suite using the Run(*testing.T, TestingSuite) function.\nfunc TestRunSuite(t *testing.T) {\n\tsuiteTester := new(SuiteTester)\n\tRun(t, suiteTester)\n\n\t// Normally, the test would end here.  The following are simply\n\t// some assertions to ensure that the Run function is working as\n\t// intended - they are not part of the example.\n\n\t// The suite was only run once, so the SetupSuite and TearDownSuite\n\t// methods should have each been run only once.\n\tassert.Equal(t, 1, suiteTester.SetupSuiteRunCount)\n\tassert.Equal(t, 1, suiteTester.TearDownSuiteRunCount)\n\n\tassert.Len(t, suiteTester.SuiteNameAfter, 4)\n\tassert.Len(t, suiteTester.SuiteNameBefore, 4)\n\tassert.Len(t, suiteTester.TestNameAfter, 4)\n\tassert.Len(t, suiteTester.TestNameBefore, 4)\n\n\tassert.Contains(t, suiteTester.TestNameAfter, \"TestOne\")\n\tassert.Contains(t, suiteTester.TestNameAfter, \"TestTwo\")\n\tassert.Contains(t, suiteTester.TestNameAfter, \"TestSkip\")\n\tassert.Contains(t, suiteTester.TestNameAfter, \"TestSubtest\")\n\n\tassert.Contains(t, suiteTester.TestNameBefore, \"TestOne\")\n\tassert.Contains(t, suiteTester.TestNameBefore, \"TestTwo\")\n\tassert.Contains(t, suiteTester.TestNameBefore, \"TestSkip\")\n\tassert.Contains(t, suiteTester.TestNameBefore, \"TestSubtest\")\n\n\tassert.Contains(t, suiteTester.SetupSubTestNames, \"TestRunSuite/TestSubtest/first\")\n\tassert.Contains(t, suiteTester.SetupSubTestNames, \"TestRunSuite/TestSubtest/second\")\n\n\tassert.Contains(t, suiteTester.TearDownSubTestNames, \"TestRunSuite/TestSubtest/first\")\n\tassert.Contains(t, suiteTester.TearDownSubTestNames, \"TestRunSuite/TestSubtest/second\")\n\n\tfor _, suiteName := range suiteTester.SuiteNameAfter {\n\t\tassert.Equal(t, \"SuiteTester\", suiteName)\n\t}\n\n\tfor _, suiteName := range suiteTester.SuiteNameBefore {\n\t\tassert.Equal(t, \"SuiteTester\", suiteName)\n\t}\n\n\tfor _, when := range suiteTester.TimeAfter {\n\t\tassert.False(t, when.IsZero())\n\t}\n\n\tfor _, when := range suiteTester.TimeBefore {\n\t\tassert.False(t, when.IsZero())\n\t}\n\n\t// There are four test methods (TestOne, TestTwo, TestSkip, and TestSubtest), so\n\t// the SetupTest and TearDownTest methods (which should be run once for\n\t// each test) should have been run four times.\n\tassert.Equal(t, 4, suiteTester.SetupTestRunCount)\n\tassert.Equal(t, 4, suiteTester.TearDownTestRunCount)\n\n\t// Each test should have been run once.\n\tassert.Equal(t, 1, suiteTester.TestOneRunCount)\n\tassert.Equal(t, 1, suiteTester.TestTwoRunCount)\n\tassert.Equal(t, 1, suiteTester.TestSubtestRunCount)\n\n\tassert.Equal(t, 2, suiteTester.TearDownSubTestRunCount)\n\tassert.Equal(t, 2, suiteTester.SetupSubTestRunCount)\n\n\t// Methods that don't match the test method identifier shouldn't\n\t// have been run at all.\n\tassert.Equal(t, 0, suiteTester.NonTestMethodRunCount)\n\n\tsuiteSkipTester := new(SuiteSkipTester)\n\tRun(t, suiteSkipTester)\n\n\t// The suite was only run once, so the SetupSuite and TearDownSuite\n\t// methods should have each been run only once, even though SetupSuite\n\t// called Skip()\n\tassert.Equal(t, 1, suiteSkipTester.SetupSuiteRunCount)\n\tassert.Equal(t, 1, suiteSkipTester.TearDownSuiteRunCount)\n\n}\n\n// This suite has no Test... methods. It's setup and teardown must be skipped.\ntype SuiteSetupSkipTester struct {\n\tSuite\n\n\tsetUp    bool\n\ttoreDown bool\n}\n\nfunc (s *SuiteSetupSkipTester) SetupSuite() {\n\ts.setUp = true\n}\n\nfunc (s *SuiteSetupSkipTester) NonTestMethod() {\n\n}\n\nfunc (s *SuiteSetupSkipTester) TearDownSuite() {\n\ts.toreDown = true\n}\n\nfunc TestSkippingSuiteSetup(t *testing.T) {\n\tsuiteTester := new(SuiteSetupSkipTester)\n\tRun(t, suiteTester)\n\tassert.False(t, suiteTester.setUp)\n\tassert.False(t, suiteTester.toreDown)\n}\n\nfunc TestSuiteGetters(t *testing.T) {\n\tsuite := new(SuiteTester)\n\tsuite.SetT(t)\n\tassert.NotNil(t, suite.Assert())\n\tassert.Equal(t, suite.Assertions, suite.Assert())\n\tassert.NotNil(t, suite.Require())\n\tassert.Equal(t, suite.require, suite.Require())\n}\n\ntype SuiteLoggingTester struct {\n\tSuite\n}\n\nfunc (s *SuiteLoggingTester) TestLoggingPass() {\n\ts.T().Log(\"TESTLOGPASS\")\n}\n\nfunc (s *SuiteLoggingTester) TestLoggingFail() {\n\ts.T().Log(\"TESTLOGFAIL\")\n\tassert.NotNil(s.T(), nil) // expected to fail\n}\n\ntype StdoutCapture struct {\n\toldStdout *os.File\n\treadPipe  *os.File\n}\n\nfunc (sc *StdoutCapture) StartCapture() {\n\tsc.oldStdout = os.Stdout\n\tsc.readPipe, os.Stdout, _ = os.Pipe()\n}\n\nfunc (sc *StdoutCapture) StopCapture() (string, error) {\n\tif sc.oldStdout == nil || sc.readPipe == nil {\n\t\treturn \"\", errors.New(\"StartCapture not called before StopCapture\")\n\t}\n\tos.Stdout.Close()\n\tos.Stdout = sc.oldStdout\n\tbytes, err := io.ReadAll(sc.readPipe)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(bytes), nil\n}\n\nfunc TestSuiteLogging(t *testing.T) {\n\tsuiteLoggingTester := new(SuiteLoggingTester)\n\tcapture := StdoutCapture{}\n\tinternalTest := testing.InternalTest{\n\t\tName: t.Name() + \"/SuiteLoggingTester\",\n\t\tF: func(subT *testing.T) {\n\t\t\tRun(subT, suiteLoggingTester)\n\t\t},\n\t}\n\tcapture.StartCapture()\n\ttesting.RunTests(allTestsFilter, []testing.InternalTest{internalTest})\n\toutput, err := capture.StopCapture()\n\trequire.NoError(t, err, \"Got an error trying to capture stdout and stderr!\")\n\trequire.NotEmpty(t, output, \"output content must not be empty\")\n\n\t// Failed tests' output is always printed\n\tassert.Contains(t, output, \"TESTLOGFAIL\")\n\n\tif testing.Verbose() {\n\t\t// In verbose mode, output from successful tests is also printed\n\t\tassert.Contains(t, output, \"TESTLOGPASS\")\n\t} else {\n\t\tassert.NotContains(t, output, \"TESTLOGPASS\")\n\t}\n}\n\ntype CallOrderSuite struct {\n\tSuite\n\tcallOrder []string\n}\n\nfunc (s *CallOrderSuite) call(method string) {\n\ttime.Sleep(time.Duration(rand.Intn(300)) * time.Millisecond)\n\ts.callOrder = append(s.callOrder, method)\n}\n\nfunc TestSuiteCallOrder(t *testing.T) {\n\tRun(t, new(CallOrderSuite))\n}\nfunc (s *CallOrderSuite) SetupSuite() {\n\ts.call(\"SetupSuite\")\n}\n\nfunc (s *CallOrderSuite) TearDownSuite() {\n\ts.call(\"TearDownSuite\")\n\tassert.Equal(s.T(), \"SetupSuite;SetupTest;Test A;SetupSubTest;SubTest A1;TearDownSubTest;SetupSubTest;SubTest A2;TearDownSubTest;TearDownTest;SetupTest;Test B;SetupSubTest;SubTest B1;TearDownSubTest;SetupSubTest;SubTest B2;TearDownSubTest;TearDownTest;TearDownSuite\", strings.Join(s.callOrder, \";\"))\n}\nfunc (s *CallOrderSuite) SetupTest() {\n\ts.call(\"SetupTest\")\n}\n\nfunc (s *CallOrderSuite) TearDownTest() {\n\ts.call(\"TearDownTest\")\n}\n\nfunc (s *CallOrderSuite) SetupSubTest() {\n\ts.call(\"SetupSubTest\")\n}\n\nfunc (s *CallOrderSuite) TearDownSubTest() {\n\ts.call(\"TearDownSubTest\")\n}\n\nfunc (s *CallOrderSuite) Test_A() {\n\ts.call(\"Test A\")\n\ts.Run(\"SubTest A1\", func() {\n\t\ts.call(\"SubTest A1\")\n\t})\n\ts.Run(\"SubTest A2\", func() {\n\t\ts.call(\"SubTest A2\")\n\t})\n}\n\nfunc (s *CallOrderSuite) Test_B() {\n\ts.call(\"Test B\")\n\ts.Run(\"SubTest B1\", func() {\n\t\ts.call(\"SubTest B1\")\n\t})\n\ts.Run(\"SubTest B2\", func() {\n\t\ts.call(\"SubTest B2\")\n\t})\n}\n\ntype suiteWithStats struct {\n\tSuite\n\twasCalled bool\n\tstats     *SuiteInformation\n}\n\nfunc (s *suiteWithStats) HandleStats(suiteName string, stats *SuiteInformation) {\n\ts.wasCalled = true\n\ts.stats = stats\n}\n\nfunc (s *suiteWithStats) TestSomething() {\n\ts.Equal(1, 1)\n}\n\nfunc (s *suiteWithStats) TestPanic() {\n\tpanic(\"oops\")\n}\n\nfunc TestSuiteWithStats(t *testing.T) {\n\tsuiteWithStats := new(suiteWithStats)\n\n\tsuiteSuccess := testing.RunTests(allTestsFilter, []testing.InternalTest{\n\t\t{\n\t\t\tName: t.Name() + \"/suiteWithStats\",\n\t\t\tF: func(t *testing.T) {\n\t\t\t\tRun(t, suiteWithStats)\n\t\t\t},\n\t\t},\n\t})\n\trequire.False(t, suiteSuccess, \"suiteWithStats should report test failure because of panic in TestPanic\")\n\n\tassert.True(t, suiteWithStats.wasCalled)\n\tassert.NotZero(t, suiteWithStats.stats.Start)\n\tassert.NotZero(t, suiteWithStats.stats.End)\n\tassert.False(t, suiteWithStats.stats.Passed())\n\n\ttestStats := suiteWithStats.stats.TestStats\n\n\tassert.NotZero(t, testStats[\"TestSomething\"].Start)\n\tassert.NotZero(t, testStats[\"TestSomething\"].End)\n\tassert.True(t, testStats[\"TestSomething\"].Passed)\n\n\tassert.NotZero(t, testStats[\"TestPanic\"].Start)\n\tassert.NotZero(t, testStats[\"TestPanic\"].End)\n\tassert.False(t, testStats[\"TestPanic\"].Passed)\n}\n\n// FailfastSuite will test the behavior when running with the failfast flag\n// It logs calls in the callOrder slice which we then use to assert the correct calls were made\ntype FailfastSuite struct {\n\tSuite\n\tcallOrder []string\n}\n\nfunc (s *FailfastSuite) call(method string) {\n\ts.callOrder = append(s.callOrder, method)\n}\n\nfunc TestFailfastSuite(t *testing.T) {\n\t// This test suite is run twice. Once normally and once with the -failfast flag by TestFailfastSuiteFailFastOn\n\t// If you need to debug it run this test directly with the failfast flag set on/off as you need\n\tfailFast := flag.Lookup(\"test.failfast\").Value.(flag.Getter).Get().(bool)\n\ts := new(FailfastSuite)\n\tok := testing.RunTests(\n\t\tallTestsFilter,\n\t\t[]testing.InternalTest{{\n\t\t\tName: t.Name() + \"/FailfastSuite\",\n\t\t\tF: func(t *testing.T) {\n\t\t\t\tRun(t, s)\n\t\t\t},\n\t\t}},\n\t)\n\tassert.False(t, ok)\n\tvar expect []string\n\tif failFast {\n\t\t// Test A Fails and because we are running with failfast Test B never runs and we proceed straight to TearDownSuite\n\t\texpect = []string{\"SetupSuite\", \"SetupTest\", \"Test A Fails\", \"TearDownTest\", \"TearDownSuite\"}\n\t} else {\n\t\t// Test A Fails and because we are running without failfast we continue and run Test B and then proceed to TearDownSuite\n\t\texpect = []string{\"SetupSuite\", \"SetupTest\", \"Test A Fails\", \"TearDownTest\", \"SetupTest\", \"Test B Passes\", \"TearDownTest\", \"TearDownSuite\"}\n\t}\n\tcallOrderAssert(t, expect, s.callOrder)\n}\n\ntype tHelper interface {\n\tHelper()\n}\n\n// callOrderAssert is a help with confirms that asserts that expect\n// matches one or more times in callOrder. This makes it compatible\n// with go test flag -count=X where X > 1.\nfunc callOrderAssert(t *testing.T, expect, callOrder []string) {\n\tvar ti interface{} = t\n\tif h, ok := ti.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tcallCount := len(callOrder)\n\texpectCount := len(expect)\n\tif callCount > expectCount && callCount%expectCount == 0 {\n\t\t// Command line flag -count=X where X > 1.\n\t\tfor len(callOrder) >= expectCount {\n\t\t\tassert.Equal(t, expect, callOrder[:expectCount])\n\t\t\tcallOrder = callOrder[expectCount:]\n\t\t}\n\t\treturn\n\t}\n\n\tassert.Equal(t, expect, callOrder)\n}\n\nfunc TestFailfastSuiteFailFastOn(t *testing.T) {\n\t// To test this with failfast on (and isolated from other intended test failures in our test suite) we launch it in its own process\n\tcmd := exec.Command(\"go\", \"test\", \"-v\", \"-race\", \"-run\", \"TestFailfastSuite\", \"-failfast\")\n\tvar out bytes.Buffer\n\tcmd.Stdout = &out\n\tt.Log(\"Running go test -v -race -run TestFailfastSuite -failfast\")\n\terr := cmd.Run()\n\tt.Log(out.String())\n\tif err != nil {\n\t\tt.Log(err)\n\t\tt.Fail()\n\t}\n}\nfunc (s *FailfastSuite) SetupSuite() {\n\ts.call(\"SetupSuite\")\n}\n\nfunc (s *FailfastSuite) TearDownSuite() {\n\ts.call(\"TearDownSuite\")\n}\nfunc (s *FailfastSuite) SetupTest() {\n\ts.call(\"SetupTest\")\n}\n\nfunc (s *FailfastSuite) TearDownTest() {\n\ts.call(\"TearDownTest\")\n}\n\nfunc (s *FailfastSuite) Test_A_Fails() {\n\ts.call(\"Test A Fails\")\n\ts.T().Error(\"Test A meant to fail\")\n}\n\nfunc (s *FailfastSuite) Test_B_Passes() {\n\ts.call(\"Test B Passes\")\n\ts.Require().True(true)\n}\n\ntype subtestPanicSuite struct {\n\tSuite\n\tinTearDownSuite   bool\n\tinTearDownTest    bool\n\tinTearDownSubTest bool\n}\n\nfunc (s *subtestPanicSuite) TearDownSuite() {\n\ts.inTearDownSuite = true\n}\n\nfunc (s *subtestPanicSuite) TearDownTest() {\n\ts.inTearDownTest = true\n}\n\nfunc (s *subtestPanicSuite) TearDownSubTest() {\n\ts.inTearDownSubTest = true\n}\n\nfunc (s *subtestPanicSuite) TestSubtestPanic() {\n\tok := s.Run(\"subtest\", func() {\n\t\tpanic(\"panic\")\n\t})\n\ts.False(ok, \"subtest failure is expected\")\n}\n\nfunc TestSubtestPanic(t *testing.T) {\n\tsuite := new(subtestPanicSuite)\n\tok := testing.RunTests(\n\t\tallTestsFilter,\n\t\t[]testing.InternalTest{{\n\t\t\tName: t.Name() + \"/subtestPanicSuite\",\n\t\t\tF: func(t *testing.T) {\n\t\t\t\tRun(t, suite)\n\t\t\t},\n\t\t}},\n\t)\n\tassert.False(t, ok, \"TestSubtestPanic/subtest should make the testsuite fail\")\n\tassert.True(t, suite.inTearDownSubTest)\n\tassert.True(t, suite.inTearDownTest)\n\tassert.True(t, suite.inTearDownSuite)\n}\n\ntype unInitializedSuite struct {\n\tSuite\n}\n\n// TestUnInitializedSuites asserts the behavior of the suite methods when the\n// suite is not initialized\nfunc TestUnInitializedSuites(t *testing.T) {\n\tt.Run(\"should panic on Require\", func(t *testing.T) {\n\t\tsuite := new(unInitializedSuite)\n\n\t\tassert.Panics(t, func() {\n\t\t\tsuite.Require().True(true)\n\t\t})\n\t})\n\n\tt.Run(\"should panic on Assert\", func(t *testing.T) {\n\t\tsuite := new(unInitializedSuite)\n\n\t\tassert.Panics(t, func() {\n\t\t\tsuite.Assert().True(true)\n\t\t})\n\t})\n}\n\n// SuiteSignatureValidationTester tests valid and invalid method signatures.\ntype SuiteSignatureValidationTester struct {\n\tSuite\n\n\texecutedTestCount int\n\tsetUp             bool\n\ttoreDown          bool\n}\n\n// SetupSuite runs once before any tests.\nfunc (s *SuiteSignatureValidationTester) SetupSuite() {\n\ts.setUp = true\n}\n\n// TearDownSuite runs once after all tests.\nfunc (s *SuiteSignatureValidationTester) TearDownSuite() {\n\ts.toreDown = true\n}\n\n// Valid test method — should run.\nfunc (s *SuiteSignatureValidationTester) TestValidSignature() {\n\ts.executedTestCount++\n}\n\n// Invalid: has return value.\nfunc (s *SuiteSignatureValidationTester) TestInvalidSignatureReturnValue() interface{} {\n\ts.executedTestCount++\n\treturn nil\n}\n\n// Invalid: has input arg.\nfunc (s *SuiteSignatureValidationTester) TestInvalidSignatureArg(somearg string) {\n\ts.executedTestCount++\n}\n\n// Invalid: both input arg and return value.\nfunc (s *SuiteSignatureValidationTester) TestInvalidSignatureBoth(somearg string) interface{} {\n\ts.executedTestCount++\n\treturn nil\n}\n\n// TestSuiteSignatureValidation ensures that invalid signature methods fail and valid method runs.\nfunc TestSuiteSignatureValidation(t *testing.T) {\n\tsuiteTester := new(SuiteSignatureValidationTester)\n\n\tok := testing.RunTests(allTestsFilter, []testing.InternalTest{\n\t\t{\n\t\t\tName: \"signature validation\",\n\t\t\tF: func(t *testing.T) {\n\t\t\t\tRun(t, suiteTester)\n\t\t\t},\n\t\t},\n\t})\n\n\trequire.False(t, ok, \"Suite should fail due to invalid method signatures\")\n\n\tassert.Equal(t, 1, suiteTester.executedTestCount, \"Only the valid test method should have been executed\")\n\n\tassert.True(t, suiteTester.setUp, \"SetupSuite should have been executed\")\n\tassert.True(t, suiteTester.toreDown, \"TearDownSuite should have been executed\")\n}\n"
  }
]