Commit e62b2223 authored by Matthew Holt's avatar Matthew Holt

Couple more controller tests

parent a0e93009
......@@ -3,7 +3,18 @@ package config
import "testing"
func TestController(t *testing.T) {
c := controller{parser: new(parser)}
p := &parser{filename: "test"}
c := newController(p)
if c == nil || c.parser == nil {
t.Fatal("Expected newController to return a non-nil controller with a non-nil parser")
}
if c.dispenser.cursor != -1 {
t.Errorf("Dispenser not initialized properly; expecting cursor at -1, got %d", c.dispenser.cursor)
}
if c.dispenser.filename != p.filename {
t.Errorf("Dispenser's filename should be same as parser's (%s); got '%s'", p.filename, c.dispenser.filename)
}
c.Startup(func() error { return nil })
if n := len(c.parser.cfg.Startup); n != 1 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment