Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/twine.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Ludwig <sebastian@lurado.de>2016-11-22 00:05:25 +0300
committerSebastian Ludwig <sebastian@lurado.de>2016-11-22 00:05:25 +0300
commit43b83cc8e60a9ba07bae606b556851080e5b3681 (patch)
tree836ab3c0aae07aee3d2266168892917fa7b8dd2a /test
parentc19b88d429f9f7ebcb3dd12f9b4d9c145869c0ab (diff)
Fixed #165 by disallowing single spaces as valid printf flags.
Diffstat (limited to 'test')
-rw-r--r--test/test_placeholders.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/test_placeholders.rb b/test/test_placeholders.rb
index f88e9d1..55d0f02 100644
--- a/test/test_placeholders.rb
+++ b/test/test_placeholders.rb
@@ -11,7 +11,7 @@ class PlaceholderTest < TwineTest
lucky = lambda { rand > 0.5 }
placeholder = '%'
placeholder += (rand * 20).to_i.to_s + '$' if lucky.call
- placeholder += '-+ 0#'.chars.to_a.sample if lucky.call
+ placeholder += '-+0#'.chars.to_a.sample if lucky.call
placeholder += (0.upto(20).map(&:to_s) << "*").sample if lucky.call
placeholder += '.' + (0.upto(20).map(&:to_s) << "*").sample if lucky.call
placeholder += %w(h hh l ll L z j t).sample if lucky.call
@@ -39,6 +39,11 @@ class PlaceholderTest < TwineTest
assert_equal "some % value", to_android("some % value")
end
+ def test_does_not_modify_single_percent_signs_when_followed_by_space_and_format_letter
+ # Said differently: formartter parser should not recognize %a in "70% and"
+ assert_equal 'If 70% and 30% dog 80% end', to_android('If 70% and 30% dog 80% end')
+ end
+
def test_escapes_single_percent_signs_if_placeholder_present
assert_starts_with "some %% v", to_android("some % value #{placeholder}")
end