func TestGetValidationKeys(t *testing.T) {
	fset := token.NewFileSet()
	file, err := parser.ParseFile(fset, "validationKeysSource", validationKeysSource, 0)
	if err != nil {
		t.Fatal(err)
	}
	if len(file.Decls) != 2 {
		t.Fatal("Expected 2 decl in the source, found", len(file.Decls))
	}
	for i, decl := range file.Decls {
		lineKeys := revelParser.GetValidationKeys("test", fset, decl.(*ast.FuncDecl), map[string]string{"revel": model.RevelImportPath})
		for k, v := range expectedValidationKeys[i] {
			if lineKeys[k] != v {
				t.Errorf("Not found - %d: %v - Actual Map: %v", k, v, lineKeys)
			}
		}
		if len(lineKeys) != len(expectedValidationKeys[i]) {
			t.Error("Validation key map not the same size as expected:", lineKeys)
		}
	}
}
This tests the recording of line number to validation key of the preceeding
example source.
package parser_test
import (
	"go/ast"
	"go/parser"
	"go/token"
	"reflect"
	"strings"
	"testing"
	"github.com/revel/cmd/model"
	revelParser "github.com/revel/cmd/parser"
)
const validationKeysSource = `
package test
func (c *Application) testFunc(a, b int, user models.User) revel.Result {
	c.Validation.Required(a)
	c.Validation.Required(a).Message("Error message")
	c.Validation.Required(a).
		Message("Error message")
	c.Validation.Required(user.Name)
	c.Validation.Required(user.Name).Message("Error message")
	c.Validation.MinSize(b, 12)
	c.Validation.MinSize(b, 12).Message("Error message")
	c.Validation.MinSize(b,
		12)
	c.Validation.Required(b == 5)
}
func (m Model) Validate(v *revel.Validation) {
	v.Required(m.name)
	v.Required(m.name == "something").
		Message("Error Message")
	v.Required(!m.bool)
}
`
var expectedValidationKeys = []map[int]string{
	{
		6:  "a",
		7:  "a",
		8:  "a",
		12: "user.Name",
		13: "user.Name",
		16: "b",
		17: "b",
		19: "b",
		22: "b",
	}, {
		27: "m.name",
		28: "m.name",
		30: "m.bool",
	},
}