scripts/CodeMirror/mode/ruby/test.js (view raw)
1// CodeMirror, copyright (c) by Marijn Haverbeke and others
2// Distributed under an MIT license: https://codemirror.net/LICENSE
3
4(function() {
5 var mode = CodeMirror.getMode({indentUnit: 2}, "ruby");
6 function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
7
8 MT("divide_equal_operator",
9 "[variable bar] [operator /=] [variable foo]");
10
11 MT("divide_equal_operator_no_spacing",
12 "[variable foo][operator /=][number 42]");
13
14 MT("complex_regexp",
15 "[keyword if] [variable cr] [operator =~] [string-2 /(?: \\( #{][tag RE_NOT][string-2 }\\( | #{][tag RE_NOT_PAR_OR][string-2 }* #{][tag RE_OPA_OR][string-2 } )/][variable x]")
16
17 MT("indented_heredoc",
18 "[keyword def] [def x]",
19 " [variable y] [operator =] [string <<-FOO]",
20 "[string bar]",
21 "[string FOO]",
22 "[keyword end]")
23})();