test.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  2. // Distributed under an MIT license: http://codemirror.net/LICENSE
  3. (function() {
  4. var mode = CodeMirror.getMode({indentUnit: 4},
  5. {name: "python",
  6. version: 3,
  7. singleLineStringErrors: false});
  8. function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
  9. // Error, because "foobarhello" is neither a known type or property, but
  10. // property was expected (after "and"), and it should be in parentheses.
  11. MT("decoratorStartOfLine",
  12. "[meta @dec]",
  13. "[keyword def] [def function]():",
  14. " [keyword pass]");
  15. MT("decoratorIndented",
  16. "[keyword class] [def Foo]:",
  17. " [meta @dec]",
  18. " [keyword def] [def function]():",
  19. " [keyword pass]");
  20. MT("matmulWithSpace:", "[variable a] [operator @] [variable b]");
  21. MT("matmulWithoutSpace:", "[variable a][operator @][variable b]");
  22. MT("matmulSpaceBefore:", "[variable a] [operator @][variable b]");
  23. MT("fValidStringPrefix", "[string f'this is a {formatted} string']");
  24. MT("uValidStringPrefix", "[string u'this is an unicode string']");
  25. })();