Skip to content

Commit 45e67ee

Browse files
authored
chore: add a new test case (#307)
1 parent eb58d37 commit 45e67ee

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

packages/sql/test/__snapshots__/fixtures.spec.ts.snap

+38
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,44 @@ CREATE SCHEMA test;
3636
"
3737
`;
3838

39+
exports[`parser and printer > should format all fixtures > 291.sql 1`] = `
40+
"BEGIN IF :APEX$ROW_STATUS = 'C' THEN
41+
-- Call the CreateProfessor procedure to insert the new professor
42+
CreateProfessor (
43+
p_first_name = > :FIRST_NAME,
44+
p_last_name = > :LAST_NAME,
45+
p_user_name = > :USER_NAME,
46+
p_email = > :EMAIL,
47+
p_department_id = > :DEPARTMENT_ID,
48+
p_salary = > :SALARY,
49+
p_work_hours = > :WORK_HOURS,
50+
p_title = > :TITLE
51+
);
52+
53+
ELSIF :APEX$ROW_STATUS = 'U' THEN
54+
-- Call the UpdateProfessor procedure to update the professor
55+
UpdateProfessor (
56+
p_user_id = > :USER_ID,
57+
p_first_name = > :FIRST_NAME,
58+
p_last_name = > :LAST_NAME,
59+
p_user_name = > :USER_NAME,
60+
p_email = > :EMAIL,
61+
p_department_id = > :DEPARTMENT_ID,
62+
p_salary = > :SALARY,
63+
p_work_hours = > :WORK_HOURS,
64+
p_title = > :TITLE
65+
);
66+
67+
ELSIF :APEX$ROW_STATUS = 'D' THEN
68+
-- Call the DeleteProfessor procedure to delete the professor
69+
DeleteProfessor (p_user_id = > :USER_ID);
70+
71+
END IF;
72+
73+
END;
74+
"
75+
`;
76+
3977
exports[`parser and printer > should format all fixtures > basic.sql 1`] = `
4078
"-- this is a comment
4179
SELECT

packages/sql/test/fixtures.spec.ts

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ const PARSER_OPTIONS: Record<string, SqlFormatOptions> = {
2727
custom: [{ regex: String.raw`\\c` }],
2828
} satisfies ParamTypes),
2929
},
30+
291: {
31+
paramTypes: JSON.stringify({
32+
custom: [{ regex: String.raw`:\w+(\$\w+)?` }],
33+
} satisfies ParamTypes),
34+
},
3035
}
3136

3237
const _dirname =

packages/sql/test/fixtures/291.sql

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
BEGIN
2+
IF :APEX$ROW_STATUS = 'C' THEN
3+
-- Call the CreateProfessor procedure to insert the new professor
4+
CreateProfessor(
5+
p_first_name => :FIRST_NAME,
6+
p_last_name => :LAST_NAME,
7+
p_user_name => :USER_NAME,
8+
p_email => :EMAIL,
9+
p_department_id => :DEPARTMENT_ID,
10+
p_salary => :SALARY,
11+
p_work_hours => :WORK_HOURS,
12+
p_title => :TITLE
13+
);
14+
15+
ELSIF :APEX$ROW_STATUS = 'U' THEN
16+
-- Call the UpdateProfessor procedure to update the professor
17+
UpdateProfessor(
18+
p_user_id => :USER_ID,
19+
p_first_name => :FIRST_NAME,
20+
p_last_name => :LAST_NAME,
21+
p_user_name => :USER_NAME,
22+
p_email => :EMAIL,
23+
p_department_id => :DEPARTMENT_ID,
24+
p_salary => :SALARY,
25+
p_work_hours => :WORK_HOURS,
26+
p_title => :TITLE
27+
);
28+
29+
ELSIF :APEX$ROW_STATUS = 'D' THEN
30+
-- Call the DeleteProfessor procedure to delete the professor
31+
DeleteProfessor(p_user_id => :USER_ID);
32+
END IF;
33+
END;

0 commit comments

Comments
 (0)