Skip to content

Commit

Permalink
chore: add a new test case (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Nov 10, 2023
1 parent eb58d37 commit 45e67ee
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
38 changes: 38 additions & 0 deletions packages/sql/test/__snapshots__/fixtures.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,44 @@ CREATE SCHEMA test;
"
`;

exports[`parser and printer > should format all fixtures > 291.sql 1`] = `
"BEGIN IF :APEX$ROW_STATUS = 'C' THEN
-- Call the CreateProfessor procedure to insert the new professor
CreateProfessor (
p_first_name = > :FIRST_NAME,
p_last_name = > :LAST_NAME,
p_user_name = > :USER_NAME,
p_email = > :EMAIL,
p_department_id = > :DEPARTMENT_ID,
p_salary = > :SALARY,
p_work_hours = > :WORK_HOURS,
p_title = > :TITLE
);
ELSIF :APEX$ROW_STATUS = 'U' THEN
-- Call the UpdateProfessor procedure to update the professor
UpdateProfessor (
p_user_id = > :USER_ID,
p_first_name = > :FIRST_NAME,
p_last_name = > :LAST_NAME,
p_user_name = > :USER_NAME,
p_email = > :EMAIL,
p_department_id = > :DEPARTMENT_ID,
p_salary = > :SALARY,
p_work_hours = > :WORK_HOURS,
p_title = > :TITLE
);
ELSIF :APEX$ROW_STATUS = 'D' THEN
-- Call the DeleteProfessor procedure to delete the professor
DeleteProfessor (p_user_id = > :USER_ID);
END IF;
END;
"
`;

exports[`parser and printer > should format all fixtures > basic.sql 1`] = `
"-- this is a comment
SELECT
Expand Down
5 changes: 5 additions & 0 deletions packages/sql/test/fixtures.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const PARSER_OPTIONS: Record<string, SqlFormatOptions> = {
custom: [{ regex: String.raw`\\c` }],
} satisfies ParamTypes),
},
291: {
paramTypes: JSON.stringify({
custom: [{ regex: String.raw`:\w+(\$\w+)?` }],
} satisfies ParamTypes),
},
}

const _dirname =
Expand Down
33 changes: 33 additions & 0 deletions packages/sql/test/fixtures/291.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
BEGIN
IF :APEX$ROW_STATUS = 'C' THEN
-- Call the CreateProfessor procedure to insert the new professor
CreateProfessor(
p_first_name => :FIRST_NAME,
p_last_name => :LAST_NAME,
p_user_name => :USER_NAME,
p_email => :EMAIL,
p_department_id => :DEPARTMENT_ID,
p_salary => :SALARY,
p_work_hours => :WORK_HOURS,
p_title => :TITLE
);

ELSIF :APEX$ROW_STATUS = 'U' THEN
-- Call the UpdateProfessor procedure to update the professor
UpdateProfessor(
p_user_id => :USER_ID,
p_first_name => :FIRST_NAME,
p_last_name => :LAST_NAME,
p_user_name => :USER_NAME,
p_email => :EMAIL,
p_department_id => :DEPARTMENT_ID,
p_salary => :SALARY,
p_work_hours => :WORK_HOURS,
p_title => :TITLE
);

ELSIF :APEX$ROW_STATUS = 'D' THEN
-- Call the DeleteProfessor procedure to delete the professor
DeleteProfessor(p_user_id => :USER_ID);
END IF;
END;

0 comments on commit 45e67ee

Please sign in to comment.