List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:November 17 2010 3:07pm
Subject:bzr commit into mysql-5.1-mtr branch (bjorn.munch:2951) Bug#58257
View as plain text  
#At file:///home/bm136801/my/notspc-51/ based on revid:bjorn.munch@stripped

 2951 Bjorn Munch	2010-11-17
      Bug #58257 mysqltest: in if(), ! $var with space is always false
      Evaluation would start with the space and thus ignore the $
      Added while() to skip past white space

    modified:
      client/mysqltest.cc
      mysql-test/r/mysqltest.result
      mysql-test/t/mysqltest.test
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2010-11-15 13:23:02 +0000
+++ b/client/mysqltest.cc	2010-11-17 15:05:52 +0000
@@ -5434,7 +5434,9 @@ void do_block(enum block_cmd cmd, struct
   if (*expr_start == '!')
   {
     not_expr= TRUE;
-    expr_start++; /* Step past the '!' */
+    expr_start++; /* Step past the '!', then any whitespace */
+    while (*expr_start && my_isspace(charset_info, *expr_start))
+      expr_start++;
   }
   /* Find ending ')' */
   expr_end= strrchr(expr_start, ')');

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2010-11-15 13:23:02 +0000
+++ b/mysql-test/r/mysqltest.result	2010-11-17 15:05:52 +0000
@@ -402,7 +402,9 @@ true-inner
 true-inner again
 true-outer
 Counter is greater than 0, (counter=10)
+Counter should still be 10, is 10
 Counter is not 0, (counter=0)
+Not space var works
 Counter is true, (counter=alpha)
 Beta is true
 while with string, only once

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2010-11-15 13:23:02 +0000
+++ b/mysql-test/t/mysqltest.test	2010-11-17 15:05:52 +0000
@@ -1138,6 +1138,11 @@ if (!$counter)
 {
   echo Counter is not 0, (counter=10);
 }
+if (! $counter)
+{
+  let $counter=5;
+}
+echo Counter should still be 10, is $counter;
 let $counter=0;
 if($counter)
 {
@@ -1147,6 +1152,10 @@ if (!$counter)
 {
   echo Counter is not 0, (counter=0);
 }
+if (! $counter)
+{
+  echo Not space var works;
+}
 
 # ----------------------------------------------------------------------------
 # Test if with some non-numerics


Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20101117150552-jex9j2wov87hzmiq.bundle
Thread
bzr commit into mysql-5.1-mtr branch (bjorn.munch:2951) Bug#58257Bjorn Munch17 Nov