Skip to content

Commit

Permalink
Added Bytes() generator
Browse files Browse the repository at this point in the history
  • Loading branch information
jaswdr committed Aug 21, 2018
1 parent 1c99615 commit 1be9d1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lorem.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ func (l Lorem) Text(maxNbChars int) (out string) {

return
}

func (l Lorem) Bytes(maxNbChars int) (out []byte) {
return []byte(l.Text(maxNbChars))
}
6 changes: 6 additions & 0 deletions lorem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ func TestText(t *testing.T) {
text := l.Text(255)
Expect(t, true, len(text) <= 255)
}

func TestBytes(t *testing.T) {
l := New().Lorem()
text := l.Bytes(255)
Expect(t, true, len(text) <= 255)
}

0 comments on commit 1be9d1b

Please sign in to comment.