MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestUserFunctionSyntaxError

Function TestUserFunctionSyntaxError

db/functions/function_test.go:420–437  ·  view source on GitHub ↗

Test that JS syntax errors are detected when the db opens.

(t *testing.T)

Source from the content-addressed store, hash-verified

418
419// Test that JS syntax errors are detected when the db opens.
420func TestUserFunctionSyntaxError(t *testing.T) {
421 var kUserFunctionBadConfig = FunctionsConfig{
422 Definitions: FunctionsDefs{
423 "square": &FunctionConfig{
424 Code: "return args.numero * args.numero;",
425 Args: []string{"numero"},
426 Allow: &Allow{Channels: []string{"wonderland"}},
427 },
428 "syntax_error": &FunctionConfig{
429 Code: "returm )42(",
430 Allow: allowAll,
431 },
432 },
433 }
434
435 _, err := CompileFunctions(base.TestCtx(t), kUserFunctionBadConfig)
436 assert.Error(t, err)
437}
438
439func TestUserFunctionsMaxFunctionCount(t *testing.T) {
440 var twoFunctionConfig = FunctionsConfig{

Callers

nothing calls this directly

Calls 3

TestCtxFunction · 0.92
CompileFunctionsFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected