1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-07 08:41:17 +03:00

Fix a problem causing an assert() to fail if a snippet containing 0 tokens was requested from fts3.

FossilOrigin-Name: eafd0a1e3f25f38d551603f177ff4634cf79de77
This commit is contained in:
dan
2015-04-15 08:20:50 +00:00
parent 347bdc39a7
commit 2deb12be2b
4 changed files with 30 additions and 9 deletions

View File

@ -538,6 +538,25 @@ do_execsql_test 3.4 {
SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'one OR two OR three';
} {{[<b>one</b> <b>two</b> <b>three</b>]}}
#-------------------------------------------------------------------------
# Request a snippet 0 tokens in size. This is always an empty string.
do_execsql_test 4.1 {
CREATE VIRTUAL TABLE t4 USING fts4;
INSERT INTO t4 VALUES('a b c d');
SELECT snippet(t4, '[', ']', '...', 0, 0) FROM t4 WHERE t4 MATCH 'b';
} {{}}
do_test 4.2 {
set x35 [string trim [string repeat "x " 35]]
execsql "INSERT INTO t4 VALUES('$x35 E $x35 F $x35 G $x35');"
llength [db one {
SELECT snippet(t4, '', '', '', 0, 64) FROM t4 WHERE t4 MATCH 'E'
}]
} {64}
set sqlite_fts3_enable_parentheses 0
finish_test