Commit 0dba8d40 authored by Matthew Holt's avatar Matthew Holt

NextBlock() doesn't enter an empty block

parent 2ce51024
......@@ -109,6 +109,10 @@ func (d *Dispenser) NextBlock() bool {
return false
}
d.Next()
if d.Val() == "}" {
// Open and then closed right away
return false
}
d.nesting++
return true
}
......
......@@ -149,9 +149,8 @@ func TestDispenser_NextBlock(t *testing.T) {
assertNextBlock(true, 3, 1)
assertNextBlock(true, 4, 1)
assertNextBlock(false, 5, 0)
d.Next() // foobar2
assertNextBlock(true, 8, 1)
assertNextBlock(false, 8, 0)
d.Next() // foobar2
assertNextBlock(false, 8, 0) // empty block is as if it didn't exist
}
func TestDispenser_Args(t *testing.T) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment