Skip to content

Commit

Permalink
Dumps templates for fuzzy testing
Browse files Browse the repository at this point in the history
  • Loading branch information
aymerick committed Jun 8, 2015
1 parent 87a0ff3 commit 44017d2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1201,13 +1201,6 @@ These handlebars features are currently NOT implemented:
- `@level` - log level


## Todo

- [ ] add a test for inverse statement with the `each` helper
- [ ] test with <https://github.com/dvyukov/go-fuzz>
- [ ] benchmarks


## Handlebars Lexer

You should not use the lexer directly, but for your information here is an example:
Expand Down
16 changes: 16 additions & 0 deletions handlebars/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@ package handlebars

import (
"fmt"
"io/ioutil"
"path"
"strconv"
"testing"

"github.com/aymerick/raymond"
)

// cf. https://github.com/aymerick/go-fuzz-tests/raymond
const DUMP_TPL = true

var dump_tpl_nb = 0

type Test struct {
name string
input string
Expand All @@ -25,6 +33,14 @@ func launchTests(t *testing.T, tests []Test) {
var err error
var tpl *raymond.Template

if DUMP_TPL {
filename := strconv.Itoa(dump_tpl_nb)
if err := ioutil.WriteFile(path.Join(".", "dump_tpl", filename), []byte(test.input), 0644); err != nil {
panic(err)
}
dump_tpl_nb += 1
}

// parse template
tpl, err = raymond.Parse(test.input)
if err != nil {
Expand Down

0 comments on commit 44017d2

Please sign in to comment.