Commit Graph
677 Commits
Author SHA1 Message Date
Florian Weingarten 5eff375094 Optional line numbers for liquid errors 2014-09-05 14:12:29 +00:00
Tristan Hume 2df643ba18 Merge pull request #425 from Shopify/pass-options-include
Pass options through on include
2014-08-26 13:40:06 -04:00
Tristan Hume 68af2d6e2a Pass options to include tags 2014-08-26 10:50:25 -04:00
Arthur Nogueira Neves dfb6c20493 Merge pull request #423 from bogdan/contains-with-integer
Fixed condition constains operator with wrong data type
2014-08-18 14:58:08 -04:00
Bogdan Gusiev 4e9d414fde Fixed condition constains operator with wrong data type
"contains" operator on wrong data type should not cause NoMethodError.
2014-08-18 17:32:29 +03:00
Florian Weingarten c0ec0652ae Merge pull request #421 from djreimer/url-encode-filter
Add url_encode standard filter
2014-08-15 20:05:39 +02:00
Derrick Reimer f8c3cea09b Add url_encode filter to history 2014-08-15 11:03:06 -07:00
Derrick Reimer 0b847e553c Add url_encode standard filter 2014-08-15 08:45:40 -07:00
Florian Weingarten c2663258be Merge pull request #364 from collectiveidea/instrument-rendering-with-hooks
Profiling the rendering of a liquid template
2014-08-13 23:04:29 +02:00
Tristan Hume d4654d0062 Merge pull request #417 from Shopify/simplify-regex
Simplify Variable Parsing Regexes
2014-08-13 12:07:35 -04:00
Tristan Hume ffd4f9d959 Simplify secondary filter regex 2014-08-13 09:36:02 -04:00
Tristan Hume 292161865d Simplify filter parse regex 2014-08-13 09:28:01 -04:00
Florian Weingarten 35808390ee Merge pull request #414 from Shopify/to_liquid_context
Call to_liquid in Context invoke
2014-08-12 22:05:52 +02:00
Florian Weingarten 1678c07548 Call to_liquid in Context invoke 2014-08-12 19:54:12 +00:00
Jason Roelofs 173a58d36a Profile liquid rendering
Add a simple profiling system to liquid rendering. Each
liquid tag ({{ }} and {% %}) is processed through this profiling,
keeping track of the partial name (in the case of {% include %}), line
number, and the time it took to render the tag. In the case of {%
include %}, the profiler keeps track of the name of the partial and
properly links back tag rendering to the partial and line number for
easy lookup and dive down. With this, it's now possible to track down
exactly how long each tag takes to render.

These hooks get installed and uninstalled on an as-need basis so by
default there is no impact on the overall liquid execution speed.
2014-08-12 15:37:21 -04:00
Tristan Hume f31e309770 Merge pull request #416 from Shopify/filter-quirks
Make Filter Quirks Tests Actual Integration Tests
2014-08-12 10:08:05 -04:00
Tristan Hume ffe1036e15 Make tests actual integration tests 2014-08-12 09:27:46 -04:00
Dylan Thacker-Smith d3b113d2e1 Merge pull request #391 from Shopify/extract-context-parse
Separate expression parsing and rendering from Context#[]
2014-08-11 14:17:54 -07:00
Dylan Thacker-Smith 2aa9bbbac2 Separate expression parsing and rendering from Context#resolve. 2014-08-11 14:15:58 -07:00
Tristan Hume d5e57a8ea4 Merge pull request #412 from Shopify/assign-strict
Pass through options on assign tag
2014-08-11 15:37:49 -04:00
Florian Weingarten 5c0e0be639 Merge pull request #402 from Shopify/benchmark-ips
benchmark/ips
2014-08-11 21:22:43 +02:00
Florian Weingarten a74d40f1e5 benchmark/ips 2014-08-11 19:22:06 +00:00
Tristan Hume 79d4ec1a48 Merge pull request #413 from Shopify/filter-quirks
Add quirks test for unanchored filter args
2014-08-11 13:06:51 -04:00
Tristan Hume 4db22be8ba Add tests for assign tag fix 2014-08-11 13:06:01 -04:00
Tristan Hume dc58a4d648 Add quirks test for unanchored filter args 2014-08-11 11:58:36 -04:00
Tristan Hume 2809ec780a Pass through options on assign tag 2014-08-11 10:38:36 -04:00
Jean Boussier 2d98392bf5 Merge pull request #411 from Shopify/to-s-before-split
Cast input to string before spliting
2014-08-08 00:13:35 -04:00
Jean Boussier df6b442816 Cast input to string before spliting 2014-08-07 14:01:44 -04:00
Florian Weingarten 4b22fc8d1b Merge pull request #407 from Shopify/slice_arrays
Slice filter for arrays
2014-08-05 20:00:45 +02:00
Florian Weingarten fb6f9c1c13 Slice filter for arrays. 2014-08-05 17:59:31 +00:00
Florian Weingarten 66ae7f3ec0 Merge pull request #406 from Shopify/slice_filter
slice filter
2014-08-05 17:14:01 +02:00
Florian Weingarten 0bea31d2ef Use Integer() instead of to_i 2014-08-05 15:13:15 +00:00
Florian Weingarten e5b0487fef Merge pull request #312 from Shopify/uniq_filter
uniq filter
2014-08-05 16:22:48 +02:00
Florian Weingarten 9117722740 Use symbols in respond_to? 2014-08-05 14:22:11 +00:00
Florian Weingarten baea0a6bf7 slice filter 2014-08-04 16:47:08 +00:00
Tom Burns 17347d43de Merge pull request #400 from Shopify/lazy_stack
lazily create stacks
2014-07-30 11:43:31 -04:00
Tom Burns 794ca9f604 make the conditions around stack creation easier to read 2014-07-30 15:42:24 +00:00
Tom Burns 15f6cabf83 avoid a hash comparison 2014-07-30 15:12:22 +00:00
Tom Burns e53d102a2c use 'unless' instead of 'if !' for simple conditional 2014-07-30 14:59:56 +00:00
Florian WeingartenandFlorian Weingarten 33e7b8e373 uniq filter 2014-07-29 13:09:34 +00:00
Florian Weingarten 9b8e3d437e Merge pull request #401 from Shopify/ktdreyer-minitest
Minitest 5 (continuation of #358)
2014-07-29 15:05:23 +02:00
Florian Weingarten a2f0f2547d with_global_filter test helper 2014-07-28 19:28:22 +00:00
Ken DreyerandFlorian Weingarten 57d5426eed tests: reset Strainer's filters after modification
Three tests in the test suite use the Liquid::Template.register_filter
function to register custom filters with Liquid::Strainer. The problem
is that these register_filter calls leave the Liquid::Strainer object in
an altered state.

As an example, the FiltersTest's test_local_filter relies on the default
behavior of Liquid::Strainer operator, and the test was failing if
register_function had been called earlier. The same thing was happening
with FiltersInTemplate's test_local_global.

The problem was present when the Filters test classes were loaded inside
a single ruby process that also loaded HashOrderingTest. One example is
"rake test", which runs "require" on every test file. Another basic
example is the following command:

  ruby -Itest -e "require 'integration/hash_ordering_test';
  require 'integration/filter_test'"

Update the tests to always reset Liquid::Strainer's filters back to the
default list of filters.

With this change, FiltersTest and FiltersInTemplate now pass.
2014-07-28 16:36:43 +00:00
Ken DreyerandFlorian Weingarten 3e3a415457 tests: fix whitespace in hash_ordering_test
Indent two spaces, not one.
2014-07-28 16:36:43 +00:00
Ken DreyerandFlorian Weingarten deba039d6d tests: reset "contains" op during IfElseTagTest
Two tests in IfElseTagTest each set a custom operator function for the
"contains" comparison operator.

The problem is that IfElseTagTest was clobbering the original operator
in Liquid and leaving it in an altered state.

As an example, ConditionUnitTest's test_contains_works_on_arrays relies
on the specific behavior of the "contains" operator, and its
test_contains_works_on_arrays was failing.

The problem was present when both test classes were require'd inside a
single ruby process. One example is "rake test", which runs "require" on
every test file. Another basic example is the following command:

  ruby -Itest -e "require 'integration/tags/if_else_tag_test.rb';
  require 'unit/condition_unit_test.rb'"

This would cause test_contains_works_on_arrays to fail.

Update IfElseTagTest to avoid clobbering the "contains" operator.

With this change, ConditionUnitTest's test_contains_works_on_arrays now
passes.
2014-07-28 16:36:43 +00:00
Ken DreyerandFlorian Weingarten ee4295c889 tests: switch to minitest
Ruby 1.9+ uses Minitest as the backend for Test::Unit. As of Minitest 5,
the shim has broken some compatibility with Test::Unit::TestCase in some
scenarios.

Adjusts the test suite to support Minitest 5's syntax.

Minitest versions 4 and below do not support the newer Minitest::Test
class that arrived in version 5. For that case, use the
MiniTest::Unit::TestCase class as a fallback

Conflicts:
	test/integration/tags/for_tag_test.rb
	test/test_helper.rb
2014-07-28 16:36:38 +00:00
Tom Burns f5e67a12f9 remove added newline in liquid.rb 2014-07-28 14:24:29 +00:00
Tom Burns 6b56bdd74f remove variables used for counting empty stacks 2014-07-28 14:23:16 +00:00
Tom Burns ba6e3e3da6 lazily create stacks 2014-07-28 14:12:11 +00:00
Jason Hiltz-Laforge a8e63ff03d Merge pull request #398 from Shopify/fix_order_of_constructor_initialize
Reorder constructor to avoid referencing uninitialized variable when environment contains a self-referencing proc
2014-07-24 15:04:36 -04:00