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 tmp = [];
|
||||
tmp.push(JSON.stringify(data.state));
|
||||
var tokenizedLine = "";
|
||||
data.tokens.forEach(function(x) {
|
||||
tokenizedLine += x.value;
|
||||
tmp.push(JSON.stringify([x.type, x.value]));
|
||||
});
|
||||
if (tokenizedLine != line)
|
||||
tmp.push(JSON.stringify(line));
|
||||
state = data.state;
|
||||
return tmp.join(",\n ");
|
||||
});
|
||||
|
|
@ -85,12 +89,15 @@ function testMode(modeName, i) {
|
|||
lineData.values = [];
|
||||
lineData.types = [];
|
||||
lineData.state = lineData.shift();
|
||||
var line = null;
|
||||
if (typeof lineData[lineData.length - 1] == "string")
|
||||
line = lineData.pop()
|
||||
lineData.forEach(function(x) {
|
||||
lineData.types.push(x[0]);
|
||||
lineData.values.push(x[1]);
|
||||
});
|
||||
|
||||
var line = lineData.values.join("");
|
||||
if (typeof line != "string")
|
||||
line = lineData.values.join("");
|
||||
|
||||
var tokens = tokenizer.getLineTokens(line, state);
|
||||
var values = tokens.tokens.map(function(x) {return x.value;});
|
||||
|
|
@ -98,7 +105,7 @@ function testMode(modeName, i) {
|
|||
|
||||
var success = true;
|
||||
var err = testEqual([
|
||||
lineData.state, tokens.state,
|
||||
JSON.stringify(lineData.state), JSON.stringify(tokens.state),
|
||||
lineData.types, types,
|
||||
lineData.values, values]);
|
||||
|
||||
|
|
@ -107,7 +114,7 @@ function testMode(modeName, i) {
|
|||
throw "error";
|
||||
}
|
||||
|
||||
state = lineData.state;
|
||||
state = tokens.state;
|
||||
});
|
||||
}
|
||||
function testEqual(a) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
["text","var"],
|
||||
["text","' in"],
|
||||
["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",{}]
|
||||
],[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue