backports 3.16.0 → 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +691 -0
- data/Gemfile +6 -0
- data/README.md +529 -0
- data/SECURITY.md +5 -0
- data/backports.gemspec +5 -1
- data/lib/backports.rb +6 -0
- data/lib/backports/1.8.7.rb +10 -2
- data/lib/backports/1.9.1.rb +6 -1
- data/lib/backports/1.9.2.rb +6 -1
- data/lib/backports/1.9.2/stdlib/matrix.rb +5 -0
- data/lib/backports/1.9.3.rb +6 -1
- data/lib/backports/2.0.0.rb +6 -1
- data/lib/backports/2.0.0/range/size.rb +2 -0
- data/lib/backports/2.1.0.rb +1 -1
- data/lib/backports/2.2.0.rb +1 -1
- data/lib/backports/2.2.0/enumerable/slice_after.rb +1 -1
- data/lib/backports/2.2.0/float/next_float.rb +1 -1
- data/lib/backports/2.2.0/float/prev_float.rb +1 -1
- data/lib/backports/2.2.0/method/super_method.rb +2 -2
- data/lib/backports/2.3.0.rb +1 -1
- data/lib/backports/2.3.0/array/bsearch_index.rb +1 -1
- data/lib/backports/2.3.0/hash/lt.rb +1 -1
- data/lib/backports/2.3.0/hash/lte.rb +1 -1
- data/lib/backports/2.3.0/hash/to_proc.rb +1 -1
- data/lib/backports/2.3.0/struct/dig.rb +1 -2
- data/lib/backports/2.4.0.rb +1 -1
- data/lib/backports/2.4.0/hash/transform_values.rb +2 -2
- data/lib/backports/2.4.0/true_class/dup.rb +0 -1
- data/lib/backports/2.5.0.rb +1 -1
- data/lib/backports/2.5.0/hash/transform_keys.rb +1 -1
- data/lib/backports/2.5.0/integer/sqrt.rb +2 -2
- data/lib/backports/2.5.0/module/alias_method.rb +0 -1
- data/lib/backports/2.5.0/string/undump.rb +3 -7
- data/lib/backports/2.5.0/struct/new.rb +1 -1
- data/lib/backports/2.6.0.rb +1 -1
- data/lib/backports/2.6.0/enumerable/chain.rb +4 -1
- data/lib/backports/2.6.0/hash/to_h.rb +1 -1
- data/lib/backports/2.6.0/range.rb +3 -0
- data/lib/backports/2.6.0/range/cover.rb +22 -0
- data/lib/backports/2.7.0.rb +1 -1
- data/lib/backports/2.7.0/enumerable/filter_map.rb +2 -2
- data/lib/backports/rails/array.rb +4 -0
- data/lib/backports/rails/enumerable.rb +4 -0
- data/lib/backports/rails/hash.rb +4 -0
- data/lib/backports/rails/kernel.rb +4 -0
- data/lib/backports/rails/module.rb +4 -0
- data/lib/backports/rails/string.rb +4 -0
- data/lib/backports/std_lib.rb +3 -0
- data/lib/backports/tools/deprecation.rb +19 -0
- data/lib/backports/tools/require_relative_dir.rb +6 -1
- data/lib/backports/version.rb +1 -1
- metadata +10 -511
- data/.document +0 -6
- data/.gitignore +0 -9
- data/.gitmodules +0 -6
- data/.irbrc +0 -3
- data/.travis.yml +0 -19
- data/CHANGELOG.rdoc +0 -504
- data/README.rdoc +0 -445
- data/Rakefile +0 -192
- data/default.mspec +0 -14
- data/frozen_old_spec/tags/1.8.6/core/argf/each_line_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/argf/each_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/argf/lines_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/array/append_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/array/collect_spec.rb +0 -7
- data/frozen_old_spec/tags/1.8.6/core/array/rotate_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/array/uniq_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/complex/to_r_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/enumerable/all_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/enumerable/any_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/enumerable/each_entry_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/enumerable/none_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/enumerable/one_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/enumerator/next_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/env/to_h_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/file/join_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/file/lchmod_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/file/new_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/file/open_spec.rb +0 -13
- data/frozen_old_spec/tags/1.8.6/core/file/to_path_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/fixnum/fdiv_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/gc/stress_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/hash/assoc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/hash/constructor_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/hash/default_proc_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/hash/delete_if_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/hash/each_pair_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/hash/eql_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/hash/hash_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/hash/keep_if_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/hash/rassoc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/hash/reject_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/hash/select_spec.rb +0 -8
- data/frozen_old_spec/tags/1.8.6/core/integer/round_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/io/binread_spec.rb +0 -7
- data/frozen_old_spec/tags/1.8.6/core/io/chars_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/io/each_char_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/io/lines_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/io/open_spec.rb +0 -24
- data/frozen_old_spec/tags/1.8.6/core/io/ungetbyte_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.6/core/io/write_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.6/core/kernel/__callee___spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/kernel/__method___spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/kernel/define_singleton_method_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/kernel/public_method_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/kernel/require_relative_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/math/log2_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/math/log_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/class_exec_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/module/module_exec_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/numeric/step_spec.rb +0 -12
- data/frozen_old_spec/tags/1.8.6/core/proc/curry_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.6/core/range/step_spec.rb +0 -12
- data/frozen_old_spec/tags/1.8.6/core/string/getbyte_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/string/partition_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/string/prepend_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/string/rpartition_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/string/setbyte_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.6/core/string/upto_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/symbol/capitalize_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/symbol/comparison_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/symbol/downcase_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/symbol/element_reference_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.6/core/symbol/empty_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/symbol/match_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/symbol/swapcase_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/symbol/to_proc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/symbol/upcase_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/array/append_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/array/keep_if_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/array/rotate_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/array/select_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/array/uniq_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/complex/to_r_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/enumerable/all_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/enumerable/any_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/enumerable/collect_concat_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/enumerable/flat_map_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/enumerable/none_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/enumerable/one_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/env/to_h_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/file/lchmod_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/file/new_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/file/open_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.7/core/file/readlink_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.7/core/file/to_path_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/assoc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/default_proc_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/hash/keep_if_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/hash/merge_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/hash/rassoc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/select_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/to_h_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/update_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/integer/round_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/io/binread_spec.rb +0 -7
- data/frozen_old_spec/tags/1.8.7/core/io/open_spec.rb +0 -32
- data/frozen_old_spec/tags/1.8.7/core/io/ungetbyte_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.7/core/io/write_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.7/core/kernel/__callee___spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.7/core/kernel/define_singleton_method_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/kernel/public_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/kernel/require_relative_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/math/log2_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.7/core/math/log_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/module/alias_method_spec.rb +0 -7
- data/frozen_old_spec/tags/1.8.7/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/module/attr_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/module/include_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/module/remove_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/module/undef_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/proc/curry_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/proc/yield_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.7/core/range/size_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/string/getbyte_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.7/core/string/prepend_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/string/setbyte_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.7/core/struct/new_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/symbol/capitalize_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/symbol/comparison_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/symbol/downcase_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/symbol/element_reference_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.7/core/symbol/empty_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/symbol/match_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/symbol/swapcase_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/symbol/upcase_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/array/append_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/array/rotate_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/enumerable/all_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/enumerable/any_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/enumerable/none_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/enumerable/one_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/env/to_h_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/hash/default_proc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/io/write_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/module/alias_method_spec.rb +0 -4
- data/frozen_old_spec/tags/1.9.1/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/module/define_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.9.1/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/array/append_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/enumerable/all_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/enumerable/any_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.2/core/enumerable/none_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/enumerable/one_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/io/write_spec.rb +0 -3
- data/frozen_old_spec/tags/1.9.2/core/module/alias_method_spec.rb +0 -4
- data/frozen_old_spec/tags/1.9.2/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.2/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.2/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.2/core/module/define_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.9.2/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/alias_method_spec.rb +0 -4
- data/frozen_old_spec/tags/1.9.3/core/module/attr_accessor_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/attr_reader_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/attr_writer_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/define_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.9.3/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.0.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.0.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.0.0/core/module/define_method_spec.rb +0 -2
- data/frozen_old_spec/tags/2.0.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.1.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.1.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.1.0/core/module/define_method_spec.rb +0 -2
- data/frozen_old_spec/tags/2.1.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.2.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.2.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.2.0/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.3.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.3.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.3.0/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.5/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.4.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.4.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.4.0/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.5.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.5.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.5.0/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/struct/new_spec.rb +0 -1
- data/set_version/1.8.7.rb +0 -1
- data/set_version/1.9.1.rb +0 -1
- data/set_version/1.9.2.rb +0 -1
- data/set_version/1.9.3.rb +0 -1
- data/set_version/2.0.0.rb +0 -1
- data/set_version/2.1.0.rb +0 -1
- data/set_version/2.2.0.rb +0 -1
- data/set_version/2.3.0.rb +0 -1
- data/set_version/2.4.0.rb +0 -1
- data/set_version/2.5.0.rb +0 -1
- data/set_version/2.6.0.rb +0 -1
- data/set_version/2.7.0.rb +0 -1
- data/set_version/setter.rb +0 -22
- data/spec/tags/1.8.7/core/array/to_h_spec.rb +0 -3
- data/spec/tags/1.8.7/core/enumerable/to_h_spec.rb +0 -2
- data/spec/tags/1.8.7/core/module/attr_spec.rb +0 -1
- data/spec/tags/1.8.7/core/module/include_spec.rb +0 -1
- data/spec/tags/1.9.1/core/array/bsearch_index_spec.rb +0 -1
- data/spec/tags/1.9.1/core/array/rotate_spec.rb +0 -1
- data/spec/tags/1.9.1/core/dir/each_child_spec.rb +0 -1
- data/spec/tags/1.9.1/core/env/to_h_spec.rb +0 -2
- data/spec/tags/1.9.1/core/hash/default_proc_spec.rb +0 -1
- data/spec/tags/1.9.1/core/hash/slice_spec.rb +0 -1
- data/spec/tags/1.9.1/core/hash/transform_keys_spec.rb +0 -2
- data/spec/tags/1.9.1/core/hash/transform_values_spec.rb +0 -2
- data/spec/tags/1.9.1/core/io/write_spec.rb +0 -3
- data/spec/tags/1.9.1/core/kernel/yield_self_spec.rb +0 -1
- data/spec/tags/1.9.1/core/method/curry_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/alias_method_spec.rb +0 -3
- data/spec/tags/1.9.1/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/attr_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/define_method_spec.rb +0 -7
- data/spec/tags/1.9.1/core/string/uplus_spec.rb +0 -1
- data/spec/tags/1.9.1/core/struct/new_spec.rb +0 -2
- data/spec/tags/1.9.2/core/array/bsearch_index_spec.rb +0 -1
- data/spec/tags/1.9.2/core/array/to_h_spec.rb +0 -3
- data/spec/tags/1.9.2/core/dir/each_child_spec.rb +0 -1
- data/spec/tags/1.9.2/core/enumerable/to_h_spec.rb +0 -2
- data/spec/tags/1.9.2/core/hash/slice_spec.rb +0 -1
- data/spec/tags/1.9.2/core/hash/to_h_spec.rb +0 -3
- data/spec/tags/1.9.2/core/hash/transform_keys_spec.rb +0 -2
- data/spec/tags/1.9.2/core/hash/transform_values_spec.rb +0 -2
- data/spec/tags/1.9.2/core/io/write_spec.rb +0 -3
- data/spec/tags/1.9.2/core/kernel/then_spec.rb +0 -1
- data/spec/tags/1.9.2/core/kernel/yield_self_spec.rb +0 -1
- data/spec/tags/1.9.2/core/method/curry_spec.rb +0 -1
- data/spec/tags/1.9.2/core/module/alias_method_spec.rb +0 -3
- data/spec/tags/1.9.2/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/1.9.2/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/1.9.2/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/1.9.2/core/module/define_method_spec.rb +0 -7
- data/spec/tags/1.9.2/core/module/include_spec.rb +0 -1
- data/spec/tags/1.9.2/core/string/uplus_spec.rb +0 -1
- data/spec/tags/1.9.2/core/struct/new_spec.rb +0 -2
- data/spec/tags/1.9.3/core/array/bsearch_index_spec.rb +0 -1
- data/spec/tags/1.9.3/core/array/to_h_spec.rb +0 -3
- data/spec/tags/1.9.3/core/dir/each_child_spec.rb +0 -1
- data/spec/tags/1.9.3/core/enumerable/grep_v_spec.rb +0 -2
- data/spec/tags/1.9.3/core/enumerable/to_h_spec.rb +0 -2
- data/spec/tags/1.9.3/core/enumerator/produce_spec.rb +0 -1
- data/spec/tags/1.9.3/core/hash/slice_spec.rb +0 -1
- data/spec/tags/1.9.3/core/hash/to_h_spec.rb +0 -3
- data/spec/tags/1.9.3/core/hash/transform_keys_spec.rb +0 -2
- data/spec/tags/1.9.3/core/hash/transform_values_spec.rb +0 -2
- data/spec/tags/1.9.3/core/io/write_spec.rb +0 -3
- data/spec/tags/1.9.3/core/kernel/then_spec.rb +0 -1
- data/spec/tags/1.9.3/core/kernel/yield_self_spec.rb +0 -1
- data/spec/tags/1.9.3/core/method/curry_spec.rb +0 -1
- data/spec/tags/1.9.3/core/module/alias_method_spec.rb +0 -3
- data/spec/tags/1.9.3/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/1.9.3/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/1.9.3/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/1.9.3/core/module/define_method_spec.rb +0 -7
- data/spec/tags/1.9.3/core/module/include_spec.rb +0 -1
- data/spec/tags/1.9.3/core/string/uplus_spec.rb +0 -1
- data/spec/tags/1.9.3/core/struct/new_spec.rb +0 -2
- data/spec/tags/2.0.0/core/array/to_h_spec.rb +0 -3
- data/spec/tags/2.0.0/core/enumerable/grep_v_spec.rb +0 -2
- data/spec/tags/2.0.0/core/enumerable/to_h_spec.rb +0 -2
- data/spec/tags/2.0.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.0.0/core/hash/to_h_spec.rb +0 -3
- data/spec/tags/2.0.0/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/define_method_spec.rb +0 -5
- data/spec/tags/2.0.0/core/module/include_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/undef_method_spec.rb +0 -2
- data/spec/tags/2.0.0/core/string/uplus_spec.rb +0 -1
- data/spec/tags/2.0.0/core/struct/new_spec.rb +0 -3
- data/spec/tags/2.1.0/core/array/union_spec.rb +0 -1
- data/spec/tags/2.1.0/core/enumerable/grep_v_spec.rb +0 -2
- data/spec/tags/2.1.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.1.0/core/hash/to_h_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/define_method_spec.rb +0 -5
- data/spec/tags/2.1.0/core/module/undef_method_spec.rb +0 -2
- data/spec/tags/2.1.0/core/string/uplus_spec.rb +0 -1
- data/spec/tags/2.1.0/core/struct/new_spec.rb +0 -3
- data/spec/tags/2.2.0/core/enumerable/grep_v_spec.rb +0 -2
- data/spec/tags/2.2.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.2.0/core/hash/to_h_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/define_method_spec.rb +0 -5
- data/spec/tags/2.2.0/core/module/undef_method_spec.rb +0 -2
- data/spec/tags/2.2.0/core/string/uplus_spec.rb +0 -1
- data/spec/tags/2.2.0/core/struct/new_spec.rb +0 -3
- data/spec/tags/2.3.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.3.0/core/hash/to_h_spec.rb +0 -1
- data/spec/tags/2.3.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.3.0/core/string/uplus_spec.rb +0 -1
- data/spec/tags/2.3.0/core/struct/new_spec.rb +0 -3
- data/spec/tags/2.4.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.4.0/core/hash/to_h_spec.rb +0 -1
- data/spec/tags/2.4.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.4.0/core/struct/new_spec.rb +0 -1
- data/spec/tags/2.5.0/core/hash/to_h_spec.rb +0 -1
- data/test/README +0 -2
- data/test/_backport_guards_test.rb +0 -152
- data/test/bit_length_test.rb +0 -11
- data/test/lazy_test.rb +0 -487
- data/test/socket_interaction_test.rb +0 -9
- data/test/test_helper.rb +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#slice uses the regular Hash#[] method, even on subclasses that override it
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Kernel#then returns a sized Enumerator when no block given
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Kernel#yield_self returns a sized Enumerator when no block given
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Method#curry with optional arity argument raises ArgumentError when the method requires less arguments than the given arity
|
@@ -1,3 +0,0 @@
|
|
1
|
-
fails:Module#alias_method aliasing special methods keeps initialize_clone private when aliasing
|
2
|
-
fails:Module#alias_method aliasing special methods keeps initialize_dup private when aliasing
|
3
|
-
fails:Module#alias_method aliasing special methods keeps respond_to_missing? private when aliasing
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_accessor not allows creating an attr_accessor on an immediate class
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_reader not allows for adding an attr_reader to an immediate
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_writer not allows for adding an attr_writer to an immediate
|
@@ -1,7 +0,0 @@
|
|
1
|
-
fails:Module#define_method when name is not a special private name given an UnboundMethod and called from the target module sets the visibility of the method to the current visibility
|
2
|
-
fails:Module#define_method when name is not a special private name given an UnboundMethod and called from another module sets the visibility of the method to public
|
3
|
-
fails:Module#define_method when name is not a special private name passed a block and called from the target module sets the visibility of the method to the current visibility
|
4
|
-
fails:Module#define_method does not use the caller block when no block is given
|
5
|
-
fails:Module#define_method returns its symbol
|
6
|
-
fails:Module#define_method allows an UnboundMethod from a module to be defined on a class
|
7
|
-
fails:Module#define_method allows an UnboundMethod from a module to be defined on another unrelated module
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#include doesn't accept no-arguments
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#slice uses the regular Hash#[] method, even on subclasses that override it
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_accessor not allows creating an attr_accessor on an immediate class
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_reader not allows for adding an attr_reader to an immediate
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr with a boolean argument emits a warning when $VERBOSE is true
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_writer not allows for adding an attr_writer to an immediate
|
@@ -1,5 +0,0 @@
|
|
1
|
-
fails:Module#define_method when name is not a special private name given an UnboundMethod and called from the target module sets the visibility of the method to the current visibility
|
2
|
-
fails:Module#define_method when name is not a special private name passed a block and called from the target module sets the visibility of the method to the current visibility
|
3
|
-
fails:Module#define_method does not use the caller block when no block is given
|
4
|
-
fails:Module#define_method returns its symbol
|
5
|
-
fails:Module#define_method allows an UnboundMethod of a Kernel method retrieved from Object to defined on a BasicObject subclass
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#include doesn't accept no-arguments
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
|
@@ -1,3 +0,0 @@
|
|
1
|
-
fails:Struct.new keyword_init: true option new class instantiation raises ArgumentError when passed not declared keyword argument
|
2
|
-
fails:Struct.new raises ArgumentError when there is a duplicate member
|
3
|
-
fails:Struct.new keyword_init: true option raises when there is a duplicate member
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Array#| acts as if using an intermediate hash to collect values
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#slice uses the regular Hash#[] method, even on subclasses that override it
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#to_h with block raises ArgumentError if block returns longer or shorter array
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_accessor not allows creating an attr_accessor on an immediate class
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_reader not allows for adding an attr_reader to an immediate
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr with a boolean argument emits a warning when $VERBOSE is true
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_writer not allows for adding an attr_writer to an immediate
|
@@ -1,5 +0,0 @@
|
|
1
|
-
fails:Module#define_method when name is not a special private name given an UnboundMethod and called from the target module sets the visibility of the method to the current visibility
|
2
|
-
fails:Module#define_method when name is not a special private name passed a block and called from the target module sets the visibility of the method to the current visibility
|
3
|
-
fails:Module#define_method does not use the caller block when no block is given
|
4
|
-
fails:Module#define_method returns its symbol
|
5
|
-
fails:Module#define_method allows an UnboundMethod of a Kernel method retrieved from Object to defined on a BasicObject subclass
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
|
@@ -1,3 +0,0 @@
|
|
1
|
-
fails:Struct.new keyword_init: true option new class instantiation raises ArgumentError when passed not declared keyword argument
|
2
|
-
fails:Struct.new raises ArgumentError when there is a duplicate member
|
3
|
-
fails:Struct.new keyword_init: true option raises when there is a duplicate member
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#slice uses the regular Hash#[] method, even on subclasses that override it
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#to_h with block raises ArgumentError if block returns longer or shorter array
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_accessor not allows creating an attr_accessor on an immediate class
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_reader not allows for adding an attr_reader to an immediate
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr with a boolean argument emits a warning when $VERBOSE is true
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr_writer not allows for adding an attr_writer to an immediate
|
@@ -1,5 +0,0 @@
|
|
1
|
-
fails:Module#define_method when name is not a special private name given an UnboundMethod and called from the target module sets the visibility of the method to the current visibility
|
2
|
-
fails:Module#define_method when name is not a special private name passed a block and called from the target module sets the visibility of the method to the current visibility
|
3
|
-
fails:Module#define_method does not use the caller block when no block is given
|
4
|
-
fails:Module#define_method returns its symbol
|
5
|
-
fails:Module#define_method allows an UnboundMethod of a Kernel method retrieved from Object to defined on a BasicObject subclass
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
|
@@ -1,3 +0,0 @@
|
|
1
|
-
fails:Struct.new keyword_init: true option new class instantiation raises ArgumentError when passed not declared keyword argument
|
2
|
-
fails:Struct.new raises ArgumentError when there is a duplicate member
|
3
|
-
fails:Struct.new keyword_init: true option raises when there is a duplicate member
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#slice uses the regular Hash#[] method, even on subclasses that override it
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#to_h with block raises ArgumentError if block returns longer or shorter array
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr with a boolean argument emits a warning when $VERBOSE is true
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
|
@@ -1,3 +0,0 @@
|
|
1
|
-
fails:Struct.new keyword_init: true option new class instantiation raises ArgumentError when passed not declared keyword argument
|
2
|
-
fails:Struct.new raises ArgumentError when there is a duplicate member
|
3
|
-
fails:Struct.new keyword_init: true option raises when there is a duplicate member
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#slice uses the regular Hash#[] method, even on subclasses that override it
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#to_h with block raises ArgumentError if block returns longer or shorter array
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Module#attr with a boolean argument emits a warning when $VERBOSE is true
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Struct.new keyword_init: true option new class instantiation raises ArgumentError when passed not declared keyword argument
|
@@ -1 +0,0 @@
|
|
1
|
-
fails:Hash#to_h with block raises ArgumentError if block returns longer or shorter array
|
data/test/README
DELETED
@@ -1,152 +0,0 @@
|
|
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 require_with_backports require_without_backports] # 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 to_hash(key_value_pairs)
|
39
|
-
h = {}
|
40
|
-
key_value_pairs.each{|k,v| h[k] = v}
|
41
|
-
h
|
42
|
-
end
|
43
|
-
|
44
|
-
# This returns all user defined methods on klass.
|
45
|
-
# For Ruby 1.8.7 or below, it returns all methods, so we can at least check we are not adding new methods needlessly
|
46
|
-
def class_signature(klass)
|
47
|
-
list =
|
48
|
-
(klass.instance_methods - EXCLUDE).map{|m| [m, klass.instance_method(m)] } +
|
49
|
-
(klass.methods - EXCLUDE).map{|m| [".#{m}", klass.method(m) ]}
|
50
|
-
list.select!{|name, method| method.source_location } if UnboundMethod.method_defined? :source_location
|
51
|
-
to_hash(list)
|
52
|
-
end
|
53
|
-
|
54
|
-
CLASSES = [Array, Binding, Bignum, Dir, Comparable, Enumerable, FalseClass, Fixnum, Float, GC,
|
55
|
-
Hash, Integer, IO, Kernel, Math, MatchData, Method, Module, NilClass, Numeric,
|
56
|
-
ObjectSpace, Proc, Process, Range, Regexp, String, Struct, Symbol, TrueClass] +
|
57
|
-
[ENV, ARGF].map{|obj| class << obj; self; end }
|
58
|
-
|
59
|
-
case RUBY_VERSION
|
60
|
-
when '1.8.6'
|
61
|
-
when '1.8.7'
|
62
|
-
CLASSES << Enumerable::Enumerator
|
63
|
-
else
|
64
|
-
CLASSES << Enumerator
|
65
|
-
end
|
66
|
-
|
67
|
-
def digest
|
68
|
-
to_hash(
|
69
|
-
CLASSES.map { |klass| [klass, class_signature(klass)] }
|
70
|
-
)
|
71
|
-
end
|
72
|
-
|
73
|
-
def digest_delta(before, after)
|
74
|
-
delta = {}
|
75
|
-
before.each do |klass, methods|
|
76
|
-
compare = after[klass]
|
77
|
-
d = methods.map do |name, unbound|
|
78
|
-
name unless unbound == compare[name]
|
79
|
-
end + (compare.map(&:first) - methods.map(&:first))
|
80
|
-
d.compact!
|
81
|
-
delta[klass] = d unless d.empty?
|
82
|
-
end
|
83
|
-
delta unless delta.empty?
|
84
|
-
end
|
85
|
-
|
86
|
-
# Order super important!
|
87
|
-
def test__1_abbrev_can_be_required_before_backports
|
88
|
-
assert require('abbrev')
|
89
|
-
assert !$LOADED_FEATURES.include?('backports')
|
90
|
-
end
|
91
|
-
|
92
|
-
# Order super important!
|
93
|
-
def test__2_backports_wont_override_unnecessarily
|
94
|
-
before = digest
|
95
|
-
latest = "2.4.0"
|
96
|
-
if RUBY_VERSION > '1.8.6'
|
97
|
-
main_version = [RUBY_VERSION, latest].min
|
98
|
-
unless File.exist?(File.expand_path("../../lib/backports/#{main_version}.rb", __FILE__))
|
99
|
-
main_version = main_version.sub(/\.\d+$/, '.0')
|
100
|
-
end
|
101
|
-
require "backports/#{main_version}"
|
102
|
-
after = digest
|
103
|
-
assert_nil digest_delta(before, after)
|
104
|
-
end
|
105
|
-
if RUBY_VERSION < latest
|
106
|
-
require "backports"
|
107
|
-
after = digest
|
108
|
-
assert !digest_delta(before, after).nil?
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
if RUBY_VERSION < '2.7' # e2mmap was dropped in 2.7, and matrix reimpl depends on it
|
113
|
-
def test_setlib_load_correctly_after_requiring_backports
|
114
|
-
path = File.expand_path("../../lib/backports/1.9.2/stdlib/matrix.rb", __FILE__)
|
115
|
-
assert_equal false, $LOADED_FEATURES.include?(path)
|
116
|
-
assert_equal true, require('matrix')
|
117
|
-
assert_equal true, $bogus.include?("matrix")
|
118
|
-
assert_equal true, $LOADED_FEATURES.include?(path)
|
119
|
-
assert_equal false, require('matrix')
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_setlib_load_correctly_before_requiring_backports_test
|
124
|
-
assert_equal true, $bogus.include?("abbrev")
|
125
|
-
path = File.expand_path("../../lib/backports/2.0.0/stdlib/abbrev.rb", __FILE__)
|
126
|
-
assert_equal true, $LOADED_FEATURES.include?(path)
|
127
|
-
assert_equal false, require('abbrev')
|
128
|
-
end
|
129
|
-
|
130
|
-
if RUBY_VERSION < '2.7' # scanf was dropped in 2.7
|
131
|
-
def test_backports_does_not_interfere_for_libraries_without_backports_test
|
132
|
-
assert_equal true, require('scanf')
|
133
|
-
assert_equal false, require('scanf')
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_load_correctly_new_libraries_test
|
138
|
-
path = File.expand_path("../../lib/backports/2.0.0/stdlib/fake_stdlib_lib.rb", __FILE__)
|
139
|
-
assert_equal false, $LOADED_FEATURES.include?(path)
|
140
|
-
assert_equal true, require('fake_stdlib_lib')
|
141
|
-
assert_equal true, $LOADED_FEATURES.include?(path)
|
142
|
-
assert_equal false, require('fake_stdlib_lib')
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_no_warnings
|
146
|
-
require 'ostruct'
|
147
|
-
require 'set'
|
148
|
-
require 'backports/1.8.7/array/each'
|
149
|
-
require 'backports/1.8.7/enumerator/next'
|
150
|
-
assert_equal 1, [1,2,3].each.next # [Bug #70]
|
151
|
-
end
|
152
|
-
end
|
data/test/bit_length_test.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require './test/test_helper'
|
2
|
-
|
3
|
-
class BitLengthTest < Test::Unit::TestCase
|
4
|
-
def test_big_num # Issue #95
|
5
|
-
require 'backports/2.1.0/bignum/bit_length'
|
6
|
-
r = 91178362617816881166579720176198217549251305244541026425489888079462471837807
|
7
|
-
assert_equal 256, r.bit_length
|
8
|
-
r = 57896044618658097711785492504343953926634992332820282019728792003956564819968
|
9
|
-
assert_equal 256, r.bit_length
|
10
|
-
end
|
11
|
-
end
|
data/test/lazy_test.rb
DELETED
@@ -1,487 +0,0 @@
|
|
1
|
-
# This is copied & modified from MRI
|
2
|
-
require './test/test_helper'
|
3
|
-
|
4
|
-
class TestLazyEnumerator < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
require "backports/2.0.0/enumerable/lazy"
|
7
|
-
require "backports/1.8.7/enumerable"
|
8
|
-
require "backports/1.8.7/io/each"
|
9
|
-
end
|
10
|
-
|
11
|
-
class Step
|
12
|
-
include Enumerable
|
13
|
-
attr_reader :current, :args
|
14
|
-
|
15
|
-
def initialize(enum)
|
16
|
-
@enum = enum
|
17
|
-
@current = nil
|
18
|
-
@args = nil
|
19
|
-
end
|
20
|
-
|
21
|
-
def each(*args)
|
22
|
-
@args = args
|
23
|
-
@enum.each {|i| @current = i; yield i}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_initialize
|
28
|
-
assert_equal([1, 2, 3], [1, 2, 3].lazy.to_a)
|
29
|
-
assert_equal([1, 2, 3], Enumerator::Lazy.new([1, 2, 3]){|y, v| y << v}.to_a)
|
30
|
-
assert_raise(ArgumentError) { Enumerator::Lazy.new([1, 2, 3]) }
|
31
|
-
end
|
32
|
-
|
33
|
-
### Backports: Disabled because of Enumerator#each not passing args in MRI < 2.0
|
34
|
-
# def test_each_args
|
35
|
-
# a = Step.new(1..3)
|
36
|
-
# assert_equal(1, a.lazy.each(4).first)
|
37
|
-
# assert_equal([4], a.args)
|
38
|
-
# end
|
39
|
-
|
40
|
-
def test_each_line
|
41
|
-
name = lineno = nil
|
42
|
-
File.open(__FILE__) do |f|
|
43
|
-
f.each("").map do |paragraph|
|
44
|
-
paragraph[/\A\s*(.*)/, 1]
|
45
|
-
end.find do |line|
|
46
|
-
if name = line[/^class\s+(\S+)/, 1]
|
47
|
-
lineno = f.lineno
|
48
|
-
true
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
assert_equal(self.class.name, name)
|
53
|
-
assert_operator(lineno, :>, 2)
|
54
|
-
|
55
|
-
name = lineno = nil
|
56
|
-
File.open(__FILE__) do |f|
|
57
|
-
### Backports: Modified to avoid bug of Enumerator#each not passing args in MRI < 2.0
|
58
|
-
f.each("").lazy.map do |paragraph| #
|
59
|
-
paragraph[/\A\s*(.*)/, 1]
|
60
|
-
end.find do |line|
|
61
|
-
if name = line[/^class\s+(\S+)/, 1]
|
62
|
-
lineno = f.lineno
|
63
|
-
true
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
assert_equal(self.class.name, name)
|
68
|
-
assert_equal(2, lineno)
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_select
|
72
|
-
a = Step.new(1..6)
|
73
|
-
assert_equal(4, a.select {|x| x > 3}.first)
|
74
|
-
assert_equal(6, a.current)
|
75
|
-
assert_equal(4, a.lazy.select {|x| x > 3}.first)
|
76
|
-
assert_equal(4, a.current)
|
77
|
-
|
78
|
-
a = Step.new(['word', nil, 1])
|
79
|
-
assert_raise(TypeError) {a.select {|x| "x"+x}.first}
|
80
|
-
assert_equal(nil, a.current)
|
81
|
-
assert_equal("word", a.lazy.select {|x| "x"+x}.first)
|
82
|
-
assert_equal("word", a.current)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_select_multiple_values
|
86
|
-
e = Enumerator.new { |yielder|
|
87
|
-
for i in 1..5
|
88
|
-
yielder.yield(i, i.to_s)
|
89
|
-
end
|
90
|
-
}
|
91
|
-
### Backport: non lazy version differs on JRuby and MRI
|
92
|
-
assert_equal([[2, "2"], [4, "4"]],
|
93
|
-
e.lazy.select {|x| x[0] % 2 == 0}.force)
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_map
|
97
|
-
a = Step.new(1..3)
|
98
|
-
assert_equal(2, a.map {|x| x * 2}.first)
|
99
|
-
assert_equal(3, a.current)
|
100
|
-
assert_equal(2, a.lazy.map {|x| x * 2}.first)
|
101
|
-
assert_equal(1, a.current)
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_flat_map
|
105
|
-
a = Step.new(1..3)
|
106
|
-
assert_equal(2, a.flat_map {|x| [x * 2]}.first)
|
107
|
-
assert_equal(3, a.current)
|
108
|
-
assert_equal(2, a.lazy.flat_map {|x| [x * 2]}.first)
|
109
|
-
assert_equal(1, a.current)
|
110
|
-
end if [].respond_to?(:flat_map)
|
111
|
-
|
112
|
-
def test_flat_map_nested
|
113
|
-
a = Step.new(1..3)
|
114
|
-
assert_equal([1, "a"],
|
115
|
-
a.flat_map {|x| ("a".."c").map {|y| [x, y]}}.first)
|
116
|
-
assert_equal(3, a.current)
|
117
|
-
assert_equal([1, "a"],
|
118
|
-
a.lazy.flat_map {|x| ("a".."c").lazy.map {|y| [x, y]}}.first)
|
119
|
-
assert_equal(1, a.current)
|
120
|
-
end if [].respond_to?(:flat_map)
|
121
|
-
|
122
|
-
def test_flat_map_to_ary
|
123
|
-
to_ary = Class.new {
|
124
|
-
def initialize(value)
|
125
|
-
@value = value
|
126
|
-
end
|
127
|
-
|
128
|
-
def to_ary
|
129
|
-
[:to_ary, @value]
|
130
|
-
end
|
131
|
-
}
|
132
|
-
assert_equal([:to_ary, 1, :to_ary, 2, :to_ary, 3],
|
133
|
-
[1, 2, 3].flat_map {|x| to_ary.new(x)})
|
134
|
-
assert_equal([:to_ary, 1, :to_ary, 2, :to_ary, 3],
|
135
|
-
[1, 2, 3].lazy.flat_map {|x| to_ary.new(x)}.force)
|
136
|
-
end if [].respond_to?(:flat_map)
|
137
|
-
|
138
|
-
def test_flat_map_non_array
|
139
|
-
assert_equal(["1", "2", "3"], [1, 2, 3].flat_map {|x| x.to_s})
|
140
|
-
assert_equal(["1", "2", "3"], [1, 2, 3].lazy.flat_map {|x| x.to_s}.force)
|
141
|
-
end if [].respond_to?(:flat_map)
|
142
|
-
|
143
|
-
def test_flat_map_hash
|
144
|
-
assert_equal([{?a=>97}, {?b=>98}, {?c=>99}], [?a, ?b, ?c].flat_map {|x| {x=>x.ord}})
|
145
|
-
assert_equal([{?a=>97}, {?b=>98}, {?c=>99}], [?a, ?b, ?c].lazy.flat_map {|x| {x=>x.ord}}.force)
|
146
|
-
end if [].respond_to?(:flat_map)
|
147
|
-
|
148
|
-
def test_reject
|
149
|
-
a = Step.new(1..6)
|
150
|
-
assert_equal(4, a.reject {|x| x < 4}.first)
|
151
|
-
assert_equal(6, a.current)
|
152
|
-
assert_equal(4, a.lazy.reject {|x| x < 4}.first)
|
153
|
-
assert_equal(4, a.current)
|
154
|
-
|
155
|
-
a = Step.new(['word', nil, 1])
|
156
|
-
assert_equal(nil, a.reject {|x| x}.first)
|
157
|
-
assert_equal(1, a.current)
|
158
|
-
assert_equal(nil, a.lazy.reject {|x| x}.first)
|
159
|
-
assert_equal(nil, a.current)
|
160
|
-
end
|
161
|
-
|
162
|
-
def test_reject_multiple_values
|
163
|
-
e = Enumerator.new { |yielder|
|
164
|
-
for i in 1..5
|
165
|
-
yielder.yield(i, i.to_s)
|
166
|
-
end
|
167
|
-
}
|
168
|
-
### Backport: non lazy version differs on JRuby and MRI
|
169
|
-
assert_equal([[2, "2"], [4, "4"]],
|
170
|
-
e.lazy.reject {|x| x[0] % 2 != 0}.force)
|
171
|
-
end
|
172
|
-
|
173
|
-
def test_grep
|
174
|
-
a = Step.new('a'..'f')
|
175
|
-
assert_equal('c', a.grep(/c/).first)
|
176
|
-
assert_equal('f', a.current)
|
177
|
-
assert_equal('c', a.lazy.grep(/c/).first)
|
178
|
-
assert_equal('c', a.current)
|
179
|
-
assert_equal(%w[a e], a.grep(proc {|x| /[aeiou]/ =~ x}))
|
180
|
-
assert_equal(%w[a e], a.lazy.grep(proc {|x| /[aeiou]/ =~ x}).to_a)
|
181
|
-
end
|
182
|
-
|
183
|
-
def test_grep_with_block
|
184
|
-
a = Step.new('a'..'f')
|
185
|
-
assert_equal('C', a.grep(/c/) {|i| i.upcase}.first)
|
186
|
-
assert_equal('C', a.lazy.grep(/c/) {|i| i.upcase}.first)
|
187
|
-
end
|
188
|
-
|
189
|
-
def test_grep_multiple_values
|
190
|
-
e = Enumerator.new { |yielder|
|
191
|
-
3.times { |i|
|
192
|
-
yielder.yield(i, i.to_s)
|
193
|
-
}
|
194
|
-
}
|
195
|
-
### Backport: non lazy version differs on JRuby and MRI
|
196
|
-
assert_equal([[2, "2"]], e.lazy.grep(proc {|x| x == [2, "2"]}).force)
|
197
|
-
assert_equal(["22"],
|
198
|
-
e.lazy.grep(proc {|x| x == [2, "2"]}, &:join).force)
|
199
|
-
end
|
200
|
-
|
201
|
-
def test_zip
|
202
|
-
a = Step.new(1..3)
|
203
|
-
assert_equal([1, "a"], a.zip("a".."c").first)
|
204
|
-
assert_equal(3, a.current)
|
205
|
-
assert_equal([1, "a"], a.lazy.zip("a".."c").first)
|
206
|
-
assert_equal(1, a.current)
|
207
|
-
end
|
208
|
-
|
209
|
-
def test_zip_short_arg
|
210
|
-
a = Step.new(1..5)
|
211
|
-
assert_equal([5, nil], a.zip("a".."c").last)
|
212
|
-
enum = [42].to_enum.next
|
213
|
-
assert_equal([5, nil], a.lazy.zip("a".."d").force.last) ### Backport: modified to avoid fact that 1.8.x's Enumerator auto-rewind
|
214
|
-
end
|
215
|
-
|
216
|
-
def test_zip_without_arg
|
217
|
-
a = Step.new(1..3)
|
218
|
-
assert_equal([1], a.zip.first)
|
219
|
-
assert_equal(3, a.current)
|
220
|
-
avoid_bug_on_jruby = Enumerator.new{|y| y << [1]}.first ### Backport: see https://jira.codehaus.org/browse/JRUBY-7108
|
221
|
-
assert_equal(avoid_bug_on_jruby, a.lazy.zip.first)
|
222
|
-
assert_equal(1, a.current)
|
223
|
-
end
|
224
|
-
|
225
|
-
def test_zip_bad_arg
|
226
|
-
a = Step.new(1..3)
|
227
|
-
assert_raise(TypeError){ a.lazy.zip(42) }
|
228
|
-
end
|
229
|
-
|
230
|
-
def test_zip_with_block
|
231
|
-
# zip should be eager when a block is given
|
232
|
-
a = Step.new(1..3)
|
233
|
-
ary = []
|
234
|
-
assert_equal(nil, a.lazy.zip("a".."c") {|x, y| ary << [x, y]})
|
235
|
-
assert_equal(a.zip("a".."c"), ary)
|
236
|
-
assert_equal(3, a.current)
|
237
|
-
end
|
238
|
-
|
239
|
-
def test_take
|
240
|
-
a = Step.new(1..10)
|
241
|
-
assert_equal(1, a.take(5).first)
|
242
|
-
assert_equal(5, a.current)
|
243
|
-
assert_equal(1, a.lazy.take(5).first)
|
244
|
-
assert_equal(1, a.current)
|
245
|
-
assert_equal((1..5).to_a, a.lazy.take(5).force)
|
246
|
-
assert_equal(5, a.current)
|
247
|
-
a = Step.new(1..10)
|
248
|
-
assert_equal([], a.lazy.take(0).force)
|
249
|
-
assert_equal(nil, a.current)
|
250
|
-
end
|
251
|
-
|
252
|
-
def test_take_recycle
|
253
|
-
bug6428 = '[ruby-dev:45634]'
|
254
|
-
a = Step.new(1..10)
|
255
|
-
take5 = a.lazy.take(5)
|
256
|
-
assert_equal((1..5).to_a, take5.force, bug6428)
|
257
|
-
assert_equal((1..5).to_a, take5.force, bug6428)
|
258
|
-
end
|
259
|
-
|
260
|
-
def test_take_nested
|
261
|
-
bug7696 = '[ruby-core:51470]'
|
262
|
-
a = Step.new(1..10)
|
263
|
-
take5 = a.lazy.take(5)
|
264
|
-
assert_equal([*(1..5)]*5, take5.flat_map{take5}.force, bug7696)
|
265
|
-
end
|
266
|
-
|
267
|
-
def test_drop_while_nested
|
268
|
-
bug7696 = '[ruby-core:51470]'
|
269
|
-
a = Step.new(1..10)
|
270
|
-
drop5 = a.lazy.drop_while{|x| x < 6}
|
271
|
-
assert_equal([*(6..10)]*5, drop5.flat_map{drop5}.force, bug7696)
|
272
|
-
end
|
273
|
-
|
274
|
-
def test_drop_nested
|
275
|
-
bug7696 = '[ruby-core:51470]'
|
276
|
-
a = Step.new(1..10)
|
277
|
-
drop5 = a.lazy.drop(5)
|
278
|
-
assert_equal([*(6..10)]*5, drop5.flat_map{drop5}.force, bug7696)
|
279
|
-
end
|
280
|
-
|
281
|
-
def test_zip_nested
|
282
|
-
bug7696 = '[ruby-core:51470]'
|
283
|
-
enum = ('a'..'z').each
|
284
|
-
enum.next
|
285
|
-
zip = (1..3).lazy.zip(enum, enum)
|
286
|
-
assert_equal([[1, 'a', 'a'], [2, 'b', 'b'], [3, 'c', 'c']]*3, zip.flat_map{zip}.force, bug7696)
|
287
|
-
end
|
288
|
-
|
289
|
-
def test_zip_lazy_on_args
|
290
|
-
zip = Step.new(1..2).lazy.zip(42..Float::INFINITY)
|
291
|
-
assert_equal [[1, 42], [2, 43]], zip.force
|
292
|
-
end
|
293
|
-
|
294
|
-
def test_zip_efficient_on_array_args
|
295
|
-
ary = [42, :foo]
|
296
|
-
[:to_enum, :enum_for, :lazy, :each].each do |forbid|
|
297
|
-
ary.define_singleton_method(forbid){ fail "#{forbid} was called"}
|
298
|
-
end
|
299
|
-
zip = Step.new(1..2).lazy.zip(ary)
|
300
|
-
assert_equal [[1, 42], [2, :foo]], zip.force
|
301
|
-
end
|
302
|
-
|
303
|
-
def test_take_rewound
|
304
|
-
bug7696 = '[ruby-core:51470]'
|
305
|
-
e=(1..42).lazy.take(2)
|
306
|
-
assert_equal 1, e.next
|
307
|
-
assert_equal 2, e.next
|
308
|
-
e.rewind
|
309
|
-
assert_equal 1, e.next
|
310
|
-
assert_equal 2, e.next
|
311
|
-
end
|
312
|
-
|
313
|
-
def test_take_while
|
314
|
-
a = Step.new(1..10)
|
315
|
-
assert_equal(1, a.take_while {|i| i < 5}.first)
|
316
|
-
assert_equal(5, a.current)
|
317
|
-
assert_equal(1, a.lazy.take_while {|i| i < 5}.first)
|
318
|
-
assert_equal(1, a.current)
|
319
|
-
assert_equal((1..4).to_a, a.lazy.take_while {|i| i < 5}.to_a)
|
320
|
-
end
|
321
|
-
|
322
|
-
def test_drop
|
323
|
-
a = Step.new(1..10)
|
324
|
-
assert_equal(6, a.drop(5).first)
|
325
|
-
assert_equal(10, a.current)
|
326
|
-
assert_equal(6, a.lazy.drop(5).first)
|
327
|
-
assert_equal(6, a.current)
|
328
|
-
assert_equal((6..10).to_a, a.lazy.drop(5).to_a)
|
329
|
-
end
|
330
|
-
|
331
|
-
def test_drop_while
|
332
|
-
a = Step.new(1..10)
|
333
|
-
assert_equal(5, a.drop_while {|i| i < 5}.first)
|
334
|
-
assert_equal(10, a.current)
|
335
|
-
assert_equal(5, a.lazy.drop_while {|i| i < 5}.first)
|
336
|
-
assert_equal(5, a.current)
|
337
|
-
assert_equal((5..10).to_a, a.lazy.drop_while {|i| i < 5}.to_a)
|
338
|
-
end
|
339
|
-
|
340
|
-
def test_drop_and_take
|
341
|
-
assert_equal([4, 5], (1..(1.0/0)).lazy.drop(3).take(2).to_a) # Backports: don't rely on INFINITY
|
342
|
-
end
|
343
|
-
|
344
|
-
def test_cycle
|
345
|
-
a = Step.new(1..3)
|
346
|
-
assert_equal("1", a.cycle(2).map{|x| x.to_s}.first)
|
347
|
-
assert_equal(3, a.current)
|
348
|
-
assert_equal("1", a.lazy.cycle(2).map{|x| x.to_s}.first)
|
349
|
-
assert_equal(1, a.current)
|
350
|
-
end
|
351
|
-
|
352
|
-
def test_cycle_with_block
|
353
|
-
# cycle should be eager when a block is given
|
354
|
-
a = Step.new(1..3)
|
355
|
-
ary = []
|
356
|
-
assert_equal(nil, a.lazy.cycle(2) {|i| ary << i})
|
357
|
-
assert_equal(a.cycle(2).to_a, ary)
|
358
|
-
assert_equal(3, a.current)
|
359
|
-
end
|
360
|
-
|
361
|
-
def test_cycle_chain
|
362
|
-
a = 1..3
|
363
|
-
assert_equal([1,2,3,1,2,3,1,2,3,1], a.lazy.cycle.take(10).force)
|
364
|
-
assert_equal([2,2,2,2,2,2,2,2,2,2], a.lazy.cycle.select {|x| x == 2}.take(10).force)
|
365
|
-
assert_equal([2,2,2,2,2,2,2,2,2,2], a.lazy.select {|x| x == 2}.cycle.take(10).force)
|
366
|
-
end
|
367
|
-
|
368
|
-
def test_force
|
369
|
-
assert_equal([1, 2, 3], (1..Float::INFINITY).lazy.take(3).force)
|
370
|
-
end
|
371
|
-
|
372
|
-
def test_inspect
|
373
|
-
return unless Enumerator.to_s == "Enumerator"
|
374
|
-
assert_equal("#<Enumerator::Lazy: 1..10>", (1..10).lazy.inspect)
|
375
|
-
assert_equal('#<Enumerator::Lazy: #<Enumerator: "foo":each_char>>',
|
376
|
-
"foo".each_char.lazy.inspect)
|
377
|
-
assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:map>",
|
378
|
-
(1..10).lazy.map {}.inspect)
|
379
|
-
assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:take(0)>",
|
380
|
-
(1..10).lazy.take(0).inspect)
|
381
|
-
assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:take(3)>",
|
382
|
-
(1..10).lazy.take(3).inspect)
|
383
|
-
assert_equal('#<Enumerator::Lazy: #<Enumerator::Lazy: "a".."c">:grep(/b/)>',
|
384
|
-
("a".."c").lazy.grep(/b/).inspect)
|
385
|
-
assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:cycle(3)>",
|
386
|
-
(1..10).lazy.cycle(3).inspect)
|
387
|
-
assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:cycle>",
|
388
|
-
(1..10).lazy.cycle.inspect)
|
389
|
-
assert_equal("#<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:cycle(3)>",
|
390
|
-
(1..10).lazy.cycle(3).inspect)
|
391
|
-
l = (1..10).lazy.map {}.flat_map {}.select {}.reject {}.grep(1).zip(?a..?c).take(10).take_while {}.drop(3).drop_while {}.cycle(3)
|
392
|
-
### Backport: Modified because I don't think the actual name we were called under in case of aliases is important enough to care
|
393
|
-
assert_equal(<<EOS.chomp, l.inspect)
|
394
|
-
#<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 1..10>:map>:flat_map>:select>:reject>:grep(1)>:zip(\"a\"..\"c\")>:take(10)>:take_while>:drop(3)>:drop_while>:cycle(3)>
|
395
|
-
EOS
|
396
|
-
end if [].respond_to?(:flat_map)
|
397
|
-
|
398
|
-
def test_lazy_to_enum
|
399
|
-
lazy = [1, 2, 3].lazy
|
400
|
-
def lazy.foo(*args)
|
401
|
-
yield args
|
402
|
-
yield args
|
403
|
-
end
|
404
|
-
enum = lazy.to_enum(:foo, :hello, :world)
|
405
|
-
assert_equal Enumerator::Lazy, enum.class
|
406
|
-
# assert_equal nil, enum.size ### Backport: see below
|
407
|
-
assert_equal [[:hello, :world], [:hello, :world]], enum.to_a
|
408
|
-
|
409
|
-
assert_equal [1, 2, 3], lazy.to_enum.to_a
|
410
|
-
end
|
411
|
-
|
412
|
-
### Backport: way too much work to shim #size
|
413
|
-
# def test_size
|
414
|
-
# lazy = [1, 2, 3].lazy
|
415
|
-
# assert_equal 3, lazy.size
|
416
|
-
# assert_equal 42, Enumerator::Lazy.new([],->{42}){}.size
|
417
|
-
# assert_equal 42, Enumerator::Lazy.new([],42){}.size
|
418
|
-
# assert_equal 42, Enumerator::Lazy.new([],42){}.lazy.size
|
419
|
-
# assert_equal 42, lazy.to_enum{ 42 }.size
|
420
|
-
|
421
|
-
# [:map, :collect].each do |m|
|
422
|
-
# assert_equal 3, lazy.send(m){}.size
|
423
|
-
# end
|
424
|
-
# assert_equal 3, lazy.zip([4]).size
|
425
|
-
# [:flat_map, :collect_concat, :select, :find_all, :reject, :take_while, :drop_while].each do |m|
|
426
|
-
# assert_equal nil, lazy.send(m){}.size
|
427
|
-
# end
|
428
|
-
# assert_equal nil, lazy.grep(//).size
|
429
|
-
|
430
|
-
# assert_equal 2, lazy.take(2).size
|
431
|
-
# assert_equal 3, lazy.take(4).size
|
432
|
-
# assert_equal 4, loop.lazy.take(4).size
|
433
|
-
# assert_equal nil, lazy.select{}.take(4).size
|
434
|
-
|
435
|
-
# assert_equal 1, lazy.drop(2).size
|
436
|
-
# assert_equal 0, lazy.drop(4).size
|
437
|
-
# assert_equal Float::INFINITY, loop.lazy.drop(4).size
|
438
|
-
# assert_equal nil, lazy.select{}.drop(4).size
|
439
|
-
|
440
|
-
# assert_equal 0, lazy.cycle(0).size
|
441
|
-
# assert_equal 6, lazy.cycle(2).size
|
442
|
-
# assert_equal 3 << 80, 4.times.inject(lazy){|enum| enum.cycle(1 << 20)}.size
|
443
|
-
# assert_equal Float::INFINITY, lazy.cycle.size
|
444
|
-
# assert_equal Float::INFINITY, loop.lazy.cycle(4).size
|
445
|
-
# assert_equal Float::INFINITY, loop.lazy.cycle.size
|
446
|
-
# assert_equal nil, lazy.select{}.cycle(4).size
|
447
|
-
# assert_equal nil, lazy.select{}.cycle.size
|
448
|
-
# end
|
449
|
-
|
450
|
-
# def test_map_zip
|
451
|
-
# bug7507 = '[ruby-core:50545]'
|
452
|
-
# assert_ruby_status(["-e", "GC.stress = true", "-e", "(1..10).lazy.map{}.zip(){}"], bug7507)
|
453
|
-
# assert_ruby_status(["-e", "GC.stress = true", "-e", "(1..10).lazy.map{}.zip().to_a"], bug7507)
|
454
|
-
# end
|
455
|
-
|
456
|
-
def test_require_block
|
457
|
-
[:select, :reject, :drop_while, :take_while, :map, :flat_map].each do |method|
|
458
|
-
assert_raise(ArgumentError){ [].lazy.send(method) }
|
459
|
-
end
|
460
|
-
end
|
461
|
-
|
462
|
-
def test_laziness_conservation
|
463
|
-
bug7507 = '[ruby-core:51510]'
|
464
|
-
{
|
465
|
-
:slice_before => //,
|
466
|
-
:with_index => [],
|
467
|
-
:cycle => [],
|
468
|
-
:each_with_object => 42,
|
469
|
-
:each_slice => 42,
|
470
|
-
:each_entry => [],
|
471
|
-
:each_cons => 42,
|
472
|
-
}.each do |method, arg|
|
473
|
-
assert_equal Enumerator::Lazy, [].lazy.send(method, *arg).class, method if [].respond_to?(method)
|
474
|
-
end
|
475
|
-
assert_equal Enumerator::Lazy, [].lazy.chunk{}.class, bug7507
|
476
|
-
end
|
477
|
-
|
478
|
-
### Backport: assert_warning not defined, we're ok anyways
|
479
|
-
# def test_no_warnings
|
480
|
-
# le = (1..3).lazy
|
481
|
-
# assert_warning("") {le.zip([4,5,6]).force}
|
482
|
-
# assert_warning("") {le.zip(4..6).force}
|
483
|
-
# assert_warning("") {le.take(1).force}
|
484
|
-
# assert_warning("") {le.drop(1).force}
|
485
|
-
# assert_warning("") {le.drop_while{false}.force}
|
486
|
-
# end
|
487
|
-
end
|