Skip to content

Commit

Permalink
A bit of renaming on GeneratedContent stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnc committed Jul 27, 2017
1 parent 5f4e634 commit 23afa9e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions generator/generated_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (

type GeneratedContent map[string]GeneratedEntities

type GeneratedEntities []GeneratedEntity
type GeneratedEntities []GeneratedFields

type GeneratedEntity map[string]interface{}
type GeneratedFields map[string]interface{}

func NewGeneratedEntities(count int64) GeneratedEntities {
return make([]GeneratedEntity, count)
return make([]GeneratedFields, count)
}

func NewGeneratedContent() GeneratedContent {
Expand All @@ -40,7 +40,7 @@ func (gc GeneratedContent) WriteFilePerKey() error {
}
d := NewGeneratedContent()
d[k] = v
if err = d.writeToFile(out); err != nil {
if err = d.write(out); err != nil {
return err
}
}
Expand All @@ -53,10 +53,10 @@ func (gc GeneratedContent) WriteContentToFile(dest string) error {
return err
}

return gc.writeToFile(out)
return gc.write(out)
}

func (gc GeneratedContent) writeToFile(out io.Writer) error {
func (gc GeneratedContent) write(out io.Writer) error {
if closeable, doClose := isClosable(out); doClose {
defer closeable.Close()
}
Expand Down
4 changes: 2 additions & 2 deletions generator/generated_content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
func TestAppendingToGeneratedContent(t *testing.T) {
actual := NewGeneratedContent()

beast := GeneratedEntities{GeneratedEntity{"of the beast": 666}}
beast := GeneratedEntities{GeneratedFields{"of the beast": 666}}

expected := GeneratedContent{"sign": beast}
actual.Append(expected)

Assert(t, reflect.DeepEqual(expected, actual), "expected \n%v\n to be equal to \n%v\n but wasn't", expected, actual)

rick := GeneratedEntity{
rick := GeneratedFields{
"of Rick": "wubba lubba dub dub!!!!",
}

Expand Down
2 changes: 1 addition & 1 deletion generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (g *Generator) Generate(count int64) GeneratedContent {
result := NewGeneratedContent()
entities := NewGeneratedEntities(count)
for i := int64(0); i < count; i++ {
entity := GeneratedEntity{}
entity := GeneratedFields{}
for name, field := range g.fields {
entity[name] = field.GenerateValue()
}
Expand Down

0 comments on commit 23afa9e

Please sign in to comment.