test.min.js (1416B)
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: 4}, 6 {name: "python", 7 version: 3, 8 singleLineStringErrors: false}); 9 function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } 10 11 // Error, because "foobarhello" is neither a known type or property, but 12 // property was expected (after "and"), and it should be in parentheses. 13 MT("decoratorStartOfLine", 14 "[meta @dec]", 15 "[keyword def] [def function]():", 16 " [keyword pass]"); 17 18 MT("decoratorIndented", 19 "[keyword class] [def Foo]:", 20 " [meta @dec]", 21 " [keyword def] [def function]():", 22 " [keyword pass]"); 23 24 MT("matmulWithSpace:", "[variable a] [operator @] [variable b]"); 25 MT("matmulWithoutSpace:", "[variable a][operator @][variable b]"); 26 MT("matmulSpaceBefore:", "[variable a] [operator @][variable b]"); 27 var before_equal_sign = ["+", "-", "*", "/", "=", "!", ">", "<"]; 28 for (var i = 0; i < before_equal_sign.length; ++i) { 29 var c = before_equal_sign[i] 30 MT("before_equal_sign_" + c, "[variable a] [operator " + c + "=] [variable b]"); 31 } 32 33 MT("fValidStringPrefix", "[string f'this is a {formatted} string']"); 34 MT("uValidStringPrefix", "[string u'this is an unicode string']"); 35 })();