From c6b3c9c875f1fffcea8c0e7535906e6ea25c501f Mon Sep 17 00:00:00 2001 From: Sebastian Celis Date: Wed, 24 Jan 2018 08:56:04 -0600 Subject: [PATCH] Fix an error caused by combining %@ with other placeholders Fixes #234 --- lib/twine/placeholders.rb | 2 +- test/test_placeholders.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/twine/placeholders.rb b/lib/twine/placeholders.rb index bc44d05..63dd793 100644 --- a/lib/twine/placeholders.rb +++ b/lib/twine/placeholders.rb @@ -24,7 +24,7 @@ module Twine # %@ -> %s value = convert_twine_string_placeholder(input) - number_of_placeholders = number_of_twine_placeholders(input) + number_of_placeholders = number_of_twine_placeholders(value) return value if number_of_placeholders == 0 diff --git a/test/test_placeholders.rb b/test/test_placeholders.rb index 3fcd5a6..abc3ab2 100644 --- a/test/test_placeholders.rb +++ b/test/test_placeholders.rb @@ -79,6 +79,10 @@ class PlaceholderTest < TwineTest to_android("some %d second %2$f") end end + + def test_complicated_float_placeholders + assert_equal "%1$.0f%2$s (apparent: %3$.0f)", to_android("%.0f%@ (apparent: %.0f)") + end end class FromAndroid < PlaceholderTest