typed

package
v0.0.0-...-141b800 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package typed is a strictly typed wrapper around cmp.Diff.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff[T any](want T, got T, opts ...cmp.Option) string

Diff is just like cmp.Diff but it forces got and want to have the same type and includes protocmp.Transform().

This will result in more informative compile-time errors. protocmp.Transform() is necessary for any protocol buffer comparison, and it correctly does nothing if the arguments that we pass in are hereditarily non-protobufs. So, for developer convenience, let's just always add it.

if you want to extend the defaults, take a look at: - "go.chromium.org/luci/common/testing/registry"

func Got

func Got[T any](got T) *diffBuilder[T]

Got supports the got-before-want style, it can be used as:

if diff := Got(1).Want(2).Options(...).Diff(); diff != "" {
  ...
}

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL