test.js 993 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  2. // Distributed under an MIT license: https://codemirror.net/LICENSE
  3. (function() {
  4. var mode = CodeMirror.getMode({indentUnit: 4}, "rust");
  5. function MT(name) {test.mode(name, mode, Array.prototype.slice.call(arguments, 1));}
  6. MT('integer_test',
  7. '[number 123i32]',
  8. '[number 123u32]',
  9. '[number 123_u32]',
  10. '[number 0xff_u8]',
  11. '[number 0o70_i16]',
  12. '[number 0b1111_1111_1001_0000_i32]',
  13. '[number 0usize]');
  14. MT('float_test',
  15. '[number 123.0f64]',
  16. '[number 0.1f64]',
  17. '[number 0.1f32]',
  18. '[number 12E+99_f64]');
  19. MT('string-literals-test',
  20. '[string "foo"]',
  21. '[string r"foo"]',
  22. '[string "\\"foo\\""]',
  23. '[string r#""foo""#]',
  24. '[string "foo #\\"# bar"]',
  25. '[string b"foo"]',
  26. '[string br"foo"]',
  27. '[string b"\\"foo\\""]',
  28. '[string br#""foo""#]',
  29. '[string br##"foo #" bar"##]',
  30. "[string-2 'h']",
  31. "[string-2 b'h']");
  32. })();