[前][次][番号順一覧][スレッド一覧]

ruby-changes:15673

From: nobu <ko1@a...>
Date: Mon, 3 May 2010 08:18:25 +0900 (JST)
Subject: [ruby-changes:15673] Ruby:r27591 (ruby_1_8, trunk): * ext/syck/emitter.c (syck_scan_scalar): set SCAN_WHITEEDGE flag

nobu	2010-05-03 08:15:08 +0900 (Mon, 03 May 2010)

  New Revision: 27591

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27591

  Log:
    * ext/syck/emitter.c (syck_scan_scalar): set SCAN_WHITEEDGE flag
      when scalar begins with newline.  patches from Dave B <daz AT
      d10.karoo.co.uk> at [ruby-core:23019] and caleb clausen at
      [ruby-core:25851].  [ruby-core:23006][ruby-core:29925]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/ext/syck/emitter.c
    branches/ruby_1_8/test/yaml/test_yaml.rb
    branches/ruby_1_8/version.h
    trunk/ChangeLog
    trunk/ext/syck/emitter.c
    trunk/test/syck/test_yaml.rb
    trunk/version.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27590)
+++ ChangeLog	(revision 27591)
@@ -1,3 +1,10 @@
+Mon May  3 08:15:05 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/syck/emitter.c (syck_scan_scalar): set SCAN_WHITEEDGE flag
+	  when scalar begins with newline.  patches from Dave B <daz AT
+	  d10.karoo.co.uk> at [ruby-core:23019] and caleb clausen at
+	  [ruby-core:25851].  [ruby-core:23006][ruby-core:29925]
+
 Sun May  2 17:52:16 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/rdoc/task.rb (RDoc::Task): should not override newer code.
Index: ext/syck/emitter.c
===================================================================
--- ext/syck/emitter.c	(revision 27590)
+++ ext/syck/emitter.c	(revision 27591)
@@ -570,7 +570,7 @@
         flags |= SCAN_MANYNL_E;
     }
     if (
-        ( len > 0 && ( cursor[0] == ' ' || cursor[0] == '\t' ) ) ||
+        ( len > 0 && ( cursor[0] == ' ' || cursor[0] == '\t' || cursor[0] == '\n' || cursor[0] == '\r' ) ) ||
         ( len > 1 && ( cursor[len-1] == ' ' || cursor[len-1] == '\t' ) )
     ) {
         flags |= SCAN_WHITEEDGE;
Index: version.h
===================================================================
--- version.h	(revision 27590)
+++ version.h	(revision 27591)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_RELEASE_DATE "2010-05-02"
+#define RUBY_RELEASE_DATE "2010-05-03"
 #define RUBY_PATCHLEVEL -1
 #define RUBY_BRANCH_NAME "trunk"
 
@@ -8,7 +8,7 @@
 #define RUBY_VERSION_TEENY 1
 #define RUBY_RELEASE_YEAR 2010
 #define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 2
+#define RUBY_RELEASE_DAY 3
 
 #include "ruby/version.h"
 
Index: test/syck/test_yaml.rb
===================================================================
--- test/syck/test_yaml.rb	(revision 27590)
+++ test/syck/test_yaml.rb	(revision 27591)
@@ -1,4 +1,4 @@
-# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*-
+# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4; indent-tabs-mode: t -*-
 #												vim:sw=4:ts=4
 # $Id$
 #
@@ -26,31 +26,31 @@
 	# Convert between YAML and the object to verify correct parsing and
 	# emitting
 	#
-	def assert_to_yaml( obj, yaml )
-		assert_equal( obj, YAML::load( yaml ) )
-		assert_equal( obj, YAML::parse( yaml ).transform )
-        assert_equal( obj, YAML::load( obj.to_yaml ) )
-		assert_equal( obj, YAML::parse( obj.to_yaml ).transform )
+	def assert_to_yaml( obj, yaml, msg = nil )
+		assert_equal( obj, YAML::load( yaml ), msg )
+		assert_equal( obj, YAML::parse( yaml ).transform, msg )
+        assert_equal( obj, YAML::load( obj.to_yaml ), msg )
+		assert_equal( obj, YAML::parse( obj.to_yaml ).transform, msg )
         assert_equal( obj, YAML::load(
 			obj.to_yaml( :UseVersion => true, :UseHeader => true, :SortKeys => true )
-		) )
+		), msg )
 	end
 
 	#
 	# Test parser only
 	#
-	def assert_parse_only( obj, yaml )
-		assert_equal( obj, YAML::load( yaml ) )
-		assert_equal( obj, YAML::parse( yaml ).transform )
+	def assert_parse_only( obj, yaml, msg = nil )
+		assert_equal( obj, YAML::load( yaml ), msg )
+		assert_equal( obj, YAML::parse( yaml ).transform, msg )
 	end
 
-    def assert_cycle( obj )
-        assert_equal( obj, YAML::load( obj.to_yaml ) )
+    def assert_cycle( obj, msg = nil )
+        assert_equal( obj, YAML::load( obj.to_yaml ), msg )
     end
 
-    def assert_path_segments( path, segments )
+    def assert_path_segments( path, segments, msg = nil )
         YAML::YPath.each_path( path ) { |choice|
-            assert_equal( choice.segments, segments.shift )
+            assert_equal( choice.segments, segments.shift, msg )
         }
         assert_equal( segments.length, 0, "Some segments leftover: #{ segments.inspect }" )
     end
@@ -438,6 +438,85 @@
 		)
 	end
 
+	#
+	# Reports from N.Easterly & J.Trupiano : Tests with patch from daz
+	# [ruby-core:23006] [Bug #1311] http://redmine.ruby-lang.org/issues/show/1311
+	#
+	def test_scan_scalar_nl
+		bug1311 = '[ruby-core:23006]'
+		assert_cycle(<<EoY, bug1311)
+
+ a
+b
+EoY
+		assert_cycle(<<EoY, bug1311)
+
+ a
+  b
+c
+EoY
+		assert_cycle(<<EoY, bug1311)
+
+  a
+ b
+EoY
+		assert_cycle("  Do I work?\nNo indent", bug1311)
+		assert_cycle("  \n  Do I work?\nNo indent", bug1311)
+		assert_cycle("\n  Do I work?\nNo indent", bug1311)
+		assert_cycle("\n", bug1311)
+		assert_cycle("\n\n", bug1311)
+		assert_cycle("\r\n", bug1311)
+
+		assert_cycle <<EoY, '[ruby-core:28777]'
+    Domain name:
+        ckgteam.co.uk
+
+    Registrant:
+        James Gregory
+
+    Registrant type:
+        UK Individual
+
+    Registrant's address:
+        The registrant is a non-trading individual who has opted to have their
+        address omitted from the WHOIS service.
+
+    Registrar:
+        Webfusion Ltd t/a 123-Reg.co.uk [Tag = 123-REG]
+        URL: http://www.123-reg.co.uk
+
+    Relevant dates:
+        Registered on: 16-Nov-2009
+        Renewal date:  16-Nov-2011
+        Last updated:  25-Nov-2009
+
+    Registration status:
+        Registered until renewal date.
+
+    Name servers:
+        ns1.slicehost.net
+        ns2.slicehost.net
+        ns3.slicehost.net
+
+    WHOIS lookup made at 11:56:46 19-Mar-2010
+
+-- 
+This WHOIS information is provided for free by Nominet UK the central registry
+for .uk domain names. This information and the .uk WHOIS are:
+
+    Copyright Nominet UK 1996 - 2010.
+
+You may not access the .uk WHOIS or use any data from it except as permitted
+by the terms of use available in full at http://www.nominet.org.uk/whois, which
+includes restrictions on: (A) use of the data for advertising, or its
+repackaging, recompilation, redistribution or reuse (B) obscuring, removing
+or hiding any or all of this notice and (C) exceeding query rate or volume
+limits. The data is provided on an 'as-is' basis and may lag behind the
+register. Access may be withdrawn or restricted at any time. 
+EoY
+
+	end
+
 	def test_spec_multiline_scalars
 		# Multiline flow scalars
 	 	assert_parse_only(
@@ -1327,12 +1406,3 @@
     end
 end
 end
-
-if $0 == __FILE__
-  suite = Test::Unit::TestSuite.new('YAML')
-  ObjectSpace.each_object(Class) do |klass|
-    suite << klass.suite if (Test::Unit::TestCase > klass)
-  end
-  require 'test/unit/ui/console/testrunner'
-  Test::Unit::UI::Console::TestRunner.run(suite).passed?
-end
Index: ruby_1_8/ext/syck/emitter.c
===================================================================
--- ruby_1_8/ext/syck/emitter.c	(revision 27590)
+++ ruby_1_8/ext/syck/emitter.c	(revision 27591)
@@ -570,8 +570,8 @@
     } else if ( len > 1 && cursor[len-2] == '\n' ) {
         flags |= SCAN_MANYNL_E;
     }
-    if ( 
-        ( len > 0 && ( cursor[0] == ' ' || cursor[0] == '\t' ) ) ||
+    if (
+        ( len > 0 && ( cursor[0] == ' ' || cursor[0] == '\t' || cursor[0] == '\n' || cursor[0] == '\r' ) ) ||
         ( len > 1 && ( cursor[len-1] == ' ' || cursor[len-1] == '\t' ) )
     ) {
         flags |= SCAN_WHITEEDGE;
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 27590)
+++ ruby_1_8/ChangeLog	(revision 27591)
@@ -1,3 +1,10 @@
+Mon May  3 08:15:05 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/syck/emitter.c (syck_scan_scalar): set SCAN_WHITEEDGE flag
+	  when scalar begins with newline.  patches from Dave B <daz AT
+	  d10.karoo.co.uk> at [ruby-core:23019] and caleb clausen at
+	  [ruby-core:25851].  [ruby-core:23006][ruby-core:29925]
+
 Sun May  2 13:39:31 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/cgi.rb (CGI::NEEDS_BINMODE): check if O_BINARY is defined.
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h	(revision 27590)
+++ ruby_1_8/version.h	(revision 27591)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.8.8"
-#define RUBY_RELEASE_DATE "2010-05-02"
+#define RUBY_RELEASE_DATE "2010-05-03"
 #define RUBY_VERSION_CODE 188
-#define RUBY_RELEASE_CODE 20100502
+#define RUBY_RELEASE_CODE 20100503
 #define RUBY_PATCHLEVEL -1
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 8
 #define RUBY_RELEASE_YEAR 2010
 #define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 2
+#define RUBY_RELEASE_DAY 3
 
 #define NO_STRING_LITERAL_CONCATENATION 1
 #ifdef RUBY_EXTERN
Index: ruby_1_8/test/yaml/test_yaml.rb
===================================================================
--- ruby_1_8/test/yaml/test_yaml.rb	(revision 27590)
+++ ruby_1_8/test/yaml/test_yaml.rb	(revision 27591)
@@ -1,4 +1,4 @@
-# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*-
+# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4; indent-tabs-mode: t -*-
 #												vim:sw=4:ts=4
 # $Id$
 #
@@ -15,31 +15,31 @@
 	# Convert between YAML and the object to verify correct parsing and
 	# emitting
 	#
-	def assert_to_yaml( obj, yaml )
-		assert_equal( obj, YAML::load( yaml ) )
-		assert_equal( obj, YAML::parse( yaml ).transform )
-        assert_equal( obj, YAML::load( obj.to_yaml ) )
-		assert_equal( obj, YAML::parse( obj.to_yaml ).transform )
+	def assert_to_yaml( obj, yaml, msg = nil )
+		assert_equal( obj, YAML::load( yaml ), msg )
+		assert_equal( obj, YAML::parse( yaml ).transform, msg )
+        assert_equal( obj, YAML::load( obj.to_yaml ), msg )
+		assert_equal( obj, YAML::parse( obj.to_yaml ).transform, msg )
         assert_equal( obj, YAML::load(
 			obj.to_yaml( :UseVersion => true, :UseHeader => true, :SortKeys => true )
-		) )
+		), msg )
 	end
 
 	#
 	# Test parser only
 	#
-	def assert_parse_only( obj, yaml )
-		assert_equal( obj, YAML::load( yaml ) )
-		assert_equal( obj, YAML::parse( yaml ).transform )
+	def assert_parse_only( obj, yaml, msg = nil )
+		assert_equal( obj, YAML::load( yaml ), msg )
+		assert_equal( obj, YAML::parse( yaml ).transform, msg )
 	end
 
-    def assert_cycle( obj )
-        assert_equal( obj, YAML::load( obj.to_yaml ) )
+    def assert_cycle( obj, msg = nil )
+        assert_equal( obj, YAML::load( obj.to_yaml ), msg )
     end
 
-    def assert_path_segments( path, segments )
+    def assert_path_segments( path, segments, msg = nil )
         YAML::YPath.each_path( path ) { |choice|
-            assert_equal( choice.segments, segments.shift )
+            assert_equal( choice.segments, segments.shift, msg )
         }
         assert_equal( segments.length, 0, "Some segments leftover: #{ segments.inspect }" )
     end
@@ -427,6 +427,85 @@
 		)
 	end
 
+	#
+	# Reports from N.Easterly & J.Trupiano : Tests with patch from daz
+	# [ruby-core:23006] [Bug #1311] http://redmine.ruby-lang.org/issues/show/1311
+	#
+	def test_scan_scalar_nl
+		bug1311 = '[ruby-core:23006]'
+		assert_cycle(<<EoY, bug1311)
+
+ a
+b
+EoY
+		assert_cycle(<<EoY, bug1311)
+
+ a
+  b
+c
+EoY
+		assert_cycle(<<EoY, bug1311)
+
+  a
+ b
+EoY
+		assert_cycle("  Do I work?\nNo indent", bug1311)
+		assert_cycle("  \n  Do I work?\nNo indent", bug1311)
+		assert_cycle("\n  Do I work?\nNo indent", bug1311)
+		assert_cycle("\n", bug1311)
+		assert_cycle("\n\n", bug1311)
+		assert_cycle("\r\n", bug1311)
+
+		assert_cycle <<EoY, '[ruby-core:28777]'
+    Domain name:
+        ckgteam.co.uk
+
+    Registrant:
+        James Gregory
+
+    Registrant type:
+        UK Individual
+
+    Registrant's address:
+        The registrant is a non-trading individual who has opted to have their
+        address omitted from the WHOIS service.
+
+    Registrar:
+        Webfusion Ltd t/a 123-Reg.co.uk [Tag = 123-REG]
+        URL: http://www.123-reg.co.uk
+
+    Relevant dates:
+        Registered on: 16-Nov-2009
+        Renewal date:  16-Nov-2011
+        Last updated:  25-Nov-2009
+
+    Registration status:
+        Registered until renewal date.
+
+    Name servers:
+        ns1.slicehost.net
+        ns2.slicehost.net
+        ns3.slicehost.net
+
+    WHOIS lookup made at 11:56:46 19-Mar-2010
+
+-- 
+This WHOIS information is provided for free by Nominet UK the central registry
+for .uk domain names. This information and the .uk WHOIS are:
+
+    Copyright Nominet UK 1996 - 2010.
+
+You may not access the .uk WHOIS or use any data from it except as permitted
+by the terms of use available in full at http://www.nominet.org.uk/whois, which
+includes restrictions on: (A) use of the data for advertising, or its
+repackaging, recompilation, redistribution or reuse (B) obscuring, removing
+or hiding any or all of this notice and (C) exceeding query rate or volume
+limits. The data is provided on an 'as-is' basis and may lag behind the
+register. Access may be withdrawn or restricted at any time. 
+EoY
+
+	end
+
 	def test_spec_multiline_scalars
 		# Multiline flow scalars
 	 	assert_parse_only(
@@ -1281,12 +1360,3 @@
       raise "id collision in ordered map" if omap.to_yaml =~ /id\d+/
     end
 end
-
-if $0 == __FILE__
-  suite = Test::Unit::TestSuite.new('YAML')
-  ObjectSpace.each_object(Class) do |klass|
-    suite << klass.suite if (Test::Unit::TestCase > klass)
-  end
-  require 'test/unit/ui/console/testrunner'
-  Test::Unit::UI::Console::TestRunner.run(suite).passed?
-end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]