Ejemplo n.º 1
0
func parTestGobler(t *testing.T, l *glick.Library, api, act, cmdPath string, useJSON bool, tisOut func() interface{}) {
	gobbler := fmt.Sprintf("%v", !useJSON)
	if err := l.Configure([]byte(`[
{"Plugin":"pie1","API":"` + api + `","Actions":["intStr1"],"Type":"PIE","Cmd":["` + cmdPath + `"],"Method":"CI.CopyIntX","Gob":` + gobbler + `}
		]`)); err != nil {
		t.Error(err)
	}
	par := test.IntStr{I: 42}
	if _, err := l.Run(nil, api, "intStr1", par); err != nil {
		t.Error("unable to run intStr1 for " + api + " err=" + err.Error())
	}
	if err := l.Configure([]byte(`[
{"Plugin":"pie2","API":"` + api + `","Actions":["intStr2"],"Type":"PIE"}
		]`)); err == nil {
		t.Error("unsuited end pie exe not spotted")
	}
	if err := l.Configure([]byte(`[
{"Plugin":"pie3","API":"` + api + `","Actions":["intStr1"],"Type":"PIE","Cmd":["illegal path"]}
		]`)); err == nil {
		t.Error("unsuited pie exe path not spotted")
	}
	if err := l.Configure([]byte(`[
{"Plugin":"pie4","API":"nothing here","Actions":["intStr1"],"Type":"PIE"}
		]`)); err == nil {
		t.Error("unsuited pie api not spotted")
	}
}