Skip to content

Commit 46f3f2b

Browse files
committed
Rename and fix Primitive.steal_array_storage spec
1 parent 29ce93a commit 46f3f2b

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

spec/truffle/array/steal_array_storage.rb renamed to spec/truffle/array/steal_array_storage_spec.rb

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,25 @@ def storage(ary)
1616
Truffle::Debug.array_storage(ary)
1717
end
1818

19-
before :each do
20-
@array = %i[first second third]
21-
end
22-
2319
guard -> { !Truffle::Boot.get_option('chaos-data') } do
2420
it "should no-op when called on itself" do
25-
copy = @array.dup
21+
array = %i[first second third]
22+
Primitive.steal_array_storage(array, array)
2623

27-
Primitive.steal_array_storage(@array, @array)
28-
29-
storage(@array).should == "Object[]"
30-
@array.should == copy
24+
storage(array).should == "Object[]"
25+
array.should == %i[first second third]
3126
end
3227

3328
it "should take ownership of the store" do
29+
array = %i[first second third]
3430
other = [1, 2, 3, 4, 5]
35-
other_copy = other.dup
36-
37-
Primitive.steal_array_storage(@array, other)
31+
Primitive.steal_array_storage(array, other)
3832

39-
storage(@array).should == "int[]"
40-
@array.should == other_copy
33+
storage(array).should == "int[]"
34+
array.should == [1, 2, 3, 4, 5]
4135

42-
storage(other).should == "null"
43-
other.empty?.should == true
36+
storage(other).should == "empty"
37+
other.should.empty?
4438
end
4539
end
4640
end

0 commit comments

Comments
 (0)