github.com/leanovate/gopter@v0.2.9/commands/replay.go (about)

     1  package commands
     2  
     3  import (
     4  	"github.com/leanovate/gopter"
     5  )
     6  
     7  // Replay a sequence of commands on a system for regression testing
     8  func Replay(systemUnderTest SystemUnderTest, initialState State, commands ...Command) *gopter.PropResult {
     9  	sequentialCommands := make([]shrinkableCommand, 0, len(commands))
    10  	for _, command := range commands {
    11  		sequentialCommands = append(sequentialCommands, shrinkableCommand{command: command, shrinker: gopter.NoShrinker})
    12  	}
    13  	actions := actions{
    14  		initialStateProvider: func() State { return initialState },
    15  		sequentialCommands:   sequentialCommands,
    16  	}
    17  	return actions.run(systemUnderTest)
    18  }