Skip to content

Commit

Permalink
持续调整单测断言
Browse files Browse the repository at this point in the history
持续调整单测断言
  • Loading branch information
lizongbo committed Apr 20, 2024
1 parent 18c57cc commit b5f6f15
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11761,9 +11761,9 @@ public boolean visit(SQLPartitionOf x) {
x.getConstraintName().accept(this);
}
if (x.getCheckExpr() != null) {
print0(ucase ? " CHECK (" : " check (");
print0(ucase ? " CHECK " : " check ");
x.getCheckExpr().accept(this);
print0(")");
print0("");
}
if (x.getDefaultExpr() != null) {
print0(ucase ? " DEFAULT " : " default ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void test_0() throws Exception {
"FROM (\n" +
"\tSELECT /*+ qb_name(\"innerQuery\") */ 1 AS C1\n" +
"\tFROM SYS.\"X$KZSPR\" \"X$KZSPR\"\n" +
"\tWHERE \"X$KZSPR\".\"INST_ID\" = USERENV('INSTANCE')\n" +
"\tWHERE (\"X$KZSPR\".\"INST_ID\" = USERENV('INSTANCE'))\n" +
"\t\tAND (-\"X$KZSPR\".\"KZSPRPRV\" = -45\n" +
"\t\t\tOR -\"X$KZSPR\".\"KZSPRPRV\" = -47\n" +
"\t\t\tOR -\"X$KZSPR\".\"KZSPRPRV\" = -48\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public void test_0() throws Exception {
+ "\t, in_ProdDiscount, in_CreditCardFee, in_ServiceFee, in_ActivityNo, in_ProductShelfNo\n"
+ "\t, IN_PayOrganID, IN_CorrelationID\n"
+ "INTO (:b0, :b1, :b2:b3, :b4:b5, :b6:b7, :b8:b9, :b10:b11, :b12:b13, :b14:b15, :b16:b17, :b18:b19, :b20:b21, :b22:b23, :b24:b25, :b26:b27, :b28:b29, :b30:b31, :b32:b33, :b34:b35, :b36:b37, :b38:b39, :b40:b41, :b42:b43, :b44:b45, :b46:b47, :b48:b49, :b50:b51, :b52:b53, :b54:b55, :b56:b57, :b58:b59, :b60:b61, :b62:b63, :b64:b65, :b66:b67, :b68:b69, :b70:b71, :b72:b73, :b74:b75, :b76:b77, :b78:b79, :b80:b81, :b82:b83, :b84:b85, :b86:b87, :b88:b89, :b90:b91, :b92:b93, :b94:b95, :b96:b97, :b98:b99, :b100:b101, :b102:b103, :b104:b105)\n"
+ "FROM b2b_payment_ReconDetail\n" + "WHERE Recon_seq_id = :b106\n"
+ "\tAND transaction_id = :b107", text);
+ "FROM b2b_payment_ReconDetail\n" + "WHERE (Recon_seq_id = :b106\n"
+ "\tAND transaction_id = :b107)", text);
}

System.out.println("Tables : " + visitor.getTables());
Expand Down Expand Up @@ -110,8 +110,8 @@ public void test_1() throws Exception {
String text = SQLUtils.toOracleString(stmt);

assertEquals("SELECT max(Request_Seq)\n" + "INTO :b0:b1\n" + "FROM TrustBill\n"
+ "WHERE Acct_Home_City = :b2\n" + "\tAND (Acct_Home_County = :b3\n" + "\t\tOR :b3 = 0)\n"
+ "\tAND Accounting_Period = :b5\n" + "\tAND Trust_Method = :b6", text);
+ "WHERE (Acct_Home_City = :b2\n" + "\tAND (Acct_Home_County = :b3\n" + "\t\tOR :b3 = 0)\n"
+ "\tAND Accounting_Period = :b5\n" + "\tAND Trust_Method = :b6)", text);
}

System.out.println("Tables : " + visitor.getTables());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void test_1() throws Exception {
+ "WHERE server_id = 5000\n"
+ "\tAND health = 'A'\n"
+ "\tAND primary = 'Y'\n"
+ "\tAND last_update_date >= SYSDATE - 1 / 288", text);
+ "\tAND last_update_date >= (SYSDATE - (1 / 288))", text);
}

System.out.println("Tables : " + visitor.getTables());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void test_0() throws Exception {
"\t\t\t, CSRQ AS CSRQ, SSGAJGJGDM AS SSGAJGJGDM, AJLB AS AJLB, TBTSBJ AS TBTSBJ, LX AS LX\n" +
"\t\t\t, XP AS XP, NULL\n" +
"\t\tFROM QQFW_ZYK.GZDX\n" +
"\t\tWHERE XM = '忘轻春'\n" +
"\t\tWHERE (XM = '忘轻春')\n" +
"\t) row_\n" +
"\tWHERE rownum <= 5\n" +
")", text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,25 @@ public void test_0() throws Exception {
"\t\t\t\t), bb.flyj) AS flyj\n" +
"\t\t\t\t, bb.aybh, bb.aymc\n" +
"\t\t\t\t, CASE \n" +
"\t\t\t\t\tWHEN bb.jg = '1'\n" +
"\t\t\t\t\tWHEN (bb.jg = '1'\n" +
"\t\t\t\t\t\tAND bb.fk IS NULL\n" +
"\t\t\t\t\t\tAND bb.jl IS NULL\n" +
"\t\t\t\t\t\tAND (bb.zltcty IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.zltcty = '0')\n" +
"\t\t\t\t\t\tAND (bb.dxxkz IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.dxxkz = '0')\n" +
"\t\t\t\t\t\tAND bb.qtcfyj IS NULL\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL)\n" +
"\t\t\t\t\tTHEN '警告'\n" +
"\t\t\t\t\tWHEN bb.jg = '1'\n" +
"\t\t\t\t\tWHEN (bb.jg = '1'\n" +
"\t\t\t\t\t\tAND bb.fk IS NOT NULL\n" +
"\t\t\t\t\t\tAND bb.jl IS NULL\n" +
"\t\t\t\t\t\tAND (bb.zltcty IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.zltcty = '0')\n" +
"\t\t\t\t\t\tAND (bb.dxxkz IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.dxxkz = '0')\n" +
"\t\t\t\t\t\tAND bb.qtcfyj IS NULL\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL)\n" +
"\t\t\t\t\tTHEN '警告并处罚款' || f_num_zi(bb.fk) || '元'\n" +
"\t\t\t\t\tWHEN bb.jg = '1'\n" +
"\t\t\t\t\t\tAND bb.jl IS NOT NULL\n" +
Expand All @@ -132,15 +132,15 @@ public void test_0() throws Exception {
"\t\t\t\t\t\tAND bb.qtcfyj IS NULL\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL\n" +
"\t\t\t\t\tTHEN '行政拘留' || f_num_zi(bb.jl) || '日并警告'\n" +
"\t\t\t\t\tWHEN bb.jg = '1'\n" +
"\t\t\t\t\tWHEN (bb.jg = '1'\n" +
"\t\t\t\t\t\tAND bb.qtcfyj IS NOT NULL\n" +
"\t\t\t\t\t\tAND bb.fk IS NOT NULL\n" +
"\t\t\t\t\t\tAND bb.jl IS NULL\n" +
"\t\t\t\t\t\tAND (bb.zltcty IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.zltcty = '0')\n" +
"\t\t\t\t\t\tAND (bb.dxxkz IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.dxxkz = '0')\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL)\n" +
"\t\t\t\t\tTHEN '警告并' || bb.qtcfyj\n" +
"\t\t\t\t\tWHEN bb.fk IS NOT NULL\n" +
"\t\t\t\t\t\tAND (bb.jg IS NULL\n" +
Expand Down Expand Up @@ -247,17 +247,17 @@ public void test_0() throws Exception {
"\t\t\t\t\t\tAND bb.jd IS NULL\n" +
"\t\t\t\t\t\tAND bb.qtcfyj IS NULL\n" +
"\t\t\t\t\tTHEN '吊销公安机关发放的许可证'\n" +
"\t\t\t\t\tWHEN bb.dxxkz = '1'\n" +
"\t\t\t\t\tWHEN (bb.dxxkz = '1'\n" +
"\t\t\t\t\t\tAND bb.qtcfyj IS NOT NULL\n" +
"\t\t\t\t\t\tAND (bb.jg IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.jg = '0')\n" +
"\t\t\t\t\t\tAND bb.fk IS NULL\n" +
"\t\t\t\t\t\tAND (bb.zltcty IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.zltcty = '0')\n" +
"\t\t\t\t\t\tAND bb.jl IS NULL\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL)\n" +
"\t\t\t\t\tTHEN '吊销公安机关发放的许可证并' || bb.qtcfyj\n" +
"\t\t\t\t\tWHEN bb.qtcfyj IS NOT NULL\n" +
"\t\t\t\t\tWHEN (bb.qtcfyj IS NOT NULL\n" +
"\t\t\t\t\t\tAND (bb.jg IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.jg = '0')\n" +
"\t\t\t\t\t\tAND bb.fk IS NULL\n" +
Expand All @@ -266,7 +266,7 @@ public void test_0() throws Exception {
"\t\t\t\t\t\tAND bb.jl IS NULL\n" +
"\t\t\t\t\t\tAND bb.jd IS NULL\n" +
"\t\t\t\t\t\tAND (bb.dxxkz IS NULL\n" +
"\t\t\t\t\t\t\tOR bb.dxxkz = '0')\n" +
"\t\t\t\t\t\t\tOR bb.dxxkz = '0'))\n" +
"\t\t\t\t\tTHEN qtcfyj\n" +
"\t\t\t\t\tELSE NULL\n" +
"\t\t\t\tEND AS cfjgmx\n" +
Expand Down Expand Up @@ -808,7 +808,7 @@ public void test_0() throws Exception {
"\t\t\t\t\tSELECT a.rybh, a.ay_mc, a.ay_bh\n" +
"\t\t\t\t\t\t, trunc(MONTHS_BETWEEN(to_date(to_char(a.lrsj, 'yyyy-mm-dd'), 'yyyy-mm-dd'), to_date(to_char(a.csrq, 'yyyy-mm-dd'), 'yyyy-mm-dd')) / 12) AS nnl\n" +
"\t\t\t\t\tFROM case_gg_xyryxx a\n" +
"\t\t\t\t\tWHERE length(regexp_replace(a.sfzh, ?)) >= ?\n" +
"\t\t\t\t\tWHERE (length(regexp_replace(a.sfzh, ?)) >= ?)\n" +
"\t\t\t\t\t\tAND a.rybh NOT LIKE ?\n" +
"\t\t\t\t\t\tAND a.gj = ?\n" +
"\t\t\t\t\t\tAND a.ay_mc != ?\n" +
Expand Down Expand Up @@ -1042,17 +1042,17 @@ public void test_0() throws Exception {
"\t\t\t\t\t\tand bb.jd is null\n" +
"\t\t\t\t\t\tand bb.qtcfyj is null\n" +
"\t\t\t\t\tthen '吊销公安机关发放的许可证'\n" +
"\t\t\t\t\twhen bb.dxxkz = '1'\n" +
"\t\t\t\t\twhen (bb.dxxkz = '1'\n" +
"\t\t\t\t\t\tand bb.qtcfyj is not null\n" +
"\t\t\t\t\t\tand (bb.jg is null\n" +
"\t\t\t\t\t\t\tor bb.jg = '0')\n" +
"\t\t\t\t\t\tand bb.fk is null\n" +
"\t\t\t\t\t\tand (bb.zltcty is null\n" +
"\t\t\t\t\t\t\tor bb.zltcty = '0')\n" +
"\t\t\t\t\t\tand bb.jl is null\n" +
"\t\t\t\t\t\tand bb.jd is null\n" +
"\t\t\t\t\t\tand bb.jd is null)\n" +
"\t\t\t\t\tthen '吊销公安机关发放的许可证并' || bb.qtcfyj\n" +
"\t\t\t\t\twhen bb.qtcfyj is not null\n" +
"\t\t\t\t\twhen (bb.qtcfyj is not null\n" +
"\t\t\t\t\t\tand (bb.jg is null\n" +
"\t\t\t\t\t\t\tor bb.jg = '0')\n" +
"\t\t\t\t\t\tand bb.fk is null\n" +
Expand All @@ -1061,7 +1061,7 @@ public void test_0() throws Exception {
"\t\t\t\t\t\tand bb.jl is null\n" +
"\t\t\t\t\t\tand bb.jd is null\n" +
"\t\t\t\t\t\tand (bb.dxxkz is null\n" +
"\t\t\t\t\t\t\tor bb.dxxkz = '0')\n" +
"\t\t\t\t\t\t\tor bb.dxxkz = '0'))\n" +
"\t\t\t\t\tthen qtcfyj\n" +
"\t\t\t\t\telse null\n" +
"\t\t\t\tend as cfjgmx\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void test_0() throws Exception {
{
String text = SQLUtils.toOracleString(stmt);

assertEquals("SELECT o.STORE - o.LAST_STORE AS STORE\n" +
assertEquals("SELECT (o.STORE - o.LAST_STORE) AS STORE\n" +
"FROM t_order o;", text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class PGFromAsTest extends PGTest {
public void testFromAs() throws Exception {
String sql = "SELECT Count(*) FROM tb_abc AS t1 WHERE ((t1.a_id = 'global_a_id') AND (t1.owner = 'global_bc'));";
String expectedSql = "SELECT Count(*)\nFROM tb_abc t1\nWHERE t1.a_id = 'global_a_id'\n\tAND t1.owner = 'global_bc';";
String expectedSql = "SELECT Count(*)\nFROM tb_abc t1\nWHERE ((t1.a_id = 'global_a_id')\n\tAND (t1.owner = 'global_bc'));";
String expectedPattern = "SELECT COUNT(*)\nFROM tb_abc t1\nWHERE t1.a_id = ?\n\tAND t1.owner = ?";
testParseSql(sql, expectedSql, expectedPattern, PGSelectStatement.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void test_0() throws Exception {
"USING (\n" +
"\tSELECT CustomerId, TransactionValue\n" +
"\tFROM RecentTransactions\n" +
") T ON (CA.CustomerId = T.CustomerId) \n" +
") T ON CA.CustomerId = T.CustomerId \n" +
"WHEN NOT MATCHED THEN INSERT (CustomerId, Balance) VALUES (T.CustomerId, T.TransactionValue)\n" +
"WHEN MATCHED THEN UPDATE SET Balance = Balance + TransactionValue;" , stmt.toString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public void test_0() throws Exception {
Assert.assertEquals("SELECT id, login_name, name, password, salt"
+ "\n\t, roles, register_date"
+ "\nFROM user"
+ "\nWHERE name LIKE ?"
+ "\nWHERE (name LIKE ?)"
+ "\nLIMIT ? OFFSET ?", SQLUtils.toPGString(stmt));

Assert.assertEquals("select id, login_name, name, password, salt"
+ "\n\t, roles, register_date"
+ "\nfrom user"
+ "\nwhere name like ?"
+ "\nwhere (name like ?)"
+ "\nlimit ? offset ?", SQLUtils.toPGString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION));

Assert.assertEquals(1, statementList.size());
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/resources/bvt/parser/oracle-28.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ WHERE 1 = 2
AND CREDIT_CMT_APPLY.GMT_CREATE <= ?
AND CREDIT_CMT_APPLY.ID = A_B_C.cmt_apply_id
AND Type = 'denounce'
AND SHEET_STATUS = 'assigned_unresolved'
AND (SHEET_STATUS = 'assigned_unresolved')


0 comments on commit b5f6f15

Please sign in to comment.