parent
9d634eee7b
commit
4012c32a55
4 changed files with 76 additions and 27 deletions
|
|
@ -96,19 +96,42 @@ module.exports = {
|
|||
assert.equal("text", tokens[1].type);
|
||||
assert.equal("rparen", tokens[2].type);
|
||||
},
|
||||
|
||||
|
||||
"test for last rule in ruleset to catch capturing group bugs" : function() {
|
||||
var tokens = this.tokenizer.getLineTokens("}", "start").tokens;
|
||||
|
||||
|
||||
assert.equal(1, tokens.length);
|
||||
assert.equal("rparen", tokens[0].type);
|
||||
},
|
||||
|
||||
"test tokenize regular expressions": function() {
|
||||
|
||||
"test tokenize arithmetic expression which looks like a regexp": function() {
|
||||
var tokens = this.tokenizer.getLineTokens("a/b/c", "start").tokens;
|
||||
assert.equal(5, tokens.length);
|
||||
|
||||
var tokens = this.tokenizer.getLineTokens("a/=b/c", "start").tokens;
|
||||
assert.equal(5, tokens.length);
|
||||
},
|
||||
|
||||
"test tokenize reg exps" : function() {
|
||||
var tokens = this.tokenizer.getLineTokens("a=/b/g", "start").tokens;
|
||||
assert.equal(3, tokens.length);
|
||||
assert.equal("string.regexp", tokens[2].type);
|
||||
|
||||
var tokens = this.tokenizer.getLineTokens("a+/b/g", "start").tokens;
|
||||
assert.equal(3, tokens.length);
|
||||
assert.equal("string.regexp", tokens[2].type);
|
||||
|
||||
var tokens = this.tokenizer.getLineTokens("a = 1 + /2 + 1/b", "start").tokens;
|
||||
assert.equal(9, tokens.length);
|
||||
assert.equal("string.regexp", tokens[8].type);
|
||||
|
||||
var tokens = this.tokenizer.getLineTokens("a=/a/ / /a/", "start").tokens;
|
||||
assert.equal(7, tokens.length);
|
||||
assert.equal("string.regexp", tokens[2].type);
|
||||
assert.equal("string.regexp", tokens[6].type);
|
||||
},
|
||||
|
||||
|
||||
"test tokenize identifier with umlauts": function() {
|
||||
var tokens = this.tokenizer.getLineTokens("füße", "start").tokens;
|
||||
assert.equal(1, tokens.length);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue