add failing unit test for #510

This commit is contained in:
Fabian Jakobs 2011-11-28 17:38:58 +01:00
commit cd271f1a8b
3 changed files with 12 additions and 1 deletions

View file

@ -18,3 +18,5 @@ do ->
///imgy ///imgy
this isnt: `just JavaScript` this isnt: `just JavaScript`
undefined undefined
sentence = "#{ 22 / 7 } is a decent approximation of π"

View file

@ -179,12 +179,14 @@ define(function(require, exports, module) {
qstring : [{ qstring : [{
token : "string", token : "string",
regex : "[^\\\\']*(?:\\\\.[^\\\\']*)*'", regex : "[^\\\\']*(?:\\\\.[^\\\\']*)*'",
merge : true,
next : "start" next : "start"
}, stringfill], }, stringfill],
qqstring : [{ qqstring : [{
token : "string", token : "string",
regex : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"', regex : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
merge : true,
next : "start" next : "start"
}, stringfill], }, stringfill],

View file

@ -53,6 +53,13 @@ module.exports = {
var tokens = this.tokenizer.getLineTokens("for", "start").tokens; var tokens = this.tokenizer.getLineTokens("for", "start").tokens;
assert.equal(tokens.length, 1); assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, "keyword"); assert.equal(tokens[0].type, "keyword");
},
"test tokenize string with interpolation": function() {
var tokens = this.tokenizer.getLineTokens('"#{ 22 / 7 } is a decent approximation of π"', "start").tokens;
console.log(tokens);
assert.equal(tokens.length, 12);
//assert.equal(tokens[0].type, "keyword");
} }
}; };