MCPcopy Create free account
hub / github.com/dolthub/doltgresql / TestDropProcedure

Function TestDropProcedure

testing/go/drop_procedure_test.go:23–242  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestDropProcedure(t *testing.T) {
24 RunScripts(t, []ScriptTest{
25 {
26 Name: "Procedure does not exist",
27 Assertions: []ScriptTestAssertion{
28 {
29 Query: "DROP PROCEDURE doesnotexist;",
30 ExpectedErr: "does not exist",
31 },
32 {
33 Query: "DROP PROCEDURE IF EXISTS doesnotexist;",
34 Expected: []sql.Row{},
35 },
36 },
37 },
38 {
39 Name: "Basic cases",
40 SetUpScript: []string{
41 `CREATE PROCEDURE proc1() AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;`,
42 `CREATE PROCEDURE proc2(input INT) AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;`,
43 },
44 Assertions: []ScriptTestAssertion{
45 {
46 Query: "CALL proc1();",
47 Expected: []sql.Row{},
48 },
49 {
50 Query: "CALL proc2(99);",
51 Expected: []sql.Row{},
52 },
53 {
54 Query: "DROP PROCEDURE proc1;",
55 Expected: []sql.Row{},
56 },
57 {
58 Query: "DROP PROCEDURE proc2(INT);",
59 Expected: []sql.Row{},
60 },
61 {
62 Query: "CALL proc1();",
63 ExpectedErr: "does not exist",
64 },
65 {
66 Query: "CALL proc2(99);",
67 ExpectedErr: "does not exist",
68 },
69 },
70 },
71 {
72 Name: "Optional type information",
73 SetUpScript: []string{
74 `CREATE PROCEDURE proc1() AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;`,
75 `CREATE PROCEDURE proc2() AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;`,
76 `CREATE PROCEDURE proc3(input INT) AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;`,
77 `CREATE PROCEDURE proc4(input INT) AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;`,
78 `CREATE PROCEDURE proc5(input INT, foo TEXT) AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;`,
79 },
80 Assertions: []ScriptTestAssertion{

Callers

nothing calls this directly

Calls 1

RunScriptsFunction · 0.70

Tested by

no test coverage detected