Esempio n. 1
0
// NewTestController creates a new *Controller for
// the input specified, with a filename of "Testfile".
// The Config is bare, consisting only of a Root of cwd.
//
// Used primarily for testing but needs to be exported so
// add-ons can use this as a convenience. Does not initialize
// the server-block-related fields.
func NewTestController(input string) *Controller {
	return &Controller{
		Config: &server.Config{
			Root: ".",
		},
		Dispenser: parse.NewDispenser("Testfile", strings.NewReader(input)),
	}
}
Esempio n. 2
0
// NewTestController creates a new *Controller for
// the input specified, with a filename of "Testfile".
// The Config is bare, consisting only of a Root of cwd.
//
// Used primarily for testing but needs to be exported so
// add-ons can use this as a convenience. Does not initialize
// the server-block-related fields.
func NewTestController(input string) *Controller {
	return &Controller{
		Config: &server.Config{
			Root: ".",
		},
		Dispenser: parse.NewDispenser("Testfile", strings.NewReader(input)),
		OncePerServerBlock: func(f func() error) error {
			return f()
		},
	}
}