MCPcopy
hub / github.com/livebud/bud / TestScriptEval

Function TestScriptEval

package/budhttp/client_test.go:202–221  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

200}
201
202func TestScriptEval(t *testing.T) {
203 ctx := context.Background()
204 is := is.New(t)
205 log := testlog.New()
206 dir := t.TempDir()
207 td := testdir.New(dir)
208 is.NoErr(td.Write(ctx))
209 ps := pubsub.New()
210 server, err := loadServer(ps, dir)
211 is.NoErr(err)
212 server.Start(ctx)
213 defer server.Close()
214 client, err := budhttp.Load(log, server.Address())
215 is.NoErr(err)
216 err = client.Script("script.js", "function a() { return 1 }")
217 is.NoErr(err)
218 val, err := client.Eval("script.js", "a()")
219 is.NoErr(err)
220 is.Equal(val, "1")
221}

Callers

nothing calls this directly

Calls 14

NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
LoadFunction · 0.92
loadServerFunction · 0.85
NoErrMethod · 0.80
AddressMethod · 0.80
EqualMethod · 0.80
CloseMethod · 0.65
ScriptMethod · 0.65
EvalMethod · 0.65

Tested by

no test coverage detected