diff --git a/parser/parser_test.go b/parser/parser_test.go index 9c0508d..fae3374 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -8,6 +8,7 @@ import ( "github.com/robertkrimen/otto/ast" "github.com/robertkrimen/otto/file" + "github.com/robertkrimen/otto/underscore" ) func firstErr(err error) error { @@ -1005,3 +1006,13 @@ func TestPosition(t *testing.T) { is(node.(*ast.FunctionLiteral).Source, "function(){ return abc; }") }) } + +func BenchmarkParser(b *testing.B) { + src := underscore.Source() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + parser := newParser("", src) + parser.parse() + } +}