diff options
-rw-r--r-- | imemo.c | 18 | ||||
-rwxr-xr-x | tool/auto-style.rb | 9 | ||||
-rw-r--r-- | tool/test/testunit/test_parallel.rb | 26 | ||||
-rw-r--r-- | tool/test/testunit/tests_for_parallel/ptest_forth.rb | 8 | ||||
-rw-r--r-- | variable.c | 13 |
5 files changed, 44 insertions, 30 deletions
@@ -155,6 +155,13 @@ imemo_fields_trigger_wb_i(st_data_t key, st_data_t value, st_data_t arg) return ST_CONTINUE; } +static int +imemo_fields_complex_wb_i(st_data_t key, st_data_t value, st_data_t arg) +{ + RB_OBJ_WRITTEN((VALUE)arg, Qundef, (VALUE)value); + return ST_CONTINUE; +} + VALUE rb_imemo_fields_new_complex_tbl(VALUE klass, st_table *tbl) { @@ -174,12 +181,19 @@ rb_imemo_fields_clone(VALUE fields_obj) clone = rb_imemo_fields_new_complex(CLASS_OF(fields_obj), 0); RBASIC_SET_SHAPE_ID(clone, shape_id); st_table *src_table = rb_imemo_fields_complex_tbl(fields_obj); - st_replace(rb_imemo_fields_complex_tbl(clone), src_table); + st_table *dest_table = rb_imemo_fields_complex_tbl(clone); + st_replace(dest_table, src_table); + st_foreach(dest_table, imemo_fields_complex_wb_i, (st_data_t)clone); } else { clone = imemo_fields_new(CLASS_OF(fields_obj), RSHAPE_CAPACITY(shape_id)); RBASIC_SET_SHAPE_ID(clone, shape_id); - MEMCPY(rb_imemo_fields_ptr(clone), rb_imemo_fields_ptr(fields_obj), VALUE, RSHAPE_LEN(shape_id)); + VALUE *fields = rb_imemo_fields_ptr(clone); + attr_index_t fields_count = RSHAPE_LEN(shape_id); + MEMCPY(fields, rb_imemo_fields_ptr(fields_obj), VALUE, fields_count); + for (attr_index_t i = 0; i < fields_count; i++) { + RB_OBJ_WRITTEN(clone, Qundef, fields[i]); + } } return clone; diff --git a/tool/auto-style.rb b/tool/auto-style.rb index 7e66f376ec..0c6ce6848a 100755 --- a/tool/auto-style.rb +++ b/tool/auto-style.rb @@ -233,11 +233,10 @@ edited_files = files.select do |f| if File.fnmatch?("*.[ch]", f, File::FNM_PATHNAME) && !DIFFERENT_STYLE_FILES.any? {|pat| File.fnmatch?(pat, f, File::FNM_PATHNAME)} - orig = src.dup - src.gsub!(/^\w+\([^(\n)]*?\)\K[ \t]*(?=\{$)/, "\n") - src.gsub!(/^([ \t]*)\}\K[ \t]*(?=else\b)/, "\n" '\1') - src.gsub!(/^[ \t]*\}\n\K\n+(?=[ \t]*else\b)/, '') - indent = indent0 = src != orig + indent0 = true if src.gsub!(/^\w+\([^(\n)]*?\)\K[ \t]*(?=\{$)/, "\n") + indent0 = true if src.gsub!(/^([ \t]*)\}\K[ \t]*(?=else\b)/, "\n" '\1') + indent0 = true if src.gsub!(/^[ \t]*\}\n\K\n+(?=[ \t]*else\b)/, '') + indent ||= indent0 end if trailing0 or eofnewline0 or expandtab0 or indent0 diff --git a/tool/test/testunit/test_parallel.rb b/tool/test/testunit/test_parallel.rb index a0cbca69eb..d87e0ed327 100644 --- a/tool/test/testunit/test_parallel.rb +++ b/tool/test/testunit/test_parallel.rb @@ -126,19 +126,19 @@ module TestParallel assert_not_nil($1, "'done' was not found") result = Marshal.load($1.chomp.unpack1("m")) - assert_equal(5, result[0]) - pend "TODO: result[1] returns 17. We should investigate it" do # TODO: misusage of pend (pend doens't use given block) - assert_equal(12, result[1]) - end - assert_kind_of(Array,result[2]) - assert_kind_of(Array,result[3]) - assert_kind_of(Array,result[4]) - assert_kind_of(Array,result[2][1]) - assert_kind_of(Test::Unit::AssertionFailedError,result[2][0][2]) - assert_kind_of(Test::Unit::PendedError,result[2][1][2]) - assert_kind_of(Test::Unit::PendedError,result[2][2][2]) - assert_kind_of(Exception, result[2][3][2]) - assert_equal(result[5], "TestE") + tests, asserts, reports, failures, loadpaths, suite = result + assert_equal(5, tests) + assert_equal(12, asserts) + assert_kind_of(Array, reports) + assert_kind_of(Array, failures) + assert_kind_of(Array, loadpaths) + reports.sort_by! {|_, t| t} + assert_kind_of(Array, reports[1]) + assert_kind_of(Test::Unit::AssertionFailedError, reports[0][2]) + assert_kind_of(Test::Unit::PendedError, reports[1][2]) + assert_kind_of(Test::Unit::PendedError, reports[2][2]) + assert_kind_of(Exception, reports[3][2]) + assert_equal("TestE", suite) end end diff --git a/tool/test/testunit/tests_for_parallel/ptest_forth.rb b/tool/test/testunit/tests_for_parallel/ptest_forth.rb index 8831676e19..54474c828d 100644 --- a/tool/test/testunit/tests_for_parallel/ptest_forth.rb +++ b/tool/test/testunit/tests_for_parallel/ptest_forth.rb @@ -8,19 +8,19 @@ class TestE < Test::Unit::TestCase assert_equal(1,1) end - def test_always_skip - skip "always" + def test_always_omit + omit "always" end def test_always_fail assert_equal(0,1) end - def test_skip_after_unknown_error + def test_pend_after_unknown_error begin raise UnknownError, "unknown error" rescue - skip "after raise" + pend "after raise" end end diff --git a/variable.c b/variable.c index b71c3981f3..e535aefe27 100644 --- a/variable.c +++ b/variable.c @@ -4774,13 +4774,14 @@ rb_class_ivar_set(VALUE obj, ID id, VALUE val) if (new_fields_obj != original_fields_obj) { RCLASS_WRITABLE_SET_FIELDS_OBJ(obj, new_fields_obj); - - // TODO: What should we set as the T_CLASS shape_id? - // In most case we can replicate the single `fields_obj` shape - // but in namespaced case? - // Perhaps INVALID_SHAPE_ID? - RBASIC_SET_SHAPE_ID(obj, RBASIC_SHAPE_ID(new_fields_obj)); } + + // TODO: What should we set as the T_CLASS shape_id? + // In most case we can replicate the single `fields_obj` shape + // but in namespaced case? + // Perhaps INVALID_SHAPE_ID? + RBASIC_SET_SHAPE_ID(obj, RBASIC_SHAPE_ID(new_fields_obj)); + return existing; } |