testing package - google.golang.org/api/iterator/testing - Go Packages | Latest TMZ Celebrity News & Gossip | Watch TMZ Live

testing

package
v0.240.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package testing provides support functions for testing iterators conforming to the standard pattern. See package google.golang.org/api/iterator and https://github.com/GoogleCloudPlatform/gcloud-golang/wiki/Iterator-Guidelines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestIterator

func TestIterator(want interface{}, create func() interface{}, next func(interface{}) (interface{}, error)) (string, bool)

TestIterator tests the Next method of a standard iterator. It assumes that the underlying sequence to be iterated over already exists.

The want argument should be a slice that contains the elements of this sequence. It may be an empty slice, but it must not be the nil interface value. The elements must be comparable with reflect.DeepEqual.

The create function should create and return a new iterator. It will typically look like

func() interface{} { return client.Items(ctx) }

The next function takes the return value of create and should return the result of calling Next on the iterator. It can usually be defined as

func(it interface{}) (interface{}, error) { return it.(*ItemIterator).Next() }

TestIterator checks that the iterator returns all the elements of want in order, followed by (zero, done). It also confirms that subsequent calls to next also return (zero, done).

If the iterator implements the method

PageInfo() *iterator.PageInfo

then exact pagination with iterator.Pager is also tested. Pagination testing will be more informative if the want slice contains at least three elements.

On success, TestIterator returns ("", true). On failure, it returns a suitable error message and false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.