Skip to content

Commit

Permalink
Test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
liderman committed Nov 14, 2021
1 parent bae106c commit c672d25
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Fast text generator on a mask.

[![Go Report Card](https://goreportcard.com/badge/github.com/liderman/text-generator)](https://goreportcard.com/report/github.com/liderman/text-generator)
[![codecov](https://codecov.io/gh/liderman/text-generator/branch/master/graph/badge.svg?token=53NH949TQY)](https://codecov.io/gh/liderman/text-generator)
[![Go Reference](https://pkg.go.dev/badge/github.com/liderman/text-generator.svg)](https://pkg.go.dev/github.com/liderman/text-generator)
[![Release](https://img.shields.io/github/release/liderman/text-generator.svg?style=flat-square)](https://github.com/liderman/text-generator/releases/latest)

Expand Down
8 changes: 8 additions & 0 deletions cached-text-generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ func TestCustomCachedGenerate(t *testing.T) {
assert.Equal(t, result, prevResult)
}
}

func TestCachedTextGenerator_CustomGenerateConfig(t *testing.T) {
tg := New()
NewCached(tg, 10).Configure('[', ']', '!')
assert.Equal(t, tg.startTag, "[")
assert.Equal(t, tg.endTag, "]")
assert.Equal(t, tg.separator, "!")
}
2 changes: 1 addition & 1 deletion text-generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type TextGenerator struct {
}

// New returns a new instance a text generator.
func New() GeneratorInterface {
func New() *TextGenerator {
rand.Seed(time.Now().UnixNano())
return &TextGenerator{
startTag: '{',
Expand Down

0 comments on commit c672d25

Please sign in to comment.