Encode incoming son data as string for ease of use

This commit is contained in:
Steve Streeting 2015-08-25 16:56:21 +01:00
parent 3f18feb2e2
commit 0968ac04dd

@ -9,7 +9,6 @@ package test
// as if the test was in the same package (as usual)
import (
"bytes"
"fmt"
"io"
"io/ioutil"
@ -189,7 +188,7 @@ type FileInput struct {
// Input data (optional, if provided will be source of data)
DataReader io.Reader
// Input data (optional, if provided will be source of data)
Data []byte
Data string
}
// Input for defining commits for test repo
@ -282,8 +281,8 @@ func (repo *Repo) AddCommits(inputs []*CommitInput) []*CommitOutput {
// Any files to write?
for fi, infile := range input.Files {
inputData := infile.DataReader
if inputData == nil && infile.Data != nil {
inputData = bytes.NewReader(infile.Data)
if inputData == nil && infile.Data != "" {
inputData = strings.NewReader(infile.Data)
}
if inputData == nil {
// Different data for each file but deterministic