strings

package
v0.0.0-...-93a508a Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package strings provides string related utilities for testing purposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SliceDiffIgnoreOrder

func SliceDiffIgnoreOrder(a, b []string) string

SliceDiffIgnoreOrder returns a human-readable diff of two string slices. Two slices are considered equal when they have the same length and same elements. The order of the elements is ignored while comparing. Nil and empty slices are considered equal.

This function is intended to be used in tests for comparing expected and actual values, and printing the diff for users to debug:

if diff := SliceDiffIgnoreOrder(got, want); diff != "" {
    t.Errorf("got: %v, want: %v, diff: %s", got, want, diff)
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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