fix tests
This commit is contained in:
parent
47ba638f4b
commit
e3c001b79f
2 changed files with 12 additions and 9 deletions
|
|
@ -112,7 +112,7 @@ var SnippetManager = function() {
|
||||||
if (stack[0])
|
if (stack[0])
|
||||||
stack[0].expectIf = true;
|
stack[0].expectIf = true;
|
||||||
}, next: "start"},
|
}, next: "start"},
|
||||||
{regex: "[^:}]*:?", token: "", next: "start"}
|
{regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"}
|
||||||
],
|
],
|
||||||
formatString: [
|
formatString: [
|
||||||
{regex: "/(" + escape("/") + "+)/", token: "regex"},
|
{regex: "/(" + escape("/") + "+)/", token: "regex"},
|
||||||
|
|
@ -732,7 +732,7 @@ var moveRelative = function(point, start) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
require("ace/lib/dom").importCssString("\
|
require("./lib/dom").importCssString("\
|
||||||
.ace_snippet-marker {\
|
.ace_snippet-marker {\
|
||||||
-moz-box-sizing: border-box;\
|
-moz-box-sizing: border-box;\
|
||||||
box-sizing: border-box;\
|
box-sizing: border-box;\
|
||||||
|
|
|
||||||
|
|
@ -53,26 +53,29 @@ module.exports = {
|
||||||
guard: "(?:(=)|(:))?s*)",
|
guard: "(?:(=)|(:))?s*)",
|
||||||
trigger: "\\(?f",
|
trigger: "\\(?f",
|
||||||
endTrigger: "\\)",
|
endTrigger: "\\)",
|
||||||
endGuard: "\\)",
|
endGuard: "",
|
||||||
content: "{$0}\n"
|
content: "{$0}\n"
|
||||||
}, {
|
}, {
|
||||||
tabTrigger: "f",
|
tabTrigger: "f",
|
||||||
name: "function",
|
name: "f function",
|
||||||
content: "function"
|
content: "function"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var parsed = SnippetManager.parseSnippetFile(
|
var parsed = SnippetManager.parseSnippetFile(
|
||||||
"name a\nregex /(?:(=)|(:))?\s*)/\\(?f/\\)/\n\t{$0}" +
|
"name a\nregex /(?:(=)|(:))?\s*)/\\(?f/\\)/\n\t{$0}" +
|
||||||
"\n\t\n\n#function\nsnippet f function\n\tfunction"
|
"\n\t\n\n#function\nsnippet f function\n\tfunction"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(JSON.stringify(expected), JSON.stringify(parsed))
|
assert.equal(JSON.stringify(expected, null, 4), JSON.stringify(parsed, null, 4))
|
||||||
},
|
},
|
||||||
"test: parse snippet": function() {
|
"test: parse snippet": function() {
|
||||||
var content = "-\\$$2a${1:x${$2:y$3}\\n\\}$TM_SELECTION}";
|
var content = "-\\$$2a${1:x${$2:y$3\\}\\n\\}$TM_SELECTION}";
|
||||||
var tokens = SnippetManager.tokenizeTmSnippet(content);
|
var tokens = SnippetManager.tokenizeTmSnippet(content);
|
||||||
assert.equal(tokens.length, 14);
|
assert.equal(tokens.length, 15);
|
||||||
assert.equal(tokens[4] == tokens[13]);
|
assert.equal(tokens[4], tokens[14]);
|
||||||
assert.equal(tokens[2].tabstopId == 2);
|
assert.equal(tokens[2].tabstopId, 2);
|
||||||
|
|
||||||
var content = "\\}${var/as\\/d/\\ul\\//g:s}"
|
var content = "\\}${var/as\\/d/\\ul\\//g:s}"
|
||||||
var tokens = SnippetManager.tokenizeTmSnippet(content);
|
var tokens = SnippetManager.tokenizeTmSnippet(content);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue