1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-01 08:47:40 -04:00
gitea/vendor/github.com/niklasfasching/go-org/org/fuzz.go
Lauris BH 086a46994a Rewrite markdown rendering to blackfriday v2 and rewrite orgmode rendering to go-org (#8560)
* Rewrite markdown rendering to blackfriday v2.0

* Fix style

* Fix go mod with golang 1.13

* Fix blackfriday v2 import

* Inital orgmode renderer migration to go-org

* Vendor go-org dependency

* Ignore errors :/

* Update go-org to latest version

* Update test

* Fix go-org test

* Remove unneeded code

* Fix comments

* Fix markdown test

* Fix blackfriday regression rendering HTML block
2019-10-31 01:06:25 +00:00

28 lines
590 B
Go

// +build gofuzz
package org
import (
"bytes"
"strings"
)
// Fuzz function to be used by https://github.com/dvyukov/go-fuzz
func Fuzz(input []byte) int {
conf := New().Silent()
d := conf.Parse(bytes.NewReader(input), "")
orgOutput, err := d.Write(NewOrgWriter())
if err != nil {
panic(err)
}
htmlOutputA, err := d.Write(NewHTMLWriter())
if err != nil {
panic(err)
}
htmlOutputB, err := conf.Parse(strings.NewReader(orgOutput), "").Write(NewHTMLWriter())
if htmlOutputA != htmlOutputB {
panic("rendered org results in different html than original input")
}
return 0
}