diff --git a/ext/-test-/bug_reporter/bug_reporter.c b/ext/-test-/bug_reporter/bug_reporter.c index 875c3a4617..1924af4f9b 100644 --- a/ext/-test-/bug_reporter/bug_reporter.c +++ b/ext/-test-/bug_reporter/bug_reporter.c @@ -1,24 +1,24 @@ -#include -#include - -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 +#include + +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); +} diff --git a/ext/-test-/bug_reporter/extconf.rb b/ext/-test-/bug_reporter/extconf.rb index 76c1e6ff78..0fccd81a41 100644 --- a/ext/-test-/bug_reporter/extconf.rb +++ b/ext/-test-/bug_reporter/extconf.rb @@ -1 +1 @@ -create_makefile("-test-/bug_reporter/bug_reporter") +create_makefile("-test-/bug_reporter/bug_reporter") diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb index 319f3ffe9a..01f8fdc933 100644 --- a/test/-ext-/bug_reporter/test_bug_reporter.rb +++ b/test/-ext-/bug_reporter/test_bug_reporter.rb @@ -1,9 +1,9 @@ -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