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

ruby-changes:21242

From: nobu <ko1@a...>
Date: Sat, 17 Sep 2011 23:34:24 +0900 (JST)
Subject: [ruby-changes:21242] nobu:r33291 (trunk): * parse.y (parser_data_type): inherit the core type in ripper so

nobu	2011-09-17 23:34:13 +0900 (Sat, 17 Sep 2011)

  New Revision: 33291

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

  Log:
    * parse.y (parser_data_type): inherit the core type in ripper so
      that checks in core would work.  [ruby-core:39591] [Bug #5331]

  Added files:
    trunk/test/ripper/test_ripper.rb
  Modified files:
    trunk/ChangeLog
    trunk/parse.y

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33290)
+++ ChangeLog	(revision 33291)
@@ -1,3 +1,8 @@
+Sat Sep 17 23:34:10 2011  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (parser_data_type): inherit the core type in ripper so
+	  that checks in core would work.  [ruby-core:39591] [Bug #5331]
+
 Sat Sep 17 12:44:04 2011  Kazuki Tsujimoto  <kazuki@c...>
 
 	* lib/find.rb (Find.find): add documentation that Find.find
Index: parse.y
===================================================================
--- parse.y	(revision 33290)
+++ parse.y	(revision 33291)
@@ -5290,9 +5290,11 @@
     return line;
 }
 
+#ifdef RIPPER
+static rb_data_type_t parser_data_type;
+#else
 static const rb_data_type_t parser_data_type;
 
-#ifndef RIPPER
 static NODE*
 parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line)
 {
@@ -10345,7 +10347,11 @@
     return size;
 }
 
-static const rb_data_type_t parser_data_type = {
+static
+#ifndef RIPPER
+const
+#endif
+rb_data_type_t parser_data_type = {
     "parser",
     {
 	parser_mark,
@@ -10961,11 +10967,19 @@
 }
 #endif
 
+
 void
+InitVM_ripper(void)
+{
+    parser_data_type.parent = RTYPEDDATA_TYPE(rb_parser_new());
+}
+
+void
 Init_ripper(void)
 {
     VALUE Ripper;
 
+    InitVM(ripper);
     Ripper = rb_define_class("Ripper", rb_cObject);
     rb_define_const(Ripper, "Version", rb_usascii_str_new2(RIPPER_VERSION));
     rb_define_alloc_func(Ripper, ripper_s_allocate);
Index: test/ripper/test_ripper.rb
===================================================================
--- test/ripper/test_ripper.rb	(revision 0)
+++ test/ripper/test_ripper.rb	(revision 33291)
@@ -0,0 +1,49 @@
+begin
+  require 'ripper'
+  require 'test/unit'
+  ripper_test = true
+  module TestRipper; end
+rescue LoadError
+end
+
+class TestRipper::Ripper < Test::Unit::TestCase
+
+  def setup
+    @ripper = Ripper.new '1 + 1'
+  end
+
+  def test_column
+    assert_nil @ripper.column
+  end
+
+  def test_encoding
+    assert_equal Encoding::US_ASCII, @ripper.encoding
+  end
+
+  def test_end_seen_eh
+    refute @ripper.end_seen?
+  end
+
+  def test_filename
+    assert_equal '(ripper)', @ripper.filename
+  end
+
+  def test_lineno
+    assert_nil @ripper.lineno
+  end
+
+  def test_parse
+    refute @ripper.parse
+  end
+
+  def test_yydebug
+    refute @ripper.yydebug
+  end
+
+  def test_yydebug_equals
+    @ripper.yydebug = true
+
+    assert @ripper.yydebug
+  end
+
+end if ripper_test

Property changes on: test/ripper/test_ripper.rb
___________________________________________________________________
Added: svn:eol-style
   + LF


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

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