add junit test cases

This commit is contained in:
李家奥
2022-04-20 14:37:11 +08:00
parent 5958b928dc
commit 2667b421c1
5 changed files with 91 additions and 2 deletions

View File

@@ -2126,9 +2126,9 @@ void QueryTableExpression() #void :
|
LOOKAHEAD(5) "(" [ LOOKAHEAD(2) SchemaName() "." ] TableName() [TableAlias()] ")"
|
LOOKAHEAD(3) [ <LATERAL> ] "(" Subquery() [ SubqueryRestrictionClause() ] ")"
LOOKAHEAD(5) [ <LATERAL> ] "(" Subquery() [ SubqueryRestrictionClause() ] ")"
|
LOOKAHEAD(3) "(" JoinClause() ")"
"(" JoinClause() ")"
)
}

View File

@@ -0,0 +1,32 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.plsql.ast;
import org.junit.Assert;
import org.junit.Test;
import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst;
public class ParenthesisGroupTest extends AbstractPLSQLParserTst {
@Test
public void parseParenthesisGroup0() {
ASTInput input = plsql.parseResource("ParenthesisGroup0.pls");
Assert.assertNotNull(input);
}
@Test
public void parseParenthesisGroup1() {
ASTInput input = plsql.parseResource("ParenthesisGroup1.pls");
Assert.assertNotNull(input);
}
@Test
public void parseParenthesisGroup2() {
ASTInput input = plsql.parseResource("ParenthesisGroup2.pls");
Assert.assertNotNull(input);
}
}

View File

@@ -0,0 +1,21 @@
CREATE OR REPLACE PROCEDURE EXAMPLE_PROCEDURE IS
--
CURSOR c_example IS
SELECT a.owner, u.object_name, p.aggregate
FROM (USER_OBJECTS u) INNER JOIN (ALL_OBJECTS a) ON
u.object_name = a.object_name AND u.object_type = a.object_type AND u.object_id = a.object_id)
INNER JOIN (ALL_PROCEDURES p) ON
p.owner = a.owner AND p.object_name = a.object_name AND p.object_type = a.object_type
WHERE a.owner = USER;
--
BEGIN
--
FOR l_object IN c_example LOOP
--
DBMS_OUTPUT.Put_Line(l_object.owner);
DBMS_OUTPUT.Put_Line(l_object.object_name);
DBMS_OUTPUT.Put_Line(l_object.aggregate);
--
END LOOP;
--
END EXAMPLE_PROCEDURE;

View File

@@ -0,0 +1,21 @@
CREATE OR REPLACE PROCEDURE EXAMPLE_PROCEDURE IS
--
CURSOR c_example IS
SELECT a.owner, u.object_name, p.aggregate
FROM (((USER_OBJECTS u) INNER JOIN (ALL_OBJECTS a) ON
u.object_name = a.object_name AND u.object_type = a.object_type AND u.object_id = a.object_id)
INNER JOIN (ALL_PROCEDURES p) ON
p.owner = a.owner AND p.object_name = a.object_name AND p.object_type = a.object_type)
WHERE a.owner = USER;
--
BEGIN
--
FOR l_object IN c_example LOOP
--
DBMS_OUTPUT.Put_Line(l_object.owner);
DBMS_OUTPUT.Put_Line(l_object.object_name);
DBMS_OUTPUT.Put_Line(l_object.aggregate);
--
END LOOP;
--
END EXAMPLE_PROCEDURE;

View File

@@ -0,0 +1,15 @@
CREATE OR REPLACE PROCEDURE TEST_PROCEDURE IS
--
CURSOR c_test IS
SELECT si.sid, sn.name, sa.age, ss.score, sp.parent
FROM ((((STUDENT_INFO si) INNER JOIN (STUDENT_AGE sa) on si.sid = sa.sid)
INNER JOIN
(STUDENT_SCORE ss) on si.sid = sp.sid)
INNER JOIN
(STUDENT_PARENT sp) on si.sid = sp.sid)
WHERE si.sid = '114514';
--
BEGIN
--
--
END EXAMPLE_PROCEDURE;