diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2015-01-17 14:37:11 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2015-01-17 14:37:11 +0900 |
commit | 372449c75b9cb3e418a20d8e3913a9b9b47d915a (patch) | |
tree | f579c432844ca337d6defe0836cf0af6c6180dca /test | |
parent | 48e65f5743a0e335653007afc59e3aea623ec32a (diff) | |
download | psych-372449c75b9cb3e418a20d8e3913a9b9b47d915a.zip |
Fix anchor
Anchors like `\Z` are not valid inside character class.
Use negative-lookahead instead.
Diffstat (limited to 'test')
-rw-r--r-- | test/psych/test_string.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb index 4718a47..a8ae55c 100644 --- a/test/psych/test_string.rb +++ b/test/psych/test_string.rb @@ -66,18 +66,26 @@ module Psych end def test_literal_when_inner_and_final_line_break - str = "Lorem ipsum\ndolor\n" - yaml = Psych.dump str, line_width: 12 - assert_match /---\s*\|\n(.*\n){2}\Z/, yaml - assert_equal str, Psych.load(yaml) + [ + "Lorem ipsum\ndolor\n", + "Lorem ipsum\nZolor\n", + ].each do |str| + yaml = Psych.dump str, line_width: 12 + assert_match /---\s*\|\n(.*\n){2}\Z/, yaml + assert_equal str, Psych.load(yaml) + end end # http://yaml.org/spec/1.2/2009-07-21/spec.html#id2593651 def test_literal_strip_when_inner_line_break_and_no_final_line_break - str = "Lorem ipsum\ndolor" - yaml = Psych.dump str, line_width: 12 - assert_match /---\s*\|-\n(.*\n){2}\Z/, yaml - assert_equal str, Psych.load(yaml) + [ + "Lorem ipsum\ndolor", + "Lorem ipsum\nZolor", + ].each do |str| + yaml = Psych.dump str, line_width: 12 + assert_match /---\s*\|-\n(.*\n){2}\Z/, yaml + assert_equal str, Psych.load(yaml) + end end def test_cycle_x |