Skip to content

Commit

Permalink
Test for block with top level comment after value parse
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed May 17, 2024
1 parent 61e5a7c commit fc02b91
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 0 additions & 1 deletion conf/lex.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ func (lx *lexer) emitString() {
} else {
finalString = lx.input[lx.start:lx.pos]
}

// Position of string in line where it started.
pos := lx.pos - lx.ilstart - len(finalString)
lx.items <- item{itemString, finalString, lx.line, pos}
Expand Down
18 changes: 18 additions & 0 deletions conf/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,24 @@ func TestBlocks(t *testing.T) {
},
"", "",
},
{
"comment in block scope after value parse",
`
{
"debug": False
"server_name": "gcp-asianortheast3-natscj1-1"
# Profile port specification.
"prof_port": 8221
}
`,
map[string]any{
"debug": false,
"prof_port": int64(8221),
"server_name": "gcp-asianortheast3-natscj1-1",
},
"", "",
},
} {
t.Run(test.name, func(t *testing.T) {
f, err := os.CreateTemp(t.TempDir(), "nats.conf-")
Expand Down

0 comments on commit fc02b91

Please sign in to comment.