awesome-repositories.com
博客
awesome-repositories.com

通过 AI 驱动的搜索,发现最优秀的开源仓库。

探索精选搜索开源替代品自托管软件博客网站地图
项目关于排名机制媒体报道MCP 服务器
法律隐私政策服务条款
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
google avatar

google/go-cmp

0
View on GitHub↗
4,651 星标·224 分支·Go·BSD-3-Clause·2 次浏览

Go Cmp

go-cmp is a value comparison library for Go designed for use in test suites. It functions as a recursive data differ and assertion tool that determines if two complex data structures are semantically equal rather than relying on strict bitwise equality.

The library provides a framework for defining specialized comparison logic, allowing users to register custom equality overrides for specific types. It includes mechanisms to manage how unexported fields are handled during traversal to prevent runtime panics during deep equality checks.

The system utilizes reflection-based value traversal to identify specific mismatches between expected and actual values, producing detailed differences when values do not match. It supports type-specific equality dispatch and configurable comparison behavior.

Features

  • Recursive Semantic Equality - Determines if two complex data structures are semantically equal by recursively comparing their components.
  • Reflection-Based Comparison - Uses Go reflection to recursively walk through complex data structures for deep equality checks.
  • Equality Logic Frameworks - Provides a configurable framework for implementing specialized comparison logic and handling unexported fields.
  • Unexported Field Access Control - Manages reflection access to unexported fields to prevent runtime panics during deep equality checks.
  • Comparison Logic Overrides - Provides a framework for registering custom functions to replace default equality logic for specific types.
  • Custom Equality Definitions - Allows the definition of custom comparison functions to handle special cases like floating-point tolerances.
  • Recursive Data Diffing - Traverses Go types recursively to identify and produce detailed mismatches between expected and actual values.
  • Semantic Value Comparison - Determines if two values are semantically equal by recursively comparing primitive types or applying specialized logic.
  • Go Testing Frameworks - Serves as a specialized assertion tool for Go that generates detailed diffs between expected and actual values.
  • Private Field Comparison Controls - Provides capabilities to manage whether unexported fields are included in value comparisons during testing.
  • Unexported Field Handling - Manages how private struct fields are treated during comparison to prevent panics in Go test suites.
  • Value Comparison Libraries - Compares complex Go data structures in tests using semantic equality instead of strict bitwise equality.
  • Object Equality Implementations - Supports defining specific equality methods on types to control how their equality is calculated.
  • Special Type Equality Handlers - Routes comparison logic to special handlers based on the concrete type of the values.
  • Functional Options - Implements the functional options pattern to configure complex comparison settings via variadic functions.
  • Custom Assertions - Enables specialized equality rules for types to handle business logic or floating point precision during verification.
  • Unit Testing - Facilitates the verification of complex data structures within Go unit tests.
  • Testing and QA - Package for comparing Go values in tests.
  • Testing and Quality Assurance - Package for deep comparison of Go values.
  • 测试框架 - Package for comparing Go values in tests.

Star 历史

google/go-cmp 的 Star 历史图表google/go-cmp 的 Star 历史图表

AI 搜索

探索更多 awesome 仓库

用简单的语言描述您的需求 —— AI 将根据相关性为您从数千个精选开源项目中进行排序。

Start searching with AI

常见问题解答

google/go-cmp 是做什么的?

go-cmp is a value comparison library for Go designed for use in test suites. It functions as a recursive data differ and assertion tool that determines if two complex data structures are semantically equal rather than relying on strict bitwise equality.

google/go-cmp 的主要功能有哪些?

google/go-cmp 的主要功能包括:Recursive Semantic Equality, Reflection-Based Comparison, Equality Logic Frameworks, Unexported Field Access Control, Comparison Logic Overrides, Custom Equality Definitions, Recursive Data Diffing, Semantic Value Comparison。

google/go-cmp 有哪些开源替代品?

google/go-cmp 的开源替代品包括: smartystreets/goconvey — GoConvey is a behavioral testing framework for the Go programming language that provides a test runner, a code… chaijs/chai — Chai is an assertion library for Node.js and browser-based JavaScript applications. It functions as both a… sinonjs/sinon — Sinon is a JavaScript test double library and mocking framework used to isolate code and verify behavior during unit… appleboy/gofight. adamluzsi/testcase. bradleyjkemp/cupaloy.

Go Cmp 的开源替代方案

相似的开源项目,按与 Go Cmp 的功能重合度排序。
  • smartystreets/goconveysmartystreets 的头像

    smartystreets/goconvey

    8,415在 GitHub 上查看↗

    GoConvey is a behavioral testing framework for the Go programming language that provides a test runner, a code coverage tool, and a web-based monitoring dashboard. It integrates with the standard Go test command to organize tests into behavioral stories and conveyors. The project features a web interface that monitors the file system for source code changes and automatically triggers test execution to provide real-time feedback. This dashboard displays test results, failures, and a chronological history of execution status. The framework includes a state assertion system for verifying values

    Go
    在 GitHub 上查看↗8,415
  • chaijs/chaichaijs 的头像

    chaijs/chai

    8,264在 GitHub 上查看↗

    Chai is an assertion library for Node.js and browser-based JavaScript applications. It functions as both a behavior-driven development and test-driven development framework, providing a system to verify code outputs, application state, and general logic. The project is an extensible validation engine that uses a plugin-based system to allow the registration of custom assertions and specialized data checks. It supports multiple modular assertion styles to accommodate different validation philosophies. The library covers a broad range of data validation capabilities, including the inspection o

    JavaScript
    在 GitHub 上查看↗8,264
  • sinonjs/sinonsinonjs 的头像

    sinonjs/sinon

    9,753在 GitHub 上查看↗

    Sinon is a JavaScript test double library and mocking framework used to isolate code and verify behavior during unit testing. It provides a collection of spies, stubs, and mocks that replace real function implementations and object methods with controlled substitutes. The project includes a specialized fake timer library for overriding the system clock, allowing the simulation of time progression to trigger timeouts and intervals without waiting for real-time delays. It also features a test sandbox mechanism to group multiple fakes together, ensuring the original state is restored between tes

    JavaScript
    在 GitHub 上查看↗9,753
  • bradleyjkemp/cupaloyB

    bradleyjkemp/cupaloy

    0在 GitHub 上查看↗
    在 GitHub 上查看↗0
查看 Go Cmp 的所有 30 个替代方案→