db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r686104 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/precedence.out tests/lang/LangScripts.java tests/lang/PrecedenceTest.java tests/lang/_Suite.java tests/lang/precedence.sql
Date Fri, 15 Aug 2008 01:44:17 GMT
Author: myrnavl
Date: Thu Aug 14 18:44:16 2008
New Revision: 686104

URL: http://svn.apache.org/viewvc?rev=686104&view=rev
Log:
DERBY-3758: convert lang/precendence.sql from LangScripts test to junit proper.
  patch contributed by Junjie Peng

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrecedenceTest.java
  (with props)
Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/precedence.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/precedence.sql
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java?rev=686104&r1=686103&r2=686104&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java
Thu Aug 14 18:44:16 2008
@@ -82,7 +82,6 @@
         "nonreserved",
         "orderby",
         "positionedDelUpd",
-        "precedence",
         "refActions1",
         "schemas",
         "select",

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrecedenceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrecedenceTest.java?rev=686104&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrecedenceTest.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrecedenceTest.java
Thu Aug 14 18:44:16 2008
@@ -0,0 +1,71 @@
+/**
+ *  Derby - Class org.apache.derbyTesting.functionTests.tests.lang.PrecedenceTest
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.derbyTesting.functionTests.tests.lang;
+
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import junit.framework.Test;
+
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test case for precedence.sql.It tests precedence of operators other than and,
+ * or, and not that return boolean.
+ */
+public class PrecedenceTest extends BaseJDBCTestCase {
+
+    public PrecedenceTest(String name) {
+        super(name);
+    }
+    
+    public static Test suite(){
+        return TestConfiguration.defaultSuite(PrecedenceTest.class);
+    }
+    
+    public void testPrecedence() throws SQLException{
+    	String sql = "create table t1(c11 int)";
+    	Statement st = createStatement();
+    	st.executeUpdate(sql);
+    	
+    	sql = "insert into t1 values(1)";
+    	assertEquals(1, st.executeUpdate(sql));
+    	
+    	sql = "select c11 from t1 where 1 in (1,2,3) = (1=1)";
+    	JDBC.assertSingleValueResultSet(st.executeQuery(sql), "1");
+    	
+    	sql = "select c11 from t1 where 'acme widgets' " +
+    			"like 'acme%' in ('1=1')";
+    	JDBC.assertSingleValueResultSet(st.executeQuery(sql), "1");
+    	
+    	sql = "select c11 from t1 where 1 between -100 " +
+    			"and 100 is not null";
+    	JDBC.assertSingleValueResultSet(st.executeQuery(sql), "1");
+    	
+    	sql = "select c11 from t1 where exists(select *" +
+    			" from (values 1) as t) not in ('1=2')";
+    	JDBC.assertEmpty(st.executeQuery(sql));
+    	
+    	st.close();
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrecedenceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=686104&r1=686103&r2=686104&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Thu Aug 14 18:44:16 2008
@@ -175,6 +175,7 @@
         suite.addTest(ArithmeticTest.suite());
         suite.addTest(ConstantExpressionTest.suite());
         suite.addTest(OptimizerOverridesTest.suite());
+        suite.addTest(PrecedenceTest.suite());
 
         return suite;
 	}



Mime
View raw message