| 776 |
lars |
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
|
2 |
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
|
|
3 |
|
|
|
4 |
(function() {
|
|
|
5 |
var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-c");
|
|
|
6 |
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
|
|
|
7 |
|
|
|
8 |
MT("indent",
|
|
|
9 |
"[variable-3 void] [def foo]([variable-3 void*] [variable a], [variable-3 int] [variable b]) {",
|
|
|
10 |
" [variable-3 int] [variable c] [operator =] [variable b] [operator +]",
|
|
|
11 |
" [number 1];",
|
|
|
12 |
" [keyword return] [operator *][variable a];",
|
|
|
13 |
"}");
|
|
|
14 |
|
|
|
15 |
MT("indent_switch",
|
|
|
16 |
"[keyword switch] ([variable x]) {",
|
|
|
17 |
" [keyword case] [number 10]:",
|
|
|
18 |
" [keyword return] [number 20];",
|
|
|
19 |
" [keyword default]:",
|
|
|
20 |
" [variable printf]([string \"foo %c\"], [variable x]);",
|
|
|
21 |
"}");
|
|
|
22 |
|
|
|
23 |
MT("def",
|
|
|
24 |
"[variable-3 void] [def foo]() {}",
|
|
|
25 |
"[keyword struct] [def bar]{}",
|
|
|
26 |
"[variable-3 int] [variable-3 *][def baz]() {}");
|
|
|
27 |
|
|
|
28 |
MT("double_block",
|
|
|
29 |
"[keyword for] (;;)",
|
|
|
30 |
" [keyword for] (;;)",
|
|
|
31 |
" [variable x][operator ++];",
|
|
|
32 |
"[keyword return];");
|
|
|
33 |
})();
|