backports 3.0.3 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/.gitmodules +3 -0
- data/.travis.yml +11 -2
- data/CHANGELOG.rdoc +6 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +24 -0
- data/README.rdoc +39 -11
- data/Rakefile +98 -1
- data/default.mspec +9 -0
- data/lib/backports.rb +4 -4
- data/lib/backports/1.8.7.rb +2 -3
- data/lib/backports/1.8.7/argf.rb +2 -43
- data/lib/backports/1.8.7/argf/bytes.rb +1 -0
- data/lib/backports/1.8.7/argf/chars.rb +1 -0
- data/lib/backports/1.8.7/argf/each.rb +3 -0
- data/lib/backports/1.8.7/argf/each_byte.rb +9 -0
- data/lib/backports/1.8.7/argf/each_char.rb +35 -0
- data/lib/backports/1.8.7/argf/each_line.rb +3 -0
- data/lib/backports/1.8.7/argf/getbyte.rb +5 -0
- data/lib/backports/1.8.7/argf/lines.rb +5 -0
- data/lib/backports/1.8.7/argf/readbyte.rb +5 -0
- data/lib/backports/1.8.7/array.rb +2 -207
- data/lib/backports/1.8.7/array/collect.rb +3 -0
- data/lib/backports/1.8.7/array/combination.rb +24 -0
- data/lib/backports/1.8.7/array/cycle.rb +16 -0
- data/lib/backports/1.8.7/array/delete_if.rb +3 -0
- data/lib/backports/1.8.7/array/each.rb +3 -0
- data/lib/backports/1.8.7/array/each_index.rb +3 -0
- data/lib/backports/1.8.7/array/find_index.rb +1 -0
- data/lib/backports/1.8.7/array/flatten.rb +47 -0
- data/lib/backports/1.8.7/array/index.rb +15 -0
- data/lib/backports/1.8.7/array/map.rb +3 -0
- data/lib/backports/1.8.7/array/permutation.rb +30 -0
- data/lib/backports/1.8.7/array/pop.rb +15 -0
- data/lib/backports/1.8.7/array/product.rb +32 -0
- data/lib/backports/1.8.7/array/reject.rb +3 -0
- data/lib/backports/1.8.7/array/reverse_each.rb +3 -0
- data/lib/backports/1.8.7/array/rindex.rb +15 -0
- data/lib/backports/1.8.7/array/select.rb +3 -0
- data/lib/backports/1.8.7/array/shift.rb +13 -0
- data/lib/backports/1.8.7/array/shuffle.rb +17 -0
- data/lib/backports/1.8.7/binding.rb +3 -6
- data/lib/backports/1.8.7/binding/eval.rb +7 -0
- data/lib/backports/1.8.7/dir.rb +2 -57
- data/lib/backports/1.8.7/dir/each.rb +7 -0
- data/lib/backports/1.8.7/dir/foreach.rb +9 -0
- data/lib/backports/1.8.7/dir/mktmpdir.rb +44 -0
- data/lib/backports/1.8.7/enumerable.rb +2 -240
- data/lib/backports/1.8.7/enumerable/count.rb +17 -0
- data/lib/backports/1.8.7/enumerable/cycle.rb +24 -0
- data/lib/backports/1.8.7/enumerable/detect.rb +3 -0
- data/lib/backports/1.8.7/enumerable/drop.rb +13 -0
- data/lib/backports/1.8.7/enumerable/drop_while.rb +16 -0
- data/lib/backports/1.8.7/enumerable/each_cons.rb +4 -0
- data/lib/backports/1.8.7/enumerable/each_slice.rb +4 -0
- data/lib/backports/1.8.7/enumerable/each_with_index.rb +3 -0
- data/lib/backports/1.8.7/enumerable/entries.rb +11 -0
- data/lib/backports/1.8.7/enumerable/find.rb +3 -0
- data/lib/backports/1.8.7/enumerable/find_all.rb +3 -0
- data/lib/backports/1.8.7/enumerable/find_index.rb +21 -0
- data/lib/backports/1.8.7/enumerable/first.rb +21 -0
- data/lib/backports/1.8.7/enumerable/group_by.rb +14 -0
- data/lib/backports/1.8.7/enumerable/inject.rb +14 -0
- data/lib/backports/1.8.7/enumerable/max_by.rb +16 -0
- data/lib/backports/1.8.7/enumerable/min_by.rb +16 -0
- data/lib/backports/1.8.7/enumerable/minmax.rb +21 -0
- data/lib/backports/1.8.7/enumerable/minmax_by.rb +19 -0
- data/lib/backports/1.8.7/enumerable/none.rb +7 -0
- data/lib/backports/1.8.7/enumerable/one.rb +23 -0
- data/lib/backports/1.8.7/enumerable/partition.rb +3 -0
- data/lib/backports/1.8.7/enumerable/reduce.rb +1 -0
- data/lib/backports/1.8.7/enumerable/reject.rb +3 -0
- data/lib/backports/1.8.7/enumerable/reverse_each.rb +12 -0
- data/lib/backports/1.8.7/enumerable/select.rb +3 -0
- data/lib/backports/1.8.7/enumerable/sort_by.rb +3 -0
- data/lib/backports/1.8.7/enumerable/take.rb +9 -0
- data/lib/backports/1.8.7/enumerable/take_while.rb +14 -0
- data/lib/backports/1.8.7/enumerable/to_a.rb +12 -0
- data/lib/backports/1.8.7/enumerator.rb +2 -31
- data/lib/backports/1.8.7/enumerator/each.rb +6 -0
- data/lib/backports/1.8.7/enumerator/next.rb +15 -0
- data/lib/backports/1.8.7/enumerator/rewind.rb +13 -0
- data/lib/backports/1.8.7/enumerator/with_index.rb +14 -0
- data/lib/backports/1.8.7/env.rb +3 -3
- data/lib/backports/1.8.7/env/delete_if.rb +3 -0
- data/lib/backports/1.8.7/env/each.rb +3 -0
- data/lib/backports/1.8.7/env/each_key.rb +3 -0
- data/lib/backports/1.8.7/env/each_pair.rb +3 -0
- data/lib/backports/1.8.7/env/each_value.rb +3 -0
- data/lib/backports/1.8.7/env/reject.rb +4 -0
- data/lib/backports/1.8.7/env/select.rb +3 -0
- data/lib/backports/1.8.7/fixnum.rb +2 -10
- data/lib/backports/1.8.7/fixnum/div.rb +7 -0
- data/lib/backports/1.8.7/fixnum/fdiv.rb +7 -0
- data/lib/backports/1.8.7/float.rb +3 -4
- data/lib/backports/1.8.7/float/fdiv.rb +3 -0
- data/lib/backports/1.8.7/gc.rb +2 -10
- data/lib/backports/1.8.7/gc/stress.rb +9 -0
- data/lib/backports/1.8.7/hash.rb +2 -41
- data/lib/backports/1.8.7/hash/constructor.rb +25 -0
- data/lib/backports/1.8.7/hash/delete_if.rb +3 -0
- data/lib/backports/1.8.7/hash/each.rb +3 -0
- data/lib/backports/1.8.7/hash/each_key.rb +3 -0
- data/lib/backports/1.8.7/hash/each_pair.rb +3 -0
- data/lib/backports/1.8.7/hash/each_value.rb +3 -0
- data/lib/backports/1.8.7/hash/eql.rb +1 -0
- data/lib/backports/1.8.7/hash/hash.rb +17 -0
- data/lib/backports/1.8.7/hash/key.rb +3 -0
- data/lib/backports/1.8.7/hash/reject.rb +3 -0
- data/lib/backports/1.8.7/hash/select.rb +3 -0
- data/lib/backports/1.8.7/integer.rb +2 -23
- data/lib/backports/1.8.7/integer/downto.rb +3 -0
- data/lib/backports/1.8.7/integer/even.rb +7 -0
- data/lib/backports/1.8.7/integer/odd.rb +7 -0
- data/lib/backports/1.8.7/integer/ord.rb +7 -0
- data/lib/backports/1.8.7/integer/pred.rb +7 -0
- data/lib/backports/1.8.7/integer/times.rb +3 -0
- data/lib/backports/1.8.7/integer/upto.rb +3 -0
- data/lib/backports/1.8.7/io.rb +2 -42
- data/lib/backports/1.8.7/io/bytes.rb +1 -0
- data/lib/backports/1.8.7/io/chars.rb +1 -0
- data/lib/backports/1.8.7/io/each.rb +3 -0
- data/lib/backports/1.8.7/io/each_byte.rb +6 -0
- data/lib/backports/1.8.7/io/each_char.rb +34 -0
- data/lib/backports/1.8.7/io/each_line.rb +6 -0
- data/lib/backports/1.8.7/io/foreach.rb +7 -0
- data/lib/backports/1.8.7/io/getbyte.rb +3 -0
- data/lib/backports/1.8.7/io/lines.rb +1 -0
- data/lib/backports/1.8.7/io/readbyte.rb +3 -0
- data/lib/backports/1.8.7/kernel.rb +2 -35
- data/lib/backports/1.8.7/kernel/__method__.rb +8 -0
- data/lib/backports/1.8.7/kernel/instance_exec.rb +10 -0
- data/lib/backports/1.8.7/kernel/tap.rb +8 -0
- data/lib/backports/1.8.7/method.rb +2 -46
- data/lib/backports/1.8.7/method/name.rb +49 -0
- data/lib/backports/1.8.7/module.rb +3 -7
- data/lib/backports/1.8.7/module/class_exec.rb +1 -0
- data/lib/backports/1.8.7/module/module_exec.rb +11 -0
- data/lib/backports/1.8.7/numeric.rb +3 -3
- data/lib/backports/1.8.7/numeric/step.rb +3 -0
- data/lib/backports/1.8.7/object_space.rb +3 -5
- data/lib/backports/1.8.7/object_space/each_object.rb +5 -0
- data/lib/backports/1.8.7/proc.rb +3 -4
- data/lib/backports/1.8.7/proc/yield.rb +3 -0
- data/lib/backports/1.8.7/process.rb +3 -5
- data/lib/backports/1.8.7/process/exec.rb +3 -0
- data/lib/backports/1.8.7/range.rb +3 -4
- data/lib/backports/1.8.7/range/each.rb +3 -0
- data/lib/backports/1.8.7/range/step.rb +3 -0
- data/lib/backports/1.8.7/regexp.rb +3 -12
- data/lib/backports/1.8.7/regexp/union.rb +11 -0
- data/lib/backports/1.8.7/stop_iteration.rb +14 -0
- data/lib/backports/1.8.7/string.rb +2 -91
- data/lib/backports/1.8.7/string/bytes.rb +1 -0
- data/lib/backports/1.8.7/string/bytesize.rb +3 -0
- data/lib/backports/1.8.7/string/each.rb +3 -0
- data/lib/backports/1.8.7/string/each_byte.rb +5 -0
- data/lib/backports/1.8.7/string/each_char.rb +13 -0
- data/lib/backports/1.8.7/string/each_line.rb +5 -0
- data/lib/backports/1.8.7/string/end_with.rb +12 -0
- data/lib/backports/1.8.7/string/lines.rb +1 -0
- data/lib/backports/1.8.7/string/partition.rb +20 -0
- data/lib/backports/1.8.7/string/rpartition.rb +19 -0
- data/lib/backports/1.8.7/string/start_with.rb +12 -0
- data/lib/backports/1.8.7/string/upto.rb +15 -0
- data/lib/backports/1.8.7/struct.rb +3 -3
- data/lib/backports/1.8.7/struct/each.rb +3 -0
- data/lib/backports/1.8.7/struct/each_pair.rb +3 -0
- data/lib/backports/1.8.7/symbol.rb +3 -6
- data/lib/backports/1.8.7/symbol/to_proc.rb +8 -0
- data/lib/backports/1.8.8.rb +1 -3
- data/lib/backports/1.8.rb +1 -3
- data/lib/backports/1.9.1.rb +2 -4
- data/lib/backports/1.9.1/array.rb +3 -8
- data/lib/backports/1.9.1/array/sample.rb +19 -0
- data/lib/backports/1.9.1/array/try_convert.rb +7 -0
- data/lib/backports/1.9.1/dir.rb +3 -3
- data/lib/backports/1.9.1/dir/to_path.rb +3 -0
- data/lib/backports/1.9.1/enumerable.rb +2 -18
- data/lib/backports/1.9.1/enumerable/each_with_index.rb +14 -0
- data/lib/backports/1.9.1/enumerable/each_with_object.rb +9 -0
- data/lib/backports/1.9.1/enumerator.rb +2 -40
- data/lib/backports/1.9.1/enumerator/new.rb +40 -0
- data/lib/backports/1.9.1/enumerator/with_object.rb +6 -0
- data/lib/backports/1.9.1/env.rb +3 -3
- data/lib/backports/1.9.1/env/key.rb +5 -0
- data/lib/backports/1.9.1/file.rb +2 -43
- data/lib/backports/1.9.1/file/atime.rb +5 -0
- data/lib/backports/1.9.1/file/basename.rb +5 -0
- data/lib/backports/1.9.1/file/binary.rb +6 -0
- data/lib/backports/1.9.1/file/blockdev.rb +5 -0
- data/lib/backports/1.9.1/file/chardev.rb +5 -0
- data/lib/backports/1.9.1/file/chmod.rb +5 -0
- data/lib/backports/1.9.1/file/chown.rb +5 -0
- data/lib/backports/1.9.1/file/ctime.rb +5 -0
- data/lib/backports/1.9.1/file/delete.rb +5 -0
- data/lib/backports/1.9.1/file/directory.rb +5 -0
- data/lib/backports/1.9.1/file/dirname.rb +5 -0
- data/lib/backports/1.9.1/file/executable.rb +5 -0
- data/lib/backports/1.9.1/file/executable_real.rb +5 -0
- data/lib/backports/1.9.1/file/exist.rb +5 -0
- data/lib/backports/1.9.1/file/exists.rb +5 -0
- data/lib/backports/1.9.1/file/expand_path.rb +14 -0
- data/lib/backports/1.9.1/file/extname.rb +5 -0
- data/lib/backports/1.9.1/file/file.rb +5 -0
- data/lib/backports/1.9.1/file/ftype.rb +5 -0
- data/lib/backports/1.9.1/file/grpowned.rb +5 -0
- data/lib/backports/1.9.1/file/join.rb +5 -0
- data/lib/backports/1.9.1/file/lchmod.rb +5 -0
- data/lib/backports/1.9.1/file/lchown.rb +5 -0
- data/lib/backports/1.9.1/file/link.rb +5 -0
- data/lib/backports/1.9.1/file/lstat.rb +5 -0
- data/lib/backports/1.9.1/file/mtime.rb +5 -0
- data/lib/backports/1.9.1/file/new.rb +5 -0
- data/lib/backports/1.9.1/file/open.rb +23 -0
- data/lib/backports/1.9.1/file/owned.rb +5 -0
- data/lib/backports/1.9.1/file/pipe.rb +5 -0
- data/lib/backports/1.9.1/file/readable.rb +5 -0
- data/lib/backports/1.9.1/file/readable_real.rb +5 -0
- data/lib/backports/1.9.1/file/readlink.rb +5 -0
- data/lib/backports/1.9.1/file/rename.rb +5 -0
- data/lib/backports/1.9.1/file/setgid.rb +5 -0
- data/lib/backports/1.9.1/file/setuid.rb +5 -0
- data/lib/backports/1.9.1/file/size.rb +14 -0
- data/lib/backports/1.9.1/file/socket.rb +5 -0
- data/lib/backports/1.9.1/file/split.rb +5 -0
- data/lib/backports/1.9.1/file/stat.rb +5 -0
- data/lib/backports/1.9.1/file/sticky.rb +5 -0
- data/lib/backports/1.9.1/file/symlink.rb +6 -0
- data/lib/backports/1.9.1/file/to_path.rb +3 -0
- data/lib/backports/1.9.1/file/truncate.rb +5 -0
- data/lib/backports/1.9.1/file/unlink.rb +5 -0
- data/lib/backports/1.9.1/file/writable.rb +5 -0
- data/lib/backports/1.9.1/file/writable_real.rb +5 -0
- data/lib/backports/1.9.1/file/zero.rb +5 -0
- data/lib/backports/1.9.1/float.rb +3 -19
- data/lib/backports/1.9.1/float/round.rb +21 -0
- data/lib/backports/1.9.1/hash.rb +2 -35
- data/lib/backports/1.9.1/hash/assoc.rb +12 -0
- data/lib/backports/1.9.1/hash/default_proc.rb +14 -0
- data/lib/backports/1.9.1/hash/rassoc.rb +9 -0
- data/lib/backports/1.9.1/hash/try_convert.rb +7 -0
- data/lib/backports/1.9.1/integer.rb +2 -21
- data/lib/backports/1.9.1/integer/magnitude.rb +3 -0
- data/lib/backports/1.9.1/integer/round.rb +24 -0
- data/lib/backports/1.9.1/io.rb +2 -33
- data/lib/backports/1.9.1/io/binread.rb +10 -0
- data/lib/backports/1.9.1/io/open.rb +21 -0
- data/lib/backports/1.9.1/io/try_convert.rb +7 -0
- data/lib/backports/1.9.1/io/ungetbyte.rb +3 -0
- data/lib/backports/1.9.1/kernel.rb +2 -39
- data/lib/backports/1.9.1/kernel/__callee__.rb +7 -0
- data/lib/backports/1.9.1/kernel/define_singleton_method.rb +9 -0
- data/lib/backports/1.9.1/kernel/public_method.rb +11 -0
- data/lib/backports/1.9.1/kernel/public_send.rb +13 -0
- data/lib/backports/1.9.1/kernel/require_relative.rb +14 -0
- data/lib/backports/1.9.1/math.rb +2 -24
- data/lib/backports/1.9.1/math/log.rb +22 -0
- data/lib/backports/1.9.1/math/log2.rb +5 -0
- data/lib/backports/1.9.1/numeric.rb +3 -9
- data/lib/backports/1.9.1/numeric/round.rb +11 -0
- data/lib/backports/1.9.1/proc.rb +2 -53
- data/lib/backports/1.9.1/proc/case_compare.rb +6 -0
- data/lib/backports/1.9.1/proc/curry.rb +24 -0
- data/lib/backports/1.9.1/proc/lambda.rb +40 -0
- data/lib/backports/1.9.1/range.rb +3 -3
- data/lib/backports/1.9.1/range/cover.rb +3 -0
- data/lib/backports/1.9.1/regexp.rb +3 -8
- data/lib/backports/1.9.1/regexp/try_convert.rb +7 -0
- data/lib/backports/1.9.1/stdlib.rb +1 -1
- data/lib/backports/1.9.1/string.rb +2 -44
- data/lib/backports/1.9.1/string/ascii_only.rb +7 -0
- data/lib/backports/1.9.1/string/chr.rb +7 -0
- data/lib/backports/1.9.1/string/clear.rb +8 -0
- data/lib/backports/1.9.1/string/codepoints.rb +8 -0
- data/lib/backports/1.9.1/string/each_codepoint.rb +3 -0
- data/lib/backports/1.9.1/string/getbyte.rb +3 -0
- data/lib/backports/1.9.1/string/ord.rb +7 -0
- data/lib/backports/1.9.1/string/setbyte.rb +3 -0
- data/lib/backports/1.9.1/string/try_convert.rb +7 -0
- data/lib/backports/1.9.1/symbol.rb +2 -31
- data/lib/backports/1.9.1/symbol/capitalize.rb +7 -0
- data/lib/backports/1.9.1/symbol/casecmp.rb +8 -0
- data/lib/backports/1.9.1/symbol/comparable.rb +7 -0
- data/lib/backports/1.9.1/symbol/comparison.rb +8 -0
- data/lib/backports/1.9.1/symbol/downcase.rb +7 -0
- data/lib/backports/1.9.1/symbol/element_reference.rb +7 -0
- data/lib/backports/1.9.1/symbol/empty.rb +7 -0
- data/lib/backports/1.9.1/symbol/length.rb +7 -0
- data/lib/backports/1.9.1/symbol/match.rb +9 -0
- data/lib/backports/1.9.1/symbol/next.rb +1 -0
- data/lib/backports/1.9.1/symbol/size.rb +7 -0
- data/lib/backports/1.9.1/symbol/succ.rb +8 -0
- data/lib/backports/1.9.1/symbol/swapcase.rb +7 -0
- data/lib/backports/1.9.1/symbol/upcase.rb +7 -0
- data/lib/backports/1.9.2.rb +2 -4
- data/lib/backports/1.9.2/array.rb +2 -109
- data/lib/backports/1.9.2/array/keep_if.rb +8 -0
- data/lib/backports/1.9.2/array/product.rb +26 -0
- data/lib/backports/1.9.2/array/repeated_combination.rb +25 -0
- data/lib/backports/1.9.2/array/repeated_permutation.rb +26 -0
- data/lib/backports/1.9.2/array/rotate.rb +17 -0
- data/lib/backports/1.9.2/array/select.rb +8 -0
- data/lib/backports/1.9.2/array/sort_by.rb +9 -0
- data/lib/backports/1.9.2/array/uniq.rb +29 -0
- data/lib/backports/1.9.2/complex.rb +3 -6
- data/lib/backports/1.9.2/complex/to_r.rb +10 -0
- data/lib/backports/1.9.2/dir.rb +3 -5
- data/lib/backports/1.9.2/dir/home.rb +5 -0
- data/lib/backports/1.9.2/enumerable.rb +2 -73
- data/lib/backports/1.9.2/enumerable/chunk.rb +39 -0
- data/lib/backports/1.9.2/enumerable/collect_concat.rb +1 -0
- data/lib/backports/1.9.2/enumerable/each_entry.rb +11 -0
- data/lib/backports/1.9.2/enumerable/flat_map.rb +11 -0
- data/lib/backports/1.9.2/enumerable/slice_before.rb +30 -0
- data/lib/backports/1.9.2/float.rb +3 -4
- data/lib/backports/1.9.2/float/infinity.rb +3 -0
- data/lib/backports/1.9.2/float/nan.rb +3 -0
- data/lib/backports/1.9.2/hash.rb +2 -10
- data/lib/backports/1.9.2/hash/keep_if.rb +8 -0
- data/lib/backports/1.9.2/hash/select.rb +9 -0
- data/lib/backports/1.9.2/kernel.rb +3 -5
- data/lib/backports/1.9.2/kernel/singleton_class.rb +7 -0
- data/lib/backports/1.9.2/random.rb +1 -1
- data/lib/backports/1.9.2/stdlib.rb +1 -1
- data/lib/backports/1.9.2/stdlib/matrix.rb +9 -8
- data/lib/backports/1.9.2/stdlib/set.rb +1 -1
- data/lib/backports/1.9.3.rb +2 -4
- data/lib/backports/1.9.3/file.rb +3 -14
- data/lib/backports/1.9.3/file/null.rb +16 -0
- data/lib/backports/1.9.3/io.rb +2 -31
- data/lib/backports/1.9.3/io/advise.rb +24 -0
- data/lib/backports/1.9.3/io/binwrite.rb +7 -0
- data/lib/backports/1.9.3/io/write.rb +7 -0
- data/lib/backports/1.9.3/string.rb +2 -38
- data/lib/backports/1.9.3/string/byteslice.rb +36 -0
- data/lib/backports/1.9.3/string/prepend.rb +10 -0
- data/lib/backports/1.9.rb +1 -3
- data/lib/backports/2.0.0.rb +2 -4
- data/lib/backports/2.0.0/array.rb +2 -29
- data/lib/backports/2.0.0/array/bsearch.rb +32 -0
- data/lib/backports/2.0.0/enumerable.rb +2 -11
- data/lib/backports/2.0.0/enumerable/lazy.rb +216 -0
- data/lib/backports/2.0.0/enumerator.rb +3 -0
- data/lib/backports/2.0.0/enumerator/lazy.rb +1 -203
- data/lib/backports/2.0.0/env.rb +3 -0
- data/lib/backports/2.0.0/env/to_h.rb +5 -0
- data/lib/backports/2.0.0/hash.rb +2 -18
- data/lib/backports/2.0.0/hash/default_proc.rb +16 -0
- data/lib/backports/2.0.0/hash/to_h.rb +7 -0
- data/lib/backports/2.0.0/nil.rb +3 -0
- data/lib/backports/2.0.0/nil/to_h.rb +7 -0
- data/lib/backports/2.0.0/range.rb +2 -48
- data/lib/backports/2.0.0/range/bsearch.rb +49 -0
- data/lib/backports/2.0.0/stdlib/abbrev.rb +1 -0
- data/lib/backports/2.0.0/stdlib/fake_stdlib_lib.rb +1 -0
- data/lib/backports/2.0.0/stdlib/ostruct.rb +1 -1
- data/lib/backports/2.0.0/struct.rb +3 -7
- data/lib/backports/2.0.0/struct/to_h.rb +9 -0
- data/lib/backports/2.0.rb +1 -3
- data/lib/backports/basic_object.rb +29 -29
- data/lib/backports/{1.9.2 → extra}/random/MT19937.rb +2 -2
- data/lib/backports/{1.9.2 → extra}/random/bits_and_bytes.rb +1 -1
- data/lib/backports/{1.9.2 → extra}/random/implementation.rb +1 -1
- data/lib/backports/extra/random/load.rb +17 -0
- data/lib/backports/force/array_map.rb +1 -1
- data/lib/backports/force/enumerable_map.rb +1 -1
- data/lib/backports/force/hash_select.rb +1 -1
- data/lib/backports/force/string_size.rb +1 -1
- data/lib/backports/rails.rb +2 -2
- data/lib/backports/rails/enumerable.rb +1 -1
- data/lib/backports/rails/hash.rb +1 -1
- data/lib/backports/rails/kernel.rb +1 -1
- data/lib/backports/rails/module.rb +1 -1
- data/lib/backports/rails/string.rb +6 -6
- data/lib/backports/tools.rb +74 -64
- data/lib/backports/version.rb +1 -1
- data/set_version/1.8.7.rb +1 -0
- data/set_version/1.9.1.rb +1 -0
- data/set_version/1.9.2.rb +1 -0
- data/set_version/1.9.3.rb +1 -0
- data/set_version/2.0.0.rb +1 -0
- data/set_version/setter.rb +14 -0
- data/tags/1.8.6/core/array/rotate_spec.rb +2 -0
- data/tags/1.8.6/core/array/uniq_spec.rb +3 -0
- data/tags/1.8.6/core/complex/to_r_spec.rb +3 -0
- data/tags/1.8.6/core/enumerable/each_entry_spec.rb +1 -0
- data/tags/1.8.6/core/enumerator/next_spec.rb +1 -0
- data/tags/1.8.6/core/env/to_h_spec.rb +2 -0
- data/tags/1.8.6/core/file/join_spec.rb +3 -0
- data/tags/1.8.6/core/file/lchmod_spec.rb +2 -0
- data/tags/1.8.6/core/file/new_spec.rb +2 -0
- data/tags/1.8.6/core/file/open_spec.rb +10 -0
- data/tags/1.8.6/core/file/to_path_spec.rb +1 -0
- data/tags/1.8.6/core/fixnum/fdiv_spec.rb +1 -0
- data/tags/1.8.6/core/gc/stress_spec.rb +2 -0
- data/tags/1.8.6/core/hash/assoc_spec.rb +1 -0
- data/tags/1.8.6/core/hash/default_proc_spec.rb +2 -0
- data/tags/1.8.6/core/hash/eql_spec.rb +3 -0
- data/tags/1.8.6/core/hash/hash_spec.rb +3 -0
- data/tags/1.8.6/core/hash/keep_if_spec.rb +1 -0
- data/tags/1.8.6/core/hash/select_spec.rb +1 -0
- data/tags/1.8.6/core/integer/round_spec.rb +1 -0
- data/tags/1.8.6/core/io/binread_spec.rb +7 -0
- data/tags/1.8.6/core/io/chars_spec.rb +1 -0
- data/tags/1.8.6/core/io/each_char_spec.rb +1 -0
- data/tags/1.8.6/core/io/lines_spec.rb +1 -0
- data/tags/1.8.6/core/io/open_spec.rb +24 -0
- data/tags/1.8.6/core/io/ungetbyte_spec.rb +4 -0
- data/tags/1.8.6/core/io/write_spec.rb +3 -0
- data/tags/1.8.6/core/kernel/__callee___spec.rb +5 -0
- data/tags/1.8.6/core/kernel/__method___spec.rb +1 -0
- data/tags/1.8.6/core/kernel/define_singleton_method_spec.rb +2 -0
- data/tags/1.8.6/core/kernel/public_method_spec.rb +2 -0
- data/tags/1.8.6/core/math/log2_spec.rb +4 -0
- data/tags/1.8.6/core/math/log_spec.rb +3 -0
- data/tags/1.8.6/core/module/class_exec_spec.rb +2 -0
- data/tags/1.8.6/core/module/module_exec_spec.rb +2 -0
- data/tags/1.8.6/core/numeric/step_spec.rb +12 -0
- data/tags/1.8.6/core/proc/curry_spec.rb +4 -0
- data/tags/1.8.6/core/range/step_spec.rb +12 -0
- data/tags/1.8.6/core/string/getbyte_spec.rb +6 -0
- data/tags/1.8.6/core/string/partition_spec.rb +1 -0
- data/tags/1.8.6/core/string/prepend_spec.rb +1 -0
- data/tags/1.8.6/core/string/rpartition_spec.rb +1 -0
- data/tags/1.8.6/core/string/setbyte_spec.rb +5 -0
- data/tags/1.8.6/core/string/upto_spec.rb +1 -0
- data/tags/1.8.6/core/symbol/capitalize_spec.rb +3 -0
- data/tags/1.8.6/core/symbol/comparison_spec.rb +1 -0
- data/tags/1.8.6/core/symbol/downcase_spec.rb +2 -0
- data/tags/1.8.6/core/symbol/element_reference_spec.rb +2 -0
- data/tags/1.8.6/core/symbol/empty_spec.rb +1 -0
- data/tags/1.8.6/core/symbol/match_spec.rb +2 -0
- data/tags/1.8.6/core/symbol/swapcase_spec.rb +2 -0
- data/tags/1.8.6/core/symbol/upcase_spec.rb +1 -0
- data/tags/1.8.7/core/array/rotate_spec.rb +2 -0
- data/tags/1.8.7/core/array/uniq_spec.rb +3 -0
- data/tags/1.8.7/core/complex/to_r_spec.rb +3 -0
- data/tags/1.8.7/core/env/to_h_spec.rb +2 -0
- data/tags/1.8.7/core/file/lchmod_spec.rb +2 -0
- data/tags/1.8.7/core/file/new_spec.rb +1 -0
- data/tags/1.8.7/core/file/open_spec.rb +1 -0
- data/tags/1.8.7/core/file/readlink_spec.rb +6 -0
- data/tags/1.8.7/core/file/to_path_spec.rb +1 -0
- data/tags/1.8.7/core/hash/assoc_spec.rb +1 -0
- data/tags/1.8.7/core/hash/default_proc_spec.rb +2 -0
- data/tags/1.8.7/core/hash/keep_if_spec.rb +1 -0
- data/tags/1.8.7/core/hash/rassoc_spec.rb +1 -0
- data/tags/1.8.7/core/hash/select_spec.rb +1 -0
- data/tags/1.8.7/core/integer/round_spec.rb +1 -0
- data/tags/1.8.7/core/io/binread_spec.rb +7 -0
- data/tags/1.8.7/core/io/open_spec.rb +25 -0
- data/tags/1.8.7/core/io/ungetbyte_spec.rb +4 -0
- data/tags/1.8.7/core/io/write_spec.rb +3 -0
- data/tags/1.8.7/core/kernel/__callee___spec.rb +5 -0
- data/tags/1.8.7/core/kernel/define_singleton_method_spec.rb +2 -0
- data/tags/1.8.7/core/kernel/public_method_spec.rb +1 -0
- data/tags/1.8.7/core/math/log2_spec.rb +4 -0
- data/tags/1.8.7/core/math/log_spec.rb +3 -0
- data/tags/1.8.7/core/proc/curry_spec.rb +3 -0
- data/tags/1.8.7/core/string/getbyte_spec.rb +5 -0
- data/tags/1.8.7/core/string/prepend_spec.rb +1 -0
- data/tags/1.8.7/core/string/setbyte_spec.rb +5 -0
- data/tags/1.8.7/core/symbol/capitalize_spec.rb +3 -0
- data/tags/1.8.7/core/symbol/comparison_spec.rb +1 -0
- data/tags/1.8.7/core/symbol/downcase_spec.rb +2 -0
- data/tags/1.8.7/core/symbol/element_reference_spec.rb +2 -0
- data/tags/1.8.7/core/symbol/empty_spec.rb +1 -0
- data/tags/1.8.7/core/symbol/match_spec.rb +2 -0
- data/tags/1.8.7/core/symbol/swapcase_spec.rb +2 -0
- data/tags/1.8.7/core/symbol/upcase_spec.rb +1 -0
- data/tags/1.9.1/core/array/rotate_spec.rb +1 -0
- data/tags/1.9.1/core/env/to_h_spec.rb +2 -0
- data/tags/1.9.1/core/hash/default_proc_spec.rb +1 -0
- data/tags/1.9.1/core/io/write_spec.rb +2 -0
- data/tags/1.9.2/core/io/write_spec.rb +2 -0
- data/test/README +1 -1
- data/test/_backport_guards_test.rb +140 -0
- data/test/{test_lazy.rb → lazy_test.rb} +25 -20
- data/test/{test_socket_interaction.rb → socket_interaction_test.rb} +3 -3
- data/test/test_helper.rb +0 -4
- metadata +392 -16
- data/lib/backports/1.9.2/match_data.rb +0 -3
- data/lib/backports/1.9.2/random/load.rb +0 -16
- data/lib/backports/2.0.0/nil_class.rb +0 -5
- data/test/std_lib_loading_test.rb +0 -57
- data/test/test__me_first.rb +0 -51
@@ -0,0 +1 @@
|
|
1
|
+
fails:File#to_path preserves the encoding of the path
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Fixnum#fdiv follows the coercion protocol
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Hash#assoc only returns the first matching key-value pair for identity hashes
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Hash#keep_if raises an RuntimeError if called on a frozen instance
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Hash#select returns a Hash of entries for which block is true
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Integer#round raises a RangeError when passed Float::INFINITY
|
@@ -0,0 +1,7 @@
|
|
1
|
+
fails:IO.binread reads the contents of a file
|
2
|
+
fails:IO.binread reads the contents of a file up to a certain size when specified
|
3
|
+
fails:IO.binread reads the contents of a file from an offset of a specific size when specified
|
4
|
+
fails:IO.binread returns a String in ASCII-8BIT encoding
|
5
|
+
fails:IO.binread returns a String in ASCII-8BIT encoding regardless of Encoding.default_internal
|
6
|
+
fails:IO.binread raises an ArgumentError when not passed a valid length
|
7
|
+
fails:IO.binread raises an Errno::EINVAL when not passed a valid offset
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:IO#chars yields each character
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:IO#each_char yields each character
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:IO#lines ignores a given block
|
@@ -0,0 +1,24 @@
|
|
1
|
+
fails:IO.open uses the external encoding specified in the mode argument
|
2
|
+
fails:IO.open uses the external and the internal encoding specified in the mode argument
|
3
|
+
fails:IO.open uses the external encoding specified via the :external_encoding option
|
4
|
+
fails:IO.open uses the internal encoding specified via the :internal_encoding option
|
5
|
+
fails:IO.open uses the colon-separated encodings specified via the :encoding option
|
6
|
+
fails:IO.open ingores the :encoding option when the :external_encoding option is present
|
7
|
+
fails:IO.open ingores the :encoding option when the :internal_encoding option is present
|
8
|
+
fails:IO.open uses the encoding specified via the :mode option hash
|
9
|
+
fails:IO.open ignores the :internal_encoding option when the same as the external encoding
|
10
|
+
fails:IO.open sets internal encoding to nil when passed '-'
|
11
|
+
fails:IO.open sets binmode from mode string
|
12
|
+
fails:IO.open does not set binmode without being asked
|
13
|
+
fails:IO.open sets binmode from :binmode option
|
14
|
+
fails:IO.open does not set binmode from false :binmode
|
15
|
+
fails:IO.open raises an error if passed binary/text mode two ways
|
16
|
+
fails:IO.open sets external encoding to binary with binmode in mode string
|
17
|
+
fails:IO.open sets external encoding to binary with :binmode option
|
18
|
+
fails:IO.open does not use binary encoding when mode encoding is specified
|
19
|
+
fails:IO.open does not use binary encoding when :encoding option is specified
|
20
|
+
fails:IO.open does not use binary encoding when :external_encoding option is specified
|
21
|
+
fails:IO.open does not use binary encoding when :internal_encoding option is specified
|
22
|
+
fails:IO.open coerces mode with #to_int
|
23
|
+
fails:IO.open coerces options as second argument with #to_hash
|
24
|
+
fails:IO.open raises ArgumentError if not passed a hash or nil for options
|
@@ -0,0 +1,5 @@
|
|
1
|
+
fails:Kernel.__callee__ returns the current method, even when aliased
|
2
|
+
fails:Kernel.__callee__ returns the original name when aliased method
|
3
|
+
fails:Kernel.__callee__ returns the caller from blocks too
|
4
|
+
fails:Kernel.__callee__ returns nil when not called from a method
|
5
|
+
fails:Kernel.__callee__ returns the caller when sent as a string
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Kernel.__method__ returns the original name when aliased method
|
@@ -0,0 +1,2 @@
|
|
1
|
+
fails:Kernel#define_singleton_method when given an UnboundMethod defines any Child class method from any Parent's class methods
|
2
|
+
fails:Kernel#define_singleton_method when given an UnboundMethod will raise when attempting to define an object's singleton method from another object's singleton method
|
@@ -0,0 +1,4 @@
|
|
1
|
+
fails:Math.log2 raises an Errno::EDOM if the argument is less than 0
|
2
|
+
fails:Math.log2 raises an TypeError if the argument cannot be coerced with Float()
|
3
|
+
fails:Math.log2 raises an TypeError if passed a numerical argument as a string
|
4
|
+
fails:Math.log2 returns NaN given NaN
|
@@ -0,0 +1,12 @@
|
|
1
|
+
fails:Numeric#step Numeric#step with [stop, +step] when self, stop or step is a Float is careful about not yielding a value greater than limit
|
2
|
+
fails:Numeric#step Numeric#step with [stop, -step] when self, stop or step is a Float is careful about not yielding a value smaller than limit
|
3
|
+
fails:Numeric#step Numeric#step with [stop, +Infinity] yields once if self < stop
|
4
|
+
fails:Numeric#step Numeric#step with [stop, +Infinity] yields once when stop is Infinity
|
5
|
+
fails:Numeric#step Numeric#step with [stop, +Infinity] yields once when self equals stop
|
6
|
+
fails:Numeric#step Numeric#step with [stop, +Infinity] yields once when self and stop are Infinity
|
7
|
+
fails:Numeric#step Numeric#step with [stop, +Infinity] does not yield when self > stop
|
8
|
+
fails:Numeric#step Numeric#step with [stop, -infinity] yields once if self > stop
|
9
|
+
fails:Numeric#step Numeric#step with [stop, -infinity] yields once if stop is -Infinity
|
10
|
+
fails:Numeric#step Numeric#step with [stop, -infinity] yields once when self equals stop
|
11
|
+
fails:Numeric#step Numeric#step with [stop, -infinity] yields once when self and stop are Infinity
|
12
|
+
fails:Numeric#step Numeric#step with [stop, -infinity] does not yield when self > stop
|
@@ -0,0 +1,4 @@
|
|
1
|
+
fails:Proc#curry produces Procs that raise ArgumentError for #binding
|
2
|
+
fails:Proc#curry produces Procs that return [[:rest]] for #parameters
|
3
|
+
fails:Proc#curry produces Procs that return nil for #source_location
|
4
|
+
fails:Proc#curry produces Procs that can be passed as the block for instance_exec
|
@@ -0,0 +1,12 @@
|
|
1
|
+
fails:Range#step with inclusive end and Integer values yields Float values incremented by a Float step
|
2
|
+
fails:Range#step with inclusive end and Float values returns Float values of 'step * n + begin <= end'
|
3
|
+
fails:Range#step with inclusive end and Integer, Float values yields Float values incremented by 1 and less than or equal to end when not passed a step
|
4
|
+
fails:Range#step with inclusive end and Integer, Float values yields Float values incremented by an Integer step
|
5
|
+
fails:Range#step with inclusive end and Integer, Float values yields Float values incremented by a Float step
|
6
|
+
fails:Range#step with inclusive end and String values raises a TypeError when passed a Float step
|
7
|
+
fails:Range#step with exclusive end and Integer values yields Float values incremented by a Float step
|
8
|
+
fails:Range#step with exclusive end and Float values returns Float values of 'step * n + begin < end'
|
9
|
+
fails:Range#step with exclusive end and Integer, Float values yields Float values incremented by 1 and less than end when not passed a step
|
10
|
+
fails:Range#step with exclusive end and Integer, Float values yields Float values incremented by an Integer step
|
11
|
+
fails:Range#step with exclusive end and Integer, Float values yields an Float and then Float values incremented by a Float step
|
12
|
+
fails:Range#step with exclusive end and String values raises a TypeError when passed a Float step
|
@@ -0,0 +1,6 @@
|
|
1
|
+
fails:String#getbyte returns an Integer between 0 and 255
|
2
|
+
fails:String#getbyte regards a multi-byte character as having multiple bytes
|
3
|
+
fails:String#getbyte mirrors the output of #bytes
|
4
|
+
fails:String#getbyte interprets bytes relative to the String's encoding
|
5
|
+
fails:String#getbyte raises an ArgumentError unless given one argument
|
6
|
+
fails:String#getbyte raises a TypeError unless its argument can be coerced into an Integer
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:String#partition with String sets global vars if regexp used
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:String#prepend raises a RuntimeError when self if frozen
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:String#rpartition with String affects $~
|
@@ -0,0 +1,5 @@
|
|
1
|
+
fails:String#setbyte allows changing bytes in multi-byte characters
|
2
|
+
fails:String#setbyte can invalidate a String's encoding
|
3
|
+
fails:String#setbyte sets a byte at an index greater than String size
|
4
|
+
fails:String#setbyte raises a RuntimeError if self is frozen
|
5
|
+
fails:String#setbyte raises a TypeError unless the second argument is an Integer
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:String#upto raises a LocalJumpError if other is a string but no block was given
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Symbol#<=> with Symbol compares individual characters based on their ascii value
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Symbol#empty? returns true if self is empty
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Symbol#upcase leaves lowercase Unicode characters as they were
|
@@ -0,0 +1,3 @@
|
|
1
|
+
fails:Complex#to_r when the imaginary part is Fixnum 0 returns the result of sending #to_r to the real part
|
2
|
+
fails:Complex#to_r when the imaginary part is Rational 0 returns the result of sending #to_r to the real part
|
3
|
+
fails:Complex#to_r when the imaginary part responds to #== 0 with true returns the result of sending #to_r to the real part
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:File.new raises an Errno::EBADF if the first parameter is an invalid file descriptor
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:File.open on a FIFO opens it as a normal file
|
@@ -0,0 +1,6 @@
|
|
1
|
+
fails:File.readlink File.readlink with absolute paths return the name of the file referenced by the given link
|
2
|
+
fails:File.readlink File.readlink with absolute paths returns the name of the file referenced by the given link when the file does not exist
|
3
|
+
fails:File.readlink File.readlink with absolute paths raises an Errno::ENOENT if there is no such file
|
4
|
+
fails:File.readlink File.readlink with absolute paths raises an Errno::EINVAL if called with a normal file
|
5
|
+
fails:File.readlink File.readlink when changing the working directory returns the name of the file referenced by the given link
|
6
|
+
fails:File.readlink File.readlink when changing the working directory returns the name of the file referenced by the given link when the file does not exist
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:File#to_path preserves the encoding of the path
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Hash#assoc only returns the first matching key-value pair for identity hashes
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Hash#keep_if raises an RuntimeError if called on a frozen instance
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Hash#rassoc only returns the first matching key-value pair
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Hash#select returns a Hash of entries for which block is true
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Integer#round raises a RangeError when passed Float::INFINITY
|
@@ -0,0 +1,7 @@
|
|
1
|
+
fails:IO.binread reads the contents of a file
|
2
|
+
fails:IO.binread reads the contents of a file up to a certain size when specified
|
3
|
+
fails:IO.binread reads the contents of a file from an offset of a specific size when specified
|
4
|
+
fails:IO.binread returns a String in ASCII-8BIT encoding
|
5
|
+
fails:IO.binread returns a String in ASCII-8BIT encoding regardless of Encoding.default_internal
|
6
|
+
fails:IO.binread raises an ArgumentError when not passed a valid length
|
7
|
+
fails:IO.binread raises an Errno::EINVAL when not passed a valid offset
|
@@ -0,0 +1,25 @@
|
|
1
|
+
fails:IO.open uses the external encoding specified in the mode argument
|
2
|
+
fails:IO.open uses the external and the internal encoding specified in the mode argument
|
3
|
+
fails:IO.open uses the external encoding specified via the :external_encoding option
|
4
|
+
fails:IO.open uses the internal encoding specified via the :internal_encoding option
|
5
|
+
fails:IO.open uses the colon-separated encodings specified via the :encoding option
|
6
|
+
fails:IO.open ingores the :encoding option when the :external_encoding option is present
|
7
|
+
fails:IO.open ingores the :encoding option when the :internal_encoding option is present
|
8
|
+
fails:IO.open uses the encoding specified via the :mode option hash
|
9
|
+
fails:IO.open ignores the :internal_encoding option when the same as the external encoding
|
10
|
+
fails:IO.open sets internal encoding to nil when passed '-'
|
11
|
+
fails:IO.open raises an error if passed encodings two ways
|
12
|
+
fails:IO.open sets binmode from mode string
|
13
|
+
fails:IO.open does not set binmode without being asked
|
14
|
+
fails:IO.open sets binmode from :binmode option
|
15
|
+
fails:IO.open does not set binmode from false :binmode
|
16
|
+
fails:IO.open sets external encoding to binary with binmode in mode string
|
17
|
+
fails:IO.open does not use binary encoding when mode encoding is specified
|
18
|
+
fails:IO.open does not use binary encoding when :encoding option is specified
|
19
|
+
fails:IO.open does not use binary encoding when :external_encoding option is specified
|
20
|
+
fails:IO.open does not use binary encoding when :internal_encoding option is specified
|
21
|
+
fails:IO.open coerces mode with #to_int
|
22
|
+
fails:IO.open coerces options as second argument with #to_hash
|
23
|
+
fails:IO.open raises ArgumentError if not passed a hash or nil for options
|
24
|
+
fails:IO.open sets external encoding to binary with :binmode option
|
25
|
+
fails:IO.open raises an error if passed binary/text mode two ways
|
@@ -0,0 +1,5 @@
|
|
1
|
+
fails:Kernel.__callee__ returns the current method, even when aliased
|
2
|
+
fails:Kernel.__callee__ returns the original name when aliased method
|
3
|
+
fails:Kernel.__callee__ returns the caller from blocks too
|
4
|
+
fails:Kernel.__callee__ returns nil when not called from a method
|
5
|
+
fails:Kernel.__callee__ returns the caller when sent as a string
|
@@ -0,0 +1,2 @@
|
|
1
|
+
fails:Kernel#define_singleton_method when given an UnboundMethod defines any Child class method from any Parent's class methods
|
2
|
+
fails:Kernel#define_singleton_method when given an UnboundMethod will raise when attempting to define an object's singleton method from another object's singleton method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Kernel#public_method returns a method object if we repond_to_missing? method
|
@@ -0,0 +1,4 @@
|
|
1
|
+
fails:Math.log2 raises an Errno::EDOM if the argument is less than 0
|
2
|
+
fails:Math.log2 raises an TypeError if the argument cannot be coerced with Float()
|
3
|
+
fails:Math.log2 raises an TypeError if passed a numerical argument as a string
|
4
|
+
fails:Math.log2 returns NaN given NaN
|
@@ -0,0 +1,5 @@
|
|
1
|
+
fails:String#getbyte returns an Integer between 0 and 255
|
2
|
+
fails:String#getbyte regards a multi-byte character as having multiple bytes
|
3
|
+
fails:String#getbyte interprets bytes relative to the String's encoding
|
4
|
+
fails:String#getbyte raises an ArgumentError unless given one argument
|
5
|
+
fails:String#getbyte raises a TypeError unless its argument can be coerced into an Integer
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:String#prepend raises a RuntimeError when self if frozen
|
@@ -0,0 +1,5 @@
|
|
1
|
+
fails:String#setbyte allows changing bytes in multi-byte characters
|
2
|
+
fails:String#setbyte can invalidate a String's encoding
|
3
|
+
fails:String#setbyte sets a byte at an index greater than String size
|
4
|
+
fails:String#setbyte raises a RuntimeError if self is frozen
|
5
|
+
fails:String#setbyte raises a TypeError unless the second argument is an Integer
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Symbol#<=> with Symbol compares individual characters based on their ascii value
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Symbol#empty? returns true if self is empty
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Symbol#upcase leaves lowercase Unicode characters as they were
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Array#rotate returns subclass instance for Array subclasses
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Hash#default_proc= raises a TypeError if passed a lambda with an arity other than 2
|
data/test/README
CHANGED
@@ -10,4 +10,4 @@ For example:
|
|
10
10
|
|
11
11
|
This will run the specs for Range#cover for Ruby 1.8.7 after loading backports.
|
12
12
|
|
13
|
-
You need to check which tests fail to decide if it's OK that they do or not. For example it is to be expected that specs checking for encoding behavior will fail, as backports does not support the Ruby 1.9 encoding functionality.
|
13
|
+
You need to check which tests fail to decide if it's OK that they do or not. For example it is to be expected that specs checking for encoding behavior will fail, as backports does not support the Ruby 1.9 encoding functionality.
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
if RUBY_VERSION < '1.9'
|
3
|
+
require 'enumerator'
|
4
|
+
require 'generator' # Must require first, because of warning in Ruby 1.8.7 with `ruby -w -r generator -e ""`
|
5
|
+
end
|
6
|
+
require './test/test_helper'
|
7
|
+
$bogus = []
|
8
|
+
|
9
|
+
module Kernel
|
10
|
+
def require_with_bogus_extension(lib)
|
11
|
+
$bogus << lib
|
12
|
+
require_without_bogus_extension(lib)
|
13
|
+
end
|
14
|
+
alias_method :require_without_bogus_extension, :require
|
15
|
+
alias_method :require, :require_with_bogus_extension
|
16
|
+
|
17
|
+
if defined? BasicObject and BasicObject.superclass
|
18
|
+
BasicObject.send :undef_method, :require
|
19
|
+
BasicObject.send :undef_method, :require_with_bogus_extension
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class AAA_TestBackportGuards < Test::Unit::TestCase
|
24
|
+
def setup
|
25
|
+
$VERBOSE = true
|
26
|
+
@prev, $stderr = $stderr, StringIO.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def teardown
|
30
|
+
assert_equal '', $stderr.string
|
31
|
+
$stderr = @prev
|
32
|
+
end
|
33
|
+
|
34
|
+
EXCLUDE = %w[require] # Overriden in all circumstances to load the std-lib
|
35
|
+
EXCLUDE.map!(&:to_sym) if instance_methods.first.is_a?(Symbol)
|
36
|
+
|
37
|
+
# For some very strange reason, Hash[kvp.flatten] doesn't always work in 1.8.6??
|
38
|
+
def hash(key_value_pairs)
|
39
|
+
h = {}
|
40
|
+
key_value_pairs.each{|k,v| h[k] = v}
|
41
|
+
h
|
42
|
+
end
|
43
|
+
|
44
|
+
def class_signature(klass)
|
45
|
+
hash(
|
46
|
+
(klass.instance_methods - EXCLUDE).map{|m| [m, klass.instance_method(m)] } +
|
47
|
+
(klass.methods - EXCLUDE).map{|m| [".#{m}", klass.method(m) ]}
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
CLASSES = [Array, Binding, Dir, Enumerable, Fixnum, Float, GC,
|
52
|
+
Hash, Integer, IO, Kernel, Math, MatchData, Method, Module, Numeric,
|
53
|
+
ObjectSpace, Proc, Process, Range, Regexp, String, Struct, Symbol] +
|
54
|
+
[ENV, ARGF].map{|obj| class << obj; self; end }
|
55
|
+
|
56
|
+
case RUBY_VERSION
|
57
|
+
when '1.8.6'
|
58
|
+
when '1.8.7'
|
59
|
+
CLASSES << Enumerable::Enumerator
|
60
|
+
else
|
61
|
+
CLASSES << Enumerator
|
62
|
+
end
|
63
|
+
|
64
|
+
def digest
|
65
|
+
hash(
|
66
|
+
CLASSES.map { |klass| [klass, class_signature(klass)] }
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def digest_delta(before, after)
|
71
|
+
delta = {}
|
72
|
+
before.each do |klass, methods|
|
73
|
+
compare = after[klass]
|
74
|
+
d = methods.map do |name, unbound|
|
75
|
+
name unless unbound == compare[name]
|
76
|
+
end
|
77
|
+
d.compact!
|
78
|
+
delta[klass] = d unless d.empty?
|
79
|
+
end
|
80
|
+
delta unless delta.empty?
|
81
|
+
end
|
82
|
+
|
83
|
+
# Order super important!
|
84
|
+
def test__1_abbrev_can_be_required_before_backports
|
85
|
+
assert require('abbrev')
|
86
|
+
assert !$LOADED_FEATURES.include?('backports')
|
87
|
+
end
|
88
|
+
|
89
|
+
# Order super important!
|
90
|
+
def test__2_backports_wont_override_unnecessarily
|
91
|
+
before = digest
|
92
|
+
unless RUBY_VERSION <= '1.8.6'
|
93
|
+
require "backports/#{RUBY_VERSION}"
|
94
|
+
after = digest
|
95
|
+
assert_nil digest_delta(before, after)
|
96
|
+
end
|
97
|
+
unless RUBY_VERSION == "2.0.0"
|
98
|
+
require "backports"
|
99
|
+
after = digest
|
100
|
+
assert !digest_delta(before, after).nil?
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_setlib_load_correctly_after_requiring_backports
|
105
|
+
path = File.expand_path("../../lib/backports/1.9.2/stdlib/matrix.rb", __FILE__)
|
106
|
+
assert_equal false, $LOADED_FEATURES.include?(path)
|
107
|
+
assert_equal true, require('matrix')
|
108
|
+
assert_equal true, $bogus.include?("matrix")
|
109
|
+
assert_equal true, $LOADED_FEATURES.include?(path)
|
110
|
+
assert_equal false, require('matrix')
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_setlib_load_correctly_before_requiring_backports_test
|
114
|
+
assert_equal true, $bogus.include?("abbrev")
|
115
|
+
path = File.expand_path("../../lib/backports/2.0.0/stdlib/abbrev.rb", __FILE__)
|
116
|
+
assert_equal true, $LOADED_FEATURES.include?(path)
|
117
|
+
assert_equal false, require('abbrev')
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_backports_does_not_interfere_for_libraries_without_backports_test
|
121
|
+
assert_equal true, require('scanf')
|
122
|
+
assert_equal false, require('scanf')
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_load_correctly_new_libraries_test
|
126
|
+
path = File.expand_path("../../lib/backports/2.0.0/stdlib/fake_stdlib_lib.rb", __FILE__)
|
127
|
+
assert_equal false, $LOADED_FEATURES.include?(path)
|
128
|
+
assert_equal true, require('fake_stdlib_lib')
|
129
|
+
assert_equal true, $LOADED_FEATURES.include?(path)
|
130
|
+
assert_equal false, require('fake_stdlib_lib')
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_no_warnings
|
134
|
+
require 'ostruct'
|
135
|
+
require 'set'
|
136
|
+
require 'backports/1.8.7/array/each'
|
137
|
+
require 'backports/1.8.7/enumerator/next'
|
138
|
+
assert_equal 1, [1,2,3].each.next # [Bug #70]
|
139
|
+
end
|
140
|
+
end
|