MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / run

Function run

lib/web/CodeMirror/test/search_test.js:4–20  ·  view source on GitHub ↗
(doc, query, options)

Source from the content-addressed store, hash-verified

2 "use strict";
3
4 function run(doc, query, options) {
5 var cursor = doc.getSearchCursor(query, null, options);
6 for (var i = 3; i < arguments.length; i += 4) {
7 var found = cursor.findNext();
8 is(found, "not enough results (forward)");
9 eqCharPos(Pos(arguments[i], arguments[i + 1]), cursor.from(), "from, forward, " + (i - 3) / 4);
10 eqCharPos(Pos(arguments[i + 2], arguments[i + 3]), cursor.to(), "to, forward, " + (i - 3) / 4);
11 }
12 is(!cursor.findNext(), "too many matches (forward)");
13 for (var i = arguments.length - 4; i >= 3; i -= 4) {
14 var found = cursor.findPrevious();
15 is(found, "not enough results (backwards)");
16 eqCharPos(Pos(arguments[i], arguments[i + 1]), cursor.from(), "from, backwards, " + (i - 3) / 4);
17 eqCharPos(Pos(arguments[i + 2], arguments[i + 3]), cursor.to(), "to, backwards, " + (i - 3) / 4);
18 }
19 is(!cursor.findPrevious(), "too many matches (backwards)");
20 }
21
22 function test(name, f) { window.test("search_" + name, f) }
23

Callers 5

testFunction · 0.70
testFunction · 0.70
testCMFunction · 0.70
testVimFunction · 0.70
search_test.jsFile · 0.70

Calls 5

eqCharPosFunction · 0.85
fromMethod · 0.80
toMethod · 0.80
isFunction · 0.70
PosFunction · 0.50

Tested by 2

testFunction · 0.56
testFunction · 0.56