Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(751)

Unified Diff: third_party/sqlite/src/test/fts3snippet.test

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/fts3query.test ('k') | third_party/sqlite/src/test/fts3tok1.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/fts3snippet.test
diff --git a/third_party/sqlite/src/test/fts3snippet.test b/third_party/sqlite/src/test/fts3snippet.test
index 415251dcced746f95079689bd1085b513782f34b..4e1d123b2f8a85123f98ab32c864245034ce9a8f 100644
--- a/third_party/sqlite/src/test/fts3snippet.test
+++ b/third_party/sqlite/src/test/fts3snippet.test
@@ -520,5 +520,43 @@ do_execsql_test 2.6 {
{[one] two three [four] five}
}
+#-------------------------------------------------------------------------
+do_execsql_test 3 {
+ CREATE VIRTUAL TABLE t3 USING fts4;
+ INSERT INTO t3 VALUES('[one two three]');
+}
+do_execsql_test 3.1 {
+ SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'one';
+} {{[<b>one</b> two three]}}
+do_execsql_test 3.2 {
+ SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'two';
+} {{[one <b>two</b> three]}}
+do_execsql_test 3.3 {
+ SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'three';
+} {{[one two <b>three</b>]}}
+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
+
« no previous file with comments | « third_party/sqlite/src/test/fts3query.test ('k') | third_party/sqlite/src/test/fts3tok1.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698