summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--set.c19
-rw-r--r--test/ruby/test_set.rb5
2 files changed, 12 insertions, 12 deletions
@@ -494,18 +494,13 @@ set_i_initialize(int argc, VALUE *argv, VALUE set)
if (argc > 0 && (other = argv[0]) != Qnil) {
if (RB_TYPE_P(other, T_ARRAY)) {
- long len = RARRAY_LEN(other);
- if (RARRAY_LEN(other) != 0) {
- set_table *into = RSET_TABLE(set);
- VALUE key;
- int block_given = rb_block_given_p();
- RARRAY_PTR_USE(other, ptr, {
- for(; len > 0; len--, ptr++) {
- key = *ptr;
- if (block_given) key = rb_yield(key);
- set_table_insert_wb(into, set, key, NULL);
- }
- });
}
}
else {
@@ -643,6 +643,11 @@ class TC_Set < Test::Unit::TestCase
assert_equal([o], Set.new.merge(a).to_a)
end
def test_subtract
set = Set[1,2,3]