Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

floor and ceil should return integers #33

Merged
merged 2 commits into from
Nov 7, 2020
Merged

Conversation

Eun
Copy link

@Eun Eun commented Jul 25, 2018

See

Checklist

  • I have read the contribution guidelines.
  • make test passes.
  • make lint passes.
  • New and changed code is covered by tests.
  • Performance improvements include benchmarks.
  • Changes match the documented (not just the implemented) behavior of Shopify.

@coveralls
Copy link

coveralls commented Jul 25, 2018

Coverage Status

Coverage decreased (-39.6%) to 49.546% when pulling 5540947 on Eun:master into e0ae159 on osteele:master.

@osteele
Copy link
Owner

osteele commented Jul 31, 2018

Thanks for your contribution!

What is the test case for this? filters/standard_filters.rb contains

	{`1.2 | ceil`, 2},
	{`2.0 | ceil`, 2},
	{`183.357 | ceil`, 184},
	{`"3.5" | ceil`, 4},

	{`1.2 | floor`, 1},
	{`2.0 | floor`, 2},
	{`183.357 | floor`, 183},

Is there another case where the current implementation behaves differently from the Ruby Liquid version? Can a test be made for this?

@Eun
Copy link
Author

Eun commented Jul 31, 2018

Yes we could improve the tests by checking the types as well.
I did not notice other type problems.


The actual requirement was something like this:

{% assign TotalPages = Pages | plus: 5 %}
{% for i in (1..MaxPage) %}

(it is not possible to loop until a float variable, so we need an integer) ({% assign TotalPages = Pages | plus: 5 | floor %}

@osteele osteele merged commit 26998e1 into osteele:master Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants