Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take into account newlines #68

Merged
merged 1 commit into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integration/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestCLI(t *testing.T) {
},
{
"unknown format",
[]string{"-f=sqll", "-t=USERS", "int:42,42", "enum:foo,foo"},
[]string{"-f=no-format", "-t=USERS", "int:42,42", "enum:foo,foo"},
"unknown-format.golden",
true,
},
Expand Down
2 changes: 1 addition & 1 deletion integration/fixtures/file.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ from-an-existing-file
from-an-existing-file
from-an-existing-file
from-an-existing-file
from-an-existing-file
from-an-existing-file
2 changes: 1 addition & 1 deletion integration/golden/unknown-format.golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
unknown format: sqll
unknown format: no-format

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/fakedata/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func file(path string) (func() string, error) {
if err != nil {
return nil, fmt.Errorf("could not read file %s: %v", filePath, err)
}
list := strings.Split(string(content), "\n")
list := strings.Split(strings.Trim(string(content), "\n"), "\n")

return func() string { return withList(list)() }, nil
}
Expand Down