package flagsaver

import "github.com/google/trillian/util/flagsaver"

Package flagsaver provides a simple way to save and restore flag values. TODO(RJPercival): Move this to its own GitHub project.

Example:

func TestFoo(t *testing.T) {
  defer flagsaver.Save().Restore()
  // Test code that changes flags
} // flags are reset to their original values here.

Index

Types

type Stash

type Stash struct {
	// contains filtered or unexported fields
}

Stash holds flag values so that they can be restored at the end of a test.

func Save

func Save() *Stash

Save returns a Stash that captures the current value of all non-hidden flags.

func (*Stash) Restore

func (s *Stash) Restore()

Restore sets all non-hidden flags to the values they had when the Stash was created.

Source Files

flagsaver.go

Version
v1.0.4
Published
Dec 5, 2017
Platform
js/wasm
Imports
1 packages
Last checked
4 hours ago

Tools for package owners.