diff --git a/test/PMA_SQL_parser_test.php b/test/PMA_SQL_parser_test.php index 0c26bb4c0..2774ba10d 100644 --- a/test/PMA_SQL_parser_test.php +++ b/test/PMA_SQL_parser_test.php @@ -15,6 +15,10 @@ define('PHPMYADMIN', 1); define('TESTSUITE', 1); $GLOBALS['charset'] = 'utf-8'; +function __($s) { + return $s; +} + /** * Include to test. */ @@ -27,9 +31,10 @@ require_once './libraries/sqlparser.lib.php'; */ class PMA_SQL_parser_test extends PHPUnit_Framework_TestCase { - private function assertParser($sql, $expected) + private function assertParser($sql, $expected, $error = '') { $parsed_sql = PMA_SQP_parse($sql); + $this->assertEquals(PMA_SQP_getErrorString(), $error); $this->assertEquals($parsed_sql, $expected); } @@ -140,5 +145,37 @@ class PMA_SQL_parser_test extends PHPUnit_Framework_TestCase 'len' => 5, )); } + + public function testParse_4() + { + $this->assertParser('SELECT * from `aaa;', array ( + 'raw' => 'SELECT * from `aaa;', + 0 => + array ( + 'type' => 'alpha', + 'data' => 'SELECT', + 'pos' => 6, + ), + 1 => + array ( + 'type' => 'punct', + 'data' => '*', + 'pos' => 0, + ), + 2 => + array ( + 'type' => 'alpha', + 'data' => 'from', + 'pos' => 13, + ), + ), +'

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

+
+ERROR: Unclosed quote @ 14
+STR: `
+SQL: SELECT * from `aaa;
+
+'); + } } ?>