fix background_tokenizer_test
This commit is contained in:
parent
2ffe3726ce
commit
dd84a7d650
1 changed files with 20 additions and 20 deletions
|
|
@ -53,34 +53,34 @@ function forceTokenize(session){
|
||||||
}
|
}
|
||||||
|
|
||||||
function testStates(session, states) {
|
function testStates(session, states) {
|
||||||
for (var i = 0, l = session.getLength(); i < l; i++)
|
for (var i = 0, l = session.getLength(); i < l; i++)
|
||||||
assert.equal(session.bgTokenizer.states[i], states[i])
|
assert.equal(session.bgTokenizer.states[i], states[i])
|
||||||
assert.ok(l == states.length)
|
assert.ok(l == states.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
"test background tokenizer update on session change" : function() {
|
"test background tokenizer update on session change" : function() {
|
||||||
var doc = new EditSession([
|
var doc = new EditSession([
|
||||||
"/*",
|
"/*",
|
||||||
"*/",
|
"*/",
|
||||||
"var juhu"
|
"var juhu"
|
||||||
]);
|
]);
|
||||||
doc.setMode("ace/mode/javascript")
|
doc.setMode("./mode/javascript")
|
||||||
|
|
||||||
forceTokenize(doc)
|
forceTokenize(doc)
|
||||||
testStates(doc, ["comment", "start", "start"])
|
testStates(doc, ["comment", "start", "start"])
|
||||||
|
|
||||||
doc.remove(new Range(0,2,1,2))
|
doc.remove(new Range(0,2,1,2))
|
||||||
testStates(doc, [null, "start"])
|
testStates(doc, [null, "start"])
|
||||||
|
|
||||||
forceTokenize(doc)
|
forceTokenize(doc)
|
||||||
testStates(doc, ["comment", "comment"])
|
testStates(doc, ["comment", "comment"])
|
||||||
|
|
||||||
doc.insert({row:0, column:2}, "\n*/")
|
doc.insert({row:0, column:2}, "\n*/")
|
||||||
testStates(doc, [undefined, undefined, "comment"])
|
testStates(doc, [undefined, undefined, "comment"])
|
||||||
|
|
||||||
forceTokenize(doc)
|
forceTokenize(doc)
|
||||||
testStates(doc, ["comment", "start", "start"])
|
testStates(doc, ["comment", "start", "start"])
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue