mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-03 17:43:49 +03:00
NextBlock() doesn't enter an empty block
This commit is contained in:
parent
2ce5102473
commit
0dba8d406b
2 changed files with 6 additions and 3 deletions
|
@ -109,6 +109,10 @@ func (d *Dispenser) NextBlock() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
d.Next()
|
d.Next()
|
||||||
|
if d.Val() == "}" {
|
||||||
|
// Open and then closed right away
|
||||||
|
return false
|
||||||
|
}
|
||||||
d.nesting++
|
d.nesting++
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,9 +149,8 @@ func TestDispenser_NextBlock(t *testing.T) {
|
||||||
assertNextBlock(true, 3, 1)
|
assertNextBlock(true, 3, 1)
|
||||||
assertNextBlock(true, 4, 1)
|
assertNextBlock(true, 4, 1)
|
||||||
assertNextBlock(false, 5, 0)
|
assertNextBlock(false, 5, 0)
|
||||||
d.Next() // foobar2
|
d.Next() // foobar2
|
||||||
assertNextBlock(true, 8, 1)
|
assertNextBlock(false, 8, 0) // empty block is as if it didn't exist
|
||||||
assertNextBlock(false, 8, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDispenser_Args(t *testing.T) {
|
func TestDispenser_Args(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue