Shopify stye guide fixes (#1160)

This commit is contained in:
Mike Angell
2019-09-20 02:08:11 +10:00
committed by GitHub
parent 2c14e0b2ba
commit b667bcb48b
17 changed files with 72 additions and 83 deletions
+2 -2
View File
@@ -26,9 +26,9 @@ class ConditionUnitTest < Minitest::Test
assert_evaluates_true 1, '<=', 1
# negative numbers
assert_evaluates_true 1, '>', -1
assert_evaluates_true -1, '<', 1
assert_evaluates_true(-1, '<', 1)
assert_evaluates_true 1.0, '>', -1.0
assert_evaluates_true -1.0, '<', 1.0
assert_evaluates_true(-1.0, '<', 1.0)
end
def test_default_operators_evalute_false
+16 -4
View File
@@ -85,7 +85,7 @@ class ContextUnitTest < Minitest::Test
@context['date'] = Date.today
assert_equal Date.today, @context['date']
now = DateTime.now
now = Time.now
@context['datetime'] = now
assert_equal now, @context['datetime']
@@ -405,7 +405,11 @@ class ContextUnitTest < Minitest::Test
end
def test_lambda_is_called_once
@context['callcount'] = proc { @global ||= 0; @global += 1; @global.to_s }
@context['callcount'] = proc {
@global ||= 0
@global += 1
@global.to_s
}
assert_equal '1', @context['callcount']
assert_equal '1', @context['callcount']
@@ -415,7 +419,11 @@ class ContextUnitTest < Minitest::Test
end
def test_nested_lambda_is_called_once
@context['callcount'] = { "lambda" => proc { @global ||= 0; @global += 1; @global.to_s } }
@context['callcount'] = { "lambda" => proc {
@global ||= 0
@global += 1
@global.to_s
} }
assert_equal '1', @context['callcount.lambda']
assert_equal '1', @context['callcount.lambda']
@@ -425,7 +433,11 @@ class ContextUnitTest < Minitest::Test
end
def test_lambda_in_array_is_called_once
@context['callcount'] = [1, 2, proc { @global ||= 0; @global += 1; @global.to_s }, 4, 5]
@context['callcount'] = [1, 2, proc {
@global ||= 0
@global += 1
@global.to_s
}, 4, 5]
assert_equal '1', @context['callcount[2]']
assert_equal '1', @context['callcount[2]']
+1 -1
View File
@@ -35,7 +35,7 @@ class TokenizerTest < Minitest::Test
def tokenize(source)
tokenizer = Liquid::Tokenizer.new(source)
tokens = []
while t = tokenizer.shift
while (t = tokenizer.shift)
tokens << t
end
tokens