ruby-changes:31242
From: nobu <ko1@a...>
Date: Thu, 17 Oct 2013 10:10:40 +0900 (JST)
Subject: [ruby-changes:31242] nobu:r43321 (trunk): * properties.
nobu 2013-10-17 10:10:35 +0900 (Thu, 17 Oct 2013) New Revision: 43321 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43321 Log: * properties. Modified files: trunk/ext/-test-/bug_reporter/bug_reporter.c trunk/ext/-test-/bug_reporter/extconf.rb trunk/test/-ext-/bug_reporter/test_bug_reporter.rb Index: ext/-test-/bug_reporter/bug_reporter.c =================================================================== --- ext/-test-/bug_reporter/bug_reporter.c (revision 43320) +++ ext/-test-/bug_reporter/bug_reporter.c (revision 43321) @@ -1,24 +1,24 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/bug_reporter/bug_reporter.c#L1 -#include <ruby.h> -#include <stdio.h> - -int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data); - -static void -sample_bug_reporter(FILE *out, void *ptr) -{ - int n = (int)ptr; - fprintf(out, "Sample bug reporter: %d\n", n); -} - -static VALUE -register_sample_bug_reporter(VALUE self, VALUE obj) -{ - rb_bug_reporter_add(sample_bug_reporter, NUM2INT(obj)); - return Qnil; -} - -void -Init_bug_reporter(void) -{ - rb_define_global_function("register_sample_bug_reporter", register_sample_bug_reporter, 1); -} +#include <ruby.h> +#include <stdio.h> + +int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data); + +static void +sample_bug_reporter(FILE *out, void *ptr) +{ + int n = (int)ptr; + fprintf(out, "Sample bug reporter: %d\n", n); +} + +static VALUE +register_sample_bug_reporter(VALUE self, VALUE obj) +{ + rb_bug_reporter_add(sample_bug_reporter, NUM2INT(obj)); + return Qnil; +} + +void +Init_bug_reporter(void) +{ + rb_define_global_function("register_sample_bug_reporter", register_sample_bug_reporter, 1); +} Property changes on: ext/-test-/bug_reporter/bug_reporter.c ___________________________________________________________________ Added: svn:eol-style + LF Index: ext/-test-/bug_reporter/extconf.rb =================================================================== --- ext/-test-/bug_reporter/extconf.rb (revision 43320) +++ ext/-test-/bug_reporter/extconf.rb (revision 43321) @@ -1 +1 @@ -create_makefile("-test-/bug_reporter/bug_reporter") +create_makefile("-test-/bug_reporter/bug_reporter") Property changes on: ext/-test-/bug_reporter/extconf.rb ___________________________________________________________________ Added: svn:eol-style + LF Index: test/-ext-/bug_reporter/test_bug_reporter.rb =================================================================== --- test/-ext-/bug_reporter/test_bug_reporter.rb (revision 43320) +++ test/-ext-/bug_reporter/test_bug_reporter.rb (revision 43321) @@ -1,9 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/test/-ext-/bug_reporter/test_bug_reporter.rb#L1 -require 'test/unit' -require_relative "../../ruby/envutil" - -class TestBugReporter < Test::Unit::TestCase - def test_bug_reporter_add - expected_stderr = /Sample bug reporter: 12345/ - assert_in_out_err(["--disable-gems", "-r-test-/bug_reporter/bug_reporter", "-e", "register_sample_bug_reporter(12345); Process.kill :SEGV, $$"], "", [], expected_stderr, nil) - end -end +require 'test/unit' +require_relative "../../ruby/envutil" + +class TestBugReporter < Test::Unit::TestCase + def test_bug_reporter_add + expected_stderr = /Sample bug reporter: 12345/ + assert_in_out_err(["--disable-gems", "-r-test-/bug_reporter/bug_reporter", "-e", "register_sample_bug_reporter(12345); Process.kill :SEGV, $$"], "", [], expected_stderr, nil) + end +end Property changes on: test/-ext-/bug_reporter/test_bug_reporter.rb ___________________________________________________________________ Added: svn:eol-style + LF -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/