File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
spec/truffle/tags/core/array
truffle/src/main/ruby/core/rubinius/common Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
- fails:Array#sort_by! sorts array in place by passing each element to the given block
2
- fails:Array#sort_by! returns an Enumerator if not given a block
3
- fails:Array#sort_by! completes when supplied a block that always returns the same result
4
- fails:Array#sort_by! raises a RuntimeError on a frozen array
5
- fails:Array#sort_by! raises a RuntimeError on an empty frozen array
6
1
fails:Array#sort_by! returns the specified value when it would break in the given block
7
2
fails:Array#sort_by! makes some modification even if finished sorting when it would break in the given block
Original file line number Diff line number Diff line change @@ -1080,6 +1080,14 @@ def transpose
1080
1080
out
1081
1081
end
1082
1082
1083
+ def sort_by! ( &block )
1084
+ Rubinius . check_frozen
1085
+
1086
+ return to_enum :sort_by! unless block_given?
1087
+
1088
+ replace sort_by ( &block )
1089
+ end
1090
+
1083
1091
# Insertion sort in-place between the given indexes.
1084
1092
def isort! ( left , right )
1085
1093
i = left + 1
You can’t perform that action at this time.
0 commit comments