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

Function TestScript

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

Source from the content-addressed store, hash-verified

179}
180
181func TestScript(t *testing.T) {
182 ctx := context.Background()
183 is := is.New(t)
184 log := testlog.New()
185 dir := t.TempDir()
186 td := testdir.New(dir)
187 is.NoErr(td.Write(ctx))
188 ps := pubsub.New()
189 server, err := loadServer(ps, dir)
190 is.NoErr(err)
191 server.Start(ctx)
192 defer server.Close()
193 client, err := budhttp.Load(log, server.Address())
194 is.NoErr(err)
195 err = client.Script("script.js", "function a() { return 1 }")
196 is.NoErr(err)
197 err = client.Script("script.js", "function b() { return 1")
198 is.True(err != nil)
199 is.In(err.Error(), "SyntaxError: Unexpected end of input")
200}
201
202func TestScriptEval(t *testing.T) {
203 ctx := context.Background()

Callers

nothing calls this directly

Calls 15

NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
LoadFunction · 0.92
loadServerFunction · 0.85
NoErrMethod · 0.80
AddressMethod · 0.80
TrueMethod · 0.80
InMethod · 0.80
CloseMethod · 0.65
ScriptMethod · 0.65

Tested by

no test coverage detected