зеркало из https://github.com/github/ruby.git
* properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b62bfa2a66
Коммит
dee91b534a
|
@ -1,24 +1,24 @@
|
||||||
#include <ruby.h>
|
#include <ruby.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
|
int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sample_bug_reporter(FILE *out, void *ptr)
|
sample_bug_reporter(FILE *out, void *ptr)
|
||||||
{
|
{
|
||||||
int n = (int)ptr;
|
int n = (int)ptr;
|
||||||
fprintf(out, "Sample bug reporter: %d\n", n);
|
fprintf(out, "Sample bug reporter: %d\n", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
register_sample_bug_reporter(VALUE self, VALUE obj)
|
register_sample_bug_reporter(VALUE self, VALUE obj)
|
||||||
{
|
{
|
||||||
rb_bug_reporter_add(sample_bug_reporter, NUM2INT(obj));
|
rb_bug_reporter_add(sample_bug_reporter, NUM2INT(obj));
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Init_bug_reporter(void)
|
Init_bug_reporter(void)
|
||||||
{
|
{
|
||||||
rb_define_global_function("register_sample_bug_reporter", register_sample_bug_reporter, 1);
|
rb_define_global_function("register_sample_bug_reporter", register_sample_bug_reporter, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
create_makefile("-test-/bug_reporter/bug_reporter")
|
create_makefile("-test-/bug_reporter/bug_reporter")
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require_relative "../../ruby/envutil"
|
require_relative "../../ruby/envutil"
|
||||||
|
|
||||||
class TestBugReporter < Test::Unit::TestCase
|
class TestBugReporter < Test::Unit::TestCase
|
||||||
def test_bug_reporter_add
|
def test_bug_reporter_add
|
||||||
expected_stderr = /Sample bug reporter: 12345/
|
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)
|
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
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче