guard-mthaml 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +34 -0
- data/lib/guard/mthaml.rb +140 -0
- data/lib/guard/mthaml/compiler/MtHaml.php +255 -0
- data/lib/guard/mthaml/templates/Guardfile +12 -0
- data/lib/guard/mthaml/version.rb +5 -0
- data/vendor/autoload.php +7 -0
- data/vendor/coffeescript/coffeescript/LICENSE +22 -0
- data/vendor/coffeescript/coffeescript/README.md +96 -0
- data/vendor/coffeescript/coffeescript/composer.json +23 -0
- data/vendor/coffeescript/coffeescript/grammar.y +309 -0
- data/vendor/coffeescript/coffeescript/make.php +115 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Compiler.php +76 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Error.php +15 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Helpers.php +116 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Init.php +96 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Lexer.php +1356 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Nodes.php +105 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Parser.php +3326 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Rewriter.php +552 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Scope.php +196 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/SyntaxError.php +9 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Value.php +20 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Access.php +31 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Arr.php +69 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Assign.php +353 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Base.php +288 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Block.php +294 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Call.php +283 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Class.php +282 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Closure.php +49 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Code.php +203 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Comment.php +39 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php +42 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Extends.php +26 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/For.php +250 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/If.php +161 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/In.php +99 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Index.php +27 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Literal.php +96 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Obj.php +126 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Op.php +292 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Param.php +119 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Parens.php +45 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Range.php +225 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Return.php +56 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php +47 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Splat.php +100 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Switch.php +121 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Throw.php +37 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Try.php +79 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Value.php +210 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/While.php +112 -0
- data/vendor/coffeescript/coffeescript/tests/cases/arrays.coffee +77 -0
- data/vendor/coffeescript/coffeescript/tests/cases/assignment.coffee +352 -0
- data/vendor/coffeescript/coffeescript/tests/cases/booleans.coffee +21 -0
- data/vendor/coffeescript/coffeescript/tests/cases/classes.coffee +681 -0
- data/vendor/coffeescript/coffeescript/tests/cases/comments.coffee +207 -0
- data/vendor/coffeescript/coffeescript/tests/cases/compilation.coffee +72 -0
- data/vendor/coffeescript/coffeescript/tests/cases/comprehensions.coffee +501 -0
- data/vendor/coffeescript/coffeescript/tests/cases/control_flow.coffee +430 -0
- data/vendor/coffeescript/coffeescript/tests/cases/eval.coffee +29 -0
- data/vendor/coffeescript/coffeescript/tests/cases/exception_handling.coffee +102 -0
- data/vendor/coffeescript/coffeescript/tests/cases/formatting.coffee +146 -0
- data/vendor/coffeescript/coffeescript/tests/cases/function_invocation.coffee +552 -0
- data/vendor/coffeescript/coffeescript/tests/cases/functions.coffee +188 -0
- data/vendor/coffeescript/coffeescript/tests/cases/helpers.coffee +96 -0
- data/vendor/coffeescript/coffeescript/tests/cases/importing.coffee +18 -0
- data/vendor/coffeescript/coffeescript/tests/cases/interpolation.coffee +138 -0
- data/vendor/coffeescript/coffeescript/tests/cases/javascript_literals.coffee +10 -0
- data/vendor/coffeescript/coffeescript/tests/cases/numbers.coffee +76 -0
- data/vendor/coffeescript/coffeescript/tests/cases/objects.coffee +271 -0
- data/vendor/coffeescript/coffeescript/tests/cases/operators.coffee +277 -0
- data/vendor/coffeescript/coffeescript/tests/cases/option_parser.coffee +43 -0
- data/vendor/coffeescript/coffeescript/tests/cases/ranges.coffee +88 -0
- data/vendor/coffeescript/coffeescript/tests/cases/regexps.coffee +63 -0
- data/vendor/coffeescript/coffeescript/tests/cases/scope.coffee +43 -0
- data/vendor/coffeescript/coffeescript/tests/cases/slicing_and_splicing.coffee +143 -0
- data/vendor/coffeescript/coffeescript/tests/cases/soaks.coffee +134 -0
- data/vendor/coffeescript/coffeescript/tests/cases/strict.coffee +155 -0
- data/vendor/coffeescript/coffeescript/tests/cases/strings.coffee +107 -0
- data/vendor/coffeescript/coffeescript/tests/css/style.css +43 -0
- data/vendor/coffeescript/coffeescript/tests/index.php +119 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.1.1.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.2.0.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.0.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.1.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/diff.js +276 -0
- data/vendor/coffeescript/coffeescript/tests/js/main.js +123 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/LICENSE.txt +10 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/Lempar.php +948 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Action.php +257 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/ActionTable.php +299 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Config.php +574 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Data.php +1857 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Parser.php +851 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/PropagationLink.php +126 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Rule.php +144 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/State.php +283 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Symbol.php +288 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/cli.php +5 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/ParserGenerator.php +811 -0
- data/vendor/composer/ClassLoader.php +383 -0
- data/vendor/composer/autoload_classmap.php +9 -0
- data/vendor/composer/autoload_namespaces.php +12 -0
- data/vendor/composer/autoload_psr4.php +10 -0
- data/vendor/composer/autoload_real.php +50 -0
- data/vendor/composer/installed.json +166 -0
- data/vendor/michelf/php-markdown/License.md +36 -0
- data/vendor/michelf/php-markdown/Michelf/Markdown.inc.php +10 -0
- data/vendor/michelf/php-markdown/Michelf/Markdown.php +3117 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.inc.php +11 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php +38 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.inc.php +9 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php +37 -0
- data/vendor/michelf/php-markdown/Readme.md +305 -0
- data/vendor/michelf/php-markdown/Readme.php +31 -0
- data/vendor/michelf/php-markdown/composer.json +31 -0
- data/vendor/mthaml/mthaml/CHANGELOG +48 -0
- data/vendor/mthaml/mthaml/LICENSE +44 -0
- data/vendor/mthaml/mthaml/README.markdown +262 -0
- data/vendor/mthaml/mthaml/composer.json +45 -0
- data/vendor/mthaml/mthaml/docs/Makefile +153 -0
- data/vendor/mthaml/mthaml/docs/_static/mthaml.css +30 -0
- data/vendor/mthaml/mthaml/docs/_theme/mthaml/theme.conf +4 -0
- data/vendor/mthaml/mthaml/docs/conf.py +242 -0
- data/vendor/mthaml/mthaml/docs/index.rst +18 -0
- data/vendor/mthaml/mthaml/docs/twig-syntax.rst +274 -0
- data/vendor/mthaml/mthaml/examples/README.md +5 -0
- data/vendor/mthaml/mthaml/examples/autoload.php +8 -0
- data/vendor/mthaml/mthaml/examples/example-php.haml +5 -0
- data/vendor/mthaml/mthaml/examples/example-php.php +37 -0
- data/vendor/mthaml/mthaml/examples/example-twig-noext.twig +11 -0
- data/vendor/mthaml/mthaml/examples/example-twig.haml +9 -0
- data/vendor/mthaml/mthaml/examples/example-twig.php +60 -0
- data/vendor/mthaml/mthaml/examples/example.twig.haml +8 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Autoloader.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Environment.php +178 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Escaping.php +33 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Exception.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Exception/SyntaxErrorException.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/AbstractFilter.php +43 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Cdata.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/CoffeeScript.php +33 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Css.php +26 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Escaped.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/FilterInterface.php +15 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Javascript.php +26 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less.php +27 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/LeafoLess.php +20 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/OyejorgeLess.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown.php +58 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/CebeMarkdown.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Ciconia.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/MichelfMarkdown.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Parsedown.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Php.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Plain.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Preserve.php +19 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Scss.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Twig.php +47 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Indentation.php +96 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationException.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationInterface.php +50 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Undefined.php +41 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Comment.php +71 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Doctype.php +96 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/EscapableAbstract.php +19 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Filter.php +51 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Insert.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/InterpolatedString.php +73 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestAbstract.php +117 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestInterface.php +10 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NodeAbstract.php +77 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefClass.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefId.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Root.php +35 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Run.php +71 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Statement.php +45 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Tag.php +90 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttribute.php +62 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeInterpolation.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeList.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Text.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php +25 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Escaping.php +105 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/MergeAttrs.php +110 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Midblock.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorAbstract.php +226 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorInterface.php +97 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/PhpRenderer.php +288 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Printer.php +265 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/RendererAbstract.php +581 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/TwigRenderer.php +252 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Parser.php +862 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Parser/Buffer.php +147 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime.php +218 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeInterpolation.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeList.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Php/Executor.php +157 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Extension.php +47 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Lexer.php +48 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Loader.php +81 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/Php.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetAbstract.php +87 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetInterface.php +12 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/Twig.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilder.php +100 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilderException.php +9 -0
- data/vendor/mthaml/mthaml/phpunit.xml +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/EnvironmentTest.php +59 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/HamlSpecTest.php +83 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/IndentationTest.php +140 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/DoctypeTest.php +51 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/NodeTest.php +110 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/PhpRendererTest.php +113 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/TwigRendererTest.php +68 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php +44 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Parser/BufferTest.php +77 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/ParserTest.php +47 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/RuntimeTest.php +356 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Php/ExecutorTest.php +83 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Twig/LoaderTest.php +65 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCase.php +49 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCaseTest.php +50 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/Support/Php/Executor.001.haml +1 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_php.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_twig.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_php.test +16 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_twig.test +16 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_php.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_twig.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug42.test +13 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug8_twig.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/coffeescript_filter.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/comments.test +26 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/cond_cmt.test +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_html4.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid_xhtml.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_php.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_xhtml.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/filters.test +51 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_php.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_twig.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_php.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_twig.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_leafo.test +33 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_oyejorge.test +49 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_cebemarkdown.test +35 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_ciconia.test +36 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_michelf.test +34 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_parsedown.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_optimization_filter_michelf.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/mergeattrs.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_inner_whitespace.test +77 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_outer_whitespace.test +122 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_php.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_twig.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php.test +109 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping_once.test +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_blocks.test +29 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_filters.test +42 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/scss_filter.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/strip_inline_comments_php.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/test.test +24 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/trailing_semicolon_php.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/try_catch_php.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig.test +112 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_blocks.test +29 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_filters.test +37 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_whitespace.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/whitespace.test +63 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/autoclose.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_attr_once.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_html_false.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/mergeattrs.test +26 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock.test +54 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock_002.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attr_list.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs.test +42 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_002.test +35 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_003.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_html_linebreak.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks.test +27 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks_002.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/boolean_attr.test +19 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug28.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug8.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/cond_cmt.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/doctype.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/double_equal.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/empty_line_after_multiline.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_001.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_002.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_003.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_004.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_005.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_006.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_007.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_008.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_009.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_010.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_013.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_016.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_017.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_018.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_019.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_020.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_002.test +19 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_003.test +13 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_004.test +21 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_005.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_006.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/insertflags.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation.test +36 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation_in_html_attrs.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline_code.test +59 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiple_attr_kinds.test +47 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/non_rendered_comment.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ns.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error1.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error2.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/quotes_in_haml.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby19_attrs.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_001.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_002.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_003.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/standard.test +114 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/tagflags.test +39 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/php_filters.test +28 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/twig_filters.test +31 -0
- data/vendor/mthaml/mthaml/test/bootstrap.php +3 -0
- metadata +398 -0
@@ -0,0 +1,188 @@
|
|
1
|
+
# Function Literals
|
2
|
+
# -----------------
|
3
|
+
|
4
|
+
# TODO: add indexing and method invocation tests: (->)[0], (->).call()
|
5
|
+
|
6
|
+
# * Function Definition
|
7
|
+
# * Bound Function Definition
|
8
|
+
# * Parameter List Features
|
9
|
+
# * Splat Parameters
|
10
|
+
# * Context (@) Parameters
|
11
|
+
# * Parameter Destructuring
|
12
|
+
# * Default Parameters
|
13
|
+
|
14
|
+
# Function Definition
|
15
|
+
|
16
|
+
x = 1
|
17
|
+
y = {}
|
18
|
+
y.x = -> 3
|
19
|
+
ok x is 1
|
20
|
+
ok typeof(y.x) is 'function'
|
21
|
+
ok y.x instanceof Function
|
22
|
+
ok y.x() is 3
|
23
|
+
|
24
|
+
# The empty function should not cause a syntax error.
|
25
|
+
->
|
26
|
+
() ->
|
27
|
+
|
28
|
+
# Multiple nested function declarations mixed with implicit calls should not
|
29
|
+
# cause a syntax error.
|
30
|
+
(one) -> (two) -> three four, (five) -> six seven, eight, (nine) ->
|
31
|
+
|
32
|
+
# with multiple single-line functions on the same line.
|
33
|
+
func = (x) -> (x) -> (x) -> x
|
34
|
+
ok func(1)(2)(3) is 3
|
35
|
+
|
36
|
+
# Make incorrect indentation safe.
|
37
|
+
func = ->
|
38
|
+
obj = {
|
39
|
+
key: 10
|
40
|
+
}
|
41
|
+
obj.key - 5
|
42
|
+
eq func(), 5
|
43
|
+
|
44
|
+
# Ensure that functions with the same name don't clash with helper functions.
|
45
|
+
del = -> 5
|
46
|
+
ok del() is 5
|
47
|
+
|
48
|
+
|
49
|
+
# Bound Function Definition
|
50
|
+
|
51
|
+
obj =
|
52
|
+
bound: ->
|
53
|
+
(=> this)()
|
54
|
+
unbound: ->
|
55
|
+
(-> this)()
|
56
|
+
nested: ->
|
57
|
+
(=>
|
58
|
+
(=>
|
59
|
+
(=> this)()
|
60
|
+
)()
|
61
|
+
)()
|
62
|
+
eq obj, obj.bound()
|
63
|
+
ok obj isnt obj.unbound()
|
64
|
+
eq obj, obj.nested()
|
65
|
+
|
66
|
+
|
67
|
+
test "even more fancy bound functions", ->
|
68
|
+
obj =
|
69
|
+
one: ->
|
70
|
+
do =>
|
71
|
+
return this.two()
|
72
|
+
two: ->
|
73
|
+
do =>
|
74
|
+
do =>
|
75
|
+
do =>
|
76
|
+
return this.three
|
77
|
+
three: 3
|
78
|
+
|
79
|
+
eq obj.one(), 3
|
80
|
+
|
81
|
+
|
82
|
+
test "self-referencing functions", ->
|
83
|
+
changeMe = ->
|
84
|
+
changeMe = 2
|
85
|
+
|
86
|
+
changeMe()
|
87
|
+
eq changeMe, 2
|
88
|
+
|
89
|
+
|
90
|
+
# Parameter List Features
|
91
|
+
|
92
|
+
test "splats", ->
|
93
|
+
arrayEq [0, 1, 2], (((splat...) -> splat) 0, 1, 2)
|
94
|
+
arrayEq [2, 3], (((_, _1, splat...) -> splat) 0, 1, 2, 3)
|
95
|
+
arrayEq [0, 1], (((splat..., _, _1) -> splat) 0, 1, 2, 3)
|
96
|
+
arrayEq [2], (((_, _1, splat..., _2) -> splat) 0, 1, 2, 3)
|
97
|
+
|
98
|
+
test "@-parameters: automatically assign an argument's value to a property of the context", ->
|
99
|
+
nonce = {}
|
100
|
+
|
101
|
+
((@prop) ->).call context = {}, nonce
|
102
|
+
eq nonce, context.prop
|
103
|
+
|
104
|
+
# allow splats along side the special argument
|
105
|
+
((splat..., @prop) ->).apply context = {}, [0, 0, nonce]
|
106
|
+
eq nonce, context.prop
|
107
|
+
|
108
|
+
# allow the argument itself to be a splat
|
109
|
+
((@prop...) ->).call context = {}, 0, nonce, 0
|
110
|
+
eq nonce, context.prop[1]
|
111
|
+
|
112
|
+
# the argument should still be able to be referenced normally
|
113
|
+
eq nonce, (((@prop) -> prop).call {}, nonce)
|
114
|
+
|
115
|
+
test "@-parameters and splats with constructors", ->
|
116
|
+
a = {}
|
117
|
+
b = {}
|
118
|
+
class Klass
|
119
|
+
constructor: (@first, splat..., @last) ->
|
120
|
+
|
121
|
+
obj = new Klass a, 0, 0, b
|
122
|
+
eq a, obj.first
|
123
|
+
eq b, obj.last
|
124
|
+
|
125
|
+
test "destructuring in function definition", ->
|
126
|
+
(([{a: [b], c}]...) ->
|
127
|
+
eq 1, b
|
128
|
+
eq 2, c
|
129
|
+
) {a: [1], c: 2}
|
130
|
+
|
131
|
+
test "default values", ->
|
132
|
+
nonceA = {}
|
133
|
+
nonceB = {}
|
134
|
+
a = (_,_1,arg=nonceA) -> arg
|
135
|
+
eq nonceA, a()
|
136
|
+
eq nonceA, a(0)
|
137
|
+
eq nonceB, a(0,0,nonceB)
|
138
|
+
eq nonceA, a(0,0,undefined)
|
139
|
+
eq nonceA, a(0,0,null)
|
140
|
+
eq false , a(0,0,false)
|
141
|
+
eq nonceB, a(undefined,undefined,nonceB,undefined)
|
142
|
+
b = (_,arg=nonceA,_1,_2) -> arg
|
143
|
+
eq nonceA, b()
|
144
|
+
eq nonceA, b(0)
|
145
|
+
eq nonceB, b(0,nonceB)
|
146
|
+
eq nonceA, b(0,undefined)
|
147
|
+
eq nonceA, b(0,null)
|
148
|
+
eq false , b(0,false)
|
149
|
+
eq nonceB, b(undefined,nonceB,undefined)
|
150
|
+
c = (arg=nonceA,_,_1) -> arg
|
151
|
+
eq nonceA, c()
|
152
|
+
eq 0, c(0)
|
153
|
+
eq nonceB, c(nonceB)
|
154
|
+
eq nonceA, c(undefined)
|
155
|
+
eq nonceA, c(null)
|
156
|
+
eq false , c(false)
|
157
|
+
eq nonceB, c(nonceB,undefined,undefined)
|
158
|
+
|
159
|
+
test "default values with @-parameters", ->
|
160
|
+
a = {}
|
161
|
+
b = {}
|
162
|
+
obj = f: (q = a, @p = b) -> q
|
163
|
+
eq a, obj.f()
|
164
|
+
eq b, obj.p
|
165
|
+
|
166
|
+
test "default values with splatted arguments", ->
|
167
|
+
withSplats = (a = 2, b..., c = 3, d = 5) -> a * (b.length + 1) * c * d
|
168
|
+
eq 30, withSplats()
|
169
|
+
eq 15, withSplats(1)
|
170
|
+
eq 5, withSplats(1,1)
|
171
|
+
eq 1, withSplats(1,1,1)
|
172
|
+
eq 2, withSplats(1,1,1,1)
|
173
|
+
|
174
|
+
test "default values with function calls", ->
|
175
|
+
doesNotThrow -> CoffeeScript.compile "(x = f()) ->"
|
176
|
+
|
177
|
+
test "arguments vs parameters", ->
|
178
|
+
doesNotThrow -> CoffeeScript.compile "f(x) ->"
|
179
|
+
f = (g) -> g()
|
180
|
+
eq 5, f (x) -> 5
|
181
|
+
|
182
|
+
test "#1844: bound functions in nested comprehensions causing empty var statements", ->
|
183
|
+
a = ((=>) for a in [0] for b in [0])
|
184
|
+
eq 1, a.length
|
185
|
+
|
186
|
+
test "#1859: inline function bodies shouldn't modify prior postfix ifs", ->
|
187
|
+
list = [1, 2, 3]
|
188
|
+
ok true if list.some (x) -> x is 2
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# Helpers
|
2
|
+
# -------
|
3
|
+
|
4
|
+
# pull the helpers from `CoffeeScript.helpers` into local variables
|
5
|
+
{starts, ends, compact, count, merge, extend, flatten, del, last} = CoffeeScript.helpers
|
6
|
+
|
7
|
+
|
8
|
+
# `starts`
|
9
|
+
|
10
|
+
test "the `starts` helper tests if a string starts with another string", ->
|
11
|
+
ok starts('01234', '012')
|
12
|
+
ok not starts('01234', '123')
|
13
|
+
|
14
|
+
test "the `starts` helper can take an optional offset", ->
|
15
|
+
ok starts('01234', '34', 3)
|
16
|
+
ok not starts('01234', '01', 1)
|
17
|
+
|
18
|
+
|
19
|
+
# `ends`
|
20
|
+
|
21
|
+
test "the `ends` helper tests if a string ends with another string", ->
|
22
|
+
ok ends('01234', '234')
|
23
|
+
ok not ends('01234', '012')
|
24
|
+
|
25
|
+
test "the `ends` helper can take an optional offset", ->
|
26
|
+
ok ends('01234', '012', 2)
|
27
|
+
ok not ends('01234', '234', 6)
|
28
|
+
|
29
|
+
|
30
|
+
# `compact`
|
31
|
+
|
32
|
+
test "the `compact` helper removes falsey values from an array, preserves truthy ones", ->
|
33
|
+
allValues = [1, 0, false, obj={}, [], '', ' ', -1, null, undefined, true]
|
34
|
+
truthyValues = [1, obj, [], ' ', -1, true]
|
35
|
+
arrayEq truthyValues, compact(allValues)
|
36
|
+
|
37
|
+
|
38
|
+
# `count`
|
39
|
+
|
40
|
+
test "the `count` helper counts the number of occurances of a string in another string", ->
|
41
|
+
eq 1/0, count('abc', '')
|
42
|
+
eq 0, count('abc', 'z')
|
43
|
+
eq 1, count('abc', 'a')
|
44
|
+
eq 1, count('abc', 'b')
|
45
|
+
eq 2, count('abcdc', 'c')
|
46
|
+
eq 2, count('abcdabcd','abc')
|
47
|
+
|
48
|
+
|
49
|
+
# `merge`
|
50
|
+
|
51
|
+
test "the `merge` helper makes a new object with all properties of the objects given as its arguments", ->
|
52
|
+
ary = [0, 1, 2, 3, 4]
|
53
|
+
obj = {}
|
54
|
+
merged = merge obj, ary
|
55
|
+
ok merged isnt obj
|
56
|
+
ok merged isnt ary
|
57
|
+
for own key, val of ary
|
58
|
+
eq val, merged[key]
|
59
|
+
|
60
|
+
|
61
|
+
# `extend`
|
62
|
+
|
63
|
+
test "the `extend` helper performs a shallow copy", ->
|
64
|
+
ary = [0, 1, 2, 3]
|
65
|
+
obj = {}
|
66
|
+
# should return the object being extended
|
67
|
+
eq obj, extend(obj, ary)
|
68
|
+
# should copy the other object's properties as well (obviously)
|
69
|
+
eq 2, obj[2]
|
70
|
+
|
71
|
+
|
72
|
+
# `flatten`
|
73
|
+
|
74
|
+
test "the `flatten` helper flattens an array", ->
|
75
|
+
success = yes
|
76
|
+
(success and= typeof n is 'number') for n in flatten [0, [[[1]], 2], 3, [4]]
|
77
|
+
ok success
|
78
|
+
|
79
|
+
|
80
|
+
# `del`
|
81
|
+
|
82
|
+
test "the `del` helper deletes a property from an object and returns the deleted value", ->
|
83
|
+
obj = [0, 1, 2]
|
84
|
+
eq 1, del(obj, 1)
|
85
|
+
ok 1 not of obj
|
86
|
+
|
87
|
+
|
88
|
+
# `last`
|
89
|
+
|
90
|
+
test "the `last` helper returns the last item of an array-like object", ->
|
91
|
+
ary = [0, 1, 2, 3, 4]
|
92
|
+
eq 4, last(ary)
|
93
|
+
|
94
|
+
test "the `last` helper allows one to specify an optional offset", ->
|
95
|
+
ary = [0, 1, 2, 3, 4]
|
96
|
+
eq 2, last(ary, 2)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Importing
|
2
|
+
# ---------
|
3
|
+
|
4
|
+
unless window? or testingBrowser?
|
5
|
+
test "coffeescript modules can be imported and executed", ->
|
6
|
+
|
7
|
+
magicKey = __filename
|
8
|
+
magicValue = 0xFFFF
|
9
|
+
|
10
|
+
if global[magicKey]?
|
11
|
+
if exports?
|
12
|
+
local = magicValue
|
13
|
+
exports.method = -> local
|
14
|
+
else
|
15
|
+
global[magicKey] = {}
|
16
|
+
if require?.extensions? or require?.registerExtension?
|
17
|
+
ok require(__filename).method() is magicValue
|
18
|
+
delete global[magicKey]
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# Interpolation
|
2
|
+
# -------------
|
3
|
+
|
4
|
+
# * String Interpolation
|
5
|
+
# * Regular Expression Interpolation
|
6
|
+
|
7
|
+
# String Interpolation
|
8
|
+
|
9
|
+
# TODO: refactor string interpolation tests
|
10
|
+
|
11
|
+
eq 'multiline nested "interpolations" work', """multiline #{
|
12
|
+
"nested #{
|
13
|
+
ok true
|
14
|
+
"\"interpolations\""
|
15
|
+
}"
|
16
|
+
} work"""
|
17
|
+
|
18
|
+
# Issue #923: Tricky interpolation.
|
19
|
+
eq "#{ "{" }", "{"
|
20
|
+
eq "#{ '#{}}' } }", '#{}} }'
|
21
|
+
eq "#{"'#{ ({a: "b#{1}"}['a']) }'"}", "'b1'"
|
22
|
+
|
23
|
+
# Issue #1150: String interpolation regression
|
24
|
+
eq "#{'"/'}", '"/'
|
25
|
+
eq "#{"/'"}", "/'"
|
26
|
+
eq "#{/'"/}", '/\'"/'
|
27
|
+
eq "#{"'/" + '/"' + /"'/}", '\'//"/"\'/'
|
28
|
+
eq "#{"'/"}#{'/"'}#{/"'/}", '\'//"/"\'/'
|
29
|
+
eq "#{6 / 2}", '3'
|
30
|
+
eq "#{6 / 2}#{6 / 2}", '33' # parsed as division
|
31
|
+
eq "#{6 + /2}#{6/ + 2}", '6/2}#{6/2' # parsed as a regex
|
32
|
+
eq "#{6/2}
|
33
|
+
#{6/2}", '3 3' # newline cannot be part of a regex, so it's division
|
34
|
+
eq "#{/// "'/'"/" ///}", '/"\'\\/\'"\\/"/' # heregex, stuffed with spicy characters
|
35
|
+
eq "#{/\\'/}", "/\\\\'/"
|
36
|
+
|
37
|
+
hello = 'Hello'
|
38
|
+
world = 'World'
|
39
|
+
ok '#{hello} #{world}!' is '#{hello} #{world}!'
|
40
|
+
ok "#{hello} #{world}!" is 'Hello World!'
|
41
|
+
ok "[#{hello}#{world}]" is '[HelloWorld]'
|
42
|
+
ok "#{hello}##{world}" is 'Hello#World'
|
43
|
+
ok "Hello #{ 1 + 2 } World" is 'Hello 3 World'
|
44
|
+
ok "#{hello} #{ 1 + 2 } #{world}" is "Hello 3 World"
|
45
|
+
|
46
|
+
[s, t, r, i, n, g] = ['s', 't', 'r', 'i', 'n', 'g']
|
47
|
+
ok "#{s}#{t}#{r}#{i}#{n}#{g}" is 'string'
|
48
|
+
ok "\#{s}\#{t}\#{r}\#{i}\#{n}\#{g}" is '#{s}#{t}#{r}#{i}#{n}#{g}'
|
49
|
+
ok "\#{string}" is '#{string}'
|
50
|
+
|
51
|
+
ok "\#{Escaping} first" is '#{Escaping} first'
|
52
|
+
ok "Escaping \#{in} middle" is 'Escaping #{in} middle'
|
53
|
+
ok "Escaping \#{last}" is 'Escaping #{last}'
|
54
|
+
|
55
|
+
ok "##" is '##'
|
56
|
+
ok "#{}" is ''
|
57
|
+
ok "#{}A#{} #{} #{}B#{}" is 'A B'
|
58
|
+
ok "\\\#{}" is '\\#{}'
|
59
|
+
|
60
|
+
ok "I won ##{20} last night." is 'I won #20 last night.'
|
61
|
+
ok "I won ##{'#20'} last night." is 'I won ##20 last night.'
|
62
|
+
|
63
|
+
ok "#{hello + world}" is 'HelloWorld'
|
64
|
+
ok "#{hello + ' ' + world + '!'}" is 'Hello World!'
|
65
|
+
|
66
|
+
list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
67
|
+
ok "values: #{list.join(', ')}, length: #{list.length}." is 'values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, length: 10.'
|
68
|
+
ok "values: #{list.join ' '}" is 'values: 0 1 2 3 4 5 6 7 8 9'
|
69
|
+
|
70
|
+
obj = {
|
71
|
+
name: 'Joe'
|
72
|
+
hi: -> "Hello #{@name}."
|
73
|
+
cya: -> "Hello #{@name}.".replace('Hello','Goodbye')
|
74
|
+
}
|
75
|
+
ok obj.hi() is "Hello Joe."
|
76
|
+
ok obj.cya() is "Goodbye Joe."
|
77
|
+
|
78
|
+
ok "With #{"quotes"}" is 'With quotes'
|
79
|
+
ok 'With #{"quotes"}' is 'With #{"quotes"}'
|
80
|
+
|
81
|
+
ok "Where is #{obj["name"] + '?'}" is 'Where is Joe?'
|
82
|
+
|
83
|
+
ok "Where is #{"the nested #{obj["name"]}"}?" is 'Where is the nested Joe?'
|
84
|
+
ok "Hello #{world ? "#{hello}"}" is 'Hello World'
|
85
|
+
|
86
|
+
ok "Hello #{"#{"#{obj["name"]}" + '!'}"}" is 'Hello Joe!'
|
87
|
+
|
88
|
+
a = """
|
89
|
+
Hello #{ "Joe" }
|
90
|
+
"""
|
91
|
+
ok a is "Hello Joe"
|
92
|
+
|
93
|
+
a = 1
|
94
|
+
b = 2
|
95
|
+
c = 3
|
96
|
+
ok "#{a}#{b}#{c}" is '123'
|
97
|
+
|
98
|
+
result = null
|
99
|
+
stash = (str) -> result = str
|
100
|
+
stash "a #{ ('aa').replace /a/g, 'b' } c"
|
101
|
+
ok result is 'a bb c'
|
102
|
+
|
103
|
+
foo = "hello"
|
104
|
+
ok "#{foo.replace("\"", "")}" is 'hello'
|
105
|
+
|
106
|
+
val = 10
|
107
|
+
a = """
|
108
|
+
basic heredoc #{val}
|
109
|
+
on two lines
|
110
|
+
"""
|
111
|
+
b = '''
|
112
|
+
basic heredoc #{val}
|
113
|
+
on two lines
|
114
|
+
'''
|
115
|
+
ok a is "basic heredoc 10\non two lines"
|
116
|
+
ok b is "basic heredoc \#{val}\non two lines"
|
117
|
+
|
118
|
+
eq 'multiline nested "interpolations" work', """multiline #{
|
119
|
+
"nested #{(->
|
120
|
+
ok yes
|
121
|
+
"\"interpolations\""
|
122
|
+
)()}"
|
123
|
+
} work"""
|
124
|
+
|
125
|
+
|
126
|
+
# Regular Expression Interpolation
|
127
|
+
|
128
|
+
# TODO: improve heregex interpolation tests
|
129
|
+
|
130
|
+
test "heregex interpolation", ->
|
131
|
+
eq /\\#{}\\\"/ + '', ///
|
132
|
+
#{
|
133
|
+
"#{ '\\' }" # normal comment
|
134
|
+
}
|
135
|
+
# regex comment
|
136
|
+
\#{}
|
137
|
+
\\ \"
|
138
|
+
/// + ''
|