You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fuzz.go 590B

123456789101112131415161718192021222324252627
  1. // +build gofuzz
  2. package org
  3. import (
  4. "bytes"
  5. "strings"
  6. )
  7. // Fuzz function to be used by https://github.com/dvyukov/go-fuzz
  8. func Fuzz(input []byte) int {
  9. conf := New().Silent()
  10. d := conf.Parse(bytes.NewReader(input), "")
  11. orgOutput, err := d.Write(NewOrgWriter())
  12. if err != nil {
  13. panic(err)
  14. }
  15. htmlOutputA, err := d.Write(NewHTMLWriter())
  16. if err != nil {
  17. panic(err)
  18. }
  19. htmlOutputB, err := conf.Parse(strings.NewReader(orgOutput), "").Write(NewHTMLWriter())
  20. if htmlOutputA != htmlOutputB {
  21. panic("rendered org results in different html than original input")
  22. }
  23. return 0
  24. }