Skip to content

Commit 74a4fd4

Browse files
committed
Take into account newlines
Fixes #67
1 parent 6bf0cf1 commit 74a4fd4

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

Gopkg.lock

+10-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/cli_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func TestCLI(t *testing.T) {
157157
},
158158
{
159159
"unknown format",
160-
[]string{"-f=sqll", "-t=USERS", "int:42,42", "enum:foo,foo"},
160+
[]string{"-f=no-format", "-t=USERS", "int:42,42", "enum:foo,foo"},
161161
"unknown-format.golden",
162162
true,
163163
},

integration/fixtures/file.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ from-an-existing-file
77
from-an-existing-file
88
from-an-existing-file
99
from-an-existing-file
10-
from-an-existing-file
10+
from-an-existing-file

integration/golden/unknown-format.golden

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
unknown format: sqll
1+
unknown format: no-format
22

33
Usage: fakedata [option ...] field...
44

pkg/fakedata/generator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func file(path string) (func() string, error) {
186186
if err != nil {
187187
return nil, fmt.Errorf("could not read file %s: %v", filePath, err)
188188
}
189-
list := strings.Split(string(content), "\n")
189+
list := strings.Split(strings.Trim(string(content), "\n"), "\n")
190190

191191
return func() string { return withList(list)() }, nil
192192
}

0 commit comments

Comments
 (0)