|
@@ -71,10 +71,17 @@ define([
|
|
|
it('should tokenize metric with template parameter', function() {
|
|
it('should tokenize metric with template parameter', function() {
|
|
|
var lexer = new Lexer("metric.[[server]].test");
|
|
var lexer = new Lexer("metric.[[server]].test");
|
|
|
var tokens = lexer.tokenize();
|
|
var tokens = lexer.tokenize();
|
|
|
- expect(tokens[2].type).to.be('templateStart');
|
|
|
|
|
- expect(tokens[3].type).to.be('identifier');
|
|
|
|
|
- expect(tokens[3].value).to.be('server');
|
|
|
|
|
- expect(tokens[4].type).to.be('templateEnd');
|
|
|
|
|
|
|
+ expect(tokens[2].type).to.be('identifier');
|
|
|
|
|
+ expect(tokens[2].value).to.be('[[server]]');
|
|
|
|
|
+ expect(tokens[4].type).to.be('identifier');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should tokenize metric with question mark', function() {
|
|
|
|
|
+ var lexer = new Lexer("metric.server_??.test");
|
|
|
|
|
+ var tokens = lexer.tokenize();
|
|
|
|
|
+ expect(tokens[2].type).to.be('identifier');
|
|
|
|
|
+ expect(tokens[2].value).to.be('server_??');
|
|
|
|
|
+ expect(tokens[4].type).to.be('identifier');
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('should handle error with unterminated string', function() {
|
|
it('should handle error with unterminated string', function() {
|