test.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. (function() {
  2. var mode = CodeMirror.getMode({tabSize: 4}, "stex");
  3. function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
  4. MT("word",
  5. "foo");
  6. MT("twoWords",
  7. "foo bar");
  8. MT("beginEndDocument",
  9. "[tag \\begin][bracket {][atom document][bracket }]",
  10. "[tag \\end][bracket {][atom document][bracket }]");
  11. MT("beginEndEquation",
  12. "[tag \\begin][bracket {][atom equation][bracket }]",
  13. " E=mc^2",
  14. "[tag \\end][bracket {][atom equation][bracket }]");
  15. MT("beginModule",
  16. "[tag \\begin][bracket {][atom module][bracket }[[]]]");
  17. MT("beginModuleId",
  18. "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]");
  19. MT("importModule",
  20. "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]");
  21. MT("importModulePath",
  22. "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]");
  23. MT("psForPDF",
  24. "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]");
  25. MT("comment",
  26. "[comment % foo]");
  27. MT("tagComment",
  28. "[tag \\item][comment % bar]");
  29. MT("commentTag",
  30. " [comment % \\item]");
  31. MT("commentLineBreak",
  32. "[comment %]",
  33. "foo");
  34. MT("tagErrorCurly",
  35. "[tag \\begin][error }][bracket {]");
  36. MT("tagErrorSquare",
  37. "[tag \\item][error ]]][bracket {]");
  38. MT("commentCurly",
  39. "[comment % }]");
  40. MT("tagHash",
  41. "the [tag \\#] key");
  42. MT("tagNumber",
  43. "a [tag \\$][atom 5] stetson");
  44. MT("tagPercent",
  45. "[atom 100][tag \\%] beef");
  46. MT("tagAmpersand",
  47. "L [tag \\&] N");
  48. MT("tagUnderscore",
  49. "foo[tag \\_]bar");
  50. MT("tagBracketOpen",
  51. "[tag \\emph][bracket {][tag \\{][bracket }]");
  52. MT("tagBracketClose",
  53. "[tag \\emph][bracket {][tag \\}][bracket }]");
  54. MT("tagLetterNumber",
  55. "section [tag \\S][atom 1]");
  56. MT("textTagNumber",
  57. "para [tag \\P][atom 2]");
  58. MT("thinspace",
  59. "x[tag \\,]y");
  60. MT("thickspace",
  61. "x[tag \\;]y");
  62. MT("negativeThinspace",
  63. "x[tag \\!]y");
  64. MT("periodNotSentence",
  65. "J.\\ L.\\ is");
  66. MT("periodSentence",
  67. "X[tag \\@]. The");
  68. MT("italicCorrection",
  69. "[bracket {][tag \\em] If[tag \\/][bracket }] I");
  70. MT("tagBracket",
  71. "[tag \\newcommand][bracket {][tag \\pop][bracket }]");
  72. MT("inlineMathTagFollowedByNumber",
  73. "[keyword $][tag \\pi][number 2][keyword $]");
  74. MT("inlineMath",
  75. "[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text");
  76. MT("displayMath",
  77. "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text");
  78. MT("mathWithComment",
  79. "[keyword $][variable-2 x] [comment % $]",
  80. "[variable-2 y][keyword $] other text");
  81. MT("lineBreakArgument",
  82. "[tag \\\\][bracket [[][atom 1cm][bracket ]]]");
  83. })();