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

v2 parser should require newlines between expressions #526

Closed
moorereason opened this issue Apr 23, 2021 · 1 comment · Fixed by #527
Closed

v2 parser should require newlines between expressions #526

moorereason opened this issue Apr 23, 2021 · 1 comment · Fixed by #527
Labels
bug Issues describing a bug in go-toml.

Comments

@moorereason
Copy link
Contributor

moorereason commented Apr 23, 2021

Description

TOML expressions should be separated by one or more newlines.

To Reproduce

The following test should not pass but does:

diff --git a/unmarshaler_test.go b/unmarshaler_test.go
index 7d1bd07..fc30367 100644
--- a/unmarshaler_test.go
+++ b/unmarshaler_test.go
@@ -231,6 +231,20 @@ func TestUnmarshal(t *testing.T) {
                                }
                        },
                },
+               {
+                       desc:  "no newline",
+                       input: `a = 1z = 2`,
+                       gen: func() test {
+                               m := map[string]interface{}{}
+                               return test{
+                                       target: &m,
+                                       expected: &map[string]interface{}{
+                                               `a`: int64(1),
+                                               `z`: int64(2),
+                                       },
+                               }
+                       },
+               },
                {
                        desc: "multiline basic string",
                        input: `A = """\

Versions

  • go-toml: a533331
  • go1.16.3 linux/amd64

Related to #413.

pelletier added a commit that referenced this issue Apr 24, 2021
@pelletier pelletier linked a pull request Apr 24, 2021 that will close this issue
@pelletier pelletier added the bug Issues describing a bug in go-toml. label Apr 24, 2021
@pelletier
Copy link
Owner

Thank you for catching this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues describing a bug in go-toml.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants