Skip to content

Commit

Permalink
fix infinite tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Jan 31, 2018
1 parent 8c57d3e commit e0fc813
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions fuzz_crashes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ func TestCrash1(t *testing.T) {
}
}

// TODO: this enters infinite loop
func NoTestInfinite1(t *testing.T) {
func TestInfinite1(t *testing.T) {
test := "[[[[[[\n\t: ]]]]]]\n\n: " + "\n\n:(()"
c := make(chan bool, 1)
go func() {
Expand Down Expand Up @@ -77,7 +76,7 @@ main.main()
go.fuzz.main/main.go:10 +0x2d fp=0xc42049df80 sp=0xc42049df68 pc=0x1118dad
runtime.main()
*/
func NoTestInfinite2(t *testing.T) {
func TestInfinite2(t *testing.T) {
test := ":\x00\x00\x00\x01V\n>* \x00\x80e\n\t* \n\n:\t"

c := make(chan bool, 1)
Expand Down
6 changes: 4 additions & 2 deletions parser/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ func (p *Parser) block(data []byte) {

// anything else must look like a normal paragraph
// note: this finds underlined headings, too
data = data[p.paragraph(data):]
idx := p.paragraph(data)
data = data[idx:]
}

p.nesting--
Expand Down Expand Up @@ -1479,7 +1480,8 @@ func (p *Parser) paragraph(data []byte) int {
// did this blank line followed by a definition list item?
if p.extensions&DefinitionLists != 0 {
if i < len(data)-1 && data[i+1] == ':' {
return p.list(data[prev:], ast.ListTypeDefinition)
listLen := p.list(data[prev:], ast.ListTypeDefinition)
return prev + listLen
}
}

Expand Down

0 comments on commit e0fc813

Please sign in to comment.