return s.evalFieldOrCall(data, n.ident, cmd.args, final)
}
if len(cmd.args) > 1 || final.IsValid() {
- // TODO: functions
- s.errorf("can't give argument to non-method %s", cmd.args[0])
+ s.errorf("can't give argument to non-function %s", cmd.args[0])
}
switch word := cmd.args[0].(type) {
case *dotNode:
}
case *stringNode:
return reflect.ValueOf(word.text)
- default:
- s.errorf("can't handle command %q", firstWord)
}
+ s.errorf("can't handle command %q", firstWord)
panic("not reached")
}
package template
import (
+ "flag"
"fmt"
"testing"
)
-const dumpErrors = true
+var debug = flag.Bool("debug", false, "show the errors produced by the tests")
type numberTest struct {
text string
continue
case err != nil && !test.ok:
// expected error, got one
- if dumpErrors {
+ if *debug {
fmt.Printf("%s: %s\n\t%s\n", test.name, test.input, err)
}
continue
continue
case err != nil && !test.ok:
// expected error, got one
- if dumpErrors {
+ if *debug {
fmt.Printf("%s: %s\n\t%s\n", test.name, test.input, err)
}
continue