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,43 @@
|
|
1
|
+
# Option Parser
|
2
|
+
# -------------
|
3
|
+
|
4
|
+
# TODO: refactor option parser tests
|
5
|
+
|
6
|
+
# Ensure that the OptionParser handles arguments correctly.
|
7
|
+
return unless require?
|
8
|
+
{OptionParser} = require './../lib/coffee-script/optparse'
|
9
|
+
|
10
|
+
opt = new OptionParser [
|
11
|
+
['-r', '--required [DIR]', 'desc required']
|
12
|
+
['-o', '--optional', 'desc optional']
|
13
|
+
['-l', '--list [FILES*]', 'desc list']
|
14
|
+
]
|
15
|
+
|
16
|
+
test "basic arguments", ->
|
17
|
+
args = ['one', 'two', 'three', '-r', 'dir']
|
18
|
+
result = opt.parse args
|
19
|
+
arrayEq args, result.arguments
|
20
|
+
eq undefined, result.required
|
21
|
+
|
22
|
+
test "boolean and parameterised options", ->
|
23
|
+
result = opt.parse ['--optional', '-r', 'folder', 'one', 'two']
|
24
|
+
ok result.optional
|
25
|
+
eq 'folder', result.required
|
26
|
+
arrayEq ['one', 'two'], result.arguments
|
27
|
+
|
28
|
+
test "list options", ->
|
29
|
+
result = opt.parse ['-l', 'one.txt', '-l', 'two.txt', 'three']
|
30
|
+
arrayEq ['one.txt', 'two.txt'], result.list
|
31
|
+
arrayEq ['three'], result.arguments
|
32
|
+
|
33
|
+
test "-- and interesting combinations", ->
|
34
|
+
result = opt.parse ['-o','-r','a','-r','b','-o','--','-a','b','--c','d']
|
35
|
+
arrayEq ['-a', 'b', '--c', 'd'], result.arguments
|
36
|
+
ok result.optional
|
37
|
+
eq 'b', result.required
|
38
|
+
|
39
|
+
args = ['--','-o','a','-r','c','-o','--','-a','arg0','-b','arg1']
|
40
|
+
result = opt.parse args
|
41
|
+
eq undefined, result.optional
|
42
|
+
eq undefined, result.required
|
43
|
+
arrayEq args[1..], result.arguments
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Range Literals
|
2
|
+
# --------------
|
3
|
+
|
4
|
+
# TODO: add indexing and method invocation tests: [1..4][0] is 1, [0...3].toString()
|
5
|
+
|
6
|
+
# shared array
|
7
|
+
shared = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
8
|
+
|
9
|
+
test "basic inclusive ranges", ->
|
10
|
+
arrayEq [1, 2, 3] , [1..3]
|
11
|
+
arrayEq [0, 1, 2] , [0..2]
|
12
|
+
arrayEq [0, 1] , [0..1]
|
13
|
+
arrayEq [0] , [0..0]
|
14
|
+
arrayEq [-1] , [-1..-1]
|
15
|
+
arrayEq [-1, 0] , [-1..0]
|
16
|
+
arrayEq [-1, 0, 1], [-1..1]
|
17
|
+
|
18
|
+
test "basic exclusive ranges", ->
|
19
|
+
arrayEq [1, 2, 3] , [1...4]
|
20
|
+
arrayEq [0, 1, 2] , [0...3]
|
21
|
+
arrayEq [0, 1] , [0...2]
|
22
|
+
arrayEq [0] , [0...1]
|
23
|
+
arrayEq [-1] , [-1...0]
|
24
|
+
arrayEq [-1, 0] , [-1...1]
|
25
|
+
arrayEq [-1, 0, 1], [-1...2]
|
26
|
+
|
27
|
+
arrayEq [], [1...1]
|
28
|
+
arrayEq [], [0...0]
|
29
|
+
arrayEq [], [-1...-1]
|
30
|
+
|
31
|
+
test "downward ranges", ->
|
32
|
+
arrayEq shared, [9..0].reverse()
|
33
|
+
arrayEq [5, 4, 3, 2] , [5..2]
|
34
|
+
arrayEq [2, 1, 0, -1], [2..-1]
|
35
|
+
|
36
|
+
arrayEq [3, 2, 1] , [3..1]
|
37
|
+
arrayEq [2, 1, 0] , [2..0]
|
38
|
+
arrayEq [1, 0] , [1..0]
|
39
|
+
arrayEq [0] , [0..0]
|
40
|
+
arrayEq [-1] , [-1..-1]
|
41
|
+
arrayEq [0, -1] , [0..-1]
|
42
|
+
arrayEq [1, 0, -1] , [1..-1]
|
43
|
+
arrayEq [0, -1, -2], [0..-2]
|
44
|
+
|
45
|
+
arrayEq [4, 3, 2], [4...1]
|
46
|
+
arrayEq [3, 2, 1], [3...0]
|
47
|
+
arrayEq [2, 1] , [2...0]
|
48
|
+
arrayEq [1] , [1...0]
|
49
|
+
arrayEq [] , [0...0]
|
50
|
+
arrayEq [] , [-1...-1]
|
51
|
+
arrayEq [0] , [0...-1]
|
52
|
+
arrayEq [0, -1] , [0...-2]
|
53
|
+
arrayEq [1, 0] , [1...-1]
|
54
|
+
arrayEq [2, 1, 0], [2...-1]
|
55
|
+
|
56
|
+
test "ranges with variables as enpoints", ->
|
57
|
+
[a, b] = [1, 3]
|
58
|
+
arrayEq [1, 2, 3], [a..b]
|
59
|
+
arrayEq [1, 2] , [a...b]
|
60
|
+
b = -2
|
61
|
+
arrayEq [1, 0, -1, -2], [a..b]
|
62
|
+
arrayEq [1, 0, -1] , [a...b]
|
63
|
+
|
64
|
+
test "ranges with expressions as endpoints", ->
|
65
|
+
[a, b] = [1, 3]
|
66
|
+
arrayEq [2, 3, 4, 5, 6], [(a+1)..2*b]
|
67
|
+
arrayEq [2, 3, 4, 5] , [(a+1)...2*b]
|
68
|
+
|
69
|
+
test "large ranges are generated with looping constructs", ->
|
70
|
+
down = [99..0]
|
71
|
+
eq 100, (len = down.length)
|
72
|
+
eq 0, down[len - 1]
|
73
|
+
|
74
|
+
up = [0...100]
|
75
|
+
eq 100, (len = up.length)
|
76
|
+
eq 99, up[len - 1]
|
77
|
+
|
78
|
+
test "#1012 slices with arguments object", ->
|
79
|
+
expected = [0..9]
|
80
|
+
argsAtStart = (-> [arguments[0]..9]) 0
|
81
|
+
arrayEq expected, argsAtStart
|
82
|
+
argsAtEnd = (-> [0..arguments[0]]) 9
|
83
|
+
arrayEq expected, argsAtEnd
|
84
|
+
argsAtBoth = (-> [arguments[0]..arguments[1]]) 0, 9
|
85
|
+
arrayEq expected, argsAtBoth
|
86
|
+
|
87
|
+
test "#1409: creating large ranges outside of a function body", ->
|
88
|
+
CoffeeScript.eval '[0..100]'
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Regular Expression Literals
|
2
|
+
# ---------------------------
|
3
|
+
|
4
|
+
# TODO: add method invocation tests: /regex/.toString()
|
5
|
+
|
6
|
+
# * Regexen
|
7
|
+
# * Heregexen
|
8
|
+
|
9
|
+
test "basic regular expression literals", ->
|
10
|
+
ok 'a'.match(/a/)
|
11
|
+
ok 'a'.match /a/
|
12
|
+
ok 'a'.match(/a/g)
|
13
|
+
ok 'a'.match /a/g
|
14
|
+
|
15
|
+
test "division is not confused for a regular expression", ->
|
16
|
+
eq 2, 4 / 2 / 1
|
17
|
+
|
18
|
+
a = 4
|
19
|
+
b = 2
|
20
|
+
g = 1
|
21
|
+
eq 2, a / b/g
|
22
|
+
|
23
|
+
a = 10
|
24
|
+
b = a /= 4 / 2
|
25
|
+
eq a, 5
|
26
|
+
|
27
|
+
obj = method: -> 2
|
28
|
+
two = 2
|
29
|
+
eq 2, (obj.method()/two + obj.method()/two)
|
30
|
+
|
31
|
+
i = 1
|
32
|
+
eq 2, (4)/2/i
|
33
|
+
eq 1, i/i/i
|
34
|
+
|
35
|
+
test "#764: regular expressions should be indexable", ->
|
36
|
+
eq /0/['source'], ///#{0}///['source']
|
37
|
+
|
38
|
+
test "#584: slashes are allowed unescaped in character classes", ->
|
39
|
+
ok /^a\/[/]b$/.test 'a//b'
|
40
|
+
|
41
|
+
test "#1724: regular expressions beginning with `*`", ->
|
42
|
+
throws -> CoffeeScript.compile '/*/'
|
43
|
+
|
44
|
+
|
45
|
+
# Heregexe(n|s)
|
46
|
+
|
47
|
+
test "a heregex will ignore whitespace and comments", ->
|
48
|
+
eq /^I'm\x20+[a]\s+Heregex?\/\/\//gim + '', ///
|
49
|
+
^ I'm \x20+ [a] \s+
|
50
|
+
Heregex? / // # or not
|
51
|
+
///gim + ''
|
52
|
+
|
53
|
+
test "an empty heregex will compile to an empty, non-capturing group", ->
|
54
|
+
eq /(?:)/ + '', /// /// + ''
|
55
|
+
|
56
|
+
test "#1724: regular expressions beginning with `*`", ->
|
57
|
+
throws -> CoffeeScript.compile '/// * ///'
|
58
|
+
|
59
|
+
test "empty regular expressions with flags", ->
|
60
|
+
fn = (x) -> x
|
61
|
+
a = "" + //i
|
62
|
+
fn ""
|
63
|
+
eq '/(?:)/i', a
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Scope
|
2
|
+
# -----
|
3
|
+
|
4
|
+
# * Variable Safety
|
5
|
+
# * Variable Shadowing
|
6
|
+
# * Auto-closure (`do`)
|
7
|
+
# * Global Scope Leaks
|
8
|
+
|
9
|
+
test "reference `arguments` inside of functions", ->
|
10
|
+
sumOfArgs = ->
|
11
|
+
sum = (a,b) -> a + b
|
12
|
+
sum = 0
|
13
|
+
sum += num for num in arguments
|
14
|
+
sum
|
15
|
+
eq 10, sumOfArgs(0, 1, 2, 3, 4)
|
16
|
+
|
17
|
+
test "assignment to an Object.prototype-named variable should not leak to outer scope", ->
|
18
|
+
# FIXME: fails on IE
|
19
|
+
(->
|
20
|
+
constructor = 'word'
|
21
|
+
)()
|
22
|
+
ok constructor isnt 'word'
|
23
|
+
|
24
|
+
test "siblings of splat parameters shouldn't leak to surrounding scope", ->
|
25
|
+
x = 10
|
26
|
+
oops = (x, args...) ->
|
27
|
+
oops(20, 1, 2, 3)
|
28
|
+
eq x, 10
|
29
|
+
|
30
|
+
test "catch statements should introduce their argument to scope", ->
|
31
|
+
try throw ''
|
32
|
+
catch e
|
33
|
+
do -> e = 5
|
34
|
+
eq 5, e
|
35
|
+
|
36
|
+
class Array then slice: fail # needs to be global
|
37
|
+
class Object then hasOwnProperty: fail
|
38
|
+
test "#1973: redefining Array/Object constructors shouldn't confuse __X helpers", ->
|
39
|
+
arr = [1..4]
|
40
|
+
arrayEq [3, 4], arr[2..]
|
41
|
+
obj = {arr}
|
42
|
+
for own k of obj
|
43
|
+
eq arr, obj[k]
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# Slicing and Splicing
|
2
|
+
# --------------------
|
3
|
+
|
4
|
+
# * Slicing
|
5
|
+
# * Splicing
|
6
|
+
|
7
|
+
# shared array
|
8
|
+
shared = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
9
|
+
|
10
|
+
# Slicing
|
11
|
+
|
12
|
+
test "basic slicing", ->
|
13
|
+
arrayEq [7, 8, 9] , shared[7..9]
|
14
|
+
arrayEq [2, 3] , shared[2...4]
|
15
|
+
arrayEq [2, 3, 4, 5], shared[2...6]
|
16
|
+
|
17
|
+
test "slicing with variables as endpoints", ->
|
18
|
+
[a, b] = [1, 4]
|
19
|
+
arrayEq [1, 2, 3, 4], shared[a..b]
|
20
|
+
arrayEq [1, 2, 3] , shared[a...b]
|
21
|
+
|
22
|
+
test "slicing with expressions as endpoints", ->
|
23
|
+
[a, b] = [1, 3]
|
24
|
+
arrayEq [2, 3, 4, 5, 6], shared[(a+1)..2*b]
|
25
|
+
arrayEq [2, 3, 4, 5] , shared[a+1...(2*b)]
|
26
|
+
|
27
|
+
test "unbounded slicing", ->
|
28
|
+
arrayEq [7, 8, 9] , shared[7..]
|
29
|
+
arrayEq [8, 9] , shared[-2..]
|
30
|
+
arrayEq [9] , shared[-1...]
|
31
|
+
arrayEq [0, 1, 2] , shared[...3]
|
32
|
+
arrayEq [0, 1, 2, 3], shared[..-7]
|
33
|
+
|
34
|
+
arrayEq shared , shared[..-1]
|
35
|
+
arrayEq shared[0..8], shared[...-1]
|
36
|
+
|
37
|
+
for a in [-shared.length..shared.length]
|
38
|
+
arrayEq shared[a..] , shared[a...]
|
39
|
+
for a in [-shared.length+1...shared.length]
|
40
|
+
arrayEq shared[..a][...-1] , shared[...a]
|
41
|
+
|
42
|
+
arrayEq [1, 2, 3], [1, 2, 3][..]
|
43
|
+
|
44
|
+
test "#930, #835, #831, #746 #624: inclusive slices to -1 should slice to end", ->
|
45
|
+
arrayEq shared, shared[0..-1]
|
46
|
+
arrayEq shared, shared[..-1]
|
47
|
+
arrayEq shared.slice(1,shared.length), shared[1..-1]
|
48
|
+
|
49
|
+
test "string slicing", ->
|
50
|
+
str = "abcdefghijklmnopqrstuvwxyz"
|
51
|
+
ok str[1...1] is ""
|
52
|
+
ok str[1..1] is "b"
|
53
|
+
ok str[1...5] is "bcde"
|
54
|
+
ok str[0..4] is "abcde"
|
55
|
+
ok str[-5..] is "vwxyz"
|
56
|
+
|
57
|
+
test "#1722: operator precedence in unbounded slice compilation", ->
|
58
|
+
list = [0..9]
|
59
|
+
n = 2 # some truthy number in `list`
|
60
|
+
arrayEq [0..n], list[..n]
|
61
|
+
arrayEq [0..n], list[..n or 0]
|
62
|
+
arrayEq [0..n], list[..if n then n else 0]
|
63
|
+
|
64
|
+
|
65
|
+
# Splicing
|
66
|
+
|
67
|
+
test "basic splicing", ->
|
68
|
+
ary = [0..9]
|
69
|
+
ary[5..9] = [0, 0, 0]
|
70
|
+
arrayEq [0, 1, 2, 3, 4, 0, 0, 0], ary
|
71
|
+
|
72
|
+
ary = [0..9]
|
73
|
+
ary[2...8] = []
|
74
|
+
arrayEq [0, 1, 8, 9], ary
|
75
|
+
|
76
|
+
test "unbounded splicing", ->
|
77
|
+
ary = [0..9]
|
78
|
+
ary[3..] = [9, 8, 7]
|
79
|
+
arrayEq [0, 1, 2, 9, 8, 7]. ary
|
80
|
+
|
81
|
+
ary[...3] = [7, 8, 9]
|
82
|
+
arrayEq [7, 8, 9, 9, 8, 7], ary
|
83
|
+
|
84
|
+
ary[..] = [1, 2, 3]
|
85
|
+
arrayEq [1, 2, 3], ary
|
86
|
+
|
87
|
+
test "splicing with variables as endpoints", ->
|
88
|
+
[a, b] = [1, 8]
|
89
|
+
|
90
|
+
ary = [0..9]
|
91
|
+
ary[a..b] = [2, 3]
|
92
|
+
arrayEq [0, 2, 3, 9], ary
|
93
|
+
|
94
|
+
ary = [0..9]
|
95
|
+
ary[a...b] = [5]
|
96
|
+
arrayEq [0, 5, 8, 9], ary
|
97
|
+
|
98
|
+
test "splicing with expressions as endpoints", ->
|
99
|
+
[a, b] = [1, 3]
|
100
|
+
|
101
|
+
ary = [0..9]
|
102
|
+
ary[ a+1 .. 2*b+1 ] = [4]
|
103
|
+
arrayEq [0, 1, 4, 8, 9], ary
|
104
|
+
|
105
|
+
ary = [0..9]
|
106
|
+
ary[a+1...2*b+1] = [4]
|
107
|
+
arrayEq [0, 1, 4, 7, 8, 9], ary
|
108
|
+
|
109
|
+
test "splicing to the end, against a one-time function", ->
|
110
|
+
ary = null
|
111
|
+
fn = ->
|
112
|
+
if ary
|
113
|
+
throw 'err'
|
114
|
+
else
|
115
|
+
ary = [1, 2, 3]
|
116
|
+
|
117
|
+
fn()[0..] = 1
|
118
|
+
|
119
|
+
arrayEq ary, [1]
|
120
|
+
|
121
|
+
test "the return value of a splice literal should be the RHS", ->
|
122
|
+
ary = [0, 0, 0]
|
123
|
+
eq (ary[0..1] = 2), 2
|
124
|
+
|
125
|
+
ary = [0, 0, 0]
|
126
|
+
eq (ary[0..] = 3), 3
|
127
|
+
|
128
|
+
arrayEq [ary[0..0] = 0], [0]
|
129
|
+
|
130
|
+
test "#1723: operator precedence in unbounded splice compilation", ->
|
131
|
+
n = 4 # some truthy number in `list`
|
132
|
+
|
133
|
+
list = [0..9]
|
134
|
+
list[..n] = n
|
135
|
+
arrayEq [n..9], list
|
136
|
+
|
137
|
+
list = [0..9]
|
138
|
+
list[..n or 0] = n
|
139
|
+
arrayEq [n..9], list
|
140
|
+
|
141
|
+
list = [0..9]
|
142
|
+
list[..if n then n else 0] = n
|
143
|
+
arrayEq [n..9], list
|
@@ -0,0 +1,134 @@
|
|
1
|
+
# Soaks
|
2
|
+
# -----
|
3
|
+
|
4
|
+
# * Soaked Property Access
|
5
|
+
# * Soaked Method Invocation
|
6
|
+
# * Soaked Function Invocation
|
7
|
+
|
8
|
+
|
9
|
+
# Soaked Property Access
|
10
|
+
|
11
|
+
test "soaked property access", ->
|
12
|
+
nonce = {}
|
13
|
+
obj = a: b: nonce
|
14
|
+
eq nonce , obj?.a.b
|
15
|
+
eq nonce , obj?['a'].b
|
16
|
+
eq nonce , obj.a?.b
|
17
|
+
eq nonce , obj?.a?['b']
|
18
|
+
eq undefined, obj?.a?.non?.existent?.property
|
19
|
+
|
20
|
+
test "soaked property access caches method calls", ->
|
21
|
+
nonce ={}
|
22
|
+
obj = fn: -> a: nonce
|
23
|
+
eq nonce , obj.fn()?.a
|
24
|
+
eq undefined, obj.fn()?.b
|
25
|
+
|
26
|
+
test "soaked property access chaching", ->
|
27
|
+
nonce = {}
|
28
|
+
counter = 0
|
29
|
+
fn = ->
|
30
|
+
counter++
|
31
|
+
'self'
|
32
|
+
obj =
|
33
|
+
self: -> @
|
34
|
+
prop: nonce
|
35
|
+
eq nonce, obj[fn()]()[fn()]()[fn()]()?.prop
|
36
|
+
eq 3, counter
|
37
|
+
|
38
|
+
test "method calls on soaked methods", ->
|
39
|
+
nonce = {}
|
40
|
+
obj = null
|
41
|
+
eq undefined, obj?.a().b()
|
42
|
+
obj = a: -> b: -> nonce
|
43
|
+
eq nonce , obj?.a().b()
|
44
|
+
|
45
|
+
test "postfix existential operator mixes well with soaked property accesses", ->
|
46
|
+
eq false, nonexistent?.property?
|
47
|
+
|
48
|
+
test "function invocation with soaked property access", ->
|
49
|
+
id = (_) -> _
|
50
|
+
eq undefined, id nonexistent?.method()
|
51
|
+
|
52
|
+
test "if-to-ternary should safely parenthesize soaked property accesses", ->
|
53
|
+
ok (if nonexistent?.property then false else true)
|
54
|
+
|
55
|
+
test "#726", ->
|
56
|
+
# TODO: check this test, looks like it's not really testing anything
|
57
|
+
eq undefined, nonexistent?[Date()]
|
58
|
+
|
59
|
+
test "#756", ->
|
60
|
+
# TODO: improve this test
|
61
|
+
a = null
|
62
|
+
ok isNaN a?.b.c + 1
|
63
|
+
eq undefined, a?.b.c += 1
|
64
|
+
eq undefined, ++a?.b.c
|
65
|
+
eq undefined, delete a?.b.c
|
66
|
+
|
67
|
+
test "operations on soaked properties", ->
|
68
|
+
# TODO: improve this test
|
69
|
+
a = b: {c: 0}
|
70
|
+
eq 1, a?.b.c + 1
|
71
|
+
eq 1, a?.b.c += 1
|
72
|
+
eq 2, ++a?.b.c
|
73
|
+
eq yes, delete a?.b.c
|
74
|
+
|
75
|
+
|
76
|
+
# Soaked Method Invocation
|
77
|
+
|
78
|
+
test "soaked method invocation", ->
|
79
|
+
nonce = {}
|
80
|
+
counter = 0
|
81
|
+
obj =
|
82
|
+
self: -> @
|
83
|
+
increment: -> counter++; @
|
84
|
+
eq obj , obj.self?()
|
85
|
+
eq undefined, obj.method?()
|
86
|
+
eq nonce , obj.self?().property = nonce
|
87
|
+
eq undefined, obj.method?().property = nonce
|
88
|
+
eq obj , obj.increment().increment().self?()
|
89
|
+
eq 2 , counter
|
90
|
+
|
91
|
+
test "#733", ->
|
92
|
+
a = b: {c: null}
|
93
|
+
eq a.b?.c?(), undefined
|
94
|
+
a.b?.c or= (it) -> it
|
95
|
+
eq a.b?.c?(1), 1
|
96
|
+
eq a.b?.c?([2, 3]...), 2
|
97
|
+
|
98
|
+
|
99
|
+
# Soaked Function Invocation
|
100
|
+
|
101
|
+
test "soaked function invocation", ->
|
102
|
+
nonce = {}
|
103
|
+
id = (_) -> _
|
104
|
+
eq nonce , id?(nonce)
|
105
|
+
eq nonce , (id? nonce)
|
106
|
+
eq undefined, nonexistent?(nonce)
|
107
|
+
eq undefined, (nonexistent? nonce)
|
108
|
+
|
109
|
+
test "soaked function invocation with generated functions", ->
|
110
|
+
nonce = {}
|
111
|
+
id = (_) -> _
|
112
|
+
maybe = (fn, arg) -> if typeof fn is 'function' then () -> fn(arg)
|
113
|
+
eq maybe(id, nonce)?(), nonce
|
114
|
+
eq (maybe id, nonce)?(), nonce
|
115
|
+
eq (maybe false, nonce)?(), undefined
|
116
|
+
|
117
|
+
test "soaked constructor invocation", ->
|
118
|
+
eq 42 , +new Number? 42
|
119
|
+
eq undefined, new Other? 42
|
120
|
+
|
121
|
+
test "soaked constructor invocations with caching and property access", ->
|
122
|
+
semaphore = 0
|
123
|
+
nonce = {}
|
124
|
+
class C
|
125
|
+
constructor: ->
|
126
|
+
ok false if semaphore
|
127
|
+
semaphore++
|
128
|
+
prop: nonce
|
129
|
+
eq nonce, (new C())?.prop
|
130
|
+
eq 1, semaphore
|
131
|
+
|
132
|
+
test "soaked function invocation safe on non-functions", ->
|
133
|
+
eq undefined, 0?(1)
|
134
|
+
eq undefined, 0? 1, 2
|