guard-mthaml 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (341) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +34 -0
  3. data/lib/guard/mthaml.rb +140 -0
  4. data/lib/guard/mthaml/compiler/MtHaml.php +255 -0
  5. data/lib/guard/mthaml/templates/Guardfile +12 -0
  6. data/lib/guard/mthaml/version.rb +5 -0
  7. data/vendor/autoload.php +7 -0
  8. data/vendor/coffeescript/coffeescript/LICENSE +22 -0
  9. data/vendor/coffeescript/coffeescript/README.md +96 -0
  10. data/vendor/coffeescript/coffeescript/composer.json +23 -0
  11. data/vendor/coffeescript/coffeescript/grammar.y +309 -0
  12. data/vendor/coffeescript/coffeescript/make.php +115 -0
  13. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Compiler.php +76 -0
  14. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Error.php +15 -0
  15. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Helpers.php +116 -0
  16. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Init.php +96 -0
  17. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Lexer.php +1356 -0
  18. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Nodes.php +105 -0
  19. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Parser.php +3326 -0
  20. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Rewriter.php +552 -0
  21. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Scope.php +196 -0
  22. data/vendor/coffeescript/coffeescript/src/CoffeeScript/SyntaxError.php +9 -0
  23. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Value.php +20 -0
  24. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Access.php +31 -0
  25. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Arr.php +69 -0
  26. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Assign.php +353 -0
  27. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Base.php +288 -0
  28. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Block.php +294 -0
  29. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Call.php +283 -0
  30. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Class.php +282 -0
  31. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Closure.php +49 -0
  32. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Code.php +203 -0
  33. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Comment.php +39 -0
  34. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php +42 -0
  35. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Extends.php +26 -0
  36. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/For.php +250 -0
  37. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/If.php +161 -0
  38. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/In.php +99 -0
  39. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Index.php +27 -0
  40. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Literal.php +96 -0
  41. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Obj.php +126 -0
  42. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Op.php +292 -0
  43. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Param.php +119 -0
  44. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Parens.php +45 -0
  45. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Range.php +225 -0
  46. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Return.php +56 -0
  47. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php +47 -0
  48. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Splat.php +100 -0
  49. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Switch.php +121 -0
  50. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Throw.php +37 -0
  51. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Try.php +79 -0
  52. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Value.php +210 -0
  53. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/While.php +112 -0
  54. data/vendor/coffeescript/coffeescript/tests/cases/arrays.coffee +77 -0
  55. data/vendor/coffeescript/coffeescript/tests/cases/assignment.coffee +352 -0
  56. data/vendor/coffeescript/coffeescript/tests/cases/booleans.coffee +21 -0
  57. data/vendor/coffeescript/coffeescript/tests/cases/classes.coffee +681 -0
  58. data/vendor/coffeescript/coffeescript/tests/cases/comments.coffee +207 -0
  59. data/vendor/coffeescript/coffeescript/tests/cases/compilation.coffee +72 -0
  60. data/vendor/coffeescript/coffeescript/tests/cases/comprehensions.coffee +501 -0
  61. data/vendor/coffeescript/coffeescript/tests/cases/control_flow.coffee +430 -0
  62. data/vendor/coffeescript/coffeescript/tests/cases/eval.coffee +29 -0
  63. data/vendor/coffeescript/coffeescript/tests/cases/exception_handling.coffee +102 -0
  64. data/vendor/coffeescript/coffeescript/tests/cases/formatting.coffee +146 -0
  65. data/vendor/coffeescript/coffeescript/tests/cases/function_invocation.coffee +552 -0
  66. data/vendor/coffeescript/coffeescript/tests/cases/functions.coffee +188 -0
  67. data/vendor/coffeescript/coffeescript/tests/cases/helpers.coffee +96 -0
  68. data/vendor/coffeescript/coffeescript/tests/cases/importing.coffee +18 -0
  69. data/vendor/coffeescript/coffeescript/tests/cases/interpolation.coffee +138 -0
  70. data/vendor/coffeescript/coffeescript/tests/cases/javascript_literals.coffee +10 -0
  71. data/vendor/coffeescript/coffeescript/tests/cases/numbers.coffee +76 -0
  72. data/vendor/coffeescript/coffeescript/tests/cases/objects.coffee +271 -0
  73. data/vendor/coffeescript/coffeescript/tests/cases/operators.coffee +277 -0
  74. data/vendor/coffeescript/coffeescript/tests/cases/option_parser.coffee +43 -0
  75. data/vendor/coffeescript/coffeescript/tests/cases/ranges.coffee +88 -0
  76. data/vendor/coffeescript/coffeescript/tests/cases/regexps.coffee +63 -0
  77. data/vendor/coffeescript/coffeescript/tests/cases/scope.coffee +43 -0
  78. data/vendor/coffeescript/coffeescript/tests/cases/slicing_and_splicing.coffee +143 -0
  79. data/vendor/coffeescript/coffeescript/tests/cases/soaks.coffee +134 -0
  80. data/vendor/coffeescript/coffeescript/tests/cases/strict.coffee +155 -0
  81. data/vendor/coffeescript/coffeescript/tests/cases/strings.coffee +107 -0
  82. data/vendor/coffeescript/coffeescript/tests/css/style.css +43 -0
  83. data/vendor/coffeescript/coffeescript/tests/index.php +119 -0
  84. data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.1.1.js +8 -0
  85. data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.2.0.js +8 -0
  86. data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.0.js +8 -0
  87. data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.1.js +8 -0
  88. data/vendor/coffeescript/coffeescript/tests/js/lib/diff.js +276 -0
  89. data/vendor/coffeescript/coffeescript/tests/js/main.js +123 -0
  90. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/LICENSE.txt +10 -0
  91. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/Lempar.php +948 -0
  92. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Action.php +257 -0
  93. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/ActionTable.php +299 -0
  94. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Config.php +574 -0
  95. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Data.php +1857 -0
  96. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Parser.php +851 -0
  97. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/PropagationLink.php +126 -0
  98. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Rule.php +144 -0
  99. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/State.php +283 -0
  100. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Symbol.php +288 -0
  101. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/cli.php +5 -0
  102. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/ParserGenerator.php +811 -0
  103. data/vendor/composer/ClassLoader.php +383 -0
  104. data/vendor/composer/autoload_classmap.php +9 -0
  105. data/vendor/composer/autoload_namespaces.php +12 -0
  106. data/vendor/composer/autoload_psr4.php +10 -0
  107. data/vendor/composer/autoload_real.php +50 -0
  108. data/vendor/composer/installed.json +166 -0
  109. data/vendor/michelf/php-markdown/License.md +36 -0
  110. data/vendor/michelf/php-markdown/Michelf/Markdown.inc.php +10 -0
  111. data/vendor/michelf/php-markdown/Michelf/Markdown.php +3117 -0
  112. data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.inc.php +11 -0
  113. data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php +38 -0
  114. data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.inc.php +9 -0
  115. data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php +37 -0
  116. data/vendor/michelf/php-markdown/Readme.md +305 -0
  117. data/vendor/michelf/php-markdown/Readme.php +31 -0
  118. data/vendor/michelf/php-markdown/composer.json +31 -0
  119. data/vendor/mthaml/mthaml/CHANGELOG +48 -0
  120. data/vendor/mthaml/mthaml/LICENSE +44 -0
  121. data/vendor/mthaml/mthaml/README.markdown +262 -0
  122. data/vendor/mthaml/mthaml/composer.json +45 -0
  123. data/vendor/mthaml/mthaml/docs/Makefile +153 -0
  124. data/vendor/mthaml/mthaml/docs/_static/mthaml.css +30 -0
  125. data/vendor/mthaml/mthaml/docs/_theme/mthaml/theme.conf +4 -0
  126. data/vendor/mthaml/mthaml/docs/conf.py +242 -0
  127. data/vendor/mthaml/mthaml/docs/index.rst +18 -0
  128. data/vendor/mthaml/mthaml/docs/twig-syntax.rst +274 -0
  129. data/vendor/mthaml/mthaml/examples/README.md +5 -0
  130. data/vendor/mthaml/mthaml/examples/autoload.php +8 -0
  131. data/vendor/mthaml/mthaml/examples/example-php.haml +5 -0
  132. data/vendor/mthaml/mthaml/examples/example-php.php +37 -0
  133. data/vendor/mthaml/mthaml/examples/example-twig-noext.twig +11 -0
  134. data/vendor/mthaml/mthaml/examples/example-twig.haml +9 -0
  135. data/vendor/mthaml/mthaml/examples/example-twig.php +60 -0
  136. data/vendor/mthaml/mthaml/examples/example.twig.haml +8 -0
  137. data/vendor/mthaml/mthaml/lib/MtHaml/Autoloader.php +22 -0
  138. data/vendor/mthaml/mthaml/lib/MtHaml/Environment.php +178 -0
  139. data/vendor/mthaml/mthaml/lib/MtHaml/Escaping.php +33 -0
  140. data/vendor/mthaml/mthaml/lib/MtHaml/Exception.php +9 -0
  141. data/vendor/mthaml/mthaml/lib/MtHaml/Exception/SyntaxErrorException.php +9 -0
  142. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/AbstractFilter.php +43 -0
  143. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Cdata.php +16 -0
  144. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/CoffeeScript.php +33 -0
  145. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Css.php +26 -0
  146. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Escaped.php +22 -0
  147. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/FilterInterface.php +15 -0
  148. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Javascript.php +26 -0
  149. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less.php +27 -0
  150. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/LeafoLess.php +20 -0
  151. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/OyejorgeLess.php +23 -0
  152. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown.php +58 -0
  153. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/CebeMarkdown.php +22 -0
  154. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Ciconia.php +21 -0
  155. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/MichelfMarkdown.php +21 -0
  156. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Parsedown.php +21 -0
  157. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Php.php +37 -0
  158. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Plain.php +24 -0
  159. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Preserve.php +19 -0
  160. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Scss.php +37 -0
  161. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Twig.php +47 -0
  162. data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Indentation.php +96 -0
  163. data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationException.php +9 -0
  164. data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationInterface.php +50 -0
  165. data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Undefined.php +41 -0
  166. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Comment.php +71 -0
  167. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Doctype.php +96 -0
  168. data/vendor/mthaml/mthaml/lib/MtHaml/Node/EscapableAbstract.php +19 -0
  169. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Filter.php +51 -0
  170. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Insert.php +42 -0
  171. data/vendor/mthaml/mthaml/lib/MtHaml/Node/InterpolatedString.php +73 -0
  172. data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestAbstract.php +117 -0
  173. data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestInterface.php +10 -0
  174. data/vendor/mthaml/mthaml/lib/MtHaml/Node/NodeAbstract.php +77 -0
  175. data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefClass.php +42 -0
  176. data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefId.php +42 -0
  177. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Root.php +35 -0
  178. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Run.php +71 -0
  179. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Statement.php +45 -0
  180. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Tag.php +90 -0
  181. data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttribute.php +62 -0
  182. data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeInterpolation.php +24 -0
  183. data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeList.php +24 -0
  184. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Text.php +37 -0
  185. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php +25 -0
  186. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Escaping.php +105 -0
  187. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/MergeAttrs.php +110 -0
  188. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Midblock.php +37 -0
  189. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorAbstract.php +226 -0
  190. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorInterface.php +97 -0
  191. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/PhpRenderer.php +288 -0
  192. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Printer.php +265 -0
  193. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/RendererAbstract.php +581 -0
  194. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/TwigRenderer.php +252 -0
  195. data/vendor/mthaml/mthaml/lib/MtHaml/Parser.php +862 -0
  196. data/vendor/mthaml/mthaml/lib/MtHaml/Parser/Buffer.php +147 -0
  197. data/vendor/mthaml/mthaml/lib/MtHaml/Runtime.php +218 -0
  198. data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeInterpolation.php +16 -0
  199. data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeList.php +16 -0
  200. data/vendor/mthaml/mthaml/lib/MtHaml/Support/Php/Executor.php +157 -0
  201. data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Extension.php +47 -0
  202. data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Lexer.php +48 -0
  203. data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Loader.php +81 -0
  204. data/vendor/mthaml/mthaml/lib/MtHaml/Target/Php.php +23 -0
  205. data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetAbstract.php +87 -0
  206. data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetInterface.php +12 -0
  207. data/vendor/mthaml/mthaml/lib/MtHaml/Target/Twig.php +23 -0
  208. data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilder.php +100 -0
  209. data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilderException.php +9 -0
  210. data/vendor/mthaml/mthaml/phpunit.xml +25 -0
  211. data/vendor/mthaml/mthaml/test/MtHaml/Tests/EnvironmentTest.php +59 -0
  212. data/vendor/mthaml/mthaml/test/MtHaml/Tests/HamlSpecTest.php +83 -0
  213. data/vendor/mthaml/mthaml/test/MtHaml/Tests/IndentationTest.php +140 -0
  214. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/DoctypeTest.php +51 -0
  215. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/NodeTest.php +110 -0
  216. data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/PhpRendererTest.php +113 -0
  217. data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/TwigRendererTest.php +68 -0
  218. data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php +44 -0
  219. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Parser/BufferTest.php +77 -0
  220. data/vendor/mthaml/mthaml/test/MtHaml/Tests/ParserTest.php +47 -0
  221. data/vendor/mthaml/mthaml/test/MtHaml/Tests/RuntimeTest.php +356 -0
  222. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Php/ExecutorTest.php +83 -0
  223. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Twig/LoaderTest.php +65 -0
  224. data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCase.php +49 -0
  225. data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCaseTest.php +50 -0
  226. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/Support/Php/Executor.001.haml +1 -0
  227. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_php.test +20 -0
  228. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_twig.test +12 -0
  229. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_php.test +16 -0
  230. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_twig.test +16 -0
  231. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_php.test +15 -0
  232. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_twig.test +15 -0
  233. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug42.test +13 -0
  234. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug8_twig.test +10 -0
  235. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/coffeescript_filter.test +31 -0
  236. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/comments.test +26 -0
  237. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/cond_cmt.test +25 -0
  238. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype.test +18 -0
  239. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_html4.test +20 -0
  240. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid.test +12 -0
  241. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid_xhtml.test +12 -0
  242. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_php.test +18 -0
  243. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_xhtml.test +30 -0
  244. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/filters.test +51 -0
  245. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_php.test +11 -0
  246. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_twig.test +11 -0
  247. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_php.test +31 -0
  248. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_twig.test +31 -0
  249. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_leafo.test +33 -0
  250. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_oyejorge.test +49 -0
  251. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_cebemarkdown.test +35 -0
  252. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_ciconia.test +36 -0
  253. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_michelf.test +34 -0
  254. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_parsedown.test +31 -0
  255. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_optimization_filter_michelf.test +23 -0
  256. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/mergeattrs.test +18 -0
  257. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_inner_whitespace.test +77 -0
  258. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_outer_whitespace.test +122 -0
  259. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_php.test +14 -0
  260. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_twig.test +14 -0
  261. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php.test +109 -0
  262. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping.test +22 -0
  263. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping_once.test +25 -0
  264. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_blocks.test +29 -0
  265. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_filters.test +42 -0
  266. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/scss_filter.test +32 -0
  267. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/strip_inline_comments_php.test +22 -0
  268. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/test.test +24 -0
  269. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/trailing_semicolon_php.test +14 -0
  270. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/try_catch_php.test +17 -0
  271. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig.test +112 -0
  272. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_blocks.test +29 -0
  273. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_filters.test +37 -0
  274. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_whitespace.test +32 -0
  275. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/whitespace.test +63 -0
  276. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/autoclose.test +30 -0
  277. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping.test +52 -0
  278. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_attr_once.test +52 -0
  279. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_html_false.test +52 -0
  280. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/mergeattrs.test +26 -0
  281. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock.test +54 -0
  282. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock_002.test +32 -0
  283. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attr_list.test +14 -0
  284. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs.test +42 -0
  285. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_002.test +35 -0
  286. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_003.test +30 -0
  287. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_html_linebreak.test +17 -0
  288. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks.test +27 -0
  289. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks_002.test +15 -0
  290. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/boolean_attr.test +19 -0
  291. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug28.test +15 -0
  292. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug8.test +11 -0
  293. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/cond_cmt.test +23 -0
  294. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/doctype.test +11 -0
  295. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/double_equal.test +7 -0
  296. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/empty_line_after_multiline.test +10 -0
  297. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_001.test +8 -0
  298. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_002.test +8 -0
  299. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_003.test +8 -0
  300. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_004.test +6 -0
  301. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_005.test +5 -0
  302. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_006.test +7 -0
  303. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_007.test +7 -0
  304. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_008.test +7 -0
  305. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_009.test +5 -0
  306. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_010.test +5 -0
  307. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_013.test +5 -0
  308. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_016.test +7 -0
  309. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_017.test +8 -0
  310. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_018.test +6 -0
  311. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_019.test +6 -0
  312. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_020.test +5 -0
  313. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters.test +20 -0
  314. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_002.test +19 -0
  315. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_003.test +13 -0
  316. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_004.test +21 -0
  317. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_005.test +22 -0
  318. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_006.test +23 -0
  319. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/insertflags.test +17 -0
  320. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation.test +36 -0
  321. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation_in_html_attrs.test +17 -0
  322. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline.test +18 -0
  323. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline_code.test +59 -0
  324. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiple_attr_kinds.test +47 -0
  325. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/non_rendered_comment.test +31 -0
  326. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ns.test +11 -0
  327. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref.test +22 -0
  328. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error1.test +5 -0
  329. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error2.test +5 -0
  330. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/quotes_in_haml.test +10 -0
  331. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby19_attrs.test +11 -0
  332. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma.test +23 -0
  333. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_001.test +5 -0
  334. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_002.test +5 -0
  335. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_003.test +5 -0
  336. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/standard.test +114 -0
  337. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/tagflags.test +39 -0
  338. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/php_filters.test +28 -0
  339. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/twig_filters.test +31 -0
  340. data/vendor/mthaml/mthaml/test/bootstrap.php +3 -0
  341. metadata +398 -0
@@ -0,0 +1,76 @@
1
+ # Number Literals
2
+ # ---------------
3
+
4
+ # * Decimal Integer Literals
5
+ # * Octal Integer Literals
6
+ # * Hexadecimal Integer Literals
7
+ # * Scientific Notation Integer Literals
8
+ # * Scientific Notation Non-Integer Literals
9
+ # * Non-Integer Literals
10
+ # * Binary Integer Literals
11
+
12
+
13
+ # Binary Integer Literals
14
+ # Binary notation is understood as would be decimal notation.
15
+
16
+ test "Parser recognises binary numbers", ->
17
+ eq 4, 0b100
18
+
19
+ # Decimal Integer Literals
20
+
21
+ test "call methods directly on numbers", ->
22
+ eq 4, 4.valueOf()
23
+ eq '11', 4.toString 3
24
+
25
+ eq -1, 3 -4
26
+
27
+ #764: Numbers should be indexable
28
+ eq Number::toString, 42['toString']
29
+
30
+ eq Number::toString, 42.toString
31
+
32
+
33
+ # Non-Integer Literals
34
+
35
+ # Decimal number literals.
36
+ value = .25 + .75
37
+ ok value is 1
38
+ value = 0.0 + -.25 - -.75 + 0.0
39
+ ok value is 0.5
40
+
41
+ #764: Numbers should be indexable
42
+ eq Number::toString, 4['toString']
43
+ eq Number::toString, 4.2['toString']
44
+ eq Number::toString, .42['toString']
45
+ eq Number::toString, (4)['toString']
46
+
47
+ eq Number::toString, 4.toString
48
+ eq Number::toString, 4.2.toString
49
+ eq Number::toString, .42.toString
50
+ eq Number::toString, (4).toString
51
+
52
+ test '#1168: leading floating point suppresses newline', ->
53
+ eq 1, do ->
54
+ 1
55
+ .5 + 0.5
56
+
57
+ test "Python-style octal literal notation '0o777'", ->
58
+ eq 511, 0o777
59
+ eq 1, 0o1
60
+ eq 1, 0o00001
61
+ eq parseInt('0777', 8), 0o777
62
+ eq '777', 0o777.toString 8
63
+ eq 4, 0o4.valueOf()
64
+ eq Number::toString, 0o777['toString']
65
+ eq Number::toString, 0o777.toString
66
+
67
+ test "#2060: Disallow uppercase radix prefixes and exponential notation", ->
68
+ for char in ['b', 'o', 'x', 'e']
69
+ program = "0#{char}0"
70
+ doesNotThrow -> CoffeeScript.compile program, bare: yes
71
+ throws -> CoffeeScript.compile program.toUpperCase(), bare: yes
72
+
73
+ test "#2224: hex literals with 0b or B or E", ->
74
+ eq 176, 0x0b0
75
+ eq 177, 0x0B1
76
+ eq 225, 0xE1
@@ -0,0 +1,271 @@
1
+ # Object Literals
2
+ # ---------------
3
+
4
+ # TODO: refactor object literal tests
5
+ # TODO: add indexing and method invocation tests: {a}['a'] is a, {a}.a()
6
+
7
+ trailingComma = {k1: "v1", k2: 4, k3: (-> true),}
8
+ ok trailingComma.k3() and (trailingComma.k2 is 4) and (trailingComma.k1 is "v1")
9
+
10
+ ok {a: (num) -> num is 10 }.a 10
11
+
12
+ moe = {
13
+ name: 'Moe'
14
+ greet: (salutation) ->
15
+ salutation + " " + @name
16
+ hello: ->
17
+ @['greet'] "Hello"
18
+ 10: 'number'
19
+ }
20
+ ok moe.hello() is "Hello Moe"
21
+ ok moe[10] is 'number'
22
+ moe.hello = ->
23
+ this['greet'] "Hello"
24
+ ok moe.hello() is 'Hello Moe'
25
+
26
+ obj = {
27
+ is: -> yes,
28
+ 'not': -> no,
29
+ }
30
+ ok obj.is()
31
+ ok not obj.not()
32
+
33
+ ### Top-level object literal... ###
34
+ obj: 1
35
+ ### ...doesn't break things. ###
36
+
37
+ # Object literals should be able to include keywords.
38
+ obj = {class: 'höt'}
39
+ obj.function = 'dog'
40
+ ok obj.class + obj.function is 'hötdog'
41
+
42
+ # Implicit objects as part of chained calls.
43
+ pluck = (x) -> x.a
44
+ eq 100, pluck pluck pluck a: a: a: 100
45
+
46
+
47
+ test "YAML-style object literals", ->
48
+ obj =
49
+ a: 1
50
+ b: 2
51
+ eq 1, obj.a
52
+ eq 2, obj.b
53
+
54
+ config =
55
+ development:
56
+ server: 'localhost'
57
+ timeout: 10
58
+
59
+ production:
60
+ server: 'dreamboat'
61
+ timeout: 1000
62
+
63
+ ok config.development.server is 'localhost'
64
+ ok config.production.server is 'dreamboat'
65
+ ok config.development.timeout is 10
66
+ ok config.production.timeout is 1000
67
+
68
+ obj =
69
+ a: 1,
70
+ b: 2,
71
+ ok obj.a is 1
72
+ ok obj.b is 2
73
+
74
+ # Implicit objects nesting.
75
+ obj =
76
+ options:
77
+ value: yes
78
+ fn: ->
79
+ {}
80
+ null
81
+ ok obj.options.value is yes
82
+ ok obj.fn() is null
83
+
84
+ # Implicit objects with wacky indentation:
85
+ obj =
86
+ 'reverse': (obj) ->
87
+ Array.prototype.reverse.call obj
88
+ abc: ->
89
+ @reverse(
90
+ @reverse @reverse ['a', 'b', 'c'].reverse()
91
+ )
92
+ one: [1, 2,
93
+ a: 'b'
94
+ 3, 4]
95
+ red:
96
+ orange:
97
+ yellow:
98
+ green: 'blue'
99
+ indigo: 'violet'
100
+ misdent: [[],
101
+ [],
102
+ [],
103
+ []]
104
+ ok obj.abc().join(' ') is 'a b c'
105
+ ok obj.one.length is 5
106
+ ok obj.one[4] is 4
107
+ ok obj.one[2].a is 'b'
108
+ ok (key for key of obj.red).length is 2
109
+ ok obj.red.orange.yellow.green is 'blue'
110
+ ok obj.red.indigo is 'violet'
111
+ ok obj.misdent.toString() is ',,,'
112
+
113
+ #542: Objects leading expression statement should be parenthesized.
114
+ {f: -> ok yes }.f() + 1
115
+
116
+ # String-keyed objects shouldn't suppress newlines.
117
+ one =
118
+ '>!': 3
119
+ six: -> 10
120
+ ok not one.six
121
+
122
+ # Shorthand objects with property references.
123
+ obj =
124
+ ### comment one ###
125
+ ### comment two ###
126
+ one: 1
127
+ two: 2
128
+ object: -> {@one, @two}
129
+ list: -> [@one, @two]
130
+ result = obj.object()
131
+ eq result.one, 1
132
+ eq result.two, 2
133
+ eq result.two, obj.list()[1]
134
+
135
+ third = (a, b, c) -> c
136
+ obj =
137
+ one: 'one'
138
+ two: third 'one', 'two', 'three'
139
+ ok obj.one is 'one'
140
+ ok obj.two is 'three'
141
+
142
+ test "invoking functions with implicit object literals", ->
143
+ generateGetter = (prop) -> (obj) -> obj[prop]
144
+ getA = generateGetter 'a'
145
+ getArgs = -> arguments
146
+ a = b = 30
147
+
148
+ result = getA
149
+ a: 10
150
+ eq 10, result
151
+
152
+ result = getA
153
+ "a": 20
154
+ eq 20, result
155
+
156
+ result = getA a,
157
+ b:1
158
+ eq undefined, result
159
+
160
+ result = getA b:1,
161
+ a:43
162
+ eq 43, result
163
+
164
+ result = getA b:1,
165
+ a:62
166
+ eq undefined, result
167
+
168
+ result = getA
169
+ b:1
170
+ a
171
+ eq undefined, result
172
+
173
+ result = getA
174
+ a:
175
+ b:2
176
+ b:1
177
+ eq 2, result.b
178
+
179
+ result = getArgs
180
+ a:1
181
+ b
182
+ c:1
183
+ ok result.length is 3
184
+ ok result[2].c is 1
185
+
186
+ result = getA b: 13, a: 42, 2
187
+ eq 42, result
188
+
189
+ result = getArgs a:1, (1 + 1)
190
+ ok result[1] is 2
191
+
192
+ result = getArgs a:1, b
193
+ ok result.length is 2
194
+ ok result[1] is 30
195
+
196
+ result = getArgs a:1, b, b:1, a
197
+ ok result.length is 4
198
+ ok result[2].b is 1
199
+
200
+ throws -> CoffeeScript.compile "a = b:1, c"
201
+
202
+ test "some weird indentation in YAML-style object literals", ->
203
+ two = (a, b) -> b
204
+ obj = then two 1,
205
+ 1: 1
206
+ a:
207
+ b: ->
208
+ fn c,
209
+ d: e
210
+ f: 1
211
+ eq 1, obj[1]
212
+
213
+ test "#1274: `{} = a()` compiles to `false` instead of `a()`", ->
214
+ a = false
215
+ fn = -> a = true
216
+ {} = fn()
217
+ ok a
218
+
219
+ test "#1436: `for` etc. work as normal property names", ->
220
+ obj = {}
221
+ eq no, obj.hasOwnProperty 'for'
222
+ obj.for = 'foo' of obj
223
+ eq yes, obj.hasOwnProperty 'for'
224
+
225
+ test "#1322: implicit call against implicit object with block comments", ->
226
+ ((obj, arg) ->
227
+ eq obj.x * obj.y, 6
228
+ ok not arg
229
+ )
230
+ ###
231
+ x
232
+ ###
233
+ x: 2
234
+ ### y ###
235
+ y: 3
236
+
237
+ test "#1513: Top level bare objs need to be wrapped in parens for unary and existence ops", ->
238
+ doesNotThrow -> CoffeeScript.run "{}?", bare: true
239
+ doesNotThrow -> CoffeeScript.run "{}.a++", bare: true
240
+
241
+ test "#1871: Special case for IMPLICIT_END in the middle of an implicit object", ->
242
+ result = 'result'
243
+ ident = (x) -> x
244
+
245
+ result = ident one: 1 if false
246
+
247
+ eq result, 'result'
248
+
249
+ result = ident
250
+ one: 1
251
+ two: 2 for i in [1..3]
252
+
253
+ eq result.two.join(' '), '2 2 2'
254
+
255
+ test "#1961, #1974, regression with compound assigning to an implicit object", ->
256
+
257
+ obj = null
258
+
259
+ obj ?=
260
+ one: 1
261
+ two: 2
262
+
263
+ eq obj.two, 2
264
+
265
+ obj = null
266
+
267
+ obj or=
268
+ three: 3
269
+ four: 4
270
+
271
+ eq obj.four, 4
@@ -0,0 +1,277 @@
1
+ # Operators
2
+ # ---------
3
+
4
+ # * Operators
5
+ # * Existential Operator (Binary)
6
+ # * Existential Operator (Unary)
7
+ # * Aliased Operators
8
+ # * [not] in/of
9
+ # * Chained Comparison
10
+
11
+ test "binary (2-ary) math operators do not require spaces", ->
12
+ a = 1
13
+ b = -1
14
+ eq +1, a*-b
15
+ eq -1, a*+b
16
+ eq +1, a/-b
17
+ eq -1, a/+b
18
+
19
+ test "operators should respect new lines as spaced", ->
20
+ a = 123 +
21
+ 456
22
+ eq 579, a
23
+
24
+ b = "1#{2}3" +
25
+ "456"
26
+ eq '123456', b
27
+
28
+ test "multiple operators should space themselves", ->
29
+ eq (+ +1), (- -1)
30
+
31
+ test "bitwise operators", ->
32
+ eq 2, (10 & 3)
33
+ eq 11, (10 | 3)
34
+ eq 9, (10 ^ 3)
35
+ eq 80, (10 << 3)
36
+ eq 1, (10 >> 3)
37
+ eq 1, (10 >>> 3)
38
+ num = 10; eq 2, (num &= 3)
39
+ num = 10; eq 11, (num |= 3)
40
+ num = 10; eq 9, (num ^= 3)
41
+ num = 10; eq 80, (num <<= 3)
42
+ num = 10; eq 1, (num >>= 3)
43
+ num = 10; eq 1, (num >>>= 3)
44
+
45
+ test "`instanceof`", ->
46
+ ok new String instanceof String
47
+ ok new Boolean instanceof Boolean
48
+ # `instanceof` supports negation by prefixing the operator with `not`
49
+ ok new Number not instanceof String
50
+ ok new Array not instanceof Boolean
51
+
52
+ test "use `::` operator on keywords `this` and `@`", ->
53
+ nonce = {}
54
+ obj =
55
+ withAt: -> @::prop
56
+ withThis: -> this::prop
57
+ obj.prototype = prop: nonce
58
+ eq nonce, obj.withAt()
59
+ eq nonce, obj.withThis()
60
+
61
+
62
+ # Existential Operator (Binary)
63
+
64
+ test "binary existential operator", ->
65
+ nonce = {}
66
+
67
+ b = a ? nonce
68
+ eq nonce, b
69
+
70
+ a = null
71
+ b = undefined
72
+ b = a ? nonce
73
+ eq nonce, b
74
+
75
+ a = false
76
+ b = a ? nonce
77
+ eq false, b
78
+
79
+ a = 0
80
+ b = a ? nonce
81
+ eq 0, b
82
+
83
+ test "binary existential operator conditionally evaluates second operand", ->
84
+ i = 1
85
+ func = -> i -= 1
86
+ result = func() ? func()
87
+ eq result, 0
88
+
89
+ test "binary existential operator with negative number", ->
90
+ a = null ? - 1
91
+ eq -1, a
92
+
93
+
94
+ # Existential Operator (Unary)
95
+
96
+ test "postfix existential operator", ->
97
+ ok (if nonexistent? then false else true)
98
+ defined = true
99
+ ok defined?
100
+ defined = false
101
+ ok defined?
102
+
103
+ test "postfix existential operator only evaluates its operand once", ->
104
+ semaphore = 0
105
+ fn = ->
106
+ ok false if semaphore
107
+ ++semaphore
108
+ ok(if fn()? then true else false)
109
+
110
+ test "negated postfix existential operator", ->
111
+ ok !nothing?.value
112
+
113
+ test "postfix existential operator on expressions", ->
114
+ eq true, (1 or 0)?, true
115
+
116
+
117
+ # `is`,`isnt`,`==`,`!=`
118
+
119
+ test "`==` and `is` should be interchangeable", ->
120
+ a = b = 1
121
+ ok a is 1 and b == 1
122
+ ok a == b
123
+ ok a is b
124
+
125
+ test "`!=` and `isnt` should be interchangeable", ->
126
+ a = 0
127
+ b = 1
128
+ ok a isnt 1 and b != 0
129
+ ok a != b
130
+ ok a isnt b
131
+
132
+
133
+ # [not] in/of
134
+
135
+ # - `in` should check if an array contains a value using `indexOf`
136
+ # - `of` should check if a property is defined on an object using `in`
137
+ test "in, of", ->
138
+ arr = [1]
139
+ ok 0 of arr
140
+ ok 1 in arr
141
+ # prefixing `not` to `in and `of` should negate them
142
+ ok 1 not of arr
143
+ ok 0 not in arr
144
+
145
+ test "`in` should be able to operate on an array literal", ->
146
+ ok 2 in [0, 1, 2, 3]
147
+ ok 4 not in [0, 1, 2, 3]
148
+ arr = [0, 1, 2, 3]
149
+ ok 2 in arr
150
+ ok 4 not in arr
151
+ # should cache the value used to test the array
152
+ arr = [0]
153
+ val = 0
154
+ ok val++ in arr
155
+ ok val++ not in arr
156
+ val = 0
157
+ ok val++ of arr
158
+ ok val++ not of arr
159
+
160
+ test "`of` and `in` should be able to operate on instance variables", ->
161
+ obj = {
162
+ list: [2,3]
163
+ in_list: (value) -> value in @list
164
+ not_in_list: (value) -> value not in @list
165
+ of_list: (value) -> value of @list
166
+ not_of_list: (value) -> value not of @list
167
+ }
168
+ ok obj.in_list 3
169
+ ok obj.not_in_list 1
170
+ ok obj.of_list 0
171
+ ok obj.not_of_list 2
172
+
173
+ test "#???: `in` with cache and `__indexOf` should work in argument lists", ->
174
+ eq 1, [Object() in Array()].length
175
+
176
+ test "#737: `in` should have higher precedence than logical operators", ->
177
+ eq 1, 1 in [1] and 1
178
+
179
+ test "#768: `in` should preserve evaluation order", ->
180
+ share = 0
181
+ a = -> share++ if share is 0
182
+ b = -> share++ if share is 1
183
+ c = -> share++ if share is 2
184
+ ok a() not in [b(),c()]
185
+ eq 3, share
186
+
187
+ test "#1099: empty array after `in` should compile to `false`", ->
188
+ eq 1, [5 in []].length
189
+ eq false, do -> return 0 in []
190
+
191
+ test "#1354: optimized `in` checks should not happen when splats are present", ->
192
+ a = [6, 9]
193
+ eq 9 in [3, a...], true
194
+
195
+ test "#1100: precedence in or-test compilation of `in`", ->
196
+ ok 0 in [1 and 0]
197
+ ok 0 in [1, 1 and 0]
198
+ ok not (0 in [1, 0 or 1])
199
+
200
+ test "#1630: `in` should check `hasOwnProperty`", ->
201
+ ok undefined not in length: 1
202
+
203
+ test "#1714: lexer bug with raw range `for` followed by `in`", ->
204
+ 0 for [1..2]
205
+ ok not ('a' in ['b'])
206
+
207
+ 0 for [1..2]; ok not ('a' in ['b'])
208
+
209
+ 0 for [1..10] # comment ending
210
+ ok not ('a' in ['b'])
211
+
212
+ test "#1099: statically determined `not in []` reporting incorrect result", ->
213
+ ok 0 not in []
214
+
215
+
216
+ # Chained Comparison
217
+
218
+ test "chainable operators", ->
219
+ ok 100 > 10 > 1 > 0 > -1
220
+ ok -1 < 0 < 1 < 10 < 100
221
+
222
+ test "`is` and `isnt` may be chained", ->
223
+ ok true is not false is true is not false
224
+ ok 0 is 0 isnt 1 is 1
225
+
226
+ test "different comparison operators (`>`,`<`,`is`,etc.) may be combined", ->
227
+ ok 1 < 2 > 1
228
+ ok 10 < 20 > 2+3 is 5
229
+
230
+ test "some chainable operators can be negated by `unless`", ->
231
+ ok (true unless 0==10!=100)
232
+
233
+ test "operator precedence: `|` lower than `<`", ->
234
+ eq 1, 1 | 2 < 3 < 4
235
+
236
+ test "preserve references", ->
237
+ a = b = c = 1
238
+ # `a == b <= c` should become `a === b && b <= c`
239
+ # (this test does not seem to test for this)
240
+ ok a == b <= c
241
+
242
+ test "chained operations should evaluate each value only once", ->
243
+ a = 0
244
+ ok 1 > a++ < 1
245
+
246
+ test "#891: incorrect inversion of chained comparisons", ->
247
+ ok (true unless 0 > 1 > 2)
248
+ ok (true unless (NaN = 0/0) < 0/0 < NaN)
249
+
250
+ test "#1234: Applying a splat to :: applies the splat to the wrong object", ->
251
+ nonce = {}
252
+ class C
253
+ method: -> @nonce
254
+ nonce: nonce
255
+
256
+ arr = []
257
+ eq nonce, C::method arr... # should be applied to `C::`
258
+
259
+ test "#1102: String literal prevents line continuation", ->
260
+ eq "': '", '' +
261
+ "': '"
262
+
263
+ test "#1703, ---x is invalid JS", ->
264
+ x = 2
265
+ eq (- --x), -1
266
+
267
+ test "Regression with implicit calls against an indented assignment", ->
268
+ eq 1, a =
269
+ 1
270
+
271
+ eq a, 1
272
+
273
+ test "#2155 ... conditional assignment to a closure", ->
274
+ x = null
275
+ func = -> x ?= (-> if true then 'hi')
276
+ func()
277
+ eq x(), 'hi'