1
0

test.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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({}, "shell");
  5. function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
  6. MT("var",
  7. "text [def $var] text");
  8. MT("varBraces",
  9. "text[def ${var}]text");
  10. MT("varVar",
  11. "text [def $a$b] text");
  12. MT("varBracesVarBraces",
  13. "text[def ${a}${b}]text");
  14. MT("singleQuotedVar",
  15. "[string 'text $var text']");
  16. MT("singleQuotedVarBraces",
  17. "[string 'text ${var} text']");
  18. MT("doubleQuotedVar",
  19. '[string "text ][def $var][string text"]');
  20. MT("doubleQuotedVarBraces",
  21. '[string "text][def ${var}][string text"]');
  22. MT("doubleQuotedVarPunct",
  23. '[string "text ][def $@][string text"]');
  24. MT("doubleQuotedVarVar",
  25. '[string "][def $a$b][string "]');
  26. MT("doubleQuotedVarBracesVarBraces",
  27. '[string "][def ${a}${b}][string "]');
  28. MT("notAString",
  29. "text\\'text");
  30. MT("escapes",
  31. "outside\\'\\\"\\`\\\\[string \"inside\\`\\'\\\"\\\\`\\$notAVar\"]outside\\$\\(notASubShell\\)");
  32. MT("subshell",
  33. "[builtin echo] [quote $(whoami)] s log, stardate [quote `date`].");
  34. MT("doubleQuotedSubshell",
  35. "[builtin echo] [string \"][quote $(whoami)][string 's log, stardate `date`.\"]");
  36. MT("hashbang",
  37. "[meta #!/bin/bash]");
  38. MT("comment",
  39. "text [comment # Blurb]");
  40. MT("numbers",
  41. "[number 0] [number 1] [number 2]");
  42. MT("keywords",
  43. "[keyword while] [atom true]; [keyword do]",
  44. " [builtin sleep] [number 3]",
  45. "[keyword done]");
  46. MT("options",
  47. "[builtin ls] [attribute -l] [attribute --human-readable]");
  48. MT("operator",
  49. "[def var][operator =]value");
  50. })();