]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Tests to cover a few extra branches in fts3.c.
authordan <dan@noemail.net>
Sat, 12 Dec 2009 19:15:27 +0000 (19:15 +0000)
committerdan <dan@noemail.net>
Sat, 12 Dec 2009 19:15:27 +0000 (19:15 +0000)
FossilOrigin-Name: 06b72b007393dc34d75a8bb16ce0e4507d5f8faa

ext/fts3/fts3.c
manifest
manifest.uuid
test/fts3cov.test

index 749922f18007b08d81ce0402bb4162baf104c606..a66c776dd87f435702c6824ffd174996a0391805 100644 (file)
@@ -817,7 +817,7 @@ static int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){
         rc = SQLITE_CORRUPT;
       }
       pCsr->isEof = 1;
-      if( pContext && rc!=SQLITE_OK ){
+      if( pContext ){
         sqlite3_result_error_code(pContext, rc);
       }
       return rc;
@@ -1520,13 +1520,13 @@ static int fts3TermSelect(
   int nSegment = 0;               /* Size of apSegment array */
   int nAlloc = 16;                /* Allocated size of segment array */
   int rc;                         /* Return code */
-  sqlite3_stmt *pStmt;            /* SQL statement to scan %_segdir table */
+  sqlite3_stmt *pStmt = 0;        /* SQL statement to scan %_segdir table */
   int iAge = 0;                   /* Used to assign ages to segments */
 
   apSegment = (Fts3SegReader **)sqlite3_malloc(sizeof(Fts3SegReader*)*nAlloc);
   if( !apSegment ) return SQLITE_NOMEM;
   rc = sqlite3Fts3SegReaderPending(p, zTerm, nTerm, isPrefix, &apSegment[0]);
-  if( rc!=SQLITE_OK ) return rc;
+  if( rc!=SQLITE_OK ) goto finished;
   if( apSegment[0] ){
     nSegment = 1;
   }
@@ -2050,7 +2050,7 @@ static void fts3SnippetFunc(
     case 3: zEnd = (const char*)sqlite3_value_text(apVal[2]);
     case 2: zStart = (const char*)sqlite3_value_text(apVal[1]);
   }
-  if( !zStart || !zEnd || !zEllipsis ){
+  if( !zEllipsis || !zEnd || !zStart ){
     sqlite3_result_error_nomem(pContext);
   }else if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){
     sqlite3Fts3Snippet(pContext, pCsr, zStart, zEnd, zEllipsis);
index 7355ac2e41973717a57dff7ef0350805983f5a91..7aff063b1c272665597615a966c1581c454d8414 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Further\sfts3\scoverage\stests.
-D 2009-12-12T16:04:32
+C Tests\sto\scover\sa\sfew\sextra\sbranches\sin\sfts3.c.
+D 2009-12-12T19:15:28
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -56,7 +56,7 @@ F ext/fts2/mkfts2amal.tcl 974d5d438cb3f7c4a652639262f82418c1e4cff0
 F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
 F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
 F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
-F ext/fts3/fts3.c e1828210a55b4b27df2b1f6fa78b1fb12058f56e
+F ext/fts3/fts3.c ea601b21f6bcaab4035804993328a9f0231ec6cb
 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
 F ext/fts3/fts3Int.h 6fdd41b4f296e5bcc908444dc591397995d4ff5d
 F ext/fts3/fts3_expr.c fcf6812dbfd9cb9a2cabaf50e741411794f83e7e
@@ -396,7 +396,7 @@ F test/fts3ao.test 0aa29dd4fc1c8d46b1f7cfe5926f7ac97551bea9
 F test/fts3atoken.test 25c2070e1e8755d414bf9c8200427b277a9f99fa
 F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
 F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
-F test/fts3cov.test f2d27d29628941e4814473345603b20421b93c78
+F test/fts3cov.test 3a9d8618a3107166530c447e808f8992372e0415
 F test/fts3d.test 95fb3c862cbc4297c93fceb9a635543744e9ef52
 F test/fts3e.test 1f6c6ac9cc8b772ca256e6b22aaeed50c9350851
 F test/fts3expr.test 05dab77387801e4900009917bb18f556037d82da
@@ -779,7 +779,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 68cccd62b71f7b55bf7f2f56dc8507cbe80229ba
-R 24dafc1291b25c037b068505da647d63
+P d2a8c0f683271f5fb8c9badfb13e4e46fd78db71
+R 2bf0117c3db56e5351a8a9dca36e7a01
 U dan
-Z f50ab64261ebba22ef3131cb9e897960
+Z cff0315b4b1d4f7a0aab7cdae117a3f0
index 521448761d4c1cc0d4e94414e210b86b2a939fbc..3d353b7ff67edb9b86b82c1c5880e4a692566f92 100644 (file)
@@ -1 +1 @@
-d2a8c0f683271f5fb8c9badfb13e4e46fd78db71
\ No newline at end of file
+06b72b007393dc34d75a8bb16ce0e4507d5f8faa
\ No newline at end of file
index dab208bd543d47c77fa2c11e2ad5fe1c58ddb85d..d3fe4fa8c52bd3900409f527adb66d4bf3bb6586 100644 (file)
@@ -348,5 +348,26 @@ do_test fts3cov-11.1 {
   execsql { SELECT * FROM xx WHERE xx MATCH 'two' }
 } {}
 
-finish_test
 
+do_malloc_test fts3cov-12 -sqlprep {
+  CREATE VIRTUAL TABLE t12 USING fts3;
+  INSERT INTO t12 VALUES('is one of the two togther');
+  BEGIN;
+    INSERT INTO t12 VALUES('one which was appropriate at the time');
+} -sqlbody {
+  SELECT * FROM t12 WHERE t12 MATCH 'one'
+}
+
+do_malloc_test fts3cov-13 -sqlprep {
+  PRAGMA encoding = 'UTF-16';
+  CREATE VIRTUAL TABLE t13 USING fts3;
+  INSERT INTO t13 VALUES('two scalar functions');
+  INSERT INTO t13 VALUES('scalar two functions');
+  INSERT INTO t13 VALUES('functions scalar two');
+} -sqlbody {
+  SELECT snippet(t13, '%%', '%%', '#') FROM t13 WHERE t13 MATCH 'two';
+  SELECT snippet(t13, '%%', '%%') FROM t13 WHERE t13 MATCH 'two';
+  SELECT snippet(t13, '%%') FROM t13 WHERE t13 MATCH 'two';
+}
+
+finish_test