Commit Graph
42 Commits
Author SHA1 Message Date
Florian Weingarten 17cc8fdbb3 put line number in parentheses 2014-09-05 14:12:30 +00:00
Tristan HumeandFlorian Weingarten 27c1019385 Add line numbers to warnings 2014-09-05 14:12:30 +00:00
Florian Weingarten 5eff375094 Optional line numbers for liquid errors 2014-09-05 14:12:29 +00:00
Tristan Hume 68af2d6e2a Pass options to include tags 2014-08-26 10:50:25 -04: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
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
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
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
Jean Boussier df6b442816 Cast input to string before spliting 2014-08-07 14:01:44 -04: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 e5b0487fef Merge pull request #312 from Shopify/uniq_filter
uniq filter
2014-08-05 16:22:48 +02:00
Florian Weingarten baea0a6bf7 slice filter 2014-08-04 16:47:08 +00:00
Florian WeingartenandFlorian Weingarten 33e7b8e373 uniq filter 2014-07-29 13:09:34 +00: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
Arthur Nogueira Neves 32e4f2d3b1 Merge pull request #240 from Shopify/remove_flatten
remove .flatten on standard filters
2014-07-24 10:54:28 -04:00
Florian Weingarten 6c6350f18b Exception handling for humans
Ability to pass exception_handler as a block to #render
and provide whatever behavior you want on handling exceptions

https://github.com/Shopify/liquid/pull/254
2014-07-24 14:44:02 +00:00
Florian Weingarten eae24373e6 remove unnecessary flatten filter 2014-07-24 02:56:57 +00:00
Florian Weingarten 0b45ffeada add more legacy tests 2014-07-24 00:33:39 +00:00
Arthur Neves 18e8ce1eb0 add flatten filter 2014-07-23 17:16:20 -04:00
Florian WeingartenandArthur Neves 994f309465 Fix broken standardfilter test 2014-07-23 17:15:39 -04:00
Arthur Neves 6a061cbe81 remove .flatten on standard filters 2014-07-23 17:14:26 -04:00
Jason Hiltz-Laforge 55597b8398 Fixing regression from block delimiter enhancement 2014-07-23 19:18:02 +00:00
Florian Weingarten 1e0e9f1f31 Remove unnecessary blank? code 2014-07-22 21:19:12 +00:00
Florian Weingarten 8909c9f27a add regression tests for #377 2014-07-08 14:47:39 +00:00
Florian Weingarten 114a37d9ba add additional tests for https://github.com/jekyll/jekyll/pull/2505 2014-06-23 09:28:24 -04:00
Christian Blais 2239921804 [Liquid] Add round, ceil and floor standard filters 2014-06-16 11:15:53 -04:00
Florian Weingarten 628ab3dc6a add test for numerical sort 2014-05-04 19:50:38 -04:00
Thierry Joyal ad1152853a render! will properly force rethrow of errors if context is passed as an argument 2014-05-01 16:44:00 +00:00
David Cornu 8bc3792c0e Move date coercion to #to_date 2014-04-30 22:32:36 +00:00
Florian Weingarten 2a12f253bf Fix broken rendering of variables which are equal to false (closes #345) 2014-04-29 14:33:30 -04:00
Dylan Thacker-Smith 7e45155aa9 Seperate unit and integration tests.
This makes it easier to re-use the integration tests in a seperate gem that
optimizes parts of liquid with a native implementation.
2014-03-26 15:47:07 -04:00