c9search mode is weird :(
This commit is contained in:
parent
0fe340b3fb
commit
00ebb80f87
2 changed files with 13 additions and 5 deletions
|
|
@ -50,9 +50,13 @@ function generateTestData() {
|
||||||
var data = tokenizer.getLineTokens(line, state);
|
var data = tokenizer.getLineTokens(line, state);
|
||||||
var tmp = [];
|
var tmp = [];
|
||||||
tmp.push(JSON.stringify(data.state));
|
tmp.push(JSON.stringify(data.state));
|
||||||
|
var tokenizedLine = "";
|
||||||
data.tokens.forEach(function(x) {
|
data.tokens.forEach(function(x) {
|
||||||
|
tokenizedLine += x.value;
|
||||||
tmp.push(JSON.stringify([x.type, x.value]));
|
tmp.push(JSON.stringify([x.type, x.value]));
|
||||||
});
|
});
|
||||||
|
if (tokenizedLine != line)
|
||||||
|
tmp.push(JSON.stringify(line));
|
||||||
state = data.state;
|
state = data.state;
|
||||||
return tmp.join(",\n ");
|
return tmp.join(",\n ");
|
||||||
});
|
});
|
||||||
|
|
@ -85,12 +89,15 @@ function testMode(modeName, i) {
|
||||||
lineData.values = [];
|
lineData.values = [];
|
||||||
lineData.types = [];
|
lineData.types = [];
|
||||||
lineData.state = lineData.shift();
|
lineData.state = lineData.shift();
|
||||||
|
var line = null;
|
||||||
|
if (typeof lineData[lineData.length - 1] == "string")
|
||||||
|
line = lineData.pop()
|
||||||
lineData.forEach(function(x) {
|
lineData.forEach(function(x) {
|
||||||
lineData.types.push(x[0]);
|
lineData.types.push(x[0]);
|
||||||
lineData.values.push(x[1]);
|
lineData.values.push(x[1]);
|
||||||
});
|
});
|
||||||
|
if (typeof line != "string")
|
||||||
var line = lineData.values.join("");
|
line = lineData.values.join("");
|
||||||
|
|
||||||
var tokens = tokenizer.getLineTokens(line, state);
|
var tokens = tokenizer.getLineTokens(line, state);
|
||||||
var values = tokens.tokens.map(function(x) {return x.value;});
|
var values = tokens.tokens.map(function(x) {return x.value;});
|
||||||
|
|
@ -98,7 +105,7 @@ function testMode(modeName, i) {
|
||||||
|
|
||||||
var success = true;
|
var success = true;
|
||||||
var err = testEqual([
|
var err = testEqual([
|
||||||
lineData.state, tokens.state,
|
JSON.stringify(lineData.state), JSON.stringify(tokens.state),
|
||||||
lineData.types, types,
|
lineData.types, types,
|
||||||
lineData.values, values]);
|
lineData.values, values]);
|
||||||
|
|
||||||
|
|
@ -107,7 +114,7 @@ function testMode(modeName, i) {
|
||||||
throw "error";
|
throw "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
state = lineData.state;
|
state = tokens.state;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function testEqual(a) {
|
function testEqual(a) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@
|
||||||
["text","var"],
|
["text","var"],
|
||||||
["text","' in"],
|
["text","' in"],
|
||||||
["text"," /.c9/metadata/workspace/plugins "],
|
["text"," /.c9/metadata/workspace/plugins "],
|
||||||
["text","(regexp, case sensitive, whole word)"]
|
["text","(regexp, case sensitive, whole word)"],
|
||||||
|
"Searching for \u0001var\u0001 in\u0001/.c9/metadata/workspace/plugins\u0001\u0001regexp, case sensitive, whole word\u0001"
|
||||||
],[
|
],[
|
||||||
["start",{}]
|
["start",{}]
|
||||||
],[
|
],[
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue