From 79133371e8abb1a7cbdd24b3c62ce04d7227c4b0 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 15 May 2004 04:38:39 +0000 Subject: * ext/syck/MANIFEST, ext/syck/depend: new file. * lib/yaml/rubytypes.rb: range of exponential floats. [ruby-core:02824] * test/yaml/test_yaml.rb: tests for strings start with colon and some round trip. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/yaml/test_yaml.rb | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'test/yaml') diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb index 9b1a4f4d3b..05332a6e40 100644 --- a/test/yaml/test_yaml.rb +++ b/test/yaml/test_yaml.rb @@ -33,6 +33,10 @@ class YAML_Unit_Tests < Test::Unit::TestCase assert_equal( obj, YAML::parse( yaml ).transform ) end + def assert_cycle( obj ) + assert_equal( obj, YAML::load( obj.to_yaml ) ) + end + def assert_path_segments( path, segments ) YAML::YPath.each_path( path ) { |choice| assert_equal( choice.segments, segments.shift ) @@ -71,10 +75,14 @@ EOY def test_basic_strings # Common string types + assert_cycle("x") + assert_cycle(":x") + assert_cycle(":") assert_parse_only( { 1 => 'simple string', 2 => 42, 3 => '1 Single Quoted String', 4 => 'YAML\'s Double "Quoted" String', 5 => "A block\n with several\n lines.\n", - 6 => "A \"chomped\" block", 7 => "A folded\n string\n" }, < "A \"chomped\" block", 7 => "A folded\n string\n", 8 => ": started string" }, + < - Mark McGwire's + Mark McGwire\'s year was crippled by a knee injury. EOY @@ -909,7 +918,7 @@ literal: | single line break, but does not start with one. -is equal to: "The \\ \' \\" characters may \\ +is equal to: "The \\ ' \\" characters may \\ be\\nfreely used. Leading white\\n space \\ is significant.\\n\\nLine breaks are \\ significant.\\nThus this value contains \\ @@ -1031,7 +1040,7 @@ EOY def test_ruby_regexp # Test Ruby regular expressions assert_to_yaml( - { 'simple' => /a.b/, 'complex' => /\A"((?:[^"]|\")+)"/, + { 'simple' => /a.b/, 'complex' => %r'\A"((?:[^"]|\")+)"', 'case-insensitive' => /George McFly/i }, <