[macruby-changes] [3229] MacRuby/trunk/spec/frozen

source_changes at macosforge.org source_changes at macosforge.org
Sun Jan 10 12:52:39 PST 2010


Revision: 3229
          http://trac.macosforge.org/projects/ruby/changeset/3229
Author:   eloy.de.enige at gmail.com
Date:     2010-01-10 12:52:37 -0800 (Sun, 10 Jan 2010)
Log Message:
-----------
Updated frozen RubySpec to df1eedf81d8bf3c2274f36730fd6f3ffa4076a12

Modified Paths:
--------------
    MacRuby/trunk/spec/frozen/command_line/dash_e_spec.rb
    MacRuby/trunk/spec/frozen/core/argf/close_spec.rb
    MacRuby/trunk/spec/frozen/core/argf/rewind_spec.rb
    MacRuby/trunk/spec/frozen/core/argf/shared/gets.rb
    MacRuby/trunk/spec/frozen/core/array/combination_spec.rb
    MacRuby/trunk/spec/frozen/core/array/compact_spec.rb
    MacRuby/trunk/spec/frozen/core/array/constructor_spec.rb
    MacRuby/trunk/spec/frozen/core/array/element_reference_spec.rb
    MacRuby/trunk/spec/frozen/core/array/first_spec.rb
    MacRuby/trunk/spec/frozen/core/array/flatten_spec.rb
    MacRuby/trunk/spec/frozen/core/array/frozen_spec.rb
    MacRuby/trunk/spec/frozen/core/array/hash_spec.rb
    MacRuby/trunk/spec/frozen/core/array/intersection_spec.rb
    MacRuby/trunk/spec/frozen/core/array/last_spec.rb
    MacRuby/trunk/spec/frozen/core/array/minus_spec.rb
    MacRuby/trunk/spec/frozen/core/array/multiply_spec.rb
    MacRuby/trunk/spec/frozen/core/array/new_spec.rb
    MacRuby/trunk/spec/frozen/core/array/partition_spec.rb
    MacRuby/trunk/spec/frozen/core/array/permutation_spec.rb
    MacRuby/trunk/spec/frozen/core/array/plus_spec.rb
    MacRuby/trunk/spec/frozen/core/array/pop_spec.rb
    MacRuby/trunk/spec/frozen/core/array/reject_spec.rb
    MacRuby/trunk/spec/frozen/core/array/reverse_spec.rb
    MacRuby/trunk/spec/frozen/core/array/sample_spec.rb
    MacRuby/trunk/spec/frozen/core/array/select_spec.rb
    MacRuby/trunk/spec/frozen/core/array/shared/clone.rb
    MacRuby/trunk/spec/frozen/core/array/shared/collect.rb
    MacRuby/trunk/spec/frozen/core/array/shared/slice.rb
    MacRuby/trunk/spec/frozen/core/array/shift_spec.rb
    MacRuby/trunk/spec/frozen/core/array/shuffle_spec.rb
    MacRuby/trunk/spec/frozen/core/array/sort_by_spec.rb
    MacRuby/trunk/spec/frozen/core/array/sort_spec.rb
    MacRuby/trunk/spec/frozen/core/array/to_a_spec.rb
    MacRuby/trunk/spec/frozen/core/array/transpose_spec.rb
    MacRuby/trunk/spec/frozen/core/array/try_convert_spec.rb
    MacRuby/trunk/spec/frozen/core/array/union_spec.rb
    MacRuby/trunk/spec/frozen/core/array/uniq_spec.rb
    MacRuby/trunk/spec/frozen/core/array/values_at_spec.rb
    MacRuby/trunk/spec/frozen/core/array/zip_spec.rb
    MacRuby/trunk/spec/frozen/core/bignum/bit_and_spec.rb
    MacRuby/trunk/spec/frozen/core/bignum/bit_or_spec.rb
    MacRuby/trunk/spec/frozen/core/bignum/bit_xor_spec.rb
    MacRuby/trunk/spec/frozen/core/bignum/comparison_spec.rb
    MacRuby/trunk/spec/frozen/core/bignum/exponent_spec.rb
    MacRuby/trunk/spec/frozen/core/bignum/shared/modulo.rb
    MacRuby/trunk/spec/frozen/core/binding/eval_spec.rb
    MacRuby/trunk/spec/frozen/core/continuation/continuation_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/chroot_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/close_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/delete_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/each_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/element_reference_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/entries_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/exist_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/exists_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/fixtures/common.rb
    MacRuby/trunk/spec/frozen/core/dir/foreach_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/getwd_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/glob_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/home_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/inspect_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/mkdir_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/new_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/open_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/path_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/pos_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/pwd_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/read_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/rewind_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/rmdir_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/seek_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/shared/delete.rb
    MacRuby/trunk/spec/frozen/core/dir/shared/glob.rb
    MacRuby/trunk/spec/frozen/core/dir/shared/open.rb
    MacRuby/trunk/spec/frozen/core/dir/tell_spec.rb
    MacRuby/trunk/spec/frozen/core/dir/to_path.rb
    MacRuby/trunk/spec/frozen/core/dir/unlink_spec.rb
    MacRuby/trunk/spec/frozen/core/encoding/locale_charmap_spec.rb
    MacRuby/trunk/spec/frozen/core/enumerable/each_with_object_spec.rb
    MacRuby/trunk/spec/frozen/core/enumerator/new_spec.rb
    MacRuby/trunk/spec/frozen/core/enumerator/rewind_spec.rb
    MacRuby/trunk/spec/frozen/core/enumerator/with_object_spec.rb
    MacRuby/trunk/spec/frozen/core/env/clear_spec.rb
    MacRuby/trunk/spec/frozen/core/env/reject_spec.rb
    MacRuby/trunk/spec/frozen/core/exception/exception_spec.rb
    MacRuby/trunk/spec/frozen/core/exception/fixtures/common.rb
    MacRuby/trunk/spec/frozen/core/exception/no_method_error_spec.rb
    MacRuby/trunk/spec/frozen/core/exception/shared/new.rb
    MacRuby/trunk/spec/frozen/core/fiber/alive_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/fiber/current_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/fiber/resume_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/fiber/shared/resume.rb
    MacRuby/trunk/spec/frozen/core/fiber/transfer_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/file/atime_spec.rb
    MacRuby/trunk/spec/frozen/core/file/basename_spec.rb
    MacRuby/trunk/spec/frozen/core/file/chmod_spec.rb
    MacRuby/trunk/spec/frozen/core/file/chown_spec.rb
    MacRuby/trunk/spec/frozen/core/file/ctime_spec.rb
    MacRuby/trunk/spec/frozen/core/file/dirname_spec.rb
    MacRuby/trunk/spec/frozen/core/file/fixtures/file_types.rb
    MacRuby/trunk/spec/frozen/core/file/flock_spec.rb
    MacRuby/trunk/spec/frozen/core/file/ftype_spec.rb
    MacRuby/trunk/spec/frozen/core/file/lchmod_spec.rb
    MacRuby/trunk/spec/frozen/core/file/lchown_spec.rb
    MacRuby/trunk/spec/frozen/core/file/link_spec.rb
    MacRuby/trunk/spec/frozen/core/file/lstat_spec.rb
    MacRuby/trunk/spec/frozen/core/file/mtime_spec.rb
    MacRuby/trunk/spec/frozen/core/file/new_spec.rb
    MacRuby/trunk/spec/frozen/core/file/open_spec.rb
    MacRuby/trunk/spec/frozen/core/file/path_spec.rb
    MacRuby/trunk/spec/frozen/core/file/readlink_spec.rb
    MacRuby/trunk/spec/frozen/core/file/rename_spec.rb
    MacRuby/trunk/spec/frozen/core/file/reopen_spec.rb
    MacRuby/trunk/spec/frozen/core/file/setgid_spec.rb
    MacRuby/trunk/spec/frozen/core/file/setuid_spec.rb
    MacRuby/trunk/spec/frozen/core/file/shared/open.rb
    MacRuby/trunk/spec/frozen/core/file/shared/stat.rb
    MacRuby/trunk/spec/frozen/core/file/shared/unlink.rb
    MacRuby/trunk/spec/frozen/core/file/size_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/atime_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/blksize_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/blocks_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/comparison_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/ctime_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/ftype_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/gid_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/ino_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/inspect_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/mode_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/mtime_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/new_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/nlink_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat/uid_spec.rb
    MacRuby/trunk/spec/frozen/core/file/stat_spec.rb
    MacRuby/trunk/spec/frozen/core/file/sticky_spec.rb
    MacRuby/trunk/spec/frozen/core/file/symlink_spec.rb
    MacRuby/trunk/spec/frozen/core/file/to_path_spec.rb
    MacRuby/trunk/spec/frozen/core/file/truncate_spec.rb
    MacRuby/trunk/spec/frozen/core/file/umask_spec.rb
    MacRuby/trunk/spec/frozen/core/file/utime_spec.rb
    MacRuby/trunk/spec/frozen/core/filetest/sticky_spec.rb
    MacRuby/trunk/spec/frozen/core/fixnum/exponent_spec.rb
    MacRuby/trunk/spec/frozen/core/fixnum/multiply_spec.rb
    MacRuby/trunk/spec/frozen/core/float/comparison_spec.rb
    MacRuby/trunk/spec/frozen/core/float/exponent_spec.rb
    MacRuby/trunk/spec/frozen/core/gc/disable_spec.rb
    MacRuby/trunk/spec/frozen/core/gc/enable_spec.rb
    MacRuby/trunk/spec/frozen/core/gc/garbage_collect_spec.rb
    MacRuby/trunk/spec/frozen/core/gc/start_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/constructor_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/default_proc_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/key_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/keys_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/merge_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/reject_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/shift_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/to_a_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/try_convert_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/values_at_spec.rb
    MacRuby/trunk/spec/frozen/core/hash/values_spec.rb
    MacRuby/trunk/spec/frozen/core/io/close_read_spec.rb
    MacRuby/trunk/spec/frozen/core/io/fixtures/classes.rb
    MacRuby/trunk/spec/frozen/core/io/gets_spec.rb
    MacRuby/trunk/spec/frozen/core/io/pos_spec.rb
    MacRuby/trunk/spec/frozen/core/io/read_nonblock_spec.rb
    MacRuby/trunk/spec/frozen/core/io/read_spec.rb
    MacRuby/trunk/spec/frozen/core/io/reopen_spec.rb
    MacRuby/trunk/spec/frozen/core/io/select_spec.rb
    MacRuby/trunk/spec/frozen/core/io/shared/new.rb
    MacRuby/trunk/spec/frozen/core/io/shared/pos.rb
    MacRuby/trunk/spec/frozen/core/io/shared/write.rb
    MacRuby/trunk/spec/frozen/core/io/stat_spec.rb
    MacRuby/trunk/spec/frozen/core/io/sysopen_spec.rb
    MacRuby/trunk/spec/frozen/core/io/sysread_spec.rb
    MacRuby/trunk/spec/frozen/core/io/syswrite_spec.rb
    MacRuby/trunk/spec/frozen/core/io/try_convert_spec.rb
    MacRuby/trunk/spec/frozen/core/io/write_nonblock_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/io/write_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/String_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/backtick_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/callcc_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/catch_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/eval_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb
    MacRuby/trunk/spec/frozen/core/kernel/freeze_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/instance_eval_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/instance_variables_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/load_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/method_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/open_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/p_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/public_send_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/require_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/shared/lambda.rb
    MacRuby/trunk/spec/frozen/core/kernel/shared/object_id.rb
    MacRuby/trunk/spec/frozen/core/kernel/shared/send.rb
    MacRuby/trunk/spec/frozen/core/kernel/spawn_spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/taint_spec.rb
    MacRuby/trunk/spec/frozen/core/marshal/dump_spec.rb
    MacRuby/trunk/spec/frozen/core/marshal/fixtures/marshal_data.rb
    MacRuby/trunk/spec/frozen/core/marshal/load_spec.rb
    MacRuby/trunk/spec/frozen/core/matchdata/regexp_spec.rb
    MacRuby/trunk/spec/frozen/core/math/acos_spec.rb
    MacRuby/trunk/spec/frozen/core/math/acosh_spec.rb
    MacRuby/trunk/spec/frozen/core/math/asin_spec.rb
    MacRuby/trunk/spec/frozen/core/math/asinh_spec.rb
    MacRuby/trunk/spec/frozen/core/math/atan2_spec.rb
    MacRuby/trunk/spec/frozen/core/math/atan_spec.rb
    MacRuby/trunk/spec/frozen/core/math/atanh_spec.rb
    MacRuby/trunk/spec/frozen/core/math/cos_spec.rb
    MacRuby/trunk/spec/frozen/core/math/cosh_spec.rb
    MacRuby/trunk/spec/frozen/core/math/erf_spec.rb
    MacRuby/trunk/spec/frozen/core/math/erfc_spec.rb
    MacRuby/trunk/spec/frozen/core/math/exp_spec.rb
    MacRuby/trunk/spec/frozen/core/math/hypot_spec.rb
    MacRuby/trunk/spec/frozen/core/math/ldexp_spec.rb
    MacRuby/trunk/spec/frozen/core/math/log10_spec.rb
    MacRuby/trunk/spec/frozen/core/math/log_spec.rb
    MacRuby/trunk/spec/frozen/core/math/sin_spec.rb
    MacRuby/trunk/spec/frozen/core/math/sinh_spec.rb
    MacRuby/trunk/spec/frozen/core/math/sqrt_spec.rb
    MacRuby/trunk/spec/frozen/core/math/tan_spec.rb
    MacRuby/trunk/spec/frozen/core/math/tanh_spec.rb
    MacRuby/trunk/spec/frozen/core/method/shared/to_s.rb
    MacRuby/trunk/spec/frozen/core/method/unbind_spec.rb
    MacRuby/trunk/spec/frozen/core/module/define_method_spec.rb
    MacRuby/trunk/spec/frozen/core/module/instance_method_spec.rb
    MacRuby/trunk/spec/frozen/core/module/private_spec.rb
    MacRuby/trunk/spec/frozen/core/object/new_spec.rb
    MacRuby/trunk/spec/frozen/core/objectspace/garbage_collect_spec.rb
    MacRuby/trunk/spec/frozen/core/proc/binding_spec.rb
    MacRuby/trunk/spec/frozen/core/proc/call_spec.rb
    MacRuby/trunk/spec/frozen/core/proc/case_compare_spec.rb
    MacRuby/trunk/spec/frozen/core/proc/curry_spec.rb
    MacRuby/trunk/spec/frozen/core/proc/element_reference_spec.rb
    MacRuby/trunk/spec/frozen/core/proc/shared/call.rb
    MacRuby/trunk/spec/frozen/core/proc/yield_spec.rb
    MacRuby/trunk/spec/frozen/core/process/abort_spec.rb
    MacRuby/trunk/spec/frozen/core/process/detach_spec.rb
    MacRuby/trunk/spec/frozen/core/process/euid_spec.rb
    MacRuby/trunk/spec/frozen/core/process/fork_spec.rb
    MacRuby/trunk/spec/frozen/core/process/getpriority_spec.rb
    MacRuby/trunk/spec/frozen/core/process/maxgroups_spec.rb
    MacRuby/trunk/spec/frozen/core/process/pid_spec.rb
    MacRuby/trunk/spec/frozen/core/process/wait_spec.rb
    MacRuby/trunk/spec/frozen/core/process/waitall_spec.rb
    MacRuby/trunk/spec/frozen/core/range/cover_spec.rb
    MacRuby/trunk/spec/frozen/core/range/step_spec.rb
    MacRuby/trunk/spec/frozen/core/regexp/match_spec.rb
    MacRuby/trunk/spec/frozen/core/regexp/options_spec.rb
    MacRuby/trunk/spec/frozen/core/regexp/shared/new.rb
    MacRuby/trunk/spec/frozen/core/string/capitalize_spec.rb
    MacRuby/trunk/spec/frozen/core/string/center_spec.rb
    MacRuby/trunk/spec/frozen/core/string/chomp_spec.rb
    MacRuby/trunk/spec/frozen/core/string/chop_spec.rb
    MacRuby/trunk/spec/frozen/core/string/count_spec.rb
    MacRuby/trunk/spec/frozen/core/string/crypt_spec.rb
    MacRuby/trunk/spec/frozen/core/string/delete_spec.rb
    MacRuby/trunk/spec/frozen/core/string/downcase_spec.rb
    MacRuby/trunk/spec/frozen/core/string/dump_spec.rb
    MacRuby/trunk/spec/frozen/core/string/each_spec.rb
    MacRuby/trunk/spec/frozen/core/string/encode_spec.rb
    MacRuby/trunk/spec/frozen/core/string/force_encoding_spec.rb
    MacRuby/trunk/spec/frozen/core/string/getbyte_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/string/gsub_spec.rb
    MacRuby/trunk/spec/frozen/core/string/hex_spec.rb
    MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/string/ljust_spec.rb
    MacRuby/trunk/spec/frozen/core/string/modulo_spec.rb
    MacRuby/trunk/spec/frozen/core/string/multiply_spec.rb
    MacRuby/trunk/spec/frozen/core/string/plus_spec.rb
    MacRuby/trunk/spec/frozen/core/string/rjust_spec.rb
    MacRuby/trunk/spec/frozen/core/string/setbyte_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/string/shared/slice.rb
    MacRuby/trunk/spec/frozen/core/string/shared/succ.rb
    MacRuby/trunk/spec/frozen/core/string/shared/to_s.rb
    MacRuby/trunk/spec/frozen/core/string/shared/versions/slice_1.9.rb
    MacRuby/trunk/spec/frozen/core/string/slice_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/string/split_spec.rb
    MacRuby/trunk/spec/frozen/core/string/squeeze_spec.rb
    MacRuby/trunk/spec/frozen/core/string/sub_spec.rb
    MacRuby/trunk/spec/frozen/core/string/swapcase_spec.rb
    MacRuby/trunk/spec/frozen/core/string/tr_s_spec.rb
    MacRuby/trunk/spec/frozen/core/string/tr_spec.rb
    MacRuby/trunk/spec/frozen/core/string/unpack_spec.rb
    MacRuby/trunk/spec/frozen/core/string/upcase_spec.rb
    MacRuby/trunk/spec/frozen/core/struct/element_reference_spec.rb
    MacRuby/trunk/spec/frozen/core/struct/hash_spec.rb
    MacRuby/trunk/spec/frozen/core/struct/new_spec.rb
    MacRuby/trunk/spec/frozen/core/struct/select_spec.rb
    MacRuby/trunk/spec/frozen/core/thread/current_spec.rb
    MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb
    MacRuby/trunk/spec/frozen/core/time/fixtures/methods.rb
    MacRuby/trunk/spec/frozen/core/time/inspect_spec.rb
    MacRuby/trunk/spec/frozen/core/time/shared/now.rb
    MacRuby/trunk/spec/frozen/core/time/shared/time_params.rb
    MacRuby/trunk/spec/frozen/core/time/to_s_spec.rb
    MacRuby/trunk/spec/frozen/core/unboundmethod/bind_spec_disabled.rb
    MacRuby/trunk/spec/frozen/core/unboundmethod/equal_value_spec.rb
    MacRuby/trunk/spec/frozen/core/unboundmethod/shared/to_s.rb
    MacRuby/trunk/spec/frozen/language/array_spec.rb
    MacRuby/trunk/spec/frozen/language/break_spec.rb
    MacRuby/trunk/spec/frozen/language/class_spec.rb
    MacRuby/trunk/spec/frozen/language/def_spec.rb
    MacRuby/trunk/spec/frozen/language/defined_spec.rb
    MacRuby/trunk/spec/frozen/language/eigenclass_spec.rb
    MacRuby/trunk/spec/frozen/language/file_spec.rb
    MacRuby/trunk/spec/frozen/language/fixtures/return.rb
    MacRuby/trunk/spec/frozen/language/fixtures/super.rb
    MacRuby/trunk/spec/frozen/language/if_spec.rb
    MacRuby/trunk/spec/frozen/language/metaclass_spec.rb
    MacRuby/trunk/spec/frozen/language/method_spec.rb
    MacRuby/trunk/spec/frozen/language/next_spec.rb
    MacRuby/trunk/spec/frozen/language/predefined_spec.rb
    MacRuby/trunk/spec/frozen/language/regexp_spec.rb
    MacRuby/trunk/spec/frozen/language/return_spec.rb
    MacRuby/trunk/spec/frozen/language/super_spec.rb
    MacRuby/trunk/spec/frozen/language/symbol_spec.rb
    MacRuby/trunk/spec/frozen/language/variables_spec.rb
    MacRuby/trunk/spec/frozen/language/versions/method_1.9.rb
    MacRuby/trunk/spec/frozen/language/versions/symbol_1.9.rb
    MacRuby/trunk/spec/frozen/library/bigdecimal/new_spec.rb
    MacRuby/trunk/spec/frozen/library/bigdecimal/shared/to_int.rb
    MacRuby/trunk/spec/frozen/library/bigdecimal/to_f_spec.rb
    MacRuby/trunk/spec/frozen/library/complex/math/shared/atan2.rb
    MacRuby/trunk/spec/frozen/library/complex/new_spec.rb
    MacRuby/trunk/spec/frozen/library/date/strptime_spec.rb
    MacRuby/trunk/spec/frozen/library/ftools/chmod_spec.rb
    MacRuby/trunk/spec/frozen/library/ftools/copy_spec.rb
    MacRuby/trunk/spec/frozen/library/ftools/install_spec.rb
    MacRuby/trunk/spec/frozen/library/ftools/makedirs_spec.rb
    MacRuby/trunk/spec/frozen/library/ftools/move_spec.rb
    MacRuby/trunk/spec/frozen/library/ftools/syscopy_spec.rb
    MacRuby/trunk/spec/frozen/library/iconv/shared/new.rb
    MacRuby/trunk/spec/frozen/library/logger/application/log_spec.rb
    MacRuby/trunk/spec/frozen/library/logger/logger/add_spec.rb
    MacRuby/trunk/spec/frozen/library/logger/logger/datetime_format_spec.rb
    MacRuby/trunk/spec/frozen/library/logger/logger/debug_spec.rb
    MacRuby/trunk/spec/frozen/library/logger/logger/error_spec.rb
    MacRuby/trunk/spec/frozen/library/logger/logger/fatal_spec.rb
    MacRuby/trunk/spec/frozen/library/logger/logger/info_spec.rb
    MacRuby/trunk/spec/frozen/library/logger/logger/new_spec.rb
    MacRuby/trunk/spec/frozen/library/logger/logger/unknown_spec.rb
    MacRuby/trunk/spec/frozen/library/logger/logger/warn_spec.rb
    MacRuby/trunk/spec/frozen/library/mathn/bignum/exponent_spec.rb
    MacRuby/trunk/spec/frozen/library/mathn/fixnum/exponent_spec.rb
    MacRuby/trunk/spec/frozen/library/mathn/float/exponent_spec.rb
    MacRuby/trunk/spec/frozen/library/mathn/integer/gcd2_spec.rb
    MacRuby/trunk/spec/frozen/library/mathn/prime/new_spec.rb
    MacRuby/trunk/spec/frozen/library/mathn/rational/exponent_spec.rb
    MacRuby/trunk/spec/frozen/library/mathn/rational/inspect_spec.rb
    MacRuby/trunk/spec/frozen/library/matrix/clone_spec.rb
    MacRuby/trunk/spec/frozen/library/matrix/diagonal_spec.rb
    MacRuby/trunk/spec/frozen/library/matrix/rows_spec.rb
    MacRuby/trunk/spec/frozen/library/matrix/scalar_spec.rb
    MacRuby/trunk/spec/frozen/library/matrix/shared/identity.rb
    MacRuby/trunk/spec/frozen/library/matrix/shared/inverse.rb
    MacRuby/trunk/spec/frozen/library/matrix/spec_helper.rb
    MacRuby/trunk/spec/frozen/library/matrix/zero_spec.rb
    MacRuby/trunk/spec/frozen/library/mutex/unlock_spec.rb
    MacRuby/trunk/spec/frozen/library/net/ftp/fixtures/server.rb
    MacRuby/trunk/spec/frozen/library/net/ftp/shared/getbinaryfile.rb
    MacRuby/trunk/spec/frozen/library/net/ftp/shared/gettextfile.rb
    MacRuby/trunk/spec/frozen/library/net/ftp/shared/putbinaryfile.rb
    MacRuby/trunk/spec/frozen/library/net/ftp/shared/puttextfile.rb
    MacRuby/trunk/spec/frozen/library/net/ftp/storbinary_spec.rb
    MacRuby/trunk/spec/frozen/library/net/ftp/storlines_spec.rb
    MacRuby/trunk/spec/frozen/library/openssl/hmac/digest_spec.rb
    MacRuby/trunk/spec/frozen/library/openssl/hmac/hexdigest_spec.rb
    MacRuby/trunk/spec/frozen/library/openssl/random/shared/random_bytes.rb
    MacRuby/trunk/spec/frozen/library/pathname/new_spec.rb
    MacRuby/trunk/spec/frozen/library/prime/each_spec.rb
    MacRuby/trunk/spec/frozen/library/prime/instance_spec.rb
    MacRuby/trunk/spec/frozen/library/prime/new_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/basic_quote_characters_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/basic_word_break_characters_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/completer_quote_characters_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/completer_word_break_characters_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/completion_append_character_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/completion_case_fold_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/completion_proc_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/emacs_editing_mode_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/filename_quote_characters_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/readline_spec.rb
    MacRuby/trunk/spec/frozen/library/readline/vi_editing_mode_spec.rb
    MacRuby/trunk/spec/frozen/library/resolv/get_address_spec.rb
    MacRuby/trunk/spec/frozen/library/rexml/text/write_with_substitution_spec.rb
    MacRuby/trunk/spec/frozen/library/securerandom/base64_spec.rb
    MacRuby/trunk/spec/frozen/library/securerandom/hex_spec.rb
    MacRuby/trunk/spec/frozen/library/securerandom/random_bytes_spec.rb
    MacRuby/trunk/spec/frozen/library/securerandom/random_number_spec.rb
    MacRuby/trunk/spec/frozen/library/set/initialize_copy_spec.rb
    MacRuby/trunk/spec/frozen/library/set/initialize_spec.rb
    MacRuby/trunk/spec/frozen/library/set/sortedset/add_spec.rb
    MacRuby/trunk/spec/frozen/library/set/sortedset/flatten_spec.rb
    MacRuby/trunk/spec/frozen/library/set/sortedset/initialize_copy_spec.rb
    MacRuby/trunk/spec/frozen/library/socket/basicsocket/getsockopt_spec.rb
    MacRuby/trunk/spec/frozen/library/socket/basicsocket/recv_spec.rb
    MacRuby/trunk/spec/frozen/library/socket/basicsocket/send_spec.rb
    MacRuby/trunk/spec/frozen/library/socket/basicsocket/setsockopt_spec.rb
    MacRuby/trunk/spec/frozen/library/socket/socket/for_fd_spec.rb
    MacRuby/trunk/spec/frozen/library/socket/tcpsocket/shared/new.rb
    MacRuby/trunk/spec/frozen/library/socket/unixserver/shared/new.rb
    MacRuby/trunk/spec/frozen/library/socket/unixsocket/pair_spec.rb
    MacRuby/trunk/spec/frozen/library/stringio/initialize_copy_spec.rb
    MacRuby/trunk/spec/frozen/library/stringio/initialize_spec.rb
    MacRuby/trunk/spec/frozen/library/stringio/read_spec.rb
    MacRuby/trunk/spec/frozen/library/stringio/seek_spec.rb
    MacRuby/trunk/spec/frozen/library/stringscanner/initialize_copy_spec.rb
    MacRuby/trunk/spec/frozen/library/stringscanner/initialize_spec.rb
    MacRuby/trunk/spec/frozen/library/tempfile/close_spec.rb
    MacRuby/trunk/spec/frozen/library/tempfile/initialize_spec.rb
    MacRuby/trunk/spec/frozen/library/tempfile/path_spec.rb
    MacRuby/trunk/spec/frozen/library/tempfile/shared/unlink.rb
    MacRuby/trunk/spec/frozen/library/tmpdir/dir/mktmpdir_spec.rb
    MacRuby/trunk/spec/frozen/library/uri/equality_spec.rb
    MacRuby/trunk/spec/frozen/library/uri/normalize_spec.rb
    MacRuby/trunk/spec/frozen/library/yaml/dump_spec.rb
    MacRuby/trunk/spec/frozen/library/yaml/load_file_spec.rb
    MacRuby/trunk/spec/frozen/library/yaml/load_spec.rb
    MacRuby/trunk/spec/frozen/library/zlib/gzipreader/each_byte_spec.rb
    MacRuby/trunk/spec/frozen/library/zlib/gzipreader/eof_spec.rb
    MacRuby/trunk/spec/frozen/library/zlib/gzipreader/getc_spec.rb
    MacRuby/trunk/spec/frozen/library/zlib/gzipreader/read_spec.rb
    MacRuby/trunk/spec/frozen/library/zlib/gzipreader/rewind_spec.rb
    MacRuby/trunk/spec/frozen/optional/ffi/fixtures/GNUmakefile
    MacRuby/trunk/spec/frozen/shared/array/join.rb
    MacRuby/trunk/spec/frozen/shared/file/executable.rb
    MacRuby/trunk/spec/frozen/shared/file/executable_real.rb
    MacRuby/trunk/spec/frozen/shared/file/file.rb
    MacRuby/trunk/spec/frozen/shared/file/grpowned.rb
    MacRuby/trunk/spec/frozen/shared/file/identical.rb
    MacRuby/trunk/spec/frozen/shared/file/readable.rb
    MacRuby/trunk/spec/frozen/shared/file/readable_real.rb
    MacRuby/trunk/spec/frozen/shared/file/size.rb
    MacRuby/trunk/spec/frozen/shared/file/sticky.rb
    MacRuby/trunk/spec/frozen/shared/file/symlink.rb
    MacRuby/trunk/spec/frozen/shared/file/world_readable.rb
    MacRuby/trunk/spec/frozen/shared/file/world_writable.rb
    MacRuby/trunk/spec/frozen/shared/file/writable.rb
    MacRuby/trunk/spec/frozen/shared/file/writable_real.rb
    MacRuby/trunk/spec/frozen/shared/file/zero.rb
    MacRuby/trunk/spec/frozen/shared/process/times.rb
    MacRuby/trunk/spec/frozen/shared/rational/exponent.rb
    MacRuby/trunk/spec/frozen/shared/rational/modulo.rb
    MacRuby/trunk/spec/frozen/spec_helper.rb
    MacRuby/trunk/spec/frozen/upstream

Added Paths:
-----------
    MacRuby/trunk/spec/frozen/command_line/fixtures/conditional_range.txt
    MacRuby/trunk/spec/frozen/core/complex/rationalize_spec.rb
    MacRuby/trunk/spec/frozen/core/encoding/replicate_spec.rb
    MacRuby/trunk/spec/frozen/core/gc/stress_spec.rb
    MacRuby/trunk/spec/frozen/core/io/shared/gets_ascii.rb
    MacRuby/trunk/spec/frozen/core/kernel/__callee___spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/__method___spec.rb
    MacRuby/trunk/spec/frozen/core/math/gamma_spec.rb
    MacRuby/trunk/spec/frozen/core/math/lgamma_spec.rb
    MacRuby/trunk/spec/frozen/core/proc/shared/call_arguments.rb
    MacRuby/trunk/spec/frozen/core/proc/versions/call_1.8.7.rb
    MacRuby/trunk/spec/frozen/core/proc/versions/call_1.9.rb
    MacRuby/trunk/spec/frozen/core/time/shared/inspect.rb
    MacRuby/trunk/spec/frozen/language/splat_spec.rb
    MacRuby/trunk/spec/frozen/library/delegate/marshal_spec.rb
    MacRuby/trunk/spec/frozen/library/mathn/complex/
    MacRuby/trunk/spec/frozen/library/mathn/complex/Complex_spec.rb
    MacRuby/trunk/spec/frozen/library/mathn/rational/Rational_spec.rb
    MacRuby/trunk/spec/frozen/library/matrix/vector/each2_spec.rb
    MacRuby/trunk/spec/frozen/library/socket/shared/partially_closable_sockets.rb
    MacRuby/trunk/spec/frozen/library/socket/tcpsocket/partially_closable_spec.rb
    MacRuby/trunk/spec/frozen/library/socket/unixsocket/partially_closable_spec.rb
    MacRuby/trunk/spec/frozen/library/uri/eql_spec.rb
    MacRuby/trunk/spec/frozen/library/uri/fixtures/normalization.rb
    MacRuby/trunk/spec/frozen/library/uri/shared/
    MacRuby/trunk/spec/frozen/library/uri/shared/eql.rb

Removed Paths:
-------------
    MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb.orig
    MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb.rej
    MacRuby/trunk/spec/frozen/core/dir/initialize_spec.rb
    MacRuby/trunk/spec/frozen/core/io/versions/gets_1.9.rb
    MacRuby/trunk/spec/frozen/core/kernel/__callee__spec.rb
    MacRuby/trunk/spec/frozen/core/kernel/__method__spec.rb
    MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb.orig
    MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb.rej

Modified: MacRuby/trunk/spec/frozen/command_line/dash_e_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/command_line/dash_e_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/command_line/dash_e_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -18,4 +18,22 @@
   end
 
   #needs to test return => LocalJumpError
+
+  ruby_version_is "1.8.7.248" do
+    describe "with -n and a Fixnum range" do
+      before :each do
+        @script = "-ne 'print if %s' #{fixture(__FILE__, "conditional_range.txt")}"
+      end
+
+      it "mimics an awk conditional by comparing an inclusive-end range with $." do
+        ruby_exe(nil, :args => (@script % "2..3")).should == "2\n3\n"
+        ruby_exe(nil, :args => (@script % "2..2")).should == "2\n"
+      end
+
+      it "mimics a sed conditional by comparing an exclusive-end range with $." do
+        ruby_exe(nil, :args => (@script % "2...3")).should == "2\n3\n"
+        ruby_exe(nil, :args => (@script % "2...2")).should == "2\n3\n4\n5\n"
+      end
+    end
+  end
 end

Added: MacRuby/trunk/spec/frozen/command_line/fixtures/conditional_range.txt
===================================================================
--- MacRuby/trunk/spec/frozen/command_line/fixtures/conditional_range.txt	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/command_line/fixtures/conditional_range.txt	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,5 @@
+1
+2
+3
+4
+5

Modified: MacRuby/trunk/spec/frozen/core/argf/close_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/argf/close_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/argf/close_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -35,12 +35,18 @@
   end
 
   # This passes on 1.8.6 and 1.8.7 but fails on 1.9. matz confirmed that it
-  # should pass in the referenced bug report
-  it "can close STDIN" do
-    argv ['-'] do
-      ARGV.size.should == 1
-      ARGF.close.should == ARGF
-      ARGF.closed?.should be_true
+  # should pass in the referenced bug report.
+  #
+  # This is quarantined because closing STDIN easily destabilizes specs that
+  # run after this. If this is to be spec'd, it must be done in a subprocess
+  # or in some kind of isolation.
+  quarantine! do
+    it "can close STDIN" do
+      argv ['-'] do
+        ARGV.size.should == 1
+        ARGF.close.should == ARGF
+        ARGF.closed?.should be_true
+      end
     end
-  end   
+  end
 end

Modified: MacRuby/trunk/spec/frozen/core/argf/rewind_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/argf/rewind_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/argf/rewind_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -30,7 +30,7 @@
 
   # This fails on all versions as reported in bug #1693. If it's deemed not to
   # be a bug, this guard can be removed
-  ruby_bug "#1693", "1.8.7.174" do
+  ruby_bug "#1693", "1.8.7.248" do
     it "resets ARGF.lineno to 0" do
       argv [@file2_name] do
         ARGF.lineno = 0

Modified: MacRuby/trunk/spec/frozen/core/argf/shared/gets.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/argf/shared/gets.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/argf/shared/gets.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -66,19 +66,15 @@
     @tmp1_name_bak = @tmp1_name + ".bak"
     @tmp2_name_bak = @tmp2_name + ".bak"
 
-    FileUtils.cp @file1_name, @tmp1_name
-    FileUtils.cp @file2_name, @tmp2_name
+    cp @file1_name, @tmp1_name
+    cp @file2_name, @tmp2_name
 
     method = "ARGF.send(#{@method.inspect})"
     @code = "begin while line = #{method} do puts 'x' end rescue EOFError; end"
   end
 
   after :each do
-    File.delete @tmp1_name if File.exists? @tmp1_name
-    File.delete @tmp2_name if File.exists? @tmp2_name
-
-    File.delete @tmp1_name_bak if File.exists? @tmp1_name_bak
-    File.delete @tmp2_name_bak if File.exists? @tmp2_name_bak
+    rm_r @tmp1_name, @tmp2_name, @tmp1_name_bak, @tmp2_name_bak
   end
 
   it "modifies the files when in place edit mode is on" do

Modified: MacRuby/trunk/spec/frozen/core/array/combination_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/combination_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/combination_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -26,5 +26,9 @@
       [1,2,3].combination(0).to_a.should == [[]] # one combination of length 0
       [].combination(0).to_a.should == [[]] # one combination of length 0
     end
+    
+    it "yields a partition consisting of only singletons" do
+      [1,2,3,4].combination(1).to_a.should == [[1],[2],[3],[4]]
+    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/array/compact_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/compact_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/compact_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -19,7 +19,7 @@
   end
 
   it "returns subclass instance for Array subclasses" do
-    ArraySpecs::MyArray[1, 2, 3, nil].compact.class.should == ArraySpecs::MyArray
+    ArraySpecs::MyArray[1, 2, 3, nil].compact.should be_kind_of(ArraySpecs::MyArray)
   end
 
   it "keeps tainted status even if all elements are removed" do

Modified: MacRuby/trunk/spec/frozen/core/array/constructor_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/constructor_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/constructor_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,7 +7,7 @@
     Array.[](5, true, nil, 'a', "Ruby", obj).should == [5, true, nil, "a", "Ruby", obj]
 
     a = ArraySpecs::MyArray.[](5, true, nil, 'a', "Ruby", obj)
-    a.class.should == ArraySpecs::MyArray
+    a.should be_kind_of(ArraySpecs::MyArray)
     a.inspect.should == [5, true, nil, "a", "Ruby", obj].inspect
   end
 end
@@ -18,7 +18,7 @@
     Array[5, true, nil, 'a', "Ruby", obj].should == Array.[](5, true, nil, "a", "Ruby", obj)
 
     a = ArraySpecs::MyArray[5, true, nil, 'a', "Ruby", obj]
-    a.class.should == ArraySpecs::MyArray
+    a.should be_kind_of(ArraySpecs::MyArray)
     a.inspect.should == [5, true, nil, "a", "Ruby", obj].inspect
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/array/element_reference_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/element_reference_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/element_reference_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -39,6 +39,6 @@
   
   it "returns an instance of the subtype when called on an Array subclass" do
     ArraySub = Class.new Array
-    ArraySub[1,2].class.should == ArraySub
+    ArraySub[1,2].should be_kind_of(ArraySub)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/array/first_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/first_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/first_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -70,11 +70,11 @@
   end
 
   it "does not return subclass instance when passed count on Array subclasses" do
-    ArraySpecs::MyArray[].first(0).class.should == Array
-    ArraySpecs::MyArray[].first(2).class.should == Array
-    ArraySpecs::MyArray[1, 2, 3].first(0).class.should == Array
-    ArraySpecs::MyArray[1, 2, 3].first(1).class.should == Array
-    ArraySpecs::MyArray[1, 2, 3].first(2).class.should == Array
+    ArraySpecs::MyArray[].first(0).should be_kind_of(Array)
+    ArraySpecs::MyArray[].first(2).should be_kind_of(Array)
+    ArraySpecs::MyArray[1, 2, 3].first(0).should be_kind_of(Array)
+    ArraySpecs::MyArray[1, 2, 3].first(1).should be_kind_of(Array)
+    ArraySpecs::MyArray[1, 2, 3].first(2).should be_kind_of(Array)
   end
 
   it "is not destructive" do

Modified: MacRuby/trunk/spec/frozen/core/array/flatten_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/flatten_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/flatten_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -81,10 +81,10 @@
   end
 
   it "returns subclass instance for Array subclasses" do
-    ArraySpecs::MyArray[].flatten.class.should == ArraySpecs::MyArray
-    ArraySpecs::MyArray[1, 2, 3].flatten.class.should == ArraySpecs::MyArray
-    ArraySpecs::MyArray[1, [2], 3].flatten.class.should == ArraySpecs::MyArray
-    [ArraySpecs::MyArray[1, 2, 3]].flatten.class.should == Array
+    ArraySpecs::MyArray[].flatten.should be_kind_of(ArraySpecs::MyArray)
+    ArraySpecs::MyArray[1, 2, 3].flatten.should be_kind_of(ArraySpecs::MyArray)
+    ArraySpecs::MyArray[1, [2], 3].flatten.should be_kind_of(ArraySpecs::MyArray)
+    [ArraySpecs::MyArray[1, 2, 3]].flatten.should be_kind_of(Array)
   end
 
   it "is not destructive" do
@@ -180,7 +180,7 @@
 
     ary = [ArraySpecs::MyArray[1, 2, 3]]
     ary.flatten!
-    ary.class.should == Array
+    ary.should be_kind_of(Array)
     ary.should == [1, 2, 3]
   end
 

Modified: MacRuby/trunk/spec/frozen/core/array/frozen_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/frozen_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/frozen_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,22 +9,24 @@
     a.frozen?.should == true
   end
 
-  ruby_version_is "" .. "1.9" do
-    it "returns true for an array being sorted by #sort!" do
-      a = [1, 2, 3]
-      a.sort! { |x,y| a.frozen?.should == true; x <=> y }
+  not_compliant_on :rubinius do
+    ruby_version_is "" .. "1.9" do
+      it "returns true for an array being sorted by #sort!" do
+        a = [1, 2, 3]
+        a.sort! { |x,y| a.frozen?.should == true; x <=> y }
+      end
     end
-  end
 
-  ruby_version_is "1.9" do
-    it "returns false for an array being sorted by #sort!" do
+    ruby_version_is "1.9" do
+      it "returns false for an array being sorted by #sort!" do
+        a = [1, 2, 3]
+        a.sort! { |x,y| a.frozen?.should == false; x <=> y }
+      end
+    end
+
+    it "returns false for an array being sorted by #sort" do
       a = [1, 2, 3]
-      a.sort! { |x,y| a.frozen?.should == false; x <=> y }
+      a.sort { |x,y| a.frozen?.should == false; x <=> y }
     end
   end
-
-  it "returns false for an array being sorted by #sort" do
-    a = [1, 2, 3]
-    a.sort { |x,y| a.frozen?.should == false; x <=> y }
-  end
 end

Modified: MacRuby/trunk/spec/frozen/core/array/hash_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/hash_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/hash_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,7 +7,7 @@
 
     [[], [1, 2, 3]].each do |ary|
       ary.hash.should == ary.dup.hash
-      ary.hash.class.should == Fixnum
+      ary.hash.should be_kind_of(Fixnum)
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/array/intersection_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/intersection_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/intersection_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -62,9 +62,9 @@
   end
   
   it "does return subclass instances for Array subclasses" do
-    (ArraySpecs::MyArray[1, 2, 3] & []).class.should == Array
-    (ArraySpecs::MyArray[1, 2, 3] & ArraySpecs::MyArray[1, 2, 3]).class.should == Array
-    ([] & ArraySpecs::MyArray[1, 2, 3]).class.should == Array
+    (ArraySpecs::MyArray[1, 2, 3] & []).should be_kind_of(Array)
+    (ArraySpecs::MyArray[1, 2, 3] & ArraySpecs::MyArray[1, 2, 3]).should be_kind_of(Array)
+    ([] & ArraySpecs::MyArray[1, 2, 3]).should be_kind_of(Array)
   end
 
   it "does not call to_ary on array subclasses" do

Modified: MacRuby/trunk/spec/frozen/core/array/last_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/last_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/last_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -68,11 +68,11 @@
   end
 
   it "does not return subclass instance on Array subclasses" do
-    ArraySpecs::MyArray[].last(0).class.should == Array
-    ArraySpecs::MyArray[].last(2).class.should == Array
-    ArraySpecs::MyArray[1, 2, 3].last(0).class.should == Array
-    ArraySpecs::MyArray[1, 2, 3].last(1).class.should == Array
-    ArraySpecs::MyArray[1, 2, 3].last(2).class.should == Array
+    ArraySpecs::MyArray[].last(0).should be_kind_of(Array)
+    ArraySpecs::MyArray[].last(2).should be_kind_of(Array)
+    ArraySpecs::MyArray[1, 2, 3].last(0).should be_kind_of(Array)
+    ArraySpecs::MyArray[1, 2, 3].last(1).should be_kind_of(Array)
+    ArraySpecs::MyArray[1, 2, 3].last(2).should be_kind_of(Array)
   end
 
   it "is not destructive" do

Modified: MacRuby/trunk/spec/frozen/core/array/minus_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/minus_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/minus_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -36,9 +36,9 @@
   end
 
   it "does not return subclass instance for Array subclasses" do
-    (ArraySpecs::MyArray[1, 2, 3] - []).class.should == Array
-    (ArraySpecs::MyArray[1, 2, 3] - ArraySpecs::MyArray[]).class.should == Array
-    ([1, 2, 3] - ArraySpecs::MyArray[]).class.should == Array
+    (ArraySpecs::MyArray[1, 2, 3] - []).should be_kind_of(Array)
+    (ArraySpecs::MyArray[1, 2, 3] - ArraySpecs::MyArray[]).should be_kind_of(Array)
+    ([1, 2, 3] - ArraySpecs::MyArray[]).should be_kind_of(Array)
   end
 
   it "does not call to_ary on array subclasses" do

Modified: MacRuby/trunk/spec/frozen/core/array/multiply_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/multiply_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/multiply_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -70,9 +70,9 @@
   end
   
   it "returns subclass instance with Array subclasses" do
-    (ArraySpecs::MyArray[1, 2, 3] * 0).class.should == ArraySpecs::MyArray
-    (ArraySpecs::MyArray[1, 2, 3] * 1).class.should == ArraySpecs::MyArray
-    (ArraySpecs::MyArray[1, 2, 3] * 2).class.should == ArraySpecs::MyArray
+    (ArraySpecs::MyArray[1, 2, 3] * 0).should be_kind_of(ArraySpecs::MyArray)
+    (ArraySpecs::MyArray[1, 2, 3] * 1).should be_kind_of(ArraySpecs::MyArray)
+    (ArraySpecs::MyArray[1, 2, 3] * 2).should be_kind_of(ArraySpecs::MyArray)
   end
 
   ruby_version_is '' ... '1.8' do

Modified: MacRuby/trunk/spec/frozen/core/array/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,11 +3,11 @@
 
 describe "Array.new" do
   it "returns an instance of Array" do
-    Array.new.class.should == Array
+    Array.new.should be_kind_of(Array)
   end
 
   it "returns an instance of a subclass" do
-    ArraySpecs::MyArray.new.class.should == ArraySpecs::MyArray
+    ArraySpecs::MyArray.new.should be_kind_of(ArraySpecs::MyArray)
   end
 
   it "raise an ArgumentError if passed 3 or more arguments" do

Modified: MacRuby/trunk/spec/frozen/core/array/partition_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/partition_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/partition_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -36,8 +36,8 @@
 
   it "does not return subclass instances on Array subclasses" do
     result = ArraySpecs::MyArray[1, 2, 3].partition { |x| x % 2 == 0 }
-    result.class.should == Array
-    result[0].class.should == Array
-    result[1].class.should == Array
+    result.should be_kind_of(Array)
+    result[0].should be_kind_of(Array)
+    result[1].should be_kind_of(Array)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/array/permutation_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/permutation_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/permutation_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -87,6 +87,14 @@
       @numbers.permutation(3.7).to_a.sort.should == 
         @numbers.permutation(3).to_a.sort
     end  
-  
+
+    it "returns an Enumerator which works as expected even when the array was modified" do
+      @numbers = [1, 2]
+      enum = @numbers.permutation
+      @numbers << 3
+      enum.to_a.sort.should == [
+        [1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]
+      ].sort
+    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/array/plus_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/plus_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/plus_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -32,9 +32,9 @@
   end
 
   it "does return subclass instances with Array subclasses" do
-    (ArraySpecs::MyArray[1, 2, 3] + []).class.should == Array
-    (ArraySpecs::MyArray[1, 2, 3] + ArraySpecs::MyArray[]).class.should == Array
-    ([1, 2, 3] + ArraySpecs::MyArray[]).class.should == Array
+    (ArraySpecs::MyArray[1, 2, 3] + []).should be_kind_of(Array)
+    (ArraySpecs::MyArray[1, 2, 3] + ArraySpecs::MyArray[]).should be_kind_of(Array)
+    ([1, 2, 3] + ArraySpecs::MyArray[]).should be_kind_of(Array)
   end
 
   it "does not call to_ary on array subclasses" do

Modified: MacRuby/trunk/spec/frozen/core/array/pop_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/pop_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/pop_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -134,7 +134,7 @@
       end
 
       it "does not return subclass instances with Array subclass" do
-        ArraySpecs::MyArray[1, 2, 3].pop(2).class.should == Array
+        ArraySpecs::MyArray[1, 2, 3].pop(2).should be_kind_of(Array)
       end
 
       it "returns an untainted array even if the array is tainted" do

Modified: MacRuby/trunk/spec/frozen/core/array/reject_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/reject_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/reject_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -25,13 +25,13 @@
 
   not_compliant_on :rubinius, :ironruby do
     it "returns subclass instance on Array subclasses" do
-      ArraySpecs::MyArray[1, 2, 3].reject { |x| x % 2 == 0 }.class.should == ArraySpecs::MyArray
+      ArraySpecs::MyArray[1, 2, 3].reject { |x| x % 2 == 0 }.should be_kind_of(ArraySpecs::MyArray)
     end
   end
 
   deviates_on :rubinius, :ironruby do
     it "does not return subclass instance on Array subclasses" do
-      ArraySpecs::MyArray[1, 2, 3].reject { |x| x % 2 == 0 }.class.should == Array
+      ArraySpecs::MyArray[1, 2, 3].reject { |x| x % 2 == 0 }.should be_kind_of(Array)
     end
   end
   

Modified: MacRuby/trunk/spec/frozen/core/array/reverse_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/reverse_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/reverse_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,7 +8,7 @@
   end
 
   it "returns subclass instance on Array subclasses" do
-    ArraySpecs::MyArray[1, 2, 3].reverse.class.should == ArraySpecs::MyArray
+    ArraySpecs::MyArray[1, 2, 3].reverse.should be_kind_of(ArraySpecs::MyArray)
   end
 
   it "properly handles recursive arrays" do

Modified: MacRuby/trunk/spec/frozen/core/array/sample_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/sample_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/sample_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,13 +2,7 @@
 require File.dirname(__FILE__) + '/fixtures/classes'
 
 describe "Array#sample" do
-  ruby_version_is "" ... "1.9" do
-    it "is not defined" do
-      lambda { [].sample }.should raise_error(NoMethodError)
-    end
-  end
-
-  ruby_version_is "1.9" do
+  ruby_version_is "1.8.8" do
     it "selects a random value from the array" do
       a = [1, 2, 3, 4]
       10.times {
@@ -59,7 +53,7 @@
       end
 
       it "does not return subclass instances with Array subclass" do
-        ArraySpecs::MyArray[1, 2, 3].sample(2).class.should == Array
+        ArraySpecs::MyArray[1, 2, 3].sample(2).should be_kind_of(Array)
       end
     end
   end

Modified: MacRuby/trunk/spec/frozen/core/array/select_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/select_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/select_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,7 +10,7 @@
   end
 
   it "does not return subclass instance on Array subclasses" do
-    ArraySpecs::MyArray[1, 2, 3].select { true }.class.should == Array
+    ArraySpecs::MyArray[1, 2, 3].select { true }.should be_kind_of(Array)
   end
 
   it "properly handles recursive arrays" do

Modified: MacRuby/trunk/spec/frozen/core/array/shared/clone.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/shared/clone.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/shared/clone.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,7 +1,7 @@
 describe :array_clone, :shared => true do
   it "returns an Array or a subclass instance" do
-    [].send(@method).class.should == Array
-    ArraySpecs::MyArray[1, 2].send(@method).class.should == ArraySpecs::MyArray
+    [].send(@method).should be_kind_of(Array)
+    ArraySpecs::MyArray[1, 2].send(@method).should be_kind_of(ArraySpecs::MyArray)
   end
 
   it "produces a shallow copy where the references are directly copied" do

Modified: MacRuby/trunk/spec/frozen/core/array/shared/collect.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/shared/collect.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/shared/collect.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,7 +7,7 @@
   end
 
   it "does not return subclass instance" do
-    ArraySpecs::MyArray[1, 2, 3].send(@method) { |x| x + 1 }.class.should == Array
+    ArraySpecs::MyArray[1, 2, 3].send(@method) { |x| x + 1 }.should be_kind_of(Array)
   end
 
   it "does not change self" do

Modified: MacRuby/trunk/spec/frozen/core/array/shared/slice.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/shared/slice.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/shared/slice.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -371,9 +371,9 @@
 
   it "returns a subclass instance when called on a subclass of Array" do
     ary = ArraySpecs::MyArray[1, 2, 3]
-    ary.send(@method, 0, 0).class.should == ArraySpecs::MyArray
-    ary.send(@method, 0, 2).class.should == ArraySpecs::MyArray
-    ary.send(@method, 0..10).class.should == ArraySpecs::MyArray
+    ary.send(@method, 0, 0).should be_kind_of(ArraySpecs::MyArray)
+    ary.send(@method, 0, 2).should be_kind_of(ArraySpecs::MyArray)
+    ary.send(@method, 0..10).should be_kind_of(ArraySpecs::MyArray)
   end
 
   not_compliant_on :rubinius do

Modified: MacRuby/trunk/spec/frozen/core/array/shift_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/shift_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/shift_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -118,7 +118,7 @@
       end
 
       it "does not return subclass instances with Array subclass" do
-        ArraySpecs::MyArray[1, 2, 3].shift(2).class.should == Array
+        ArraySpecs::MyArray[1, 2, 3].shift(2).should be_kind_of(Array)
       end
 
       it "returns an untainted array even if the array is tainted" do

Modified: MacRuby/trunk/spec/frozen/core/array/shuffle_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/shuffle_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/shuffle_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,8 +3,8 @@
 
 describe "Array#shuffle" do
   ruby_version_is "1.8.7" do
-    it "should return the same values, in a usually different order" do
-      a = [1,2,3,4]
+    it "returns the same values, in a usually different order" do
+      a = [1, 2, 3, 4]
       different = false
       10.times do
         s = a.shuffle
@@ -15,9 +15,9 @@
     end
 
     it "returns subclass instances with Array subclass" do
-      ArraySpecs::MyArray[1, 2, 3].shuffle.class.should == ArraySpecs::MyArray
+      ArraySpecs::MyArray[1, 2, 3].shuffle.should be_an_instance_of(ArraySpecs::MyArray)
     end
-  
+
     it "is not destructive" do
       a = [1, 2, 3]
       10.times do
@@ -25,20 +25,19 @@
         a.should == [1, 2, 3]
       end
     end
-
   end
 end
 
 describe "Array#shuffle!" do
   ruby_version_is "1.8.7" do
-    it "should return the same values, in a usually different order" do
-      a = [1,2,3,4]
+    it "returns the same values, in a usually different order" do
+      a = [1, 2, 3, 4]
       original = a
       different = false
       10.times do
         a = a.shuffle!
-        a.sort.should == [1,2,3,4]
-        different ||= (a != [1,2,3,4])
+        a.sort.should == [1, 2, 3, 4]
+        different ||= (a != [1, 2, 3, 4])
       end
       different.should be_true # Will fail once in a blue moon (4!^10)
       a.should equal(original)
@@ -56,4 +55,4 @@
       end
     end
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/core/array/sort_by_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/sort_by_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/sort_by_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -17,11 +17,11 @@
     it "completes when supplied a block that always returns the same result" do
       a = [2, 3, 5, 1, 4]
       a.sort_by!{  1 }
-      a.class.should == Array
+      a.should be_kind_of(Array)
       a.sort_by!{  0 }
-      a.class.should == Array
+      a.should be_kind_of(Array)
       a.sort_by!{ -1 }
-      a.class.should == Array
+      a.should be_kind_of(Array)
     end
 
     ruby_version_is '' ... '1.9' do

Modified: MacRuby/trunk/spec/frozen/core/array/sort_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/sort_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/sort_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -75,26 +75,26 @@
     a = Array.new(25)
     (0...25).each {|i| a[i] = ArraySpecs::UFOSceptic.new }
 
-    a.sort { -1 }.class.should == Array
+    a.sort { -1 }.should be_kind_of(Array)
   end
 
   it "does not call #<=> on elements when invoked with a block even if Array is large (Rubinius #412)" do
     a = Array.new(1500)
     (0...1500).each {|i| a[i] = ArraySpecs::UFOSceptic.new }
 
-    a.sort { -1 }.class.should == Array
+    a.sort { -1 }.should be_kind_of(Array)
   end
 
   it "completes when supplied a block that always returns the same result" do
     a = [2, 3, 5, 1, 4]
-    a.sort {  1 }.class.should == Array
-    a.sort {  0 }.class.should == Array
-    a.sort { -1 }.class.should == Array
+    a.sort {  1 }.should be_kind_of(Array)
+    a.sort {  0 }.should be_kind_of(Array)
+    a.sort { -1 }.should be_kind_of(Array)
   end
 
   it "returns subclass instance on Array subclasses" do
     ary = ArraySpecs::MyArray[1, 2, 3]
-    ary.sort.class.should == ArraySpecs::MyArray
+    ary.sort.should be_kind_of(ArraySpecs::MyArray)
   end
 
   it "does not freezes self during being sorted" do
@@ -169,21 +169,21 @@
     a = Array.new(25)
     (0...25).each {|i| a[i] = ArraySpecs::UFOSceptic.new }
 
-    a.sort! { -1 }.class.should == Array
+    a.sort! { -1 }.should be_kind_of(Array)
   end
 
   it "does not call #<=> on elements when invoked with a block even if Array is large (Rubinius #412)" do
     a = Array.new(1500)
     (0...1500).each {|i| a[i] = ArraySpecs::UFOSceptic.new }
 
-    a.sort! { -1 }.class.should == Array
+    a.sort! { -1 }.should be_kind_of(Array)
   end
 
   it "completes when supplied a block that always returns the same result" do
     a = [2, 3, 5, 1, 4]
-    a.sort!{  1 }.class.should == Array
-    a.sort!{  0 }.class.should == Array
-    a.sort!{ -1 }.class.should == Array
+    a.sort!{  1 }.should be_kind_of(Array)
+    a.sort!{  0 }.should be_kind_of(Array)
+    a.sort!{ -1 }.should be_kind_of(Array)
   end
 
   ruby_version_is '' ... '1.9' do
@@ -191,10 +191,12 @@
       lambda { ArraySpecs.frozen_array.sort! }.should raise_error(TypeError)
     end
 
-    it "temporarily freezes self and recovers after sorted" do
-      a = [1, 2, 3]
-      a.sort! { |x,y| a.frozen?.should == true; x <=> y }
-      a.frozen?.should == false
+    not_compliant_on :rubinius do
+      it "temporarily freezes self and recovers after sorted" do
+        a = [1, 2, 3]
+        a.sort! { |x,y| a.frozen?.should == true; x <=> y }
+        a.frozen?.should == false
+      end
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/array/to_a_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/to_a_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/to_a_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -11,7 +11,7 @@
   it "does not return subclass instance on Array subclasses" do
     e = ArraySpecs::MyArray.new
     e << 1
-    e.to_a.class.should == Array
+    e.to_a.should be_kind_of(Array)
     e.to_a.should == [1]
   end
 

Modified: MacRuby/trunk/spec/frozen/core/array/transpose_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/transpose_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/transpose_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -46,8 +46,8 @@
 
   it "does not return subclass instance on Array subclasses" do
     result = ArraySpecs::MyArray[ArraySpecs::MyArray[1, 2, 3], ArraySpecs::MyArray[4, 5, 6]].transpose
-    result.class.should == Array
-    result[0].class.should == Array
-    result[1].class.should == Array
+    result.should be_kind_of(Array)
+    result[0].should be_kind_of(Array)
+    result[1].should be_kind_of(Array)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/array/try_convert_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/try_convert_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/try_convert_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,7 @@
 require File.dirname(__FILE__) + '/fixtures/classes'
 
 describe "Array.try_convert" do
-  ruby_version_is "1.9" do
+  ruby_version_is "1.8.8" do
     it "returns self for arrays" do
       x = [1,2,3]
       Array.try_convert(x).should equal(x)

Modified: MacRuby/trunk/spec/frozen/core/array/union_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/union_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/union_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -58,9 +58,9 @@
   end
   
   it "does not return subclass instances for Array subclasses" do
-    (ArraySpecs::MyArray[1, 2, 3] | []).class.should == Array
-    (ArraySpecs::MyArray[1, 2, 3] | ArraySpecs::MyArray[1, 2, 3]).class.should == Array
-    ([] | ArraySpecs::MyArray[1, 2, 3]).class.should == Array
+    (ArraySpecs::MyArray[1, 2, 3] | []).should be_kind_of(Array)
+    (ArraySpecs::MyArray[1, 2, 3] | ArraySpecs::MyArray[1, 2, 3]).should be_kind_of(Array)
+    ([] | ArraySpecs::MyArray[1, 2, 3]).should be_kind_of(Array)
   end
   
   it "does not call to_ary on array subclasses" do

Modified: MacRuby/trunk/spec/frozen/core/array/uniq_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/uniq_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/uniq_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -81,7 +81,7 @@
   end
 
   it "returns subclass instance on Array subclasses" do
-    ArraySpecs::MyArray[1, 2, 3].uniq.class.should == ArraySpecs::MyArray
+    ArraySpecs::MyArray[1, 2, 3].uniq.should be_kind_of(ArraySpecs::MyArray)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/array/values_at_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/values_at_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/values_at_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -42,6 +42,6 @@
   end
 
   it "does not return subclass instance on Array subclasses" do
-    ArraySpecs::MyArray[1, 2, 3].values_at(0, 1..2, 1).class.should == Array
+    ArraySpecs::MyArray[1, 2, 3].values_at(0, 1..2, 1).should be_kind_of(Array)
   end  
 end

Modified: MacRuby/trunk/spec/frozen/core/array/zip_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/zip_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/array/zip_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -38,6 +38,6 @@
   end
 
   it "does not return subclass instance on Array subclasses" do
-    ArraySpecs::MyArray[1, 2, 3].zip(["a", "b"]).class.should == Array
+    ArraySpecs::MyArray[1, 2, 3].zip(["a", "b"]).should be_kind_of(Array)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/bignum/bit_and_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/bignum/bit_and_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/bignum/bit_and_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -27,8 +27,9 @@
   ruby_version_is "1.9" do
     it "raises a TypeError when passed a Float" do
       lambda { (@bignum & 3.4) }.should raise_error(TypeError)
-      lambda {(bignum_value & bignum_value(0xffff).to_f)}.should 
-        raise_error(TypeError)
+      lambda {
+        (bignum_value & bignum_value(0xffff).to_f)
+      }.should raise_error(TypeError)
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/bignum/bit_or_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/bignum/bit_or_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/bignum/bit_or_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -20,8 +20,9 @@
 
   ruby_version_is "1.9" do
     it "raises a TypeError when passed a Float" do
-      lambda { bignum_value | bignum_value(0xffff).to_f }.should
-        raise_error(TypeError)
+      lambda {
+        bignum_value | bignum_value(0xffff).to_f
+      }.should raise_error(TypeError)
       lambda { @bignum | 9.9 }.should raise_error(TypeError)
     end
   end

Modified: MacRuby/trunk/spec/frozen/core/bignum/bit_xor_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/bignum/bit_xor_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/bignum/bit_xor_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -21,8 +21,9 @@
   ruby_version_is "1.9" do
     it "raises a TypeError when passed a Float" do
       lambda { @bignum ^ 14.5 }.should raise_error(TypeError)
-      lambda { bignum_value ^ bignum_value(0xffff).to_f }.should 
-        raise_error(TypeError)
+      lambda {
+        bignum_value ^ bignum_value(0xffff).to_f
+      }.should raise_error(TypeError)
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/bignum/comparison_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/bignum/comparison_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/bignum/comparison_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -29,7 +29,7 @@
   end
 
   # TODO: Remove duplicate bug guards when ruby_bug is updated.
-  ruby_bug "[ruby-dev:38672] [Bug #1645]", "1.8.7.174" do
+  ruby_bug "[ruby-dev:38672] [Bug #1645]", "1.8.7.248" do
     # The 4 tests below are taken from matz's revision 23730 for Ruby trunk
     #
     it "returns 1 when self is Infinity and other is a Bignum" do

Modified: MacRuby/trunk/spec/frozen/core/bignum/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/bignum/exponent_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/bignum/exponent_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -15,4 +15,12 @@
     lambda { @bignum ** "10" }.should raise_error
     lambda { @bignum ** :symbol }.should raise_error
   end
+  
+  ruby_version_is '1.9.2' do
+    it "returns a complex number when negative and raised to a fractional power" do
+      ((- at bignum) ** (1.0/3))      .should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
+      ((- at bignum) ** Rational(1,3)).should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
+    end
+  end
+
 end

Modified: MacRuby/trunk/spec/frozen/core/bignum/shared/modulo.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/bignum/shared/modulo.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/bignum/shared/modulo.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -25,10 +25,8 @@
 
   ruby_version_is "1.9" do
     it "raises a ZeroDivisionError when the given argument is 0 and a Float" do
-      lambda { @bignum.send(@method, 0.0) }.should 
-        raise_error(ZeroDivisionError) 
-      lambda { - at bignum.send(@method, 0.0) }.should 
-        raise_error(ZeroDivisionError) 
+      lambda { @bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
+      lambda { - at bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError)
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/binding/eval_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/binding/eval_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/binding/eval_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,19 +5,15 @@
   ruby_version_is '1.8.7' do
     it "behaves like Kernel.eval(..., self)" do
       obj = BindingSpecs::Demo.new(1)
-      bind1 = obj.get_binding
-      bind2 = obj.dup.get_binding
-      { "@secret += square(3)" => 10,
-        "a" => true,
-        "class Inside ; end ; Inside.name" => "BindingSpecs::Demo::Inside"
-      }.each do |test, result|
-        r1 = bind1.eval(test)
-        r2 = Kernel.eval(test, bind2)
-        r1.should == r2
-        r1.should == result
-      end
+      bind = obj.get_binding
+
+      bind.eval("@secret += square(3)").should == 10
+      bind.eval("a").should be_true
+
+      bind.eval("class Inside; end")
+      bind.eval("Inside.name").should == "BindingSpecs::Demo::Inside"
     end
-  
+
     it "needs to be completed"
   end
 end

Added: MacRuby/trunk/spec/frozen/core/complex/rationalize_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/complex/rationalize_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/complex/rationalize_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,15 @@
+ruby_version_is "1.9.2" do
+
+  describe "Complex#rationalize" do
+
+    it "raises RangeError if self has non-zero imaginary part" do
+      lambda { Complex(1,5).rationalize }.should raise_error(RangeError)
+    end
+    
+    it "returns a Rational if self has zero imaginary part" do
+      Complex(1,0).rationalize.should == Rational(1,1)
+      Complex(2<<63+5).rationalize.should == Rational(2<<63+5,1)
+    end
+    
+  end
+end

Modified: MacRuby/trunk/spec/frozen/core/continuation/continuation_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/continuation/continuation_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/continuation/continuation_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -28,7 +28,7 @@
       lambda { Continuation.new }.should raise_error(NoMethodError)
 
       cont = ContinuationSpecs.create_cc
-      cont.class.should == Continuation
+      cont.should be_kind_of(Continuation)
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,11 +2,19 @@
 require File.dirname(__FILE__) + '/fixtures/common'
 
 describe "Dir.chdir" do
-  before(:each) do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
+  before :each do
     @original = Dir.pwd
   end
 
-  after(:each) do
+  after :each do
     Dir.chdir(@original)
   end
 
@@ -35,6 +43,12 @@
     Dir.chdir(obj)
   end
 
+  it "calls #to_str on the argument if it's not a String and a block is given" do
+    obj = mock('path')
+    obj.should_receive(:to_str).and_return(Dir.pwd)
+    Dir.chdir(obj) { }
+  end
+
   ruby_version_is "1.9" do
     it "calls #to_path on the argument if it's not a String" do
       obj = mock('path')

Deleted: MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb.orig
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb.orig	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb.orig	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,110 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/common'
-
-describe "Dir.chdir" do
-  before(:each) do
-    @original = Dir.pwd
-  end
-
-  after(:each) do
-    Dir.chdir(@original)
-  end
-
-  it "defaults to $HOME with no arguments" do
-    if ENV['HOME']
-    Dir.chdir(ENV['HOME'])
-    home = DirSpecs.pwd
-
-    Dir.chdir
-    DirSpecs.pwd.should == home
-    end
-  end
-
-  it "changes to the specified directory" do
-    Dir.chdir DirSpecs.mock_dir
-    DirSpecs.pwd.should == DirSpecs.mock_dir
-  end
-
-  it "returns 0 when successfully changing directory" do
-    Dir.chdir(@original).should == 0
-  end
-
-  it "calls #to_str on the argument if it's not a String" do
-    obj = mock('path')
-    obj.should_receive(:to_str).and_return(Dir.pwd)
-    Dir.chdir(obj)
-  end
-
-  ruby_version_is "1.9" do
-    it "calls #to_path on the argument if it's not a String" do
-      obj = mock('path')
-      obj.should_receive(:to_path).and_return(Dir.pwd)
-      Dir.chdir(obj)
-    end
-
-    it "prefers #to_str over #to_path" do
-      obj = Class.new do
-        def to_path; DirSpecs.mock_dir; end
-        def to_str;  Dir.pwd; end
-      end
-      Dir.chdir(obj.new)
-      Dir.pwd.should == @original
-    end
-  end
-
-  it "returns the value of the block when a block is given" do
-    Dir.chdir(@original) { :block_value }.should == :block_value
-  end
-
-  it "defaults to the home directory when given a block but no argument" do
-    # Windows will return a path with forward slashes for ENV["HOME"] so we have
-    # to compare the route representations returned by Dir.chdir.
-    current_dir = ""
-    Dir.chdir { current_dir = Dir.pwd }
-
-    Dir.chdir(ENV['HOME'])
-    current_dir.should == Dir.pwd
-  end
-
-  it "changes to the specified directory for the duration of the block" do
-    ar = Dir.chdir(DirSpecs.mock_dir) { |dir| [dir, DirSpecs.pwd] }
-    ar.should == [DirSpecs.mock_dir, DirSpecs.mock_dir]
-
-    DirSpecs.pwd.should == @original
-  end
-
-  it "raises a SystemCallError if the directory does not exist" do
-    lambda { Dir.chdir DirSpecs.nonexistent }.should raise_error(SystemCallError)
-    lambda { Dir.chdir(DirSpecs.nonexistent) { } }.should raise_error(SystemCallError)
-  end
-
-  it "raises a SystemCallError if the original directory no longer exists" do
-    dir1 = tmp('/testdir1')
-    dir2 = tmp('/testdir2')
-    File.exist?(dir1).should == false
-    File.exist?(dir2).should == false
-    Dir.mkdir dir1
-    Dir.mkdir dir2
-    begin
-      lambda {
-        Dir.chdir dir1 do
-          Dir.chdir(dir2) { Dir.unlink dir1 }
-        end
-      }.should raise_error(SystemCallError)
-    ensure
-      Dir.unlink dir1 if File.exist?(dir1)
-      Dir.unlink dir2 if File.exist?(dir2)
-    end
-  end
-
-  it "always returns to the original directory when given a block" do
-    begin
-      Dir.chdir(DirSpecs.mock_dir) do
-        raise StandardError, "something bad happened"
-      end
-    rescue StandardError
-    end
-
-    DirSpecs.pwd.should == @original
-  end
-end

Deleted: MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb.rej
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb.rej	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb.rej	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,56 +0,0 @@
-***************
-*** 20,30 ****
-      end
-    end
-  
--   it "changes to the specified directory" do
--     Dir.chdir DirSpecs.mock_dir
--     Dir.pwd.should == DirSpecs.mock_dir
-    end
-- 
-    it "returns 0 when successfully changing directory" do
-      Dir.chdir(@original).should == 0
-    end
---- 20,33 ----
-      end
-    end
-  
-+   # MRI fails this when /var path has symlinks, as on OS X
-+   quarantine! do
-+     it "changes to the specified directory" do
-+       Dir.chdir DirSpecs.mock_dir
-+       Dir.pwd.should == DirSpecs.mock_dir
-+     end
-    end
-+   
-    it "returns 0 when successfully changing directory" do
-      Dir.chdir(@original).should == 0
-    end
-***************
-*** 66,76 ****
-      current_dir.should == Dir.pwd
-    end
-  
--   it "changes to the specified directory for the duration of the block" do
--     ar = Dir.chdir(DirSpecs.mock_dir) { |dir| [dir, Dir.pwd] }
--     ar.should == [DirSpecs.mock_dir, DirSpecs.mock_dir]
-  
--     Dir.pwd.should == @original
-    end
-  
-    it "raises a SystemCallError if the directory does not exist" do
---- 69,82 ----
-      current_dir.should == Dir.pwd
-    end
-  
-+   # MRI fails this when /var path has symlinks, as on OS X
-+   quarantine! do
-+     it "changes to the specified directory for the duration of the block" do
-+       ar = Dir.chdir(DirSpecs.mock_dir) { |dir| [dir, Dir.pwd] }
-+       ar.should == [DirSpecs.mock_dir, DirSpecs.mock_dir]
-  
-+       Dir.pwd.should == @original
-+     end
-    end
-  
-    it "raises a SystemCallError if the directory does not exist" do

Modified: MacRuby/trunk/spec/frozen/core/dir/chroot_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/chroot_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/chroot_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,7 +5,9 @@
   not_supported_on :jruby do
     as_superuser do
       describe "Dir.chroot as root" do
-        before(:all) do
+        before :all do
+          DirSpecs.create_mock_dirs
+
           @real_root = "../" * (File.dirname(__FILE__).count('/') - 1)
           @ref_dir = File.join("/", Dir.new('/').entries.first)
         end
@@ -14,6 +16,8 @@
           until File.exists?(@ref_dir)
             Dir.chroot("../") or break
           end
+
+          DirSpecs.delete_mock_dirs
         end
 
         it "can be used to change the process' root directory" do
@@ -47,6 +51,14 @@
 
     as_user do
       describe "Dir.chroot as regular user" do
+        before :all do
+          DirSpecs.create_mock_dirs
+        end
+
+        after :all do
+          DirSpecs.delete_mock_dirs
+        end
+
         it "raises an Errno::EPERM exception if the directory exists" do
           lambda { Dir.chroot('.') }.should raise_error(Errno::EPERM)
         end

Modified: MacRuby/trunk/spec/frozen/core/dir/close_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/close_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/close_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,23 +3,39 @@
 require File.dirname(__FILE__) + '/shared/closed'
 
 describe "Dir#close" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   platform_is_not :windows do
-  it "closes the stream and fd and returns nil" do
-    # This is a bit convoluted but we are trying to ensure the file gets closed.
-    # To do that, we peek to see what the next FD number is and then probe that
-    # to see whether it has been closed.
-    peek = IO.sysopen DirSpecs.mock_dir
-    File.for_fd(peek).close
+    it "closes the stream and fd and returns nil" do
+      # This is a bit convoluted but we are trying to ensure the file gets closed.
+      # To do that, we peek to see what the next FD number is and then probe that
+      # to see whether it has been closed.
+      peek = IO.sysopen DirSpecs.mock_dir
+      File.for_fd(peek).close
 
-    dir = Dir.open DirSpecs.mock_dir
-    File.for_fd(peek).close                   # Should be open here
+      dir = Dir.open DirSpecs.mock_dir
+      File.for_fd(peek).close                   # Should be open here
 
-    dir.close.should == nil
-    lambda { File.for_fd(peek).close }.should raise_error(SystemCallError)  # And closed here
+      dir.close.should == nil
+      lambda { File.for_fd(peek).close }.should raise_error(SystemCallError)  # And closed here
     end
   end
 end
 
 describe "Dir#close" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_closed, :close
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/delete_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/delete_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/delete_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,5 +3,13 @@
 require File.dirname(__FILE__) + '/shared/delete'
 
 describe "Dir.delete" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_delete, :delete
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/each_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/each_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/each_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,11 +3,19 @@
 require File.dirname(__FILE__) + '/shared/closed'
 
 describe "Dir#each" do
-  before(:each) do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
+  before :each do
     @dir = Dir.open DirSpecs.mock_dir
   end
   
-  after(:each) do
+  after :each do
     @dir.close
   end
 
@@ -43,5 +51,13 @@
 end
 
 describe "Dir#each" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_closed, :each
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/element_reference_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/element_reference_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/element_reference_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,9 +3,25 @@
 require File.dirname(__FILE__) + '/shared/glob'
 
 describe "Dir.[]" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_glob, :[]
 end
 
 describe "Dir.[]" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_glob_recursive, :[]
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/entries_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/entries_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/entries_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,6 +2,14 @@
 require File.dirname(__FILE__) + '/fixtures/common'
 
 describe "Dir.entries" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it "returns an Array of filenames in an existing directory including dotfiles" do
     a = Dir.entries(DirSpecs.mock_dir).sort
 

Modified: MacRuby/trunk/spec/frozen/core/dir/exist_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/exist_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/exist_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,6 +3,14 @@
 
 ruby_version_is "1.9" do
   describe "Dir.exist?" do
+    before :all do
+      DirSpecs.create_mock_dirs
+    end
+
+    after :all do
+      DirSpecs.delete_mock_dirs
+    end
+
     it_behaves_like(:dir_exists, :exist?)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/exists_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/exists_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/exists_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,6 +3,14 @@
 
 ruby_version_is "1.9" do
   describe "Dir.exists?" do
+    before :all do
+      DirSpecs.create_mock_dirs
+    end
+
+    after :all do
+      DirSpecs.delete_mock_dirs
+    end
+
     it_behaves_like(:dir_exists, :exists?)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/fixtures/common.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/fixtures/common.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/fixtures/common.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,92 +1,108 @@
-require 'fileutils'
-
 module DirSpecs
-  def self.pwd
-    File.expand_path(Dir.pwd)
+  def self.mock_dir(dirs = ['dir_specs_mock'])
+    @mock_dir ||= tmp("")
+    File.join @mock_dir, dirs
   end
 
-  def self.mock_dir(dirs = ['mock'])
-    File.expand_path(tmp(File.join(dirs)))
-  end
-
   def self.nonexistent
-    name = mock_dir + "/nonexistent00"
+    name = File.join mock_dir, "nonexistent00"
     name = name.next while File.exist? name
-    name
+    File.join mock_dir, name
   end
 
+  # TODO: make these relative to the mock_dir
   def self.clear_dirs
-    old_kcode, $KCODE = $KCODE, 'u'
-    ['nonexisting', 'default_perms','reduced', 'always_returns_0', '???', [0xe9].pack('U')].each do |dir|
-      begin
-        Dir.rmdir dir
-      rescue
+    begin
+      kcode, $KCODE = $KCODE, 'u'
+      [ 'nonexisting',
+        'default_perms',
+        'reduced',
+        'always_returns_0',
+        '???',
+        [0xe9].pack('U')
+      ].each do |dir|
+        begin
+          Dir.rmdir dir
+        rescue
+        end
       end
+    ensure
+      $KCODE = kcode
     end
   end
 
-  def self.create_mock_dirs
-    mock_dir = self.mock_dir
-    files = %w[
-      .dotfile
-      .dotsubdir/.dotfile
-      .dotsubdir/nondotfile
+  # The names of the fixture directories and files used by
+  # various Dir specs.
+  def self.mock_dir_files
+    unless @mock_dir_files
+      @mock_dir_files = %w[
+        .dotfile
+        .dotsubdir/.dotfile
+        .dotsubdir/nondotfile
 
-      deeply/.dotfile
-      deeply/nested/.dotfile.ext
-      deeply/nested/directory/structure/.ext
-      deeply/nested/directory/structure/bar
-      deeply/nested/directory/structure/baz
-      deeply/nested/directory/structure/file_one
-      deeply/nested/directory/structure/file_one.ext
-      deeply/nested/directory/structure/foo
-      deeply/nondotfile
+        deeply/.dotfile
+        deeply/nested/.dotfile.ext
+        deeply/nested/directory/structure/.ext
+        deeply/nested/directory/structure/bar
+        deeply/nested/directory/structure/baz
+        deeply/nested/directory/structure/file_one
+        deeply/nested/directory/structure/file_one.ext
+        deeply/nested/directory/structure/foo
+        deeply/nondotfile
 
-      file_one.ext
-      file_two.ext
+        file_one.ext
+        file_two.ext
 
-      dir_filename_ordering
-      dir/filename_ordering
+        dir_filename_ordering
+        dir/filename_ordering
 
-      nondotfile
+        nondotfile
 
-      subdir_one/.dotfile
-      subdir_one/nondotfile
-      subdir_two/nondotfile
-      subdir_two/nondotfile.ext
+        subdir_one/.dotfile
+        subdir_one/nondotfile
+        subdir_two/nondotfile
+        subdir_two/nondotfile.ext
 
-      special/+
+        special/+
 
-      special/^
-      special/$
+        special/^
+        special/$
 
-      special/(
-      special/)
-      special/[
-      special/]
-      special/{
-      special/}
-    ]
+        special/(
+        special/)
+        special/[
+        special/]
+        special/{
+        special/}
+      ]
 
-    platform_is_not :windows do
-      files += %w[
-        special/*
-        special/?
+      platform_is_not :windows do
+        @mock_dir_files += %w[
+          special/*
+          special/?
 
-        special/|
-      ]
+          special/|
+        ]
+      end
     end
-    
+
+    @mock_dir_files
+  end
+
+  def self.create_mock_dirs
     umask = File.umask 0
-    FileUtils.rm_rf mock_dir
-    files.each do |file|
-      file = File.join mock_dir, file
-      FileUtils.mkdir_p File.dirname(file)
-      FileUtils.touch file
+    mock_dir_files.each do |name|
+      file = File.join mock_dir, name
+      mkdir_p File.dirname(file)
+      touch file
     end
     File.umask umask
   end
 
+  def self.delete_mock_dirs
+    rm_r mock_dir
+  end
+
   def self.mock_rmdir(*dirs)
     mock_dir ['rmdir_dirs'].concat(dirs)
   end
@@ -106,16 +122,16 @@
       dir = File.join base_dir, d
       if File.exists? dir
         File.chmod 0777, dir
-        FileUtils.rm_rf dir
+        rm_r dir
       end
     end
-    FileUtils.rm_rf base_dir
+    rm_r base_dir
 
     if create
       dirs.each do |d|
         dir = File.join base_dir, d
         unless File.exists? dir
-          FileUtils.mkdir_p dir
+          mkdir_p dir
           File.chmod 0777, dir
         end
       end
@@ -139,8 +155,4 @@
       subdir_two
     ]
   end
-
 end
-
-# Create the fixture directories every time the specs are run
-DirSpecs.create_mock_dirs

Modified: MacRuby/trunk/spec/frozen/core/dir/foreach_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/foreach_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/foreach_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,6 +2,14 @@
 require File.dirname(__FILE__) + '/fixtures/common'
 
 describe "Dir.foreach" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it "yields all names in an existing directory to the provided block" do
     a, b = [], []
 
@@ -27,7 +35,7 @@
   it "raises a SystemCallError if passed a nonexistent directory" do
     lambda { Dir.foreach(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError)
   end
-  
+
   ruby_version_is '' ... '1.8.7' do
     it 'raises a LocalJumpError if no block given' do
       lambda{ Dir.foreach(DirSpecs.mock_dir) }.should raise_error(LocalJumpError)

Modified: MacRuby/trunk/spec/frozen/core/dir/getwd_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/getwd_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/getwd_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,5 +3,13 @@
 require File.dirname(__FILE__) + '/shared/pwd'
 
 describe "Dir.getwd" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_pwd, :getwd
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/glob_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/glob_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/glob_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,22 +3,41 @@
 require File.dirname(__FILE__) + '/shared/glob'
 
 describe "Dir.glob" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_glob, :glob
 end
 
 describe "Dir.glob" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_glob_recursive, :[]
 end
 
 describe "Dir.glob" do
-  before(:all) do
+  before :all do
+    DirSpecs.create_mock_dirs
+
     @cwd = Dir.pwd
-
     Dir.chdir DirSpecs.mock_dir
   end
 
-  after(:all) do
+  after :all do
     Dir.chdir @cwd
+
+    DirSpecs.delete_mock_dirs
   end
 
   it "matches both dot and non-dotfiles with '*' and option File::FNM_DOTMATCH" do

Modified: MacRuby/trunk/spec/frozen/core/dir/home_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/home_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/home_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,6 +3,14 @@
 
 ruby_version_is "1.9.2" do
   describe "Dir.home" do
+    before :all do
+      DirSpecs.create_mock_dirs
+    end
+
+    after :all do
+      DirSpecs.delete_mock_dirs
+    end
+
     it "returns the current user's home directory as a string if called without arguments" do
       Dir.home.should == home_directory
     end
@@ -13,6 +21,6 @@
 
     it "raises an ArgumentError if the named user doesn't exist" do
       lambda { Dir.home('geuw2n288dh2k') }.should raise_error(ArgumentError)
-    end  
-  end  
+    end
+  end
 end

Deleted: MacRuby/trunk/spec/frozen/core/dir/initialize_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/initialize_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/initialize_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,2 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/common'

Modified: MacRuby/trunk/spec/frozen/core/dir/inspect_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/inspect_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/inspect_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,6 +2,14 @@
 
 ruby_version_is "1.8.7" do
   describe "Dir#inspect" do
+    before :all do
+      DirSpecs.create_mock_dirs
+    end
+
+    after :all do
+      DirSpecs.delete_mock_dirs
+    end
+
     it "returns a String" do
       Dir.new(Dir.getwd).inspect.should be_an_instance_of(String)
     end

Modified: MacRuby/trunk/spec/frozen/core/dir/mkdir_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/mkdir_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/mkdir_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,6 +2,14 @@
 require File.dirname(__FILE__) + '/fixtures/common'
 
 describe "Dir.mkdir" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it "creates the named directory with the given permissions" do
     DirSpecs.clear_dirs
 
@@ -44,29 +52,36 @@
     end
   end
 
-  # The permissions flag are not supported on Windows as stated in documentation:
-  # The permissions may be modified by the value of File::umask, and are ignored on NT.
-  platform_is_not :windows do
-    it "raises a SystemCallError when lacking adequate permissions in the parent dir" do
-      # In case something happened it it didn't get cleaned up.
-        FileUtils.rm_rf 'noperms' if File.directory? 'noperms'
+  it "raises a SystemCallError if any of the directories in the path before the last does not exist" do
+    lambda { Dir.mkdir "#{DirSpecs.nonexistent}/subdir" }.should raise_error(SystemCallError)
+  end
 
-      Dir.mkdir 'noperms', 0000
+  it "raises Errno::EEXIST if the specified directory already exists" do
+    lambda { Dir.mkdir(File.dirname(__FILE__)) }.should raise_error(Errno::EEXIST)
+  end
 
-      lambda { Dir.mkdir 'noperms/subdir' }.should raise_error(SystemCallError)
+  it "raises Errno::EEXIST if the argument points to the existing file" do
+    lambda { Dir.mkdir(__FILE__) }.should raise_error(Errno::EEXIST)
+  end
+end
 
-      system 'chmod 0777 noperms'
-      platform_is_not :windows do
-        File.chmod 0777, "noperms"
-      end
-      platform_is :windows do
-        File.chmod 0666, "noperms"
-      end
-      Dir.rmdir 'noperms'
+# The permissions flag are not supported on Windows as stated in documentation:
+# The permissions may be modified by the value of File::umask, and are ignored on NT.
+platform_is_not :windows do
+  describe "Dir.mkdir" do
+    before :each do
+      @dir = tmp "noperms"
     end
-  end
 
-  it "raises a SystemCallError if any of the directories in the path before the last does not exist" do
-    lambda { Dir.mkdir "#{DirSpecs.nonexistent}/subdir" }.should raise_error(SystemCallError)
+    after :each do
+      File.chmod 0777, @dir
+      rm_r @dir
+    end
+
+    it "raises a SystemCallError when lacking adequate permissions in the parent dir" do
+      Dir.mkdir @dir, 0000
+
+      lambda { Dir.mkdir "#{@dir}/subdir" }.should raise_error(SystemCallError)
+    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,2 +1,6 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/fixtures/common'
+
+describe "Dir.new" do
+  it "needs to be reviewed for spec completeness"
+end

Modified: MacRuby/trunk/spec/frozen/core/dir/open_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/open_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/open_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,5 +3,13 @@
 require File.dirname(__FILE__) + '/shared/open'
 
 describe "Dir.open" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_open, :open
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/path_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/path_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/path_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,5 +3,13 @@
 require File.dirname(__FILE__) + '/shared/path'
 
 describe "Dir#path" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like(:dir_path, :path)
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/pos_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/pos_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/pos_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,13 +4,37 @@
 require File.dirname(__FILE__) + '/shared/pos'
 
 describe "Dir#pos" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_pos, :pos
 end
 
 describe "Dir#pos" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_closed, :pos
 end
 
 describe "Dir#pos=" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_pos_set, :pos=
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/pwd_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/pwd_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/pwd_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,6 +3,14 @@
 require File.dirname(__FILE__) + '/shared/pwd'
 
 describe "Dir.pwd" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_pwd, :pwd
   
   ruby_version_is ""..."1.9" do

Modified: MacRuby/trunk/spec/frozen/core/dir/read_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/read_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/read_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,6 +3,14 @@
 require File.dirname(__FILE__) + '/shared/closed'
 
 describe "Dir#read" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it "returns the file name in the current seek position" do
     # an FS does not necessarily impose order
     ls = Dir.entries DirSpecs.mock_dir
@@ -10,8 +18,6 @@
     ls.should include(dir.read)
     dir.close
   end
-end
 
-describe "Dir#read" do
   it_behaves_like :dir_closed, :read
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/rewind_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/rewind_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/rewind_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,11 +3,19 @@
 require File.dirname(__FILE__) + '/shared/closed'
 
 describe "Dir#rewind" do
-  before(:each) do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
+  before :each do
     @dir = Dir.open DirSpecs.mock_dir
   end
 
-  after(:each) do
+  after :each do
     @dir.close
   end
 
@@ -30,8 +38,6 @@
   it "returns the Dir instance" do
     @dir.rewind.should == @dir
   end
-end
 
-describe "Dir#rewind" do
   it_behaves_like :dir_closed, :rewind
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/rmdir_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/rmdir_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/rmdir_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,5 +3,13 @@
 require File.dirname(__FILE__) + '/shared/delete'
 
 describe "Dir.rmdir" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_delete, :rmdir
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/seek_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/seek_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/seek_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,6 +3,14 @@
 require File.dirname(__FILE__) + '/shared/pos'
 
 describe "Dir#seek" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it "returns the Dir instance" do
     @dir.seek(@dir.pos).should == @dir
   end

Modified: MacRuby/trunk/spec/frozen/core/dir/shared/delete.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/shared/delete.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/shared/delete.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -26,10 +26,13 @@
     end.should raise_error(SystemCallError)
   end
 
-  it "raises a SystemCallError if lacking adequate permissions to remove the directory" do
-    File.chmod(0000, DirSpecs.mock_rmdir("noperm"))
-    lambda do
-      Dir.send @method, DirSpecs.mock_rmdir("noperm", "child")
-    end.should raise_error(SystemCallError)
+  # this won't work on Windows, since chmod(0000) does not remove all permissions
+  platform_is_not :windows do
+    it "raises a SystemCallError if lacking adequate permissions to remove the directory" do
+      File.chmod(0000, DirSpecs.mock_rmdir("noperm"))
+      lambda do
+        Dir.send @method, DirSpecs.mock_rmdir("noperm", "child")
+      end.should raise_error(SystemCallError)
+    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/shared/glob.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/shared/glob.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/shared/glob.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -230,8 +230,8 @@
       a/x/b/y/b/z/e
     ].each do |path|
       file = File.join @mock_dir, path
-      FileUtils.mkdir_p File.dirname(file)
-      FileUtils.touch file
+      mkdir_p File.dirname(file)
+      touch file
     end
 
     Dir.chdir @mock_dir
@@ -239,7 +239,7 @@
 
   after(:all) do
     Dir.chdir @cwd
-    FileUtils.rm_r @mock_dir
+    rm_r @mock_dir
   end
 
   it "matches multiple recursives" do

Modified: MacRuby/trunk/spec/frozen/core/dir/shared/open.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/shared/open.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/shared/open.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,7 +1,7 @@
 describe :dir_open, :shared => true do
   it "returns a Dir instance representing the specified directory" do
     dir = Dir.send(@method, DirSpecs.mock_dir)
-    dir.class.should == Dir
+    dir.should be_kind_of(Dir)
     dir.close
   end
 
@@ -12,7 +12,7 @@
   end
 
   it "may take a block which is yielded to with the Dir instance" do
-    Dir.send(@method, DirSpecs.mock_dir) {|dir| dir.class.should == Dir }
+    Dir.send(@method, DirSpecs.mock_dir) {|dir| dir.should be_kind_of(Dir)}
   end
 
   it "returns the value of the block if a block is given" do

Modified: MacRuby/trunk/spec/frozen/core/dir/tell_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/tell_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/tell_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,9 +4,15 @@
 require File.dirname(__FILE__) + '/shared/pos'
 
 describe "Dir#tell" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_pos, :tell
-end
 
-describe "Dir#tell" do
   it_behaves_like :dir_closed, :tell
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/to_path.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/to_path.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/to_path.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,6 +4,14 @@
 
 ruby_version_is "1.9" do
   describe "Dir#to_path" do
+    before :all do
+      DirSpecs.create_mock_dirs
+    end
+
+    after :all do
+      DirSpecs.delete_mock_dirs
+    end
+
     it_behaves_like(:dir_path, :to_path)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/dir/unlink_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/unlink_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/dir/unlink_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,5 +3,13 @@
 require File.dirname(__FILE__) + '/shared/delete'
 
 describe "Dir.unlink" do
+  before :all do
+    DirSpecs.create_mock_dirs
+  end
+
+  after :all do
+    DirSpecs.delete_mock_dirs
+  end
+
   it_behaves_like :dir_delete, :unlink
 end

Modified: MacRuby/trunk/spec/frozen/core/encoding/locale_charmap_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/encoding/locale_charmap_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/encoding/locale_charmap_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,6 +8,8 @@
 
     # FIXME: Get this working on Windows
     platform_is :os => [:darwin, :linux] do
+      # FIXME: This spec fails on Mac OS X because it doesn't have ANSI_X3.4-1968 locale.
+      # FIXME: If ENV['LC_ALL'] is already set, it comes first.
       it "returns a value based on the LANG environment variable" do
         old_lang = ENV['LANG']
         ENV['LANG'] = 'C'
@@ -24,4 +26,4 @@
       end
     end
   end
-end
\ No newline at end of file
+end

Added: MacRuby/trunk/spec/frozen/core/encoding/replicate_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/encoding/replicate_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/encoding/replicate_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,34 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+ruby_version_is "1.9" do
+  describe "Encoding#replicate" do
+    it "returns a replica of ASCII" do
+      e = Encoding::ASCII.replicate('RS-ASCII')
+      e.name.should == 'RS-ASCII'
+      "a".force_encoding(e).valid_encoding?.should be_true
+      "\x80".force_encoding(e).valid_encoding?.should be_false
+    end
+
+    it "returns a replica of UTF-8" do
+      e = Encoding::UTF_8.replicate('RS-UTF-8')
+      e.name.should == 'RS-UTF-8'
+      "a".force_encoding(e).valid_encoding?.should be_true
+      "\u3042".force_encoding(e).valid_encoding?.should be_true
+      "\x80".force_encoding(e).valid_encoding?.should be_false
+    end
+
+    it "returns a replica of UTF-16BE" do
+      e = Encoding::UTF_16BE.replicate('RS-UTF-16BE')
+      e.name.should == 'RS-UTF-16BE'
+      "a".force_encoding(e).valid_encoding?.should be_false
+      "\x30\x42".force_encoding(e).valid_encoding?.should be_true
+      "\x80".force_encoding(e).valid_encoding?.should be_false
+    end
+
+    it "returns a replica of ISO-2022-JP" do
+      e = Encoding::ISO_2022_JP.replicate('RS-ISO-2022-JP')
+      e.name.should == 'RS-ISO-2022-JP'
+      e.dummy?.should be_true
+    end
+  end
+end

Modified: MacRuby/trunk/spec/frozen/core/enumerable/each_with_object_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/enumerable/each_with_object_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/enumerable/each_with_object_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,7 @@
 require File.dirname(__FILE__) + '/fixtures/classes'
 
 describe "Enumerable#each_with_object" do
-  ruby_version_is '1.9' do
+  ruby_version_is '1.8.8' do
     before :each do
       @values = [2, 5, 3, 6, 1, 4]
       @enum = EnumerableSpecs::Numerous.new(*@values)

Modified: MacRuby/trunk/spec/frozen/core/enumerator/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/enumerator/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/enumerator/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,7 +6,7 @@
   describe "Enumerator.new" do
     it_behaves_like(:enum_new, :new)
 
-    ruby_version_is "1.9" do
+    ruby_version_is "1.8.8" do
       it "accepts a block" do
         enum = enumerator_class.new do |yielder|
           yielder.yield 3

Modified: MacRuby/trunk/spec/frozen/core/enumerator/rewind_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/enumerator/rewind_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/enumerator/rewind_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,10 +6,11 @@
   describe "Enumerator#rewind" do
     it_behaves_like(:enum_rewind, :rewind)
 
-    ruby_version_is "1.9" do
+    ruby_version_is "1.8.8" do
       it "calls the enclosed object's rewind method if one exists" do
         obj = mock('rewinder')
-        enum = enumerator_class.new(obj, :enum)
+        enum = enumerator_class.new(obj)
+        obj.should_receive(:each).at_most(1)
         obj.should_receive(:rewind)
         enum.rewind
       end
@@ -17,6 +18,8 @@
       it "does nothing if the object doesn't have a #rewind method" do
         obj = mock('rewinder')
         enum = enumerator_class.new(obj)
+        obj.should_receive(:each).at_most(1)
+        obj.should_receive(:rewind)
         lambda { enum.rewind.should == enum }.should_not raise_error
       end
     end

Modified: MacRuby/trunk/spec/frozen/core/enumerator/with_object_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/enumerator/with_object_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/enumerator/with_object_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,7 +1,7 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/../../shared/enumerator/with_object'
 
-ruby_version_is "1.9" do
+ruby_version_is "1.8.8" do
   describe "Enumerator#with_object" do
     it_behaves_like :enum_with_object, :with_object
   end

Modified: MacRuby/trunk/spec/frozen/core/env/clear_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/env/clear_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/env/clear_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,7 +5,13 @@
     orig = ENV.to_hash
     begin
       ENV.clear
-      env.should == {}
+
+      # This used 'env' the helper before. That shells out to 'env' which
+      # itself sets up certain environment variables before it runs, because
+      # the shell sets them up before it runs any command.
+      #
+      # Thusly, you can ONLY test this by asking through ENV itself.
+      ENV.size.should == 0
     ensure
       ENV.replace orig
     end

Modified: MacRuby/trunk/spec/frozen/core/env/reject_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/env/reject_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/env/reject_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -61,7 +61,7 @@
   end
 
   it "returns a Hash" do
-    ENV.reject { false }.class.should == Hash
+    ENV.reject { false }.should be_kind_of(Hash)
   end
 
   ruby_version_is "" ... "1.8.7" do

Modified: MacRuby/trunk/spec/frozen/core/exception/exception_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/exception/exception_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/exception/exception_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,4 +1,5 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/common'
 require File.dirname(__FILE__) + '/shared/new'
 
 describe "Exception.exception" do
@@ -66,4 +67,5 @@
     e2.should be_an_instance_of(RuntimeError)
     e2.message.should == :message
   end
+
 end

Modified: MacRuby/trunk/spec/frozen/core/exception/fixtures/common.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/exception/fixtures/common.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/exception/fixtures/common.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -34,4 +34,11 @@
       nil
     end
   end
+
+  class ConstructorException < Exception
+
+    def initialize
+    end
+
+  end
 end  

Modified: MacRuby/trunk/spec/frozen/core/exception/no_method_error_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/exception/no_method_error_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/exception/no_method_error_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -32,7 +32,7 @@
     begin
       NoMethodErrorSpecs::NoMethodErrorD.new.foo
     rescue Exception => e
-      e.class.should == NoMethodError
+      e.should be_kind_of(NoMethodError)
     end
   end
 
@@ -40,7 +40,7 @@
     begin
       NoMethodErrorSpecs::NoMethodErrorC.new.a_protected_method
     rescue Exception => e
-      e.class.should == NoMethodError
+      e.should be_kind_of(NoMethodError)
     end
   end
 
@@ -49,7 +49,7 @@
       begin
         NoMethodErrorSpecs::NoMethodErrorC.new.a_private_method
       rescue Exception => e
-        e.class.should == NoMethodError
+        e.should be_kind_of(NoMethodError)
         e.message.match(/private method/).should_not == nil
       end
     end

Modified: MacRuby/trunk/spec/frozen/core/exception/shared/new.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/exception/shared/new.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/exception/shared/new.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,4 +10,9 @@
   it "returns 'Exception' for message when no message given" do
     Exception.send(@method).message.should == "Exception"
   end
+
+  it "returns the exception when it has a custom constructor" do
+    ExceptionSpecs::ConstructorException.send(@method).should be_kind_of(ExceptionSpecs::ConstructorException)
+  end
+
 end

Modified: MacRuby/trunk/spec/frozen/core/fiber/alive_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/fiber/alive_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/fiber/alive_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,7 +1,9 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 
 ruby_version_is "1.9" do
-  require 'fiber'
+  not_supported_on :jruby do
+    require 'fiber'
+  end
 
   describe "Fiber#alive?" do
 

Modified: MacRuby/trunk/spec/frozen/core/fiber/current_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/fiber/current_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/fiber/current_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,9 +2,10 @@
 
 ruby_version_is "1.9" do
   describe "Fiber.current" do
+    not_supported_on :jruby do
+      require 'fiber'
+    end
 
-    require 'fiber'
-
     it "returns the root Fiber when called outside of a Fiber" do
       root = Fiber.current
       root.should be_an_instance_of(Fiber)

Modified: MacRuby/trunk/spec/frozen/core/fiber/resume_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/fiber/resume_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/fiber/resume_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,13 +5,13 @@
   describe "Fiber#resume" do
   
     it_behaves_like(:resume, :transfer)
-
+    
     it "returns control to the calling Fiber if called from one" do
       fiber1 = Fiber.new { :fiber1 }
       fiber2 = Fiber.new { fiber1.resume; :fiber2 }
       fiber2.resume.should == :fiber2
     end
-
+    
     it "raises a FiberError if the Fiber has transfered control to another Fiber" do
       fiber1 = Fiber.new { true }
       fiber2 = Fiber.new { fiber1.transfer; Fiber.yield }
@@ -19,16 +19,18 @@
       lambda { fiber2.resume }.should raise_error(FiberError)
     end
 
-    # http://redmine.ruby-lang.org/issues/show/595
-    it "executes the ensure clause" do
-      fib = Fiber.new{
-        begin
-          Fiber.yield :begin
-        ensure
-          :ensure
-        end
-      }
-      fib.resume.should == :ensure
+    ruby_bug "redmine #595", "1.9" do
+      it "executes the ensure clause" do
+        fib = Fiber.new{
+          begin
+            exit 0
+          rescue SystemExit
+          ensure
+            :ensure
+          end
+        }
+        fib.resume.should == :ensure
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/fiber/shared/resume.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/fiber/shared/resume.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/fiber/shared/resume.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,7 +1,9 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
 
 ruby_version_is "1.9" do
-  require 'fiber'
+  not_supported_on :jruby do
+    require 'fiber'
+  end
   
   describe :resume, :shared => :true do
 

Modified: MacRuby/trunk/spec/frozen/core/fiber/transfer_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/fiber/transfer_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/fiber/transfer_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,8 +3,9 @@
 
 ruby_version_is "1.9" do
   describe "Fiber#transfer" do
-    
-    require 'fiber'
+    not_supported_on :jruby do
+      require 'fiber'
+    end
 
     it_behaves_like(:resume, :transfer)
 

Modified: MacRuby/trunk/spec/frozen/core/file/atime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/atime_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/atime_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,11 +3,11 @@
 describe "File.atime" do
   before :each do
     @file = tmp('test.txt')
-    File.open(@file, "w") {} # touch
+    touch @file
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
 
   it "returns the last access time for the named file as a Time object" do

Modified: MacRuby/trunk/spec/frozen/core/file/basename_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/basename_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/basename_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,13 +3,11 @@
 describe "File.basename" do
   before :each do
     @name = tmp("test.txt")
-    File.delete(@name) if File.exist? @name
-    @file = File.open(@name, "w+")
+    touch @name
   end
 
   after :each do
-    @file.close
-    File.delete(@name) if File.exist?(@name)
+    rm_r @name
   end
 
   it "return the basename of a path (basic cases)" do
@@ -24,7 +22,6 @@
     File.basename("/tmp.cpp", ".*").should == "tmp"
     File.basename("/tmp.cpp", ".???").should == "tmp.cpp"
     File.basename("/tmp.o", ".c").should == "tmp.o"
-    #Version.greater_or_equal("1.8.0") do
     File.basename(File.join("/tmp/")).should == "tmp"
     File.basename("/").should == "/"
     File.basename("//").should == "/"
@@ -38,7 +35,6 @@
     File.basename("dir//base/", ".c").should == "base"
     File.basename("dir//base.c/", ".c").should == "base"
     File.basename("dir//base.c/", ".*").should == "base"
-    #end
   end
 
   it "return the last component of the filename" do
@@ -53,7 +49,7 @@
   end
 
   it "return an string" do
-    File.basename("foo").class.should == String
+    File.basename("foo").should be_kind_of(String)
   end
 
   it "return the basename for unix format" do

Modified: MacRuby/trunk/spec/frozen/core/file/chmod_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/chmod_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/chmod_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,7 +8,7 @@
 
   after :each do
     @file.close
-    File.delete(@filename) if File.exist?(@filename)
+    rm_r @filename
   end
 
   it "returns 0 if successful" do
@@ -98,12 +98,12 @@
 describe "File.chmod" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file, 'w') {}
+    touch @file
     @count = File.chmod(0755, @file)
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
 
   it "returns the number of files modified" do

Modified: MacRuby/trunk/spec/frozen/core/file/chown_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/chown_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/chown_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,11 +4,11 @@
   describe "File.chown" do
     before :each do
       @fname = tmp('file_chown_test')
-      File.open(@fname, 'w') { }
+      touch @fname
     end
 
     after :each do
-      File.delete @fname if File.exist? @fname
+      rm_r @fname
     end
 
     platform_is :windows do
@@ -78,7 +78,7 @@
 
     after :each do
       @file.close unless @file.closed?
-      File.delete @fname if File.exist? @fname
+      rm_r @fname
     end
 
     platform_is :windows do

Modified: MacRuby/trunk/spec/frozen/core/file/ctime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/ctime_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/ctime_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -11,7 +11,7 @@
 
   it "Returns the change time for the named file (the time at which directory information about the file was changed, not the file itself)." do
     File.ctime(@file)
-    File.ctime(@file).class.should == Time
+    File.ctime(@file).should be_kind_of(Time)
   end
 
   ruby_version_is "1.9" do
@@ -37,6 +37,6 @@
 
   it "Returns the change time for the named file (the time at which directory information about the file was changed, not the file itself)." do
     @file.ctime
-    @file.ctime.class.should == Time
+    @file.ctime.should be_kind_of(Time)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/file/dirname_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/dirname_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/dirname_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -12,7 +12,7 @@
   end
 
   it "returns a String" do
-    File.dirname("foo").class.should == String
+    File.dirname("foo").should be_kind_of(String)
   end
 
   it "does not modify its argument" do

Modified: MacRuby/trunk/spec/frozen/core/file/fixtures/file_types.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/fixtures/file_types.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/fixtures/file_types.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -56,10 +56,10 @@
   def self.socket()
     require 'socket'
     name = tmp("ftype_socket.socket")
-    File.delete name if File.exist? name
+    rm_r name
     socket = UNIXServer.new name
     yield name
     socket.close
-    File.delete name if File.exist? name
+    rm_r name
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/file/flock_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/flock_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/flock_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,24 +2,42 @@
 
 describe "File#flock" do
   before :each do
-    system "echo 'rubinius' > flock_test"
+    @name = tmp("flock_test")
+    touch(@name) { |f| f.write "rubinius" }
+
+    @file = File.open @name, "r"
   end
 
   after :each do
-    File.delete('flock_test') if File.exist?('flock_test')
+    @file.flock File::LOCK_UN
+    @file.close
+    rm_r @name
   end
 
-  it "should lock a file" do
-    f = File.open('flock_test', "r")
-    f.flock(File::LOCK_EX).should == 0
-    File.open('flock_test', "w") do |f2|
+  it "exclusively locks a file" do
+    @file.flock(File::LOCK_EX).should == 0
+    @file.flock(File::LOCK_UN).should == 0
+  end
+
+  it "non-exclusively locks a file" do
+    @file.flock(File::LOCK_SH).should == 0
+    @file.flock(File::LOCK_UN).should == 0
+  end
+
+  it "returns false if trying to lock an exclusively locked file" do
+    @file.flock File::LOCK_EX
+
+    File.open(@name, "w") do |f2|
       f2.flock(File::LOCK_EX | File::LOCK_NB).should == false
     end
-    f.flock(File::LOCK_UN).should == 0
-    File.open('flock_test', "w") do |f2|
-      f2.flock(File::LOCK_EX | File::LOCK_NB).should == 0
+  end
+
+  it "returns 0 if trying to lock a non-exclusively locked file" do
+    @file.flock File::LOCK_SH
+
+    File.open(@name, "w") do |f2|
+      f2.flock(File::LOCK_SH | File::LOCK_NB).should == 0
       f2.flock(File::LOCK_UN).should == 0
     end
-    f.close
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/file/ftype_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/ftype_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/ftype_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -14,7 +14,7 @@
 
   it "returns a String " do
     FileSpecs.normal_file do |file|
-      File.ftype(file).class.should == String
+      File.ftype(file).should be_kind_of(String)
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/file/lchmod_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/lchmod_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/lchmod_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,16 +5,15 @@
     before :each do
       @fname = tmp('file_chmod_test')
       @lname = @fname + '.lnk'
-      File.delete @fname rescue nil
-      File.delete @lname rescue nil
-      File.open(@fname, 'w') { |f| f.write "rubinius" }
+
+      touch(@fname) { |f| f.write "rubinius" }
+
+      rm_r @lname
       File.symlink @fname, @lname
     end
     
     after :each do
-      # the link should be removed first
-      File.delete @lname if File.exist? @lname
-      File.delete @fname if File.exist? @fname
+      rm_r @lname, @fname
     end
     
     it "changes the file mode of the link and not of the file" do

Modified: MacRuby/trunk/spec/frozen/core/file/lchown_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/lchown_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/lchown_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,15 +6,15 @@
       before :each do
         @fname = tmp('file_chown_test')
         @lname = @fname + '.lnk'
-        File.delete @fname rescue nil
-        File.delete @lname rescue nil
-        File.open(@fname, 'w') { |f| f.chown 501, 501 }
+
+        touch(@fname) { |f| f.chown 501, 501 }
+
+        rm_r @lname
         File.symlink @fname, @lname
       end
 
       after :each do
-        File.delete @fname if File.exist? @fname
-        File.delete @lname if File.exist? @lname
+        rm_r @lname, @fname
       end
 
       it "changes the owner id of the file" do

Modified: MacRuby/trunk/spec/frozen/core/file/link_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/link_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/link_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,17 +2,15 @@
 
 describe "File.link" do
   before :each do
-    @file = "test.txt"
-    @link = "test.lnk"
-    File.delete(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
-    File.open(@file,"w+")
+    @file = tmp("file_link.txt")
+    @link = tmp("file_link.lnk")
+
+    rm_r @link
+    touch @file
   end
 
   after :each do
-    File.unlink(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
-    @link = nil
+    rm_r @link, @file
   end
 
   platform_is_not :windows do

Modified: MacRuby/trunk/spec/frozen/core/file/lstat_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/lstat_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/lstat_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,13 +10,12 @@
   before :each do
     @file = tmp('i_exist')
     @link = tmp('i_am_a_symlink')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write 'rubinius' }
     File.symlink(@file, @link)
   end
 
   after :each do
-    File.delete(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
+    rm_r @link, @file
   end
   
   it "returns a File::Stat object with symlink properties for a symlink" do

Modified: MacRuby/trunk/spec/frozen/core/file/mtime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/mtime_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/mtime_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,15 +3,15 @@
 describe "File.mtime" do
   before :each do
     @filename = tmp('i_exist')
-    File.open(@filename, 'w') { @mtime = Time.now }
+    touch(@filename) { @mtime = Time.now }
   end
 
   after :each do
-    File.delete(@filename) if File.exist?(@filename)
+    rm_r @filename
   end
 
   it "returns the modification Time of the file" do
-    File.mtime(@filename).class.should == Time
+    File.mtime(@filename).should be_kind_of(Time)
     File.mtime(@filename).should be_close(@mtime, 2.0)
   end
 
@@ -28,11 +28,11 @@
 
   after :each do
     @f.close
-    File.delete(@filename) if File.exist?(@filename)
+    rm_r @filename
   end
 
   it "returns the modification Time of the file" do
-    @f.mtime.class.should == Time
+    @f.mtime.should be_kind_of(Time)
   end
 
 end

Modified: MacRuby/trunk/spec/frozen/core/file/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,34 +6,31 @@
     @file = tmp('test.txt')
     @fh = nil
     @flags = File::CREAT | File::TRUNC | File::WRONLY
-    File.open(@file, "w") {} # touch
+    touch @file
   end
 
   after :each do
-   @fh.close if @fh 
-    File.delete(@file) if File.exists?(@file)
-    @fh    = nil
-    @file  = nil
-    @flags = nil
+    @fh.close if @fh
+    rm_r @file
   end
 
-  it "return a new File with mode string" do
+  it "returns a new File with mode string" do
     @fh = File.new(@file, 'w')
-    @fh.class.should == File
+    @fh.should be_kind_of(File)
     File.exists?(@file).should == true
   end
 
-  it "return a new File with mode num" do
+  it "returns a new File with mode num" do
     @fh = File.new(@file, @flags)
-    @fh.class.should == File
+    @fh.should be_kind_of(File)
     File.exists?(@file).should == true
   end
 
-  it "return a new File with modus num and permissions" do
+  it "returns a new File with modus num and permissions" do
     File.delete(@file)
     File.umask(0011)
     @fh = File.new(@file, @flags, 0755)
-    @fh.class.should == File
+    @fh.should be_kind_of(File)
     File.stat(@file).mode.to_s(8).should == "100744"
     File.exists?(@file).should == true
   end
@@ -68,11 +65,11 @@
     File.read(@file).should == "test\n"
   end
 
-  it "return a new File with modus fd " do
+  it "returns a new File with modus fd " do
     begin
       @fh_orig = File.new(@file)
       @fh = File.new(@fh_orig.fileno)
-      @fh.class.should == File
+      @fh.should be_kind_of(File)
       File.exists?(@file).should == true
     ensure
       @fh.close rescue nil if @fh
@@ -82,9 +79,9 @@
     end
   end
 
-  it "create a new file when use File::EXCL mode " do
+  it "creates a new file when use File::EXCL mode " do
     @fh = File.new(@file, File::EXCL)
-    @fh.class.should == File
+    @fh.should be_kind_of(File)
     File.exists?(@file).should == true
   end
 
@@ -92,9 +89,9 @@
     lambda { @fh = File.new(@file, File::CREAT|File::EXCL) }.should raise_error(Errno::EEXIST)
   end
 
-  it "create a new file when use File::WRONLY|File::APPEND mode" do
+  it "creates a new file when use File::WRONLY|File::APPEND mode" do
     @fh = File.new(@file, File::WRONLY|File::APPEND)
-    @fh.class.should == File
+    @fh.should be_kind_of(File)
     File.exists?(@file).should == true
   end
 
@@ -112,21 +109,21 @@
 
   it "raises an Errno::EINVAL error with File::RDONLY|File::WRONLY" do
     @fh = File.new(@file, File::RDONLY|File::WRONLY)
-    @fh.class.should == File
+    @fh.should be_kind_of(File)
     File.exists?(@file).should == true
   end
 
 
-  it "create a new file when use File::WRONLY|File::TRUNC mode" do
+  it "creates a new file when use File::WRONLY|File::TRUNC mode" do
     @fh = File.new(@file, File::WRONLY|File::TRUNC)
-    @fh.class.should == File
+    @fh.should be_kind_of(File)
     File.exists?(@file).should == true
   end
 
   it "coerces filename using to_str" do
     name = mock("file")
     name.should_receive(:to_str).and_return(@file)
-    File.new(name, "w") { }
+    @fh = File.new(name, "w")
     File.exists?(@file).should == true
   end
 
@@ -134,17 +131,22 @@
     it "coerces filename using #to_path" do
       name = mock("file")
       name.should_receive(:to_path).and_return(@file)
-      File.new(name, "w") { }
+      @fh = File.new(name, "w")
       File.exists?(@file).should == true
     end
   end
-
-  specify  "expected errors " do
-    lambda { File.new(true)  }.should raise_error(TypeError)
+  
+  it "raises a TypeError if the first parameter can't be coerced to a string" do
+    lambda { File.new(true) }.should raise_error(TypeError)
     lambda { File.new(false) }.should raise_error(TypeError)
-    lambda { File.new(nil)   }.should raise_error(TypeError)
+  end
+  
+  it "raises a TypeError if the first parameter is nil" do
+    lambda { File.new(nil) }.should raise_error(TypeError)
+  end
+  
+  it "raises an Errno::EBADF if the first parameter is an invalid file descriptor" do
     lambda { File.new(-1) }.should raise_error(Errno::EBADF)
-    lambda { File.new(@file, File::CREAT, 0755, 'test') }.should raise_error(ArgumentError)
   end
 
   ruby_bug "#1582", "1.9.2" do

Modified: MacRuby/trunk/spec/frozen/core/file/open_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/open_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/open_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -11,13 +11,13 @@
   before :each do
     @fh = @fd = nil
     @flags = File::CREAT | File::TRUNC | File::WRONLY
-    File.open(@file, "w") {} # touch
+    touch @file
   end
 
   after :each do
+    @fh.close if @fh and not @fh.closed?
     File.delete(@file) if File.exist?(@file)
     File.delete("fake") if File.exist?("fake")
-    @fh.close if @fh and not @fh.closed?
   end
 
   it "with block does not raise error when file is closed inside the block" do
@@ -59,6 +59,7 @@
       class << f
         alias_method(:close_orig, :close)
         def close
+          close_orig
           raise IOError
         end
       end
@@ -432,10 +433,14 @@
   end
 
   it "opens a file when use File::WRONLY|File::TRUNC mode" do
-    File.open(@file, "w")
-    @fh = File.open(@file, File::WRONLY|File::TRUNC)
-    @fh.should be_kind_of(File)
-    File.exist?(@file).should == true
+    fh1 = File.open(@file, "w")
+    begin
+      @fh = File.open(@file, File::WRONLY|File::TRUNC)
+      @fh.should be_kind_of(File)
+      File.exist?(@file).should == true
+    ensure
+      fh1.close
+    end
   end
 
   platform_is_not :openbsd do
@@ -477,7 +482,7 @@
   it "raises an Errno::EACCES when opening non-permitted file" do
     @fh = File.open(@file, "w")
     @fh.chmod(000)
-    lambda { File.open(@file) }.should raise_error(Errno::EACCES)
+    lambda { fh1 = File.open(@file); fh1.close }.should raise_error(Errno::EACCES)
   end
 
   it "raises an Errno::EACCES when opening read-only file" do

Modified: MacRuby/trunk/spec/frozen/core/file/path_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/path_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/path_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,32 +2,30 @@
 
 describe "File#path" do
   before :each do
-    @file1 = "testfile"
-    @file2 = tmp("../tmp/xxx")
+    @name = tmp("file_path")
   end
 
   after :each do
-    File.delete(@file1) if File.exist?(@file1)
-    File.delete(@file2) if File.exist?(@file2)
+    rm_r @name
   end
 
-  # MRI fails this when /var path has symlinks, as on OS X
-  quarantine! do
-    it "returns the pathname used to create file as a string" do
-      File.open(@file1,'w'){|file| file.path.should == "testfile"}
-      File.open(@file2, 'w'){|file| file.path.should == tmp("../tmp/xxx")}
-    end
+  it "returns the pathname used to create file as a string" do
+    File.open(@name,'w') { |file| file.path.should == @name }
   end
 end
 
 describe "File.path" do
   before :each do
-    @file1 = tmp("../tmp/xxx")
+    @name = tmp("file_path")
   end
 
+  after :each do
+    rm_r @name
+  end
+
   ruby_version_is "1.9.1" do
     it "returns the full path for the given file" do
-      File.path(@file1).should == tmp("../tmp/xxx")
+      File.path(@name).should == @name
     end
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/core/file/readlink_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/readlink_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/readlink_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,24 +3,25 @@
 describe "File.readlink" do
 
   before :each do
-    @file1 = 'test.txt'
-    @file3 = 'test.lnk'
-    File.delete(@file3) if File.exists?(@file3)
+    @file = tmp('file_readlink.txt')
+    @link = tmp('file_readlink.lnk')
 
-    File.open(@file1, 'w+') { } #
-    File.symlink(@file1, @file3)
+    touch @file
+
+    rm_r @link
+    File.symlink(@file, @link)
   end
 
   after :each do
-    File.delete(@file1) if File.exists?(@file1)
-    File.delete(@file3) if File.symlink?(@file3)
+    rm_r @link, @file
   end
 
   it "return the name of the file referenced by the given link" do
-    File.readlink(@file3).should == @file1
+    File.readlink(@link).should == @file
   end
 
   it "raises an Errno::ENOENT if called with an invalid argument" do
+    # TODO: missing_file
     lambda { File.readlink("/this/surely/doesnt/exist") }.should raise_error(Errno::ENOENT)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/file/rename_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/rename_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/rename_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,16 +2,15 @@
 
 describe "File.rename" do
   before :each do
-    @old = "test.txt"
-    @new = "test.new"
-    File.delete(@old) if File.exist?(@old)
-    File.delete(@new) if File.exist?(@new)
-    File.open(@old,"w+") {|f| f.puts "hello" }
+    @old = tmp("file_rename.txt")
+    @new = tmp("file_rename.new")
+
+    rm_r @new
+    touch(@old) { |f| f.puts "hello" }
   end
 
   after :each do
-    File.delete(@old) if File.exist?(@old)
-    File.delete(@new) if File.exist?(@new)
+    rm_r @old, @new
   end
 
   it "renames a file " do
@@ -23,7 +22,7 @@
   end
 
   it "raises an Errno::ENOENT if the source does not exist" do
-    File.delete(@old)
+    rm_r @old
     lambda { File.rename(@old, @new) }.should raise_error(Errno::ENOENT)
   end
 

Modified: MacRuby/trunk/spec/frozen/core/file/reopen_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/reopen_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/reopen_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,14 +5,12 @@
     before :each do
       @file = tmp('test.txt')
       @fh = nil
-      File.open(@file, "w") {|f| f << "1234567890"}
+      touch(@file) { |f| f << "1234567890" }
     end
 
     after :each do
       @fh.close if @fh
-      File.delete(@file) if File.exists?(@file)
-      @fh    = nil
-      @file  = nil
+      rm_r @file
     end
 
     it "resets the stream to a new file path" do

Modified: MacRuby/trunk/spec/frozen/core/file/setgid_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/setgid_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/setgid_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,12 +7,12 @@
  
 describe "File.setgid?" do
   before(:each) do
-    @name = 'test.txt'
-    @file = File.new(@name, "w")
+    @name = tmp('test.txt')
+    touch @name
   end
   
   after(:each) do
-    File.delete(@name) if File.exists?(@name)
+    rm_r @name
   end
   
   it "should return false if the file was just made" do
@@ -20,7 +20,7 @@
   end
   
   it "should be false if the file doesn't exist" do
-    File.delete(@name) # delete it prematurely, just for this part
+    rm_r @name # delete it prematurely, just for this part
     File.setgid?(@name).should == false
   end
   

Modified: MacRuby/trunk/spec/frozen/core/file/setuid_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/setuid_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/setuid_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,12 +7,12 @@
  
 describe "File.setuid?" do
   before(:each) do
-    @name = 'test.txt'
-    @file = File.new(@name, "w")
+    @name = tmp('test.txt')
+    touch @name
   end
   
   after(:each) do
-    File.delete(@name) if File.exists?(@name)
+    rm_r @name
   end
   
   it "should return false if the file was just made" do
@@ -20,7 +20,7 @@
   end
   
   it "should be false if the file doesn't exist" do
-    File.delete(@name) # delete it prematurely, just for this part
+    rm_r @name # delete it prematurely, just for this part
     File.setuid?(@name).should == false
   end
   

Modified: MacRuby/trunk/spec/frozen/core/file/shared/open.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/shared/open.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/shared/open.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,6 @@
 
 describe :open_directory, :shared => true do
   it "opens directories" do
-    lambda { File.send(@method, DirSpecs.mock_dir) }.should_not raise_error
-    File.directory?(DirSpecs.mock_dir).should == true
+    File.send(@method, tmp("")).should be_kind_of(File)
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/core/file/shared/stat.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/shared/stat.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/shared/stat.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,11 +1,11 @@
 describe :file_stat, :shared => true do
   before :each do
     @file = tmp('/i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write 'rubinius' }
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
 
   it "returns a File::Stat object if the given file exists" do
@@ -16,22 +16,24 @@
     st.size.should == 8
     st.size?.should == 8
     st.blksize.should > 0
-    st.atime.class.should == Time
-    st.ctime.class.should == Time
-    st.mtime.class.should == Time
+    st.atime.should be_kind_of(Time)
+    st.ctime.should be_kind_of(Time)
+    st.mtime.should be_kind_of(Time)
   end
 
   it "should be able to use the instance methods" do
-    st = File.new(@file).send(@method)
+    File.open(@file) do |f|
+      st = f.send(@method)
 
-    st.file?.should == true
-    st.zero?.should == false
-    st.size.should == 8
-    st.size?.should == 8
-    st.blksize.should > 0
-    st.atime.class.should == Time
-    st.ctime.class.should == Time
-    st.mtime.class.should == Time
+      st.file?.should == true
+      st.zero?.should == false
+      st.size.should == 8
+      st.size?.should == 8
+      st.blksize.should > 0
+      st.atime.should be_kind_of(Time)
+      st.ctime.should be_kind_of(Time)
+      st.mtime.should be_kind_of(Time)
+    end
   end
 
   ruby_version_is "1.9" do

Modified: MacRuby/trunk/spec/frozen/core/file/shared/unlink.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/shared/unlink.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/shared/unlink.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,11 +2,9 @@
   before :each do
     @file1 = 'test.txt'
     @file2 = 'test2.txt'
-    File.send(@method, @file1) if File.exists?(@file1)
-    File.send(@method, @file2) if File.exists?(@file2)
 
-    File.open(@file1, "w") {} # Touch
-    File.open(@file2, "w") {} # Touch
+    touch @file1
+    touch @file2
   end
 
   after :each do

Modified: MacRuby/trunk/spec/frozen/core/file/size_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/size_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/size_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -19,13 +19,13 @@
   describe "File#size" do
 
     before :each do
-      @file = tmp('i_exist')
-      File.open(@file,'w'){|f| f.write 'rubinius'}
-      @file = File.new @file
+      @name = tmp('i_exist')
+      touch(@name) { |f| f.write 'rubinius' }
+      @file = File.new @name
     end
 
     after :each do
-      File.delete(@file.path) if File.exist?(@file.path)
+      rm_r @name
     end
 
     it "is an instance method" do
@@ -41,7 +41,7 @@
     end
 
     it "returns the cached size of the file if subsequently deleted" do
-      File.delete(@file)
+      rm_r @file
       @file.size.should == 8
     end
 
@@ -59,7 +59,8 @@
     platform_is_not :windows do
       it "follows symlinks if necessary" do
         ln_file = tmp('i_exist_ln')
-        File.delete(ln_file) if File.exists?(ln_file)
+        rm_r ln_file
+
         File.symlink(@file.path, ln_file).should == 0
         File.new(ln_file).size.should == 8
       end

Modified: MacRuby/trunk/spec/frozen/core/file/stat/atime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/atime_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/atime_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,16 +3,16 @@
 describe "File::Stat#atime" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "should be able to determine the atime on a File::Stat object" do
     st = File.stat(@file)
-    st.atime.class.should == Time
+    st.atime.should be_kind_of(Time)
     st.atime.should <= Time.now
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/file/stat/blksize_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/blksize_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/blksize_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,11 +3,11 @@
 describe "File::Stat#blksize" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "should be able to determine the blksize on a File::Stat object" do

Modified: MacRuby/trunk/spec/frozen/core/file/stat/blocks_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/blocks_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/blocks_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,11 +3,11 @@
 describe "File::Stat#blocks" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "should be able to determine the blocks on a File::Stat object" do

Modified: MacRuby/trunk/spec/frozen/core/file/stat/comparison_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/comparison_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/comparison_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -11,19 +11,22 @@
   after :each do
     @file1.close unless @file1.closed?
     @file2.close unless @file2.closed?
-    File.delete @name1 if File.exists? @name1
-    File.delete @name2 if File.exists? @name2
+    rm_r @name1, @name2
   end
 
   it "is able to compare files by the same modification times" do
+    now = Time.now
+    File.utime(now, now, @name1)
+    File.utime(now, now, @name2)
     (@file1.stat <=> @file2.stat).should == 0
   end
 
   it "is able to compare files by different modification times" do
-    File.utime(Time.now, Time.now + 100, @name2)
+    now = Time.now
+    File.utime(now, now + 100, @name2)
     (@file1.stat <=> @file2.stat).should == -1
 
-    File.utime(Time.now, Time.now - 100, @name2)
+    File.utime(now, now - 100, @name2)
     (@file1.stat <=> @file2.stat).should == 1
   end
 
@@ -32,7 +35,8 @@
     (@file1.stat == @file1.stat).should == true
     (@file2.stat == @file2.stat).should == true
 
-    File.utime(Time.now, Time.now + 100, @name2)
+    now = Time.now
+    File.utime(now, now + 100, @name2)
 
     (@file1.stat == @file2.stat).should == false
     (@file1.stat == @file1.stat).should == true

Modified: MacRuby/trunk/spec/frozen/core/file/stat/ctime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/ctime_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/ctime_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,16 +3,16 @@
 describe "File::Stat#ctime" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "should be able to determine the ctime on a File::Stat object" do
     st = File.stat(@file)
-    st.ctime.class.should == Time
+    st.ctime.should be_kind_of(Time)
     st.ctime.should <= Time.now
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/file/stat/ftype_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/ftype_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/ftype_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 describe "File::Stat#ftype" do
   it "returns a String " do
     FileSpecs.normal_file do |file|
-      File.lstat(file).ftype.class.should == String
+      File.lstat(file).ftype.should be_kind_of(String)
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/file/stat/gid_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/gid_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/gid_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,12 +3,12 @@
 describe "File::Stat#gid" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
     File.chown(nil, Process.gid, @file)
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "should be able to determine the group owner through a File::Stat object" do

Modified: MacRuby/trunk/spec/frozen/core/file/stat/ino_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/ino_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/ino_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,11 +3,11 @@
 describe "File::Stat#ino" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "should be able to determine the ino on a File::Stat object" do

Modified: MacRuby/trunk/spec/frozen/core/file/stat/inspect_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/inspect_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/inspect_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,11 +4,11 @@
 
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "produces a nicely formatted description of a File::Stat object" do

Modified: MacRuby/trunk/spec/frozen/core/file/stat/mode_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/mode_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/mode_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,12 +3,12 @@
 describe "File::Stat#mode" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
     File.chmod(0755, @file)
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "should be able to determine the mode through a File::Stat object" do

Modified: MacRuby/trunk/spec/frozen/core/file/stat/mtime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/mtime_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/mtime_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,16 +3,16 @@
 describe "File::Stat#mtime" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "should be able to determine the mtime on a File::Stat object" do
     st = File.stat(@file)
-    st.mtime.class.should == Time
+    st.mtime.should be_kind_of(Time)
     st.mtime.should <= Time.now
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/file/stat/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,12 +4,12 @@
 
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
     File.chmod(0755, @file)
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
 
   it "raises an exception if the file doesn't exist" do
@@ -18,7 +18,7 @@
 
   it "creates a File::Stat object for the given file" do
     st = File::Stat.new(@file)
-    st.class.should == File::Stat
+    st.should be_kind_of(File::Stat)
     st.ftype.should == 'file'
   end
 

Modified: MacRuby/trunk/spec/frozen/core/file/stat/nlink_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/nlink_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/nlink_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,18 +4,16 @@
   before :each do
     @file = tmp("stat_nlink")
     @link = @file + ".lnk"
-    File.open(@file, "w") {}
+    touch @file
   end
 
   after :each do
-    File.delete(@file) rescue nil
-    File.delete(@link) rescue nil
+    rm_r @link, @file
   end
 
   it "returns the number of links to a file" do
     File::Stat.new(@file).nlink.should == 1
     File.link(@file, @link)
     File::Stat.new(@file).nlink.should == 2
-    File.delete(@link)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/file/stat/uid_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/uid_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat/uid_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,11 +3,11 @@
 describe "File::Stat#uid" do
   before :each do
     @file = tmp('i_exist')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
   
   it "should be able to determine the owner through a File::Stat object" do

Modified: MacRuby/trunk/spec/frozen/core/file/stat_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/stat_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,15 +10,31 @@
   before :each do
     @file = tmp('i_exist')
     @link = tmp('i_am_a_symlink')
-    File.open(@file,'w'){|f| f.write 'rubinius'}
+    touch(@file) { |f| f.write "rubinius" }
     File.symlink(@file, @link)
   end
 
   after :each do
-    File.delete(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
+    rm_r @link, @file
   end
 
+  it "returns information for a file that has been deleted but is still open" do
+    File.open(@file) do |f|
+      rm_r @link, @file
+
+      st = f.stat
+
+      st.file?.should == true
+      st.zero?.should == false
+      st.size.should == 8
+      st.size?.should == 8
+      st.blksize.should > 0
+      st.atime.should be_kind_of(Time)
+      st.ctime.should be_kind_of(Time)
+      st.mtime.should be_kind_of(Time)
+    end
+  end
+
   platform_is_not :windows do
     it "returns a File::Stat object with file properties for a symlink" do
       st = File.stat(@link)

Modified: MacRuby/trunk/spec/frozen/core/file/sticky_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/sticky_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/sticky_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,6 +3,7 @@
 
 describe "File.sticky?" do
   it_behaves_like :file_sticky, :sticky?, File
+  it_behaves_like :file_sticky_missing, :sticky?, File
 end
 
 describe "File.sticky?" do

Modified: MacRuby/trunk/spec/frozen/core/file/symlink_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/symlink_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/symlink_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,23 +3,20 @@
 
 describe "File.symlink" do
   before :each do
-    @file = "test.txt"
-    @link = "test.lnk"
-    File.delete(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
-    File.open(@file,"w+")
+    @file = tmp("file_symlink.txt")
+    @link = tmp("file_symlink.lnk")
+
+    rm_r @link
+    touch @file
   end
 
   after :each do
-    File.unlink(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
-    @link = nil
+    rm_r @link, @file
   end
 
   platform_is_not :windows do
     it "create a symlink between a source and target file" do
       File.symlink(@file, @link).should == 0
-      File.exists?(@link).should == true
       File.identical?(@file, @link).should == true
     end
 

Modified: MacRuby/trunk/spec/frozen/core/file/to_path_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/to_path_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/to_path_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,32 +2,32 @@
 
 ruby_version_is "1.9" do
   describe "File#to_path" do
-    
+
     it "returns a String" do
       File.new(__FILE__).to_path.should be_an_instance_of(String)
     end
 
-    it "doesn't normalise the path it returns" do
+    it "does not normalise the path it returns" do
       Dir.chdir(File.dirname(__FILE__)) do
         unorm ='./' + File.basename(__FILE__)
         File.new(unorm).to_path.should == unorm
       end
     end
 
-    it "doesn't expand the path it returns" do
+    it "does not expand the path it returns" do
       File.new('../').to_path.should == '../'
     end
 
-    it "doesn't absolute-ise the path it returns" do
+    it "does not absolute-ise the path it returns" do
       Dir.chdir(File.dirname(__FILE__)) do
         rel_path = File.basename(__FILE__)
         File.new(rel_path).to_path.should == rel_path
       end
     end
 
-    it "preserves the encoding of the path" do
+    it "does not preserve the encoding of the path" do
       path = File.new(__FILE__.encode('euc-jp')).to_path
-      path.encoding.should == Encoding::EUC_JP
+      path.encoding.should == Encoding.find(:filesystem)
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/file/truncate_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/truncate_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/truncate_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,28 +2,20 @@
 
 describe "File.truncate" do
   before :each do
-    @name = "test.txt"
-    @file  = File.open(@name, 'w')
-    File.open(@name,"w") { |f| f.write("1234567890") }
+    @name = tmp("test.txt")
+    touch(@name) { |f| f.write("1234567890") }
   end
 
   after :each do
-    @file.close
-    File.delete(@name) if File.exist?(@name)
-    @name = nil
+    rm_r @name
   end
 
   it "truncates a file" do
-    File.open(@name, "w") { |f| f.puts "123456789" }
-    platform_is :windows do
-      File.size(@name).should == 11
-    end
+    File.size(@name).should == 10
 
-    platform_is_not :windows do
-      File.size(@name).should == 10
-    end
     File.truncate(@name, 5)
     File.size(@name).should == 5
+
     File.open(@name, "r") do |f|
       f.read(99).should == "12345"
       f.eof?.should == true
@@ -55,6 +47,7 @@
   end
 
   it "raises an Errno::ENOENT if the file does not exist" do
+    # TODO: missing_file
     not_existing_file = "file-does-not-exist-for-sure.txt"
 
     # make sure it doesn't exist for real
@@ -91,41 +84,25 @@
       File.truncate(mock_to_path(@name), 0).should == 0
     end
   end
-
-  platform_is_not :windows do
-    it "truncates an absolute pathname file" do
-      absolute_pathname_file = tmp("#{@name}")
-      File.open(absolute_pathname_file,"w") { |f| f.write("1234567890") }
-      File.truncate(absolute_pathname_file, 5)
-      File.size(absolute_pathname_file).should == 5
-      File.delete(absolute_pathname_file) if File.exist?(absolute_pathname_file)
-    end
-  end
 end
 
 
 describe "File#truncate" do
   before :each do
-    @name = "test.txt"
-    @file  = File.open(@name, 'w')
-    File.open(@name,"w") { |f| f.write("1234567890") }
+    @name = tmp("test.txt")
+    @file = File.open @name, 'w'
+    @file.write "1234567890"
+    @file.flush
   end
 
   after :each do
     @file.close unless @file.closed?
-    File.delete(@name) if File.exist?(@name)
-    @name = nil
+    rm_r @name
   end
 
   it "truncates a file" do
-    File.open(@name, "w") { |f| f.puts "123456789" }
-    platform_is :windows do
-      File.size(@name).should == 11
-    end
+    File.size(@name).should == 10
 
-    platform_is_not :windows do
-      File.size(@name).should == 10
-    end
     @file.truncate(5)
     File.size(@name).should == 5
     File.open(@name, "r") do |f|

Modified: MacRuby/trunk/spec/frozen/core/file/umask_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/umask_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/umask_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,18 +3,17 @@
 describe "File.umask" do
   before :each do
     @orig_umask = File.umask
-    @file = 'test.txt'
-    File.open(@file, 'w') {}
+    @file = tmp('test.txt')
+    touch @file
   end
 
   after :each do
-    File.delete(@file) if File.exists?(@file)
-    @file = nil
+    rm_r @file
     File.umask(@orig_umask)
   end
 
   it "return a Fixnum" do
-    File.umask.class.should == Fixnum
+    File.umask.should be_kind_of(Fixnum)
   end
 
   it "umask should return the current umask value for the process" do

Modified: MacRuby/trunk/spec/frozen/core/file/utime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/utime_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/file/utime_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,13 +6,12 @@
     @mtime = Time.now
     @file1 = tmp("specs_file_utime1")
     @file2 = tmp("specs_file_utime2")
-    File.open(@file1, "w") {}
-    File.open(@file2, "w") {}
+    touch @file1
+    touch @file2
   end
 
   after :each do
-    File.delete(@file1) if File.exist?(@file1)
-    File.delete(@file2) if File.exist?(@file2)
+    rm_r @file1, @file2
   end
 
   it "sets the access and modification time of each file" do

Modified: MacRuby/trunk/spec/frozen/core/filetest/sticky_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/filetest/sticky_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/filetest/sticky_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,4 +3,5 @@
 
 describe "FileTest.sticky?" do
   it_behaves_like :file_sticky, :sticky?, FileTest
+  it_behaves_like :file_sticky_missing, :sticky?, FileTest
 end

Modified: MacRuby/trunk/spec/frozen/core/fixnum/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/fixnum/exponent_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/fixnum/exponent_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -37,4 +37,12 @@
       lambda { 13 ** :symbol }.should raise_error(TypeError)
     end
   end
+  
+  ruby_version_is '1.9.2' do
+    it "returns a complex number when negative and raised to a fractional power" do
+      ((-8) ** (1.0/3))      .should be_close(Complex(1, 1.73205), TOLERANCE)
+      ((-8) ** Rational(1,3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+    end
+  end
+  
 end

Modified: MacRuby/trunk/spec/frozen/core/fixnum/multiply_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/fixnum/multiply_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/fixnum/multiply_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -25,13 +25,13 @@
       y = 0x4000
       result = y * y * y
       result.should == 0x40000000000
-      result.class.should == Bignum
+      result.should be_kind_of(Bignum)
     elsif 1.size == 8
       # 64-bit fixnums
       y = 0x40000000
       result = y * y * y
       result.should == 0x40000000000000000000000
-      result.class.should == Bignum
+      result.should be_kind_of(Bignum)
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/float/comparison_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/float/comparison_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/float/comparison_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -38,7 +38,7 @@
     end
   end
 
-  ruby_bug "[ruby-dev:38672] [Bug #1645]", "1.8.7.174" do
+  ruby_bug "[ruby-dev:38672] [Bug #1645]", "1.8.7.248" do
     # The 4 tests below are taken from matz's revision 23730 for Ruby trunk
     #
     it "returns 1 when self is Infinity and other is a Bignum" do

Modified: MacRuby/trunk/spec/frozen/core/float/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/float/exponent_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/float/exponent_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,4 +7,12 @@
     (9.5 ** 0.5).should be_close(3.08220700148449, TOLERANCE) 
     (9.5 ** 0xffffffff).to_s.should == 'Infinity'
   end
+
+  ruby_version_is '1.9.2' do
+    it "returns a complex number when negative and raised to a fractional power" do
+      ((-8.0) ** (1.0/3))      .should be_close(Complex(1, 1.73205), TOLERANCE)
+      ((-8.0) ** Rational(1,3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+    end
+  end
+
 end

Modified: MacRuby/trunk/spec/frozen/core/gc/disable_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/gc/disable_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/gc/disable_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1 +1,29 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe "GC.disable" do
+  after :each do
+    GC.enable
+  end
+
+  it "can be invoked without any exceptions" do
+    lambda { GC.disable }.should_not raise_error
+  end
+
+  it "doesn't accept any arguments" do
+    lambda { GC.disable(1) }.should raise_error(ArgumentError)
+  end
+
+  it "ignores the supplied block" do
+    lambda { GC.disable {} }.should_not raise_error
+  end
+
+  it "returns true iff the garbage collection was previously disabled" do
+    GC.disable.should == false
+    GC.disable.should == true
+    GC.disable.should == true
+    GC.enable
+    GC.disable.should == false
+    GC.disable.should == true
+  end
+
+end

Modified: MacRuby/trunk/spec/frozen/core/gc/enable_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/gc/enable_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/gc/enable_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1 +1,24 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe "GC.enable" do
+
+  it "can be invoked without any exceptions" do
+    lambda { GC.enable }.should_not raise_error
+  end
+
+  it "doesn't accept any arguments" do
+    lambda { GC.enable(1) }.should raise_error(ArgumentError)
+  end
+
+  it "ignores the supplied block" do
+    lambda { GC.enable {} }.should_not raise_error
+  end
+
+  it "returns true iff the garbage collection was already disabled" do
+    GC.enable.should == false
+    GC.disable
+    GC.enable.should == true
+    GC.enable.should == false
+  end
+
+end

Modified: MacRuby/trunk/spec/frozen/core/gc/garbage_collect_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/gc/garbage_collect_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/gc/garbage_collect_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1 +1,27 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe "GC#garbage_collect" do
+
+  before :each do
+    @obj = Object.new
+    @obj.extend(GC)
+  end
+
+  it "can be invoked without any exceptions" do
+    lambda { @obj.garbage_collect }.should_not raise_error
+  end
+
+  it "doesn't accept any arguments" do
+    lambda { @obj.garbage_collect(1) }.should raise_error(ArgumentError)
+  end
+
+  it "ignores the supplied block" do
+    lambda { @obj.garbage_collect {} }.should_not raise_error
+  end
+
+  it "always returns nil" do
+    @obj.garbage_collect.should == nil
+    @obj.garbage_collect.should == nil
+  end
+
+end

Modified: MacRuby/trunk/spec/frozen/core/gc/start_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/gc/start_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/gc/start_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1 +1,20 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe "GC.start" do
+  it "can be invoked without any exceptions" do
+    lambda { GC.start }.should_not raise_error
+  end
+
+  it "doesn't accept any arguments" do
+    lambda { GC.start(1) }.should raise_error(ArgumentError)
+  end
+
+  it "ignores the supplied block" do
+    lambda { GC.start {} }.should_not raise_error
+  end
+
+  it "always returns nil" do
+    GC.start.should == nil
+    GC.start.should == nil
+  end
+end

Added: MacRuby/trunk/spec/frozen/core/gc/stress_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/gc/stress_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/gc/stress_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,32 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+ruby_version_is "1.8.7" do
+  describe "GC.stress" do
+    after :each do
+      # make sure that we never leave these tests in stress enabled GC!
+      GC.stress = false
+    end
+    it "returns current status of GC stress mode" do
+      GC.stress.should == false
+      GC.stress = true
+      GC.stress.should == true
+      GC.stress = false
+      GC.stress.should == false
+    end
+  end
+
+  describe "GC.stress=" do
+    after :each do
+      GC.stress = false
+    end
+    it "can be invoked without any exceptions" do
+      lambda { GC.stress = true }.should_not raise_error
+      lambda { GC.stress = false }.should_not raise_error
+    end
+    it "returns a proper boolean result" do
+      GC.send(:stress=, true).should be_true
+      GC.send(:stress=, false).should be_false
+    end
+
+  end
+end

Modified: MacRuby/trunk/spec/frozen/core/hash/constructor_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/constructor_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/constructor_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -43,6 +43,6 @@
 
   it "returns an instance of the class it's called on" do
     hash_class[MyHash[1, 2]].class.should == hash_class
-    MyHash[hash_class[1, 2]].class.should == MyHash
+    MyHash[hash_class[1, 2]].should be_kind_of(MyHash)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/hash/default_proc_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/default_proc_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/default_proc_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -14,7 +14,7 @@
 end
 
 describe "Hash#default_proc=" do
-  ruby_version_is "1.9" do
+  ruby_version_is "1.8.8" do
     it "replaces the block passed to Hash.new" do
       h = new_hash { |i| 'Paris' }
       h.default_proc = Proc.new { 'Montreal' }
@@ -42,21 +42,24 @@
       lambda{new_hash.default_proc = 42}.should raise_error(TypeError)
     end
 
-    it "raises a TypeError if passed a lambda with an arity other than 2" do
-      h = new_hash
-      lambda do
-        h.default_proc = lambda {|a| }
-      end.should raise_error(TypeError)
-      lambda do
-        h.default_proc = lambda {|a,b,c| }
-      end.should raise_error(TypeError)
-    end
-
     it "accepts a lambda with an arity of 2" do
       h = new_hash
       lambda do
         h.default_proc = lambda {|a,b| }
       end.should_not raise_error(TypeError)
     end
+
+    ruby_version_is "1.9" do
+      it "raises a TypeError if passed a lambda with an arity other than 2" do
+        h = new_hash
+        lambda do
+          h.default_proc = lambda {|a| }
+        end.should raise_error(TypeError)
+        lambda do
+          h.default_proc = lambda {|a,b,c| }
+        end.should raise_error(TypeError)
+      end
+    end
+
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/hash/key_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/key_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/key_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,7 +7,7 @@
   it_behaves_like(:hash_key_p, :key?)
 end
 
-ruby_version_is "1.9" do
+ruby_version_is "1.8.8" do
   describe "Hash#key" do
     it_behaves_like(:hash_index, :key)
   end

Modified: MacRuby/trunk/spec/frozen/core/hash/keys_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/keys_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/keys_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,7 +6,7 @@
   ruby_version_is ""..."1.9" do
     it "returns an array populated with keys" do
       new_hash.keys.should == []
-      new_hash.keys.class.should == Array
+      new_hash.keys.should be_kind_of(Array)
       new_hash(5).keys.should == []
       new_hash { 5 }.keys.should == []
       new_hash(1 => 2, 2 => 4, 4 => 8).keys.sort.should == [1, 2, 4]
@@ -18,7 +18,7 @@
   ruby_version_is "1.9" do
     it "returns an array with the keys in the order they were inserted" do
       new_hash.keys.should == []
-      new_hash.keys.class.should == Array
+      new_hash.keys.should be_kind_of(Array)
       new_hash(5).keys.should == []
       new_hash { 5 }.keys.should == []
       new_hash(1 => 2, 4 => 8, 2 => 4).keys.should == [1, 4, 2]

Modified: MacRuby/trunk/spec/frozen/core/hash/merge_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/merge_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/merge_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -37,8 +37,8 @@
   end
 
   it "returns subclass instance for subclasses" do
-    MyHash[1 => 2, 3 => 4].merge(new_hash(1 => 2)).class.should == MyHash
-    MyHash[].merge(new_hash(1 => 2)).class.should == MyHash
+    MyHash[1 => 2, 3 => 4].merge(new_hash(1 => 2)).should be_kind_of(MyHash)
+    MyHash[].merge(new_hash(1 => 2)).should be_kind_of(MyHash)
 
     new_hash(1 => 2, 3 => 4).merge(MyHash[1 => 2]).class.should == hash_class
     new_hash.merge(MyHash[1 => 2]).class.should == hash_class
@@ -61,7 +61,7 @@
   # This bug is far too odd to explain in a comment; see
   # http://redmine.ruby-lang.org/issues/show/1535 for the closest I've got to
   # an explanation.
-  ruby_bug "#1535", "1.8.7.174" do
+  ruby_bug "#1535", "1.8.7.248" do
     it "shouldn't raise spurious RuntimeErrors" do
       hash = {1 => 2, 3 => 4, 5 => 6}
       big_hash = {}

Modified: MacRuby/trunk/spec/frozen/core/hash/reject_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/reject_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/reject_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -21,8 +21,8 @@
   end
 
   it "returns subclass instance for subclasses" do
-    MyHash[1 => 2, 3 => 4].reject { false }.class.should == MyHash
-    MyHash[1 => 2, 3 => 4].reject { true }.class.should == MyHash
+    MyHash[1 => 2, 3 => 4].reject { false }.should be_kind_of(MyHash)
+    MyHash[1 => 2, 3 => 4].reject { true }.should be_kind_of(MyHash)
   end
 
   it "processes entries with the same order as reject!" do

Modified: MacRuby/trunk/spec/frozen/core/hash/shift_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/shift_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/shift_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,7 +8,7 @@
 
     h.size.times do |i|
       r = h.shift
-      r.class.should == Array
+      r.should be_kind_of(Array)
       h2[r.first].should == r.last
       h.size.should == h2.size - i - 1
     end

Modified: MacRuby/trunk/spec/frozen/core/hash/to_a_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/to_a_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/to_a_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,7 +10,7 @@
       pairs << [key, value]
     end
 
-    h.to_a.class.should == Array
+    h.to_a.should be_kind_of(Array)
     h.to_a.should == pairs
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/hash/try_convert_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/try_convert_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/try_convert_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,6 +1,6 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 
-ruby_version_is "1.9" do
+ruby_version_is "1.8.8" do
   
   describe "Hash.try_convert" do
     

Modified: MacRuby/trunk/spec/frozen/core/hash/values_at_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/values_at_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/values_at_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,9 +4,9 @@
 describe :hash_values_at, :shared => true do
   it "returns an array of values for the given keys" do
     h = new_hash(:a => 9, :b => 'a', :c => -10, :d => nil)
-    h.send(@method).class.should == Array
+    h.send(@method).should be_kind_of(Array)
     h.send(@method).should == []
-    h.send(@method, :a, :d, :b).class.should == Array
+    h.send(@method, :a, :d, :b).should be_kind_of(Array)
     h.send(@method, :a, :d, :b).should == [9, nil, 'a']
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/hash/values_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/values_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/hash/values_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 describe "Hash#values" do
   it "returns an array of values" do
     h = new_hash(1 => :a, 'a' => :a, 'the' => 'lang')
-    h.values.class.should == Array
+    h.values.should be_kind_of(Array)
     h.values.sort {|a, b| a.to_s <=> b.to_s}.should == [:a, :a, 'lang']
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/io/close_read_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/close_read_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/close_read_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,6 +1,5 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/fixtures/classes'
-require 'fileutils'
 
 describe "IO#close_read" do
 
@@ -44,7 +43,7 @@
 
   it "closes the stream if it is neither writable nor duplexed" do
     io_close_path = @path
-    FileUtils.touch io_close_path
+    touch io_close_path
 
     io = File.open io_close_path
 

Modified: MacRuby/trunk/spec/frozen/core/io/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/fixtures/classes.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/fixtures/classes.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -16,10 +16,6 @@
     File.dirname(__FILE__) + '/gets.txt'
   end
   
-  def self.gets_output
-    File.dirname(__FILE__) + '/gets_output.txt'
-  end
-  
   def self.closed_file
     File.open(File.dirname(__FILE__) + '/gets.txt', 'r') { |f| f }
   end

Modified: MacRuby/trunk/spec/frozen/core/io/gets_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/gets_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/gets_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,12 +1,9 @@
 # encoding: utf-8
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/fixtures/classes'
+require File.dirname(__FILE__) + '/shared/gets_ascii'
 
 describe "IO#gets" do
-  after :each do
-    File.delete IOSpecs.gets_output if File.exists?(IOSpecs.gets_output)
-  end
-
   it "returns the next line of string that were separated by $/" do
     File.open(IOSpecs.gets_fixtures, 'r') do |f|
       IOSpecs.lines.each {|line| line.should == f.gets}
@@ -190,30 +187,54 @@
     b.should == "\nB\n"
     File.unlink(tmp("gets_specs"))
   end
-  
-  ruby_version_is "1.9" do
+
+  it_behaves_like(:io_gets_ascii, :gets)
+end
+
+ruby_version_is "1.9" do
+  describe "IO#gets" do
+    before :each do
+      @name = tmp("gets_specs")
+    end
+
+    after :each do
+      @file.close
+      rm_r @name
+    end
+
     it "accepts an integer as first parameter to limit the output's size" do
-      f = File.open(tmp("gets_specs"), "w")
-      f.print("waduswadus")
-      f.close
-      
-      f = File.new(tmp("gets_specs"), "r")
-      b = f.gets(5)
-      b.should == 'wadus'
-      
-      File.unlink(tmp("gets_specs"))
+      touch(@name) { |f| f.print("waduswadus") }
+
+      @file = File.open(@name)
+      @file.gets(5).should == "wadus"
     end
-    
+
     it "accepts an integer as second parameter to limit the output's size" do
-      f = File.open(tmp("gets_specs"), "w")
-      f.print("wa\n\ndus\n\nwadus")
-      f.close
-      
-      f = File.new(tmp("gets_specs"), "r")
-      b = f.gets('\n\n', 5)
-      b.should == "wa\n\nd"
-      
-      File.unlink(tmp("gets_specs"))
+      touch(@file) { |f| f.print("wa\n\ndus\n\nwadus") }
+
+      @file = File.open(@name)
+      @file.gets('\n\n', 5).should == "wa\n\nd"
     end
+
+    it "accepts an integer as limit parameter which is smaller than IO size" do
+      touch(@file) { |f| f.print("ABCD\n") }
+
+      @file = File.open(@name)
+      @file.gets("", 2).should == "AB"
+    end
+
+    it "accepts an integer as limit parameter which is same as IO size" do
+      touch(@file) { |f| f.print("ABC\n") }
+
+      @file = File.open(@name)
+      @file.gets("", 4).should == "ABC\n"
+    end
+
+    it "accepts an integer as limit parameter which is greater than IO size" do
+      touch(@file) { |f| f.print("A\n") }
+
+      @file = File.open(@name)
+      @file.gets("", 10).should == "A\n"
+    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/io/pos_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/pos_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/pos_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,7 +9,7 @@
 describe "IO#pos=" do
 
   before :each do
-    @fname = 'test.txt'
+    @fname = tmp('test.txt')
     File.open @fname, 'w' do |f| f.write "123" end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/io/read_nonblock_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/read_nonblock_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/read_nonblock_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,57 @@
 require File.dirname(__FILE__) + '/fixtures/classes'
 
 describe "IO#read_nonblock" do
+  before(:each) do
+    @read, @write = IO.pipe
+  end
+
+  after(:each) do
+    @read.close rescue nil
+    @write.close rescue nil
+  end
+
+  it "raises EAGAIN when there is no data" do
+    lambda { @read.read_nonblock(5) }.should raise_error(Errno::EAGAIN)
+  end
+
+  it "returns at most the number of bytes requested" do
+    @write << "hello"
+    @read.read_nonblock(4).should == "hell"
+  end
+
+  it "returns less data if that is all that is available" do
+    @write << "hello"
+    @read.read_nonblock(10).should == "hello"
+  end
+
+  not_compliant_on :rubinius, :jruby do
+    ruby_version_is ""..."1.9" do
+      it "changes the behavior of #read to nonblocking" do
+        @write << "hello"
+        @read.read_nonblock(5)
+
+        # Yes, use normal IO#read here. #read_nonblock has changed the internal
+        # flags of @read to be nonblocking, so now any normal read calls raise
+        # EAGAIN if there is no data.
+        lambda { @read.read(5) }.should raise_error(Errno::EAGAIN)
+      end
+    end
+
+    # This feature was changed in 1.9
+    # see also: [ruby-dev:25101] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/25101
+    #   and #2469 http://redmine.ruby-lang.org/issues/show/2469
+  end
+
   it "raises IOError on closed stream" do
     lambda { IOSpecs.closed_file.read_nonblock(5) }.should raise_error(IOError)
   end
+
+  it "raises EOFError when the end is reached" do
+    @write << "hello"
+    @write.close
+
+    @read.read_nonblock(5)
+
+    lambda { @read.read_nonblock(5) }.should raise_error(EOFError)
+  end
 end

Modified: MacRuby/trunk/spec/frozen/core/io/read_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/read_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/read_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,13 +4,13 @@
 
 describe "IO.read" do
   before :each do
-    @fname = "test.txt"
+    @fname = tmp("io_read.txt")
     @contents = "1234567890"
-    File.open(@fname, "w") { |f| f.write @contents }
+    touch(@fname) { |f| f.write @contents }
   end
 
   after :each do
-    File.delete @fname if File.exists? @fname
+    rm_r @fname
   end
 
   it "reads the contents of a file" do
@@ -48,7 +48,7 @@
   end
 
   it "raises an Errno::ENOENT when the requested file does not exist" do
-    File.delete(@fname) if File.exists?(@fname)
+    rm_r @fname
     lambda { IO.read @fname }.should raise_error(Errno::ENOENT)
   end
 
@@ -68,12 +68,12 @@
 
 describe "IO.read on an empty file" do
   before :each do
-    @fname = 'empty_test.txt'
-    File.open(@fname, 'w') {|f| 1 }
+    @fname = tmp("io_read_empty.txt")
+    touch(@fname)
   end
 
   after :each do
-    File.delete @fname  if File.exists? @fname
+    rm_r @fname
   end
 
   it "returns nil when length is passed" do
@@ -88,24 +88,16 @@
 describe "IO#read" do
 
   before :each do
-    @fname = "test.txt"
+    @fname = tmp("io_read.txt")
     @contents = "1234567890"
-    open @fname, "w" do |io| io.write @contents end
+    touch(@fname) { |f| f.write @contents }
 
     @io = open @fname, "r+"
   end
 
   after :each do
-    File.delete(@fname) if File.exists?(@fname)
-  end
-
-  after :all do
-    # We originally closed @io after every example, but on 1.9 that led to a
-    # particularly bizarre bug where #close would raise an Errno::EBADF under
-    # certain conditions. I can't determine what these conditions are,
-    # unfortunately. I believe it's safe to only close @io here because it's
-    # instantiated anew before each example.
     @io.close
+    rm_r @fname
   end
 
   it "can be read from consecutively" do
@@ -115,37 +107,6 @@
     @io.read(4).should == '7890'
   end
 
-  it "can read lots of data" do
-    data = "*" * (8096 * 2 + 1024) # HACK IO::BufferSize
-
-    File.open @fname, 'w' do |io| io.write data end
-
-    actual = nil
-
-    File.open @fname, 'r' do |io|
-      actual = io.read
-    end
-
-    actual.length.should == data.length
-    actual.split('').all? { |c| c == "*" }.should == true
-  end
-
-  it "can read lots of data with length" do
-    read_length = 8096 * 2 + 1024 # HACK IO::BufferSize
-    data = "*" * (read_length + 8096) # HACK same
-
-    File.open @fname, 'w' do |io| io.write data end
-
-    actual = nil
-
-    File.open @fname, 'r' do |io|
-      actual = io.read read_length
-    end
-
-    actual.length.should == read_length
-    actual.split('').all? { |c| c == "*" }.should == true
-  end
-
   it "consumes zero bytes when reading zero bytes" do
     pre_pos = @io.pos
 
@@ -243,32 +204,83 @@
   it "raises IOError on closed stream" do
     lambda { IOSpecs.closed_file.read }.should raise_error(IOError)
   end
+end
 
-  ruby_version_is "1.9" do
+describe "IO#read with encodings" do
+  before :each do
+    @kcode = $KCODE
+
+    @name = fixture __FILE__, "readlines.txt"
+  end
+
+  after :each do
+    $KCODE = @kcode
+  end
+
+  it "ignores unicode encoding" do
+    $KCODE = "UTF-8"
+
+    File.open(@name, 'r') do |io|
+      io.readline.should == "Voici la ligne une.\n"
+      io.read(5).should == "Qui " + [195].pack("C")
+    end
+  end
+end
+
+ruby_version_is "1.9" do
+  describe "IO#read with 1.9 encodings" do
+    before :each do
+      @file = tmp("io_read_bom.txt")
+      @text = "\uFEFFT"
+    end
+
+    after :each do
+      rm_r @file
+    end
+
     # Example derived from test/ruby/test_io_m17n.rb on MRI
     it "strips the BOM when given 'rb:utf-7-bom' as the mode" do
-      text = "\uFEFFT"
-      %w/UTF-8 UTF-16BE UTF-16LE UTF-32BE UTF-32LE/.each do |name|
-        path = tmp('%s-bom.txt' % name)
-        content = text.encode(name)
-        File.open(path,'w') { |f| f.print content }
-        result = File.read(path, :mode => "rb:BOM|#{name}")
-        content[1].force_encoding("ascii-8bit").should == result.force_encoding("ascii-8bit")
-        File.unlink(path)
+      %w/UTF-8 UTF-16BE UTF-16LE UTF-32BE UTF-32LE/.each do |encoding|
+        content = @text.encode(encoding)
+        content_ascii = content[1].force_encoding("ascii-8bit")
+        touch(@file) { |f| f.print content }
+
+        result = File.read(@file, :mode => "rb:BOM|#{encoding}")
+        result.force_encoding("ascii-8bit").should == content_ascii
       end
     end
   end
+end
 
-  it "ignores unicode encoding" do
-    begin
-      old = $KCODE
-      $KCODE = "UTF-8"
-      File.open(File.dirname(__FILE__) + '/fixtures/readlines.txt', 'r') do |io|
-        io.readline.should == "Voici la ligne une.\n"
-        io.read(5).should == "Qui " + [195].pack("C")
-      end
-    ensure
-      $KCODE = old
-    end
+describe "IO#read with large data" do
+  before :each do
+    # TODO: what is the significance of this mystery math?
+    @data_size = 8096 * 2 + 1024
+    @data = "*" * @data_size
+
+    @fname = tmp("io_read.txt")
+    touch(@fname) { |f| f.write @data }
+
+    @io = open @fname, "r"
   end
+
+  after :each do
+    @io.close
+    rm_r @fname
+  end
+
+  it "reads all the data at once" do
+    File.open(@fname, 'r') { |io| ScratchPad.record io.read }
+
+    ScratchPad.recorded.size.should == @data_size
+    ScratchPad.recorded.should == @data
+  end
+
+  it "reads only the requested number of bytes" do
+    read_size = @data_size / 2
+    File.open(@fname, 'r') { |io| ScratchPad.record io.read(read_size) }
+
+    ScratchPad.recorded.size.should == read_size
+    ScratchPad.recorded.should == @data[0, read_size]
+  end
 end

Modified: MacRuby/trunk/spec/frozen/core/io/reopen_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/reopen_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/reopen_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -21,8 +21,7 @@
     @file2.close unless @file2.closed?
     @file1_w.close unless @file1_w.closed?
     @file2_w.close unless @file2_w.closed?
-    File.delete(@name1_w)
-    File.delete(@name2_w)
+    rm_r @name1_w, @name2_w
   end
 
   it "raises IOError on closed stream" do
@@ -31,6 +30,21 @@
     }
   end
 
+  it "raises IOError when called on closed stream" do
+    @file1.close
+    lambda { @file1.reopen(@file2) }.should raise_error(IOError)
+  end
+
+  it "should not raise IOError when called on closed stream with path" do
+    @file1.close
+    lambda do
+      @file1.reopen(@name2, "r")
+    end.should_not raise_error(IOError)
+
+    @file1.closed?.should be_false
+    @file1.gets.should == "Line 1: One\n"
+  end
+
   it "reassociates self to another file/descriptor but returns self" do
     @file1.reopen(@file2).should == @file1
     @file2.reopen(@file1).should == @file2

Modified: MacRuby/trunk/spec/frozen/core/io/select_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/select_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/select_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -40,7 +40,7 @@
     result = IO.select [io], [io], nil, 0
     result.should == [[io], [io], []]
     io.close
-    File.delete(filename)
+    rm_r filename
   end
 
   it "invokes to_io on supplied objects that are not IO" do

Added: MacRuby/trunk/spec/frozen/core/io/shared/gets_ascii.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/shared/gets_ascii.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/io/shared/gets_ascii.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,27 @@
+# encoding: ASCII
+describe :io_gets_ascii, :shared => true do
+  describe "with ASCII separator" do
+    before :each do
+      @name = tmp("gets_specs.txt")
+      touch(@name, "wb") { |f| f.print "this is a test\xFFtesty\ntestier" }
+
+      File.open(@name, "rb") { |f| @data = f.gets("\xFF") }
+    end
+
+    after :each do
+      rm_r @name
+    end
+
+    ruby_version_is ""..."1.9" do
+      it "returns the separator's number representation" do
+        @data.should == "this is a test\377"
+      end
+    end
+
+    ruby_version_is "1.9" do
+      it "returns the separator's character representation" do
+        @data.should == "this is a test\xFF"
+      end
+    end
+  end
+end

Modified: MacRuby/trunk/spec/frozen/core/io/shared/new.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/shared/new.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/shared/new.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -23,7 +23,7 @@
     ensure
       io.close
     end
-    io.class.should == IO
+    io.should be_an_instance_of(IO)
   end
 
   it "takes an Integer or #to_int argument as the descriptor to open" do

Modified: MacRuby/trunk/spec/frozen/core/io/shared/pos.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/shared/pos.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/shared/pos.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,6 +1,6 @@
 describe :io_pos, :shared => true do
   before :each do
-    @fname = 'test.txt'
+    @fname = tmp('test.txt')
     File.open @fname, 'w' do |f| f.write "123" end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/io/shared/write.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/shared/write.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/shared/write.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -13,7 +13,7 @@
   after :each do
     @file.close
     @readonly_file.close
-    File.delete(@filename)
+    rm_r @filename
   end
 
   it "coerces the argument to a string using to_s" do

Modified: MacRuby/trunk/spec/frozen/core/io/stat_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/stat_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/stat_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,6 +8,6 @@
 
   it "returns a File::Stat object for the stream" do
     io = IO.new $stderr.fileno
-    io.stat.class.should == File::Stat
+    io.stat.should be_an_instance_of(File::Stat)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/io/sysopen_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/sysopen_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/sysopen_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,39 +6,49 @@
     @filename = tmp("rubinius-spec-io-sysopen-#{$$}.txt")
   end
 
+  before :each do
+    @fd = nil
+  end
+
+  after :each do
+    IO.for_fd(@fd).close if @fd
+  end
+
   after :all do
     File.unlink @filename
   end
 
-
   it "returns the file descriptor for a given path" do
-    fd = IO.sysopen(@filename, "w")
-    fd.should be_kind_of(Fixnum)
-    fd.should_not equal(0)
+    @fd = IO.sysopen(@filename, "w")
+    @fd.should be_kind_of(Fixnum)
+    @fd.should_not equal(0)
   end
 
-  it "works on directories" do
-    fd = IO.sysopen(tmp(""))    # /tmp
-    fd.should be_kind_of(Fixnum)
-    fd.should_not equal(0)
+  # opening a directory is not supported on Windows
+  platform_is_not :windows do
+    it "works on directories" do
+      @fd = IO.sysopen(tmp(""))    # /tmp
+      @fd.should be_kind_of(Fixnum)
+      @fd.should_not equal(0)
+    end
   end
 
   ruby_version_is "1.9" do
     it "calls #to_path on first argument" do
       p = mock('path')
       p.should_receive(:to_path).and_return(@filename)
-      IO.sysopen(p, 'w')
+      @fd = IO.sysopen(p, 'w')
     end
   end
 
   it "accepts a mode as second argument" do
-    fd = 0
-    lambda { fd = IO.sysopen(@filename, "w") }.should_not raise_error
-    fd.should_not equal(0)
+    @fd = 0
+    lambda { @fd = IO.sysopen(@filename, "w") }.should_not raise_error
+    @fd.should_not equal(0)
   end
 
   it "accepts permissions as third argument" do
-    fd = IO.sysopen(@filename, "w", 777)
-    fd.should_not equal(0)
+    @fd = IO.sysopen(@filename, "w", 777)
+    @fd.should_not equal(0)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/io/sysread_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/sysread_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/sysread_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -13,7 +13,7 @@
   
   after :each do
     @file.close
-    File.delete(@file_name)
+    rm_r @file_name
   end
   
   it "reads the specified number of bytes from the file" do

Modified: MacRuby/trunk/spec/frozen/core/io/syswrite_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/syswrite_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/syswrite_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -15,7 +15,7 @@
   after :each do
     @file.close
     @readonly_file.close
-    File.delete(@filename)
+    rm_r @filename
   end
 
   it "writes all of the string's bytes but does not buffer them" do

Modified: MacRuby/trunk/spec/frozen/core/io/try_convert_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/try_convert_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/try_convert_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,7 @@
 require File.dirname(__FILE__) + '/fixtures/classes'
 
 describe "IO.try_convert" do
-  ruby_version_is "1.9" do
+  ruby_version_is "1.8.8" do
     it "returns self for IO objects" do
       fd_1 = IO.new(1)
       IO.try_convert(fd_1).should equal(fd_1)

Deleted: MacRuby/trunk/spec/frozen/core/io/versions/gets_1.9.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/versions/gets_1.9.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/versions/gets_1.9.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,34 +0,0 @@
-require File.dirname(__FILE__) + '/../../../spec_helper'
-
-describe "IO#gets" do
-  after :each do
-    File.delete IOSpecs.gets_output if File.exists?(IOSpecs.gets_output)
-  end
-
-  it "returns <limit bytes if IO size is smaller than limit" do
-    tmp = tmp "gets_specs"
-    f = File.open(tmp, "w") { |f| f.print("A\n") }
-    File.open(tmp) do |f|
-      f.gets("", 10).should == "A\n"
-    end
-    File.unlink tmp
-  end
-
-  it "returns =limit bytes if IO size is same size as limit" do
-    tmp = tmp "gets_specs"
-    f = File.open(tmp, "w") { |f| f.print("ABC\n") }
-    File.open(tmp) do |f|
-      f.gets("", 4).should == "ABC\n"
-    end
-    File.unlink tmp
-  end
-
-  it "returns limit bytes if IO size is greater size than limit" do
-    tmp = tmp "gets_specs"
-    f = File.open(tmp, "w") { |f| f.print("ABCD\n") }
-    File.open(tmp) do |f|
-      f.gets("", 2).should == "AB"
-    end
-    File.unlink tmp
-  end
-end

Modified: MacRuby/trunk/spec/frozen/core/io/write_nonblock_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/write_nonblock_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/write_nonblock_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -15,7 +15,7 @@
   after :each do
     @file.close
     @readonly_file.close
-    File.delete(@filename)
+    rm_r @filename
   end
 
   it "writes all of the string's bytes but does not buffer them" do

Modified: MacRuby/trunk/spec/frozen/core/io/write_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/write_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/io/write_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -15,7 +15,7 @@
   after :each do
     @file.close
     @readonly_file.close
-    File.delete(@filename)
+    rm_r @filename
   end
 
   # TODO: impl detail? discuss this with matz. This spec is useless. - rdavis

Modified: MacRuby/trunk/spec/frozen/core/kernel/String_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/String_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/String_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -33,20 +33,40 @@
     lambda { @object.send(@method, obj) }.should raise_error(TypeError)
   end
 
-  it "raises a TypeError if respond_to? returns false for #to_s" do
-    obj = mock("to_s")
-    obj.does_not_respond_to(:to_s)
+  ruby_version_is ""..."1.9" do
+    it "raises a TypeError if respond_to? returns false for #to_s" do
+      obj = mock("to_s")
+      obj.does_not_respond_to(:to_s)
 
-    lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+      lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+    end
+
+    it "raises a NoMethodError if #to_s is not defined but #respond_to?(:to_s) returns true" do
+      # cannot use a mock because of how RSpec affects #method_missing
+      obj = Object.new
+      obj.undefine(:to_s)
+      obj.responds_to(:to_s)
+
+      lambda { @object.send(@method, obj) }.should raise_error(NoMethodError)
+    end
   end
 
-  it "raises a NoMethodError if #to_s is not defined but #respond_to?(:to_s) returns true" do
-    # cannot use a mock because of how RSpec affects #method_missing
-    obj = Object.new
-    obj.undefine(:to_s)
-    obj.responds_to(:to_s)
+  ruby_version_is "1.9" do
+    it "doesn't raise a TypeError even if respond_to? returns false for #to_s" do
+      obj = mock("to_s")
+      obj.does_not_respond_to(:to_s)
 
-    lambda { @object.send(@method, obj) }.should raise_error(NoMethodError)
+      lambda { @object.send(@method, obj) }.should_not raise_error(TypeError)
+    end
+
+    it "raises a TypeError if #to_s is not defined, even though #respond_to?(:to_s) returns true" do
+      # cannot use a mock because of how RSpec affects #method_missing
+      obj = Object.new
+      obj.undefine(:to_s)
+      obj.responds_to(:to_s)
+
+      lambda { @object.send(@method, obj) }.should raise_error(TypeError)
+    end
   end
 
   it "calls #to_s if #respond_to?(:to_s) returns true" do

Copied: MacRuby/trunk/spec/frozen/core/kernel/__callee___spec.rb (from rev 3228, MacRuby/trunk/spec/frozen/core/kernel/__callee__spec.rb)
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/__callee___spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/kernel/__callee___spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,9 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes'
+require File.dirname(__FILE__) + '/shared/__method__'
+
+describe "Kernel.__callee__" do
+  ruby_version_is '1.9' do
+    it_behaves_like(:kernel___method__, :__callee__)
+  end
+end

Deleted: MacRuby/trunk/spec/frozen/core/kernel/__callee__spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/__callee__spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/__callee__spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,9 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes'
-require File.dirname(__FILE__) + '/shared/__method__'
-
-describe "Kernel.__callee__" do
-  ruby_version_is '1.9' do
-    it_behaves_like(:kernel___method__, :__callee__)
-  end
-end

Copied: MacRuby/trunk/spec/frozen/core/kernel/__method___spec.rb (from rev 3228, MacRuby/trunk/spec/frozen/core/kernel/__method__spec.rb)
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/__method___spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/kernel/__method___spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,9 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes'
+require File.dirname(__FILE__) + '/shared/__method__'
+
+describe "Kernel.__method__" do
+  ruby_version_is '1.8.7' do
+    it_behaves_like(:kernel___method__, :__method__)
+  end
+end

Deleted: MacRuby/trunk/spec/frozen/core/kernel/__method__spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/__method__spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/__method__spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,9 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes'
-require File.dirname(__FILE__) + '/shared/__method__'
-
-describe "Kernel.__method__" do
-  ruby_version_is '1.8.7' do
-    it_behaves_like(:kernel___method__, :__method__)
-  end
-end

Modified: MacRuby/trunk/spec/frozen/core/kernel/backtick_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/backtick_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/backtick_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -20,13 +20,13 @@
     it "sets $? to the exit status of the executed sub-process" do
       ip = 'world'
       `echo disc #{ip}`
-      $?.class.should == Process::Status
+      $?.should be_kind_of(Process::Status)
       $?.stopped?.should == false
       $?.exited?.should == true
       $?.exitstatus.should == 0
       $?.success?.should == true
       `echo disc #{ip}; exit 99`
-      $?.class.should == Process::Status
+      $?.should be_kind_of(Process::Status)
       $?.stopped?.should == false
       $?.exited?.should == true
       $?.exitstatus.should == 99
@@ -38,13 +38,13 @@
     it "sets $? to the exit status of the executed sub-process" do
       ip = 'world'
       `echo disc #{ip}`
-      $?.class.should == Process::Status
+      $?.should be_kind_of(Process::Status)
       $?.stopped?.should == false
       $?.exited?.should == true
       $?.exitstatus.should == 0
       $?.success?.should == true
       `echo disc #{ip}& exit 99`
-      $?.class.should == Process::Status
+      $?.should be_kind_of(Process::Status)
       $?.stopped?.should == false
       $?.exited?.should == true
       $?.exitstatus.should == 99

Modified: MacRuby/trunk/spec/frozen/core/kernel/callcc_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/callcc_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/callcc_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,9 @@
 require File.dirname(__FILE__) + '/fixtures/classes'
 
 ruby_version_is "1.9" do
-  require 'continuation'
+  not_supported_on :jruby do
+    require 'continuation'
+  end
 end
 
 describe "Kernel#callcc" do

Modified: MacRuby/trunk/spec/frozen/core/kernel/catch_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/catch_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/catch_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -69,7 +69,7 @@
   ruby_version_is ""..."1.9" do
     it "raises TypeError if the argument is not a symbol" do
       lambda {
-        catch Object.new {}
+        catch(Object.new) {}
       }.should raise_error(TypeError)
     end
 

Modified: MacRuby/trunk/spec/frozen/core/kernel/eval_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/eval_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/eval_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -274,6 +274,19 @@
     end
   end
 
+  # Found via Rubinius bug github:#149
+  it "should not alter the value of __FILE__ in the binding" do
+    first_time =  EvalSpecs.call_eval
+    second_time = EvalSpecs.call_eval
+
+    # This bug is seen by calling the method twice and comparing the values
+    # of __FILE__ each time. If the bug is present, calling eval will set the
+    # value of __FILE__ to the eval's "filename" argument.
+
+    second_time.should_not == "(eval)"
+    first_time.should == second_time
+  end
+
   deviates_on "jruby" do
     it "can be aliased" do
       alias aliased_eval eval

Modified: MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -52,6 +52,9 @@
 
     private
     def private_method; :private_method; end
+
+    public
+    define_method(:defined_method) { :defined }
   end
 
   class Binding
@@ -172,6 +175,18 @@
     include InstEval
   end
 
+  class InstEvalConst
+    INST_EVAL_CONST_X = 2
+  end
+
+  module InstEvalOuter
+    module Inner
+      obj = InstEvalConst.new
+      X_BY_STR = obj.instance_eval("INST_EVAL_CONST_X") rescue nil
+      X_BY_BLOCK = obj.instance_eval { INST_EVAL_CONST_X } rescue nil
+    end
+  end
+
   class EvalTest
     def self.eval_yield_with_binding
       eval("yield", binding)
@@ -228,6 +243,26 @@
     undef_method :parent_mixin_method
   end
 
+  # for testing lambda
+  class Lambda
+    def outer(meth)
+      inner(meth)
+    end
+
+    def mp(&b); b; end
+
+    def inner(meth)
+      b = mp { return :good }
+
+      pr = send(meth) { |x| x.call }
+
+      pr.call(b)
+
+      # We shouldn't be here, b should have unwinded through
+      return :bad
+    end
+  end
+
   class RespondViaMissing
     def respond_to_missing?(method, priv=false)
       case method
@@ -259,6 +294,12 @@
   def f
     yield
   end
+
+  def self.call_eval
+    f = __FILE__
+    eval "true", binding, "(eval)", 1
+    return f
+  end
 end
 
 # for Kernel#sleep to have Channel in it's specs

Modified: MacRuby/trunk/spec/frozen/core/kernel/freeze_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/freeze_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/freeze_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,27 +4,60 @@
 describe "Kernel#freeze" do
   it "prevents self from being further modified" do
     o = mock('o')
-    o.frozen?.should == false
+    o.frozen?.should be_false
     o.freeze
-    o.frozen?.should == true
+    o.frozen?.should be_true
   end
 
-  # 1.9 allows immediate's to be frozen; reported as bug #1747
-  it "has no effect on immediate values" do
-    a = nil
-    b = true
-    c = false
-    d = 1
-    a.freeze
-    b.freeze
-    c.freeze
-    d.freeze
-    a.frozen?.should == false
-    b.frozen?.should == false
-    c.frozen?.should == false
-    d.frozen?.should == false
+  it "returns the immediate when called on an immediate" do
+    nil.freeze.should be_nil
+    true.freeze.should be_true
+    false.freeze.should be_false
+    1.freeze.should == 1
+    :sym.freeze.should == :sym
   end
 
+  ruby_version_is '' ... '1.9' do
+    it "has no effect on immediate values" do
+      a = nil
+      b = true
+      c = false
+      d = 1
+      e = :sym
+      a.freeze
+      b.freeze
+      c.freeze
+      d.freeze
+      e.freeze
+      a.frozen?.should be_false
+      b.frozen?.should be_false
+      c.frozen?.should be_false
+      d.frozen?.should be_false
+      e.frozen?.should be_false
+    end
+  end
+
+  ruby_version_is '1.9' do
+    # 1.9 allows immediates to be frozen #1747
+    it "freezes immediate values" do
+      a = nil
+      b = true
+      c = false
+      d = 1
+      e = :sym
+      a.freeze
+      b.freeze
+      c.freeze
+      d.freeze
+      e.freeze
+      a.frozen?.should be_true
+      b.frozen?.should be_true
+      c.frozen?.should be_true
+      d.frozen?.should be_true
+      e.frozen?.should be_true
+    end
+  end
+
   ruby_version_is "" ... "1.9" do
     it "causes mutative calls to raise TypeError" do
       o = Class.new do

Modified: MacRuby/trunk/spec/frozen/core/kernel/instance_eval_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/instance_eval_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/instance_eval_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,26 +5,26 @@
   it "expects a block with no arguments" do
     lambda { "hola".instance_eval }.should raise_error(ArgumentError)
   end
-  
+
   it "takes no arguments with a block" do
-    lambda { "hola".instance_eval(4, 5) { |a,b| a + b } }.should raise_error(ArgumentError)
+    lambda { "hola".instance_eval(4, 5) {|a,b| a + b } }.should raise_error(ArgumentError)
   end
-  
+
   ruby_version_is ""..."1.9" do
     it "passes the object to the block" do
-      "hola".instance_eval { |o| o.size }.should == 4
+      "hola".instance_eval {|o| o.size }.should == 4
     end
   end
-  
+
   ruby_version_is "1.9" do
     it "doesn't pass the object to the block" do
-      "hola".instance_eval { |o| o }.should be_nil
+      "hola".instance_eval {|o| o }.should == "hola"
     end
   end
 
   it "only binds the eval to the receiver" do
     f = Object.new
-    f.instance_eval do 
+    f.instance_eval do
       def foo
         1
       end
@@ -36,7 +36,7 @@
   # TODO: This should probably be replaced with a "should behave like" that uses
   # the many scoping/binding specs from kernel/eval_spec, since most of those
   # behaviors are the same for instance_eval. See also module_eval/class_eval.
-  
+
   # Feature removed in 1.9
   ruby_version_is ""..."1.9" do
     it "shares a scope across sibling evals" do
@@ -53,11 +53,11 @@
 
   it "binds self to the receiver" do
     s = "hola"
-    (s == s.instance_eval { self }).should == true
+    (s == s.instance_eval { self }).should be_true
     o = mock('o')
-    (o == o.instance_eval("self")).should == true
+    (o == o.instance_eval("self")).should be_true
   end
-  
+
   it "executes in the context of the receiver" do
     "Ruby-fu".instance_eval { size }.should == 7
     "hola".instance_eval("size").should == 4
@@ -103,6 +103,14 @@
     end
   end
 
+  it "gets constants in the receiver if a string given" do
+    KernelSpecs::InstEvalOuter::Inner::X_BY_STR.should == 2
+  end
+
+  it "doesn't get constants in the receiver if a block given" do
+    KernelSpecs::InstEvalOuter::Inner::X_BY_BLOCK.should be_nil
+  end
+
   it "raises a TypeError when defining methods on an immediate" do
     lambda do
       1.instance_eval { def foo; end }
@@ -116,7 +124,7 @@
   it "scopes class var accesses in the caller when called on a Fixnum" do
     # Fixnum can take instance vars
     Fixnum.class_eval "@@__tmp_instance_eval_spec = 1"
-    (defined? @@__tmp_instance_eval_spec).should == nil
+    (defined? @@__tmp_instance_eval_spec).should be_nil
 
     @@__tmp_instance_eval_spec = 2
     1.instance_eval { @@__tmp_instance_eval_spec }.should == 2

Modified: MacRuby/trunk/spec/frozen/core/kernel/instance_variables_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/instance_variables_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/instance_variables_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,5 +2,50 @@
 require File.dirname(__FILE__) + '/fixtures/classes'
 
 describe "Kernel#instance_variables" do
-  it "needs to be reviewed for spec completeness"
+
+  describe "immediate values" do
+
+    it "returns an empty array if no instance variables are defined" do
+      0.instance_variables.should == []
+    end
+
+    ruby_version_is ""..."1.9" do
+      it "returns the correct array if an instance variable is added" do
+        a = 0
+        a.instance_variable_set("@test", 1)
+        a.instance_variables.should == ["@test"]
+      end
+    end
+
+    ruby_version_is "1.9" do
+      it "returns the correct array if an instance variable is added" do
+        a = 0
+        a.instance_variable_set("@test", 1)
+        a.instance_variables.should == [:@test]
+      end
+    end
+  end
+
+  describe "regular objects" do
+
+    it "returns an empty array if no instance variables are defined" do
+      Object.new.instance_variables.should == []
+    end
+
+    ruby_version_is ""..."1.9" do
+      it "returns the correct array if an instance variable is added" do
+        a = Object.new
+        a.instance_variable_set("@test", 1)
+        a.instance_variables.should == ["@test"]
+      end
+    end
+
+    ruby_version_is "1.9" do
+      it "returns the correct array if an instance variable is added" do
+        a = Object.new
+        a.instance_variable_set("@test", 1)
+        a.instance_variables.should == [:@test]
+      end
+    end
+  end
 end

Modified: MacRuby/trunk/spec/frozen/core/kernel/load_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/load_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/load_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,7 +1,5 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 
-require 'fileutils'
-
 $load_fixture_dir = (File.dirname(__FILE__) + '/../../fixtures/load')
 $LOAD_PATH << $load_fixture_dir
 
@@ -33,13 +31,6 @@
     Kernel.should have_private_instance_method(:load)
   end
 
-  # Avoid storing .rbc in repo
-  before :all do
-    Dir.chdir($load_fixture_dir) do |dir|
-      FileUtils.rm_f(Dir["*.rbc"])
-    end
-  end
-
   it "loads a .rb from an absolute path and returns true" do
     path = File.expand_path(File.dirname(__FILE__) + '/../../fixtures/load/load_spec_1.rb')
 
@@ -221,8 +212,8 @@
 
   runner_is_not :rspec do
     it "allows wrapping the code in the file in an anonymous module" do
-      !!defined?(LoadSpecWrap).should == false
-      !!defined?(LoadSpecWrapTwo).should == false
+      defined?(LoadSpecWrap).should == nil
+      defined?(LoadSpecWrapTwo).should == nil
 
       load('load_spec_wrap.rb').should == true
       $load_spec_wrap.nil?.should == false
@@ -230,7 +221,7 @@
 
       load('load_spec_wrap2.rb', true).should == true
       $load_spec_wrap2.nil?.should == false
-      !!defined?(LoadSpecWrapTwo).should == false
+      defined?(LoadSpecWrapTwo).should == nil
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/kernel/method_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/method_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/method_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -21,6 +21,11 @@
     @obj.method(:protected_method).should be_an_instance_of(Method)
   end
 
+  it "can call methods created with define_method" do
+    m = @obj.method(:defined_method)
+    m.call.should == :defined
+  end
+
   ruby_version_is "1.9.2" do
     it "can be called even if we only repond_to_missing? method, true" do
       m = KernelSpecs::RespondViaMissing.new.method(:handled_privately)

Modified: MacRuby/trunk/spec/frozen/core/kernel/open_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/open_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/open_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,22 +7,22 @@
   end
   
   before :each do
-    @file = "test.txt"
-    File.open(@file, "w"){ |f| f.puts "This is a test" }
+    @name = tmp("kernel_open.txt")
+    touch(@name) { |f| f.write "This is a test" }
   end
   
   after :each do
-    File.delete(@file) rescue nil
+    rm_r @name
   end
   
   it "opens a file when given a valid filename" do
-    @file = open("test.txt")
-    @file.class.should == File
+    @file = open(@name)
+    @file.should be_kind_of(File)
   end
   
   it "opens a file when called with a block" do
-    @output = open("test.txt", "r") { |f| f.gets }
-    @output.should == "This is a test\n"
+    @output = open(@name, "r") { |f| f.gets }
+    @output.should == "This is a test"
   end
   
 
@@ -64,7 +64,7 @@
       obj = mock('fileish')
       obj.should_receive(:to_open).and_return(File.open(@file))
       @file = open(obj)
-      @file.class.should == File
+      @file.should be_kind_of(File)
     end
     
     it "raises a TypeError if passed a non-String that does not respond to #to_open" do

Modified: MacRuby/trunk/spec/frozen/core/kernel/p_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/p_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/p_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -14,6 +14,7 @@
     Kernel.should have_private_instance_method(:p)
   end
   
+  # TODO: fix
   it "flushes output if receiver is a File" do
     filename = tmp("Kernel_p_flush") + $$.to_s
     begin
@@ -31,7 +32,7 @@
         end
       end
     ensure
-      File.delete(filename) rescue nil
+      rm_r filename
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/kernel/public_send_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/public_send_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/public_send_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -40,8 +40,9 @@
           'done2'
         end
       end
-      lambda { KernelSpecs::Foo.new.public_send(:bar) }.should 
-        raise_error(NoMethodError)
+      lambda {
+        KernelSpecs::Foo.new.public_send(:bar)
+      }.should raise_error(NoMethodError)
     end
 
     it "raises a NoMethodError if the named method is an alias of a private method" do
@@ -52,8 +53,9 @@
           'done2'
         end
       end
-      lambda { KernelSpecs::Foo.new.public_send(:aka) }.should 
-        raise_error(NoMethodError)
+      lambda {
+        KernelSpecs::Foo.new.public_send(:aka)
+      }.should raise_error(NoMethodError)
     end
 
     it "raises a NoMethodError if the named method is an alias of a protected method" do
@@ -64,8 +66,9 @@
           'done2'
         end
       end
-      lambda { KernelSpecs::Foo.new.public_send(:aka) }.should 
-        raise_error(NoMethodError)
+      lambda {
+        KernelSpecs::Foo.new.public_send(:aka)
+      }.should raise_error(NoMethodError)
     end
 
   it_behaves_like(:kernel_send, :public_send)

Modified: MacRuby/trunk/spec/frozen/core/kernel/require_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/require_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/require_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -21,11 +21,11 @@
   before :each do
     # We explicitly delete and recreate our temporary directories every time
     # to avoid establishing dependencies between tests. 
-    FileUtils.rm_rf($require_tmp_dir)
+    rm_r $require_tmp_dir
     Dir.mkdir($require_tmp_dir)
     Dir.chdir($require_tmp_dir) { 
-      FileUtils.touch("require_spec_dummy.#{Config::CONFIG['DLEXT']}")
-      FileUtils.touch("require_spec_dummy.rb")
+      touch "require_spec_dummy.#{Config::CONFIG['DLEXT']}"
+      touch "require_spec_dummy.rb"
     }
     $LOADED_FEATURES.delete_if {|path| path =~ /require_spec/}
     $require_spec   = nil
@@ -43,6 +43,10 @@
     $require_spec_recursive = nil
   end
 
+  after :each do
+    rm_r $require_tmp_dir
+  end
+
   # The files used below just contain code that assigns
   # Time.now to the respective global variable so that
   # reloads can easily be verified.
@@ -82,7 +86,7 @@
       File.directory?(dir).should be_true
       Dir.chdir(dir) do |tmp_dir|
         file = "#{$$}_#{Process.times.utime}.rb"
-        FileUtils.touch file
+        touch file
         File.exist?(file).should be_true
         lambda { require file }.should raise_error(LoadError)
         File.unlink(file)
@@ -379,24 +383,40 @@
     lambda { require "nonesuch#{$$}#{Time.now.to_f}" }.should raise_error LoadError
   end
 
-  it "raises a LoadError if the file exists but can't be read" do
-    abs_path = File.expand_path(
-      File.join($require_tmp_dir, 'require_spec_dummy.rb'))
-    File.exists?(abs_path).should be_true
-    File.new(abs_path).chmod(0000)
-    lambda {require(abs_path)}.should raise_error(LoadError)
+  platform_is_not :os => [:windows, :cygwin] do # can't make file unreadable
+    it "raises a LoadError if the file exists but can't be read" do
+      abs_path = File.expand_path(File.join($require_tmp_dir, 'require_spec_dummy.rb'))
+      File.exists?(abs_path).should be_true
+      file = File.new(abs_path)
+      begin
+        file.chmod(0000)
+        lambda {require(abs_path)}.should raise_error(LoadError)
+      ensure
+        file.close
+      end
+    end
   end
 
   ruby_version_is ""..."1.9" do
-    it "only accepts strings" do
+    it "only accepts strings and objects with #to_str" do
       lambda { require(nil) }.should raise_error(TypeError)
       lambda { require(42)  }.should raise_error(TypeError)
       lambda { require([])  }.should raise_error(TypeError)
+
+      # objects with to_s are not good enough
+      o = mock('require_spec_dummy');
+      o.should_receive(:to_s).any_number_of_times.and_return("require_spec_dummy")
+      lambda { require(o) }.should raise_error(TypeError)
+
+      # objects with to_path are not good enough
+      o = mock('require_spec_dummy');
+      o.should_receive(:to_path).any_number_of_times.and_return("require_spec_dummy")
+      lambda { require(o) }.should raise_error(TypeError)
     end
   end
 
   ruby_version_is "1.9" do
-    it "only accepts strings or objects with #to_path" do
+    it "only accepts string or objects with #to_path or #to_str" do
       lambda { require(nil) }.should raise_error(TypeError)
       lambda { require(42)  }.should raise_error(TypeError)
       lambda { require([])  }.should raise_error(TypeError)
@@ -405,13 +425,52 @@
     it "calls #to_path on non-String arguments" do
       abs_path = File.expand_path(
         File.join($require_fixture_dir, 'require_spec.rb'))
+      path = mock('abs_path')
+      path.should_receive(:to_path).and_return(abs_path)
+      require(path).should be_true
+      $LOADED_FEATURES.include?(abs_path).should be_true
+    end
+
+    it "does not call #to_path on String arguments" do
+      abs_path = File.expand_path(
+        File.join($require_fixture_dir, 'require_spec.rb'))
+
+      def abs_path.to_path
+        'blah-non-existing-path'
+      end
+      require(abs_path).should be_true
+      $LOADED_FEATURES.include?(abs_path).should be_true
+    end
+
+    it "calls #to_str on non-String objects returned by #to_path" do
+      abs_path = File.expand_path(
+        File.join($require_fixture_dir, 'require_spec.rb'))
+
+      non_string_path = mock("non_string_path")
+      non_string_path.should_receive(:to_str).and_return(abs_path)
+
       path = mock('path')
-      path.should_receive(:to_path).and_return('require_spec')
+      path.should_receive(:to_path).and_return(non_string_path)
+
       require(path).should be_true
       $LOADED_FEATURES.include?(abs_path).should be_true
-    end  
+    end
   end
 
+  it "calls #to_str on non-String arguments" do
+    abs_path = File.expand_path(
+        File.join($require_fixture_dir, 'require_spec.rb'))
+    o = mock('require_spec');
+    o.should_receive(:to_str).and_return(abs_path)
+    $LOADED_FEATURES.include?(abs_path).should be_false
+    require(o).should be_true
+    $LOADED_FEATURES.include?(abs_path).should be_true
+
+    nil_mock = mock('nil')
+    nil_mock.should_receive(:to_str).at_least(1).and_return(nil)
+    lambda { require(nil_mock) }.should raise_error(TypeError)
+  end
+
   it "does not infinite loop on an rb file that requires itself" do
     $LOADED_FEATURES.grep(/require_spec_recursive\.rb/).should == []
     require('require_spec_recursive').should be_true

Modified: MacRuby/trunk/spec/frozen/core/kernel/shared/lambda.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/shared/lambda.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/shared/lambda.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -19,4 +19,8 @@
     test
     @reached_end_of_method.should be_true
   end
+
+  it "allows long returns to flow through it" do
+    KernelSpecs::Lambda.new.outer(@method).should == :good
+  end
 end

Modified: MacRuby/trunk/spec/frozen/core/kernel/shared/object_id.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/shared/object_id.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/shared/object_id.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,8 +2,8 @@
   # #object_id and #__id__ are aliases, so we only need one function
   # that tests both methods
   it "returns an integer" do
-    mock('fixnum').send(@method).class.should == Fixnum
-    nil.send(@method).class.should == Fixnum
+    mock('fixnum').send(@method).should be_kind_of(Fixnum)
+    nil.send(@method).should be_kind_of(Fixnum)
   end
 
   it "returns the same value on all calls to id for a given object" do

Modified: MacRuby/trunk/spec/frozen/core/kernel/shared/send.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/shared/send.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/shared/send.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -35,6 +35,10 @@
     lambda { KernelSpecs::Foo.send(@method, :baz) }.should raise_error(NameError)
   end
 
+  it "raises an ArgumentError if no arguments are given" do
+    lambda { KernelSpecs::Foo.new.send }.should raise_error(ArgumentError)
+  end
+
   it "raises an ArgumentError if called with more arguments than available parameters" do
     class KernelSpecs::Foo
       def bar; end
@@ -91,8 +95,16 @@
     end
   end
 
-  # Confirm commit r24306 
-  it "has an arity of -1" do
-    method(:__send__).arity.should == -1
+  not_compliant_on :rubinius do
+    # Confirm commit r24306
+    it "has an arity of -1" do
+      method(:__send__).arity.should == -1
+    end
   end
+
+  deviates_on :rubinius do
+    it "has an arity of -2" do
+      method(:__send__).arity.should == -2
+    end
+  end
 end

Modified: MacRuby/trunk/spec/frozen/core/kernel/spawn_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/spawn_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/spawn_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -35,7 +35,7 @@
     end
 
     it "sets the child's environment variables according to a supplied hash" do
-      pid = spawn({:spawn_of_ruby => 'yes'}, "ruby -e 'print ENV[:spawn_of_ruby]' >#{@f}")
+      pid = spawn({:spawn_of_ruby => 'yes'}, "ruby -e 'print ENV[\"spawn_of_ruby\"]' >#{@f}")
       sleep 0.1
       File.exists?(@f).should be_true
       File.read(@f).should == "yes"
@@ -75,13 +75,13 @@
 
     it "redirects STDERR to the given file descriptior if if :err => Fixnum" do
       fd = File.open(@f,'w').fileno
-      spawn("ruby -e 'print warn(:glark)'", {:err => fd})  
+      spawn("ruby -e 'warn(:glark)'", {:err => fd})  
       sleep 0.1
       File.read(@f).should =~ /glark/
     end
 
     it "redirects STDERR to the given file if :err => String" do
-      spawn("ruby -e 'print warn(:glark)'", {:err => @f})  
+      spawn("ruby -e 'warn(:glark)'", {:err => @f})  
       sleep 0.1
       File.read(@f).should =~ /glark/
     end

Modified: MacRuby/trunk/spec/frozen/core/kernel/taint_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/taint_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/kernel/taint_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,6 +6,11 @@
     mock('tainted?').taint.tainted?.should == true
   end
 
+  it "returns the immediate when called on an immediate" do
+    imediate_values = [nil, true, false, 1, :sym]
+    imediate_values.each{ |v| v.taint.should == v }
+  end
+
   it "has no effect on immediate values" do
     imediate_values = [nil, true, false, 1, :sym]
     imediate_values.each{ |v| v.taint; v.tainted?.should be_false}

Modified: MacRuby/trunk/spec/frozen/core/marshal/dump_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/marshal/dump_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/marshal/dump_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -272,9 +272,54 @@
         "#{mv+nv}e:\nMethsS:\x11Struct::Ure2\a:\x06a[\a;\aI\"\ahi\x06:\x06EF:\x06b[\a;\x00@\a"
     end
   end
-end
+  
+  it "returns an untainted string if object is untainted" do
+    obj = Object.new
+    m = Marshal.dump(obj)
+    m.tainted?.should be_false
+  end
+  
+  it "returns a tainted string if object is tainted" do
+    obj = Object.new
+    obj.taint
+    m = Marshal.dump(obj)
+    m.tainted?.should be_true
+  end
+  
+  it "returns a tainted string if object is tainted deep in nested structure" do
+    obj = Object.new
+    a = [[obj]]
+    obj.taint
+    m = Marshal.dump(a)
+    # a is not tainted, but its serialization is
+    a.tainted?.should be_false
+    m.tainted?.should be_true
+  end
 
-describe "Marshal.dump" do
+  ruby_version_is "1.9" do
+    it "returns a trusted string if object is trusted" do
+      x = Object.new
+      s = Marshal.dump(x)
+      s.untrusted?.should be_false
+    end
+
+    it "returns an untrusted string if object is untrusted" do
+      x = Object.new
+      x.untrust
+      s = Marshal.dump(x)
+      s.untrusted?.should be_true
+    end
+
+    it "returns an untrusted string if object is untrusted deep in nested structure" do
+      x = Object.new
+      a = [[x]]
+      x.untrust
+      s = Marshal.dump(a)
+      a.untrusted?.should be_false
+      s.untrusted?.should be_true
+    end
+  end
+  
   ruby_version_is ""..."1.9" do
     MarshalSpec::DATA.each do |description, (object, marshal, attributes)|
       it "dumps a #{description}" do

Modified: MacRuby/trunk/spec/frozen/core/marshal/fixtures/marshal_data.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/marshal/fixtures/marshal_data.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/marshal/fixtures/marshal_data.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -175,16 +175,21 @@
                         "\004\bl-\t\000\000\000\000\000\000\000\200"],
     "Fixnum -2**24" => [-2**24,
                         "\004\bi\375\000\000\000"],
+    "Fixnum -4516727" => [-4516727,
+                          "\004\bi\375\211\024\273"],
     "Fixnum -2**16" => [-2**16,
                         "\004\bi\376\000\000"],
     "Fixnum -2**8" => [-2**8,
                        "\004\bi\377\000"],
     "Fixnum -123" => [-123,
                       "\004\bi\200"],
+    "Fixnum -124" => [-124, "\004\bi\377\204"],
     "Fixnum 0" => [0,
                    "\004\bi\000"],
     "Fixnum 5" => [5,
                    "\004\bi\n"],
+    "Fixnum 122" => [122, "\004\bi\177"],
+    "Fixnum 123" => [123, "\004\bi\001{"],
     "Fixnum 2**8" => [2**8,
                       "\004\bi\002\000\001"],
     "Fixnum 2**16" => [2**16,
@@ -221,6 +226,8 @@
                           "\004\bf\t-inf"],
     "Float 1.0" => [1.0,
                     "\004\bf\0061"],
+    "Float 8323434.342" => [8323434.342,
+                            "\004\bf\0328323434.3420000002\000S\370"],
     "Hash" => [Hash.new,
                "\004\b{\000"],
     "Hash subclass" => [UserHash.new,

Modified: MacRuby/trunk/spec/frozen/core/marshal/load_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/marshal/load_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/marshal/load_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -40,11 +40,11 @@
 
   it "loads a user_object" do
     obj = UserObject.new
-    Marshal.load("\004\bo:\017UserObject\000").class.should == UserObject
+    Marshal.load("\004\bo:\017UserObject\000").should be_kind_of(UserObject)
   end
 
   it "loads a object" do
-    Marshal.load("\004\bo:\vObject\000").class.should == Object
+    Marshal.load("\004\bo:\vObject\000").should be_kind_of(Object)
   end
 
   it "loads an extended Object" do
@@ -316,4 +316,63 @@
       Marshal.load(marshal).should == object
     end
   end
+  
+  it "returns an untainted object if source is untainted" do
+    x = Object.new
+    y = Marshal.load(Marshal.dump(x))
+    y.tainted?.should be_false
+  end
+  
+  it "returns a tainted object if source is tainted" do
+    x = Object.new
+    x.taint
+    s = Marshal.dump(x)
+    y = Marshal.load(s)
+    y.tainted?.should be_true
+    
+    # note that round-trip via Marshal does not preserve
+    # the taintedness at each level of the nested structure
+    y = Marshal.load(Marshal.dump([[x]]))
+    y.tainted?.should be_true
+    y.first.tainted?.should be_true
+    y.first.first.tainted?.should be_true
+    
+  end
+  
+  it "preserves taintedness of nested structure" do
+    x = Object.new
+    a = [[x]]
+    x.taint
+    y = Marshal.load(Marshal.dump(a))
+    y.tainted?.should be_true
+    y.first.tainted?.should be_true
+    y.first.first.tainted?.should be_true
+  end
+
+  ruby_version_is "1.9" do
+    
+    it "returns a trusted object if source is trusted" do
+      x = Object.new
+      y = Marshal.load(Marshal.dump(x))
+      y.untrusted?.should be_false
+    end
+
+    it "returns an untrusted object if source is untrusted" do
+      x = Object.new
+      x.untrust
+      y = Marshal.load(Marshal.dump(x))
+      y.untrusted?.should be_true
+
+      # note that round-trip via Marshal does not preserve
+      # the untrustedness at each level of the nested structure
+      y = Marshal.load(Marshal.dump([[x]]))
+      y.untrusted?.should be_true
+      y.first.untrusted?.should be_true
+      y.first.first.untrusted?.should be_true
+
+    end
+    
+  end
+  
+
 end

Modified: MacRuby/trunk/spec/frozen/core/matchdata/regexp_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/matchdata/regexp_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/matchdata/regexp_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,6 +1,6 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 
-ruby_version_is "1.9" do
+ruby_version_is "1.8.8" do
   describe "MatchData#regexp" do
     it "returns a Regexp object" do
       m = 'haystack'.match(/hay/)

Modified: MacRuby/trunk/spec/frozen/core/math/acos_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/acos_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/acos_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,7 +8,7 @@
   end
   
   it "returns a float" do 
-    Math.acos(1).class.should == Float 
+    Math.acos(1).should be_kind_of(Float )
   end 
   
   it "returns the arccosine of the argument" do 

Modified: MacRuby/trunk/spec/frozen/core/math/acosh_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/acosh_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/acosh_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.acosh" do
   it "returns a float" do
-    Math.acosh(1.0).class.should == Float
+    Math.acosh(1.0).should be_kind_of(Float)
   end
   
   it "returns the principle value of the inverse hyperbolic cosine of the argument" do

Modified: MacRuby/trunk/spec/frozen/core/math/asin_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/asin_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/asin_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 # arcsine : (-1.0, 1.0) --> (-PI/2, PI/2)
 describe "Math.asin" do
   it "return a float" do 
-    Math.asin(1).class.should == Float
+    Math.asin(1).should be_kind_of(Float)
   end 
   
   it "returns the arcsine of the argument" do   

Modified: MacRuby/trunk/spec/frozen/core/math/asinh_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/asinh_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/asinh_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.asinh" do
   it "returns a float" do
-    Math.asinh(1.5).class.should == Float
+    Math.asinh(1.5).should be_kind_of(Float)
   end
   
   it "returns the inverse hyperbolic sin of the argument" do

Modified: MacRuby/trunk/spec/frozen/core/math/atan2_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/atan2_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/atan2_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.atan2" do
   it "returns a float" do
-    Math.atan2(1.2, 0.5).class.should == Float
+    Math.atan2(1.2, 0.5).should be_kind_of(Float)
   end
   
   it "returns the arc tangent of y, x" do

Modified: MacRuby/trunk/spec/frozen/core/math/atan_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/atan_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/atan_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 # arctangent : (-Inf, Inf) --> (-PI/2, PI/2)
 describe "Math.atan" do     
   it "returns a float" do 
-    Math.atan(1).class.should == Float
+    Math.atan(1).should be_kind_of(Float)
   end 
   
   it "return the arctangent of the argument" do    

Modified: MacRuby/trunk/spec/frozen/core/math/atanh_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/atanh_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/atanh_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,23 +3,35 @@
 
 describe "Math.atanh" do
   it "returns a float" do
-    Math.atanh(0.5).class.should == Float
+    Math.atanh(0.5).should be_an_instance_of(Float)
   end
-  
+
   it "returns the inverse hyperbolic tangent of the argument" do
     Math.atanh(0.0).should == 0.0
     Math.atanh(-0.0).should == -0.0
     Math.atanh(0.5).should be_close(0.549306144334055, TOLERANCE)
     Math.atanh(-0.2).should be_close(-0.202732554054082, TOLERANCE)
   end
-  
+
   platform_is :darwin, :freebsd, :java do
-    it "returns Infinity for 1.0" do
-      Math.atanh(1.0).infinite?.should == 1
+    ruby_version_is ""..."1.9" do
+      it "returns Infinity for 1.0" do
+        Math.atanh(1.0).infinite?.should == 1
+      end
+
+      it "returns -Infinity for -1.0" do
+        Math.atanh(-1.0).infinite?.should == -1
+      end
     end
-  
-    it "returns -Infinity for -1.0" do
-      Math.atanh(-1.0).infinite?.should == -1
+
+    ruby_version_is "1.9" do
+      it "raises an Errno::EDOM if x = 1.0" do
+        lambda { Math.atanh(1.0) }.should raise_error(Errno::EDOM)
+      end
+
+      it "raises an Errno::EDOM if x = -1.0" do
+        lambda { Math.atanh(-1.0) }.should raise_error(Errno::EDOM)
+      end
     end
   end
 
@@ -40,12 +52,12 @@
     it "raises an Errno::EDOM if the passed argument is greater than 1.0" do
       lambda { Math.atanh(1.0 + TOLERANCE)  }.should raise_error(Errno::EDOM)
     end
-    
+
     it "raises an Errno::EDOM if the passed argument is less than -1.0" do
       lambda { Math.atanh(-1.0 - TOLERANCE) }.should raise_error(Errno::EDOM)
     end
   end
-  
+
   ruby_version_is ""..."1.9" do
     it "raises an ArgumentError if the argument cannot be coerced with Float()" do
       lambda { Math.atanh("test") }.should raise_error(ArgumentError)
@@ -61,9 +73,9 @@
   it "raises a TypeError if the argument is nil" do
     lambda { Math.atanh(nil) }.should raise_error(TypeError)
   end
-  
+
   it "accepts any argument that can be coerced with Float()" do
-    Math.atanh(MathSpecs::Float.new(0.5)).infinite?.should == nil
+    Math.atanh(MathSpecs::Float.new(0.5)).infinite?.should be_nil
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/math/cos_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/cos_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/cos_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 # cosine : (-Inf, Inf) --> (-1.0, 1.0)
 describe "Math.cos" do  
   it "returns a float" do 
-    Math.cos(Math::PI).class.should == Float
+    Math.cos(Math::PI).should be_kind_of(Float)
   end 
 
   it "returns the cosine of the argument expressed in radians" do    

Modified: MacRuby/trunk/spec/frozen/core/math/cosh_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/cosh_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/cosh_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.cosh" do
   it "returns a float" do
-    Math.cosh(1.0).class.should == Float
+    Math.cosh(1.0).should be_kind_of(Float)
   end
   
   it "returns the hyperbolic cosine of the argument" do

Modified: MacRuby/trunk/spec/frozen/core/math/erf_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/erf_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/erf_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,7 +5,7 @@
 # distribution (which is a normalized form of the Gaussian function).
 describe "Math.erf" do
   it "returns a float" do 
-    Math.erf(1).class.should == Float
+    Math.erf(1).should be_kind_of(Float)
   end 
   
   it "returns the error function of the argument" do 

Modified: MacRuby/trunk/spec/frozen/core/math/erfc_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/erfc_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/erfc_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 # erfc is the complementary error function  
 describe "Math.erfc" do
   it "returns a float" do
-    Math.erf(1).class.should == Float
+    Math.erf(1).should be_kind_of(Float)
   end
   
   it "returns the complimentary error function of the argument" do

Modified: MacRuby/trunk/spec/frozen/core/math/exp_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/exp_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/exp_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.exp" do
   it "returns a float" do
-    Math.exp(1.0).class.should == Float
+    Math.exp(1.0).should be_kind_of(Float)
   end
   
   it "returns the base-e exponential of the argument" do

Added: MacRuby/trunk/spec/frozen/core/math/gamma_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/gamma_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/math/gamma_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,39 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+ruby_version_is "1.9" do
+  describe "Math.gamma" do
+    it "returns a float" do
+      Math.gamma(2).should be_kind_of(Float)
+    end
+
+    it "returns well-known values" do
+      # These are theoretically known precise values
+      Math.gamma(0).infinite?.should == 1
+      Math.gamma(0.5).should be_close(Math.sqrt(Math::PI), TOLERANCE)
+      Math.gamma(1).should be_close(1.0, TOLERANCE)
+      Math.gamma(6.0).should be_close(120.0, TOLERANCE)
+      Math.gamma(1.0/0).infinite?.should == 1
+    end
+    
+    it "returns good numerical approximations" do
+      Math.gamma( 3.2) .should be_close(         2.423965, TOLERANCE)
+      Math.gamma(-2.15).should be_close(        -2.999619, TOLERANCE)
+      Math.gamma( 0.00001).should be_close(  99999.422794, TOLERANCE)
+      Math.gamma(-0.00001).should be_close(-100000.577225, TOLERANCE)
+    end
+    
+    it "raises Domain Error on negative integers" do
+      lambda { Math.gamma(-1) }.should raise_error(Errno::EDOM)
+      lambda { Math.gamma(-2.0) }.should raise_error(Errno::EDOM)
+    end
+    
+    it "raises Domain Error given negative infinity" do
+      lambda { Math.gamma(-1.0/0) }.should raise_error(Errno::EDOM)
+    end
+    
+    it "returns NaN given NaN" do
+      Math.gamma(0.0/0).nan?.should be_true
+    end
+
+  end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/core/math/hypot_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/hypot_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/hypot_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.hypot" do
   it "returns a float" do
-    Math.hypot(3, 4).class.should == Float
+    Math.hypot(3, 4).should be_kind_of(Float)
   end
   
   it "returns the length of the hypotenuse of a right triangle with legs given by the arguments" do 

Modified: MacRuby/trunk/spec/frozen/core/math/ldexp_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/ldexp_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/ldexp_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.ldexp" do
   it "returns a float" do
-    Math.ldexp(1.0, 2).class.should == Float
+    Math.ldexp(1.0, 2).should be_kind_of(Float)
   end
   
   it "returns the argument multiplied by 2**n" do

Added: MacRuby/trunk/spec/frozen/core/math/lgamma_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/lgamma_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/math/lgamma_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,44 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+ruby_version_is "1.9" do
+  describe "Math.lgamma" do
+    it "returns an array of 2 elements" do
+      lg = Math.lgamma(0)
+      lg.should be_kind_of(Array)
+      lg.size.should == 2
+    end
+
+    it "returns known values" do
+      Math.lgamma(0).should  == [1.0/0, 1]
+      Math.lgamma(-1).should == [1.0/0, 1]
+      lg1 = Math.lgamma(0.5)
+      lg1[0].should be_close(Math.log(Math.sqrt(Math::PI)), TOLERANCE)
+      lg1[1].should == 1
+      
+      lg2 = Math.lgamma(6.0)
+      lg2[0].should be_close(Math.log(120.0), TOLERANCE)
+      lg2[1].should == 1
+    end
+
+    it "returns good numerical approximations" do
+      lg1 = Math.lgamma(-0.5)
+      lg1[0].should be_close(1.2655121, TOLERANCE)
+      lg1[1].should == -1
+      
+      lg2 = Math.lgamma(-1.5)
+      lg2[0].should be_close(0.8600470, TOLERANCE)
+      lg2[1].should == 1
+    end
+    
+    it "returns correct values given +/- infinity" do
+      Math.lgamma( 1.0/0).should == [1.0/0, 1]
+      Math.lgamma(-1.0/0).should == [1.0/0, 1]
+    end
+    
+    it "returns correct value given NaN" do
+      Math.lgamma(0.0/0)[0].nan?.should be_true
+      Math.lgamma(0.0/0)[1].should == 1
+    end
+
+  end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/core/math/log10_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/log10_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/log10_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 # The common logarithm, having base 10
 describe "Math.log10" do
   it "returns a float" do 
-    Math.log10(1).class.should == Float
+    Math.log10(1).should be_kind_of(Float)
   end
   
   it "return the base-10 logarithm of the argument" do

Modified: MacRuby/trunk/spec/frozen/core/math/log_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/log_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/log_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 # The natural logarithm, having base Math::E
 describe "Math.log" do
   it "returns a float" do
-    Math.log(1).class.should == Float
+    Math.log(1).should be_kind_of(Float)
   end
   
   it "returns the natural logarithm of the argument" do 

Modified: MacRuby/trunk/spec/frozen/core/math/sin_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/sin_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/sin_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 # sine : (-Inf, Inf) --> (-1.0, 1.0)
 describe "Math.sin" do 
   it "returns a float" do 
-    Math.sin(Math::PI).class.should == Float
+    Math.sin(Math::PI).should be_kind_of(Float)
   end 
   
   it "returns the sine of the argument expressed in radians" do    

Modified: MacRuby/trunk/spec/frozen/core/math/sinh_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/sinh_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/sinh_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.sinh" do
   it "returns a float" do
-    Math.sinh(1.2).class.should == Float
+    Math.sinh(1.2).should be_kind_of(Float)
   end
   
   it "returns the hyperbolic sin of the argument" do

Modified: MacRuby/trunk/spec/frozen/core/math/sqrt_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/sqrt_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/sqrt_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.sqrt" do
   it "returns a float" do
-    Math.sqrt(1).class.should == Float
+    Math.sqrt(1).should be_kind_of(Float)
   end
   
   it "returns the square root of the argument" do

Modified: MacRuby/trunk/spec/frozen/core/math/tan_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/tan_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/tan_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.tan" do
   it "returns a float" do
-    Math.tan(1.35).class.should == Float
+    Math.tan(1.35).should be_kind_of(Float)
   end
   
   it "returns the tangent of the argument" do

Modified: MacRuby/trunk/spec/frozen/core/math/tanh_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/math/tanh_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/math/tanh_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Math.tanh" do
   it "returns a float" do
-    Math.tanh(0.5).class.should == Float
+    Math.tanh(0.5).should be_kind_of(Float)
   end
   
   it "returns the hyperbolic tangent of the argument" do

Modified: MacRuby/trunk/spec/frozen/core/method/shared/to_s.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/method/shared/to_s.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/method/shared/to_s.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,12 +8,12 @@
   end
 
   it "returns a String" do
-    @m.send(@method).class.should == String
+    @m.send(@method).should be_kind_of(String)
   end
   
   it "returns a String for methods defined with attr_accessor" do
     m = MethodSpecs::Methods.new.method :attr
-    m.send(@method).class.should == String
+    m.send(@method).should be_kind_of(String)
   end
 
   it "returns a String containing 'Method'" do

Modified: MacRuby/trunk/spec/frozen/core/method/unbind_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/method/unbind_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/method/unbind_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -11,7 +11,7 @@
   end
 
   it "returns an UnboundMethod" do
-    @normal_um.class.should == UnboundMethod
+    @normal_um.should be_kind_of(UnboundMethod)
   end
 
   it "returns a String containing 'UnboundMethod'" do

Modified: MacRuby/trunk/spec/frozen/core/module/define_method_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/module/define_method_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/module/define_method_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -95,7 +95,7 @@
     lambda{o.other_inspect}.should raise_error(NoMethodError)
   end
 
-  it "should maintain the Proc's scope" do
+  it "maintains the Proc's scope" do
     class DefineMethodByProcClass
       in_scope = true
       method_proc = proc { in_scope }
@@ -104,6 +104,6 @@
     end
 
     o = DefineMethodByProcClass.new
-    o.proc_test.should == true
+    o.proc_test.should be_true
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/module/instance_method_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/module/instance_method_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/module/instance_method_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,17 +9,17 @@
   end
 
   it "returns an UnboundMethod corresponding to the given name" do
-    @parent_um.class.should == UnboundMethod
+    @parent_um.should be_kind_of(UnboundMethod)
     @parent_um.bind(ModuleSpecs::InstanceMeth.new).call.should == :foo
   end
 
   it "returns an UnboundMethod corresponding to the given name from a superclass" do
-    @child_um.class.should == UnboundMethod
+    @child_um.should be_kind_of(UnboundMethod)
     @child_um.bind(ModuleSpecs::InstanceMethChild.new).call.should == :foo
   end
 
   it "returns an UnboundMethod corresponding to the given name from an included Module" do
-    @mod_um.class.should == UnboundMethod
+    @mod_um.should be_kind_of(UnboundMethod)
     @mod_um.bind(ModuleSpecs::InstanceMethChild.new).call.should == :bar
   end
 

Modified: MacRuby/trunk/spec/frozen/core/module/private_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/module/private_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/module/private_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,7 @@
 require File.dirname(__FILE__) + '/fixtures/classes'
 
 describe "Module#private" do
-  it "should make the target method uncallable from other types" do
+  it "makes the target method uncallable from other types" do
     obj = Object.new
     class << obj
       def foo; true; end

Modified: MacRuby/trunk/spec/frozen/core/object/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/object/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/object/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,15 @@
 
 describe "Object.new" do
   it "creates a new Object" do
-    Object.new.class.should == Object
+    Object.new.should be_kind_of(Object)
   end
+
+  ruby_version_is "1.9.2" do # Ref: [redmine:2451]
+    it "accepts any number of arguments" do
+      lambda {
+        Object.new("This", "makes it easier", "to call super", "from other constructors")
+      }.should_not raise_error
+    end
+  end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/objectspace/garbage_collect_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/objectspace/garbage_collect_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/objectspace/garbage_collect_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1 +1,22 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe "ObjectSpace.garbage_collect" do
+
+  it "can be invoked without any exceptions" do
+    lambda { ObjectSpace.garbage_collect }.should_not raise_error
+  end
+
+  it "doesn't accept any arguments" do
+    lambda { ObjectSpace.garbage_collect(1) }.should raise_error(ArgumentError)
+  end
+
+  it "ignores the supplied block" do
+    lambda { ObjectSpace.garbage_collect {} }.should_not raise_error
+  end
+
+  it "always returns nil" do
+    ObjectSpace.garbage_collect.should == nil
+    ObjectSpace.garbage_collect.should == nil
+  end
+
+end

Modified: MacRuby/trunk/spec/frozen/core/proc/binding_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/binding_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/proc/binding_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 describe "Proc#binding" do
   it "returns a Binding instance" do
     [Proc.new{}, lambda {}, proc {}].each { |p|
-      p.binding.class.should == Binding
+      p.binding.should be_kind_of(Binding)
     }
   end
 

Modified: MacRuby/trunk/spec/frozen/core/proc/call_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/call_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/proc/call_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,8 +1,14 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/shared/call'
 
+language_version __FILE__, "call"
+
 describe "Proc#call" do
   it_behaves_like :proc_call, :call
+
+  ruby_version_is "1.8.7" do
+    it_behaves_like :proc_call_block_args, :call
+  end
 end
 
 describe "Proc#call on a Proc created with Proc.new" do

Modified: MacRuby/trunk/spec/frozen/core/proc/case_compare_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/case_compare_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/proc/case_compare_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,9 +1,12 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/shared/call'
 
-ruby_version_is "1.9" do
+language_version __FILE__, "call"
+
+ruby_version_is "1.8.8" do
   describe "Proc#===" do
     it_behaves_like :proc_call, :===
+    it_behaves_like :proc_call_block_args, :===
   end
 
   describe "Proc#=== on a Proc created with Proc.new" do

Modified: MacRuby/trunk/spec/frozen/core/proc/curry_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/curry_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/proc/curry_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -44,10 +44,9 @@
     end
 
     it "can be passed superfluous arguments if created from a proc" do
-      lambda { @proc_add.curry[1,2,3,4].should == 6 }.should_not 
-        raise_error(ArgumentError)
-      lambda { @proc_add.curry[1,2].curry[3,4,5,6].should == 6 }.should_not 
-        raise_error(ArgumentError)
+      @proc_add.curry[1,2,3,4].should == 6
+
+      @proc_add.curry[1,2].curry[3,4,5,6].should == 6
     end
 
     it "raises an ArgumentError if passed superfluous arguments when created from a lambda" do

Modified: MacRuby/trunk/spec/frozen/core/proc/element_reference_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/element_reference_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/proc/element_reference_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,8 +1,14 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/shared/call'
 
+language_version __FILE__, "call"
+
 describe "Proc#[]" do
   it_behaves_like :proc_call, :[]
+
+  ruby_version_is "1.8.7" do
+    it_behaves_like :proc_call_block_args, :[]
+  end
 end
 
 describe "Proc#call on a Proc created with Proc.new" do

Modified: MacRuby/trunk/spec/frozen/core/proc/shared/call.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/shared/call.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/proc/shared/call.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -19,36 +19,30 @@
     proc { |_, *args| args }.send(@method, 1, 2, 3).should == [2, 3]
   end
 
-  it "is being able to receive block arguments" do
-    Proc.new {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2
-    lambda {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2
-    proc {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2
-  end
-  
   ruby_version_is ""..."1.9" do
     it "sets self's single parameter to an Array of all given values" do
       [Proc.new { |x| [x] }, lambda { |x| [x] }, proc { |x| [x] }].each do |p|
         a = p.send(@method)
-        a.class.should == Array
+        a.should be_kind_of(Array)
         a.should == [nil]
         
         a = p.send(@method, 1)
-        a.class.should == Array
+        a.should be_kind_of(Array)
         a.should == [1]
         
         a = p.send(@method, 1, 2)
-        a.class.should == Array
+        a.should be_kind_of(Array)
         a.should == [[1, 2]]
         
         a = p.send(@method, 1, 2, 3)
-        a.class.should == Array
+        a.should be_kind_of(Array)
         a.should == [[1, 2, 3]]
       end
     end
   end
-
 end
 
+
 describe :proc_call_on_proc_new, :shared => true do
   it "replaces missing arguments with nil" do
     Proc.new { |a, b| [a, b] }.send(@method).should == [nil, nil]
@@ -107,19 +101,23 @@
     end
 
     it "raises an ArgumentError on excess arguments when self is a lambda" do
-      lambda { lambda {|x| x}.send(@method, 1, 2) }.should 
-        raise_error(ArgumentError)
+      lambda {
+        lambda {|x| x}.send(@method, 1, 2)
+      }.should raise_error(ArgumentError)
       
-      lambda { lambda {|x| x}.send(@method, 1, 2, 3) }.should
-        raise_error(ArgumentError)
+      lambda {
+        lambda {|x| x}.send(@method, 1, 2, 3)
+      }.should raise_error(ArgumentError)
     end
 
     it "raises an ArgumentError on missing arguments when self is a lambda" do
-      lambda { lambda {|x| x}.send(@method) }.should 
-        raise_error(ArgumentError)
+      lambda {
+        lambda {|x| x}.send(@method)
+      }.should raise_error(ArgumentError)
       
-      lambda { lambda {|x,y| [x,y]}.send(@method, 1) }.should
-        raise_error(ArgumentError)
+      lambda {
+        lambda {|x,y| [x,y]}.send(@method, 1)
+      }.should raise_error(ArgumentError)
     end
 
     it "treats a single Array argument as a single argument when self is a lambda" do

Added: MacRuby/trunk/spec/frozen/core/proc/shared/call_arguments.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/shared/call_arguments.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/proc/shared/call_arguments.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,7 @@
+describe :proc_call_block_args, :shared => true do
+  it "can receive block arguments" do
+    Proc.new {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2
+    lambda {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2
+    proc {|&b| b.send(@method)}.send(@method) {1 + 1}.should == 2
+  end
+end

Added: MacRuby/trunk/spec/frozen/core/proc/versions/call_1.8.7.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/versions/call_1.8.7.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/proc/versions/call_1.8.7.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1 @@
+require File.dirname(__FILE__) + '/../shared/call_arguments'

Added: MacRuby/trunk/spec/frozen/core/proc/versions/call_1.9.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/versions/call_1.9.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/proc/versions/call_1.9.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1 @@
+require File.dirname(__FILE__) + '/../shared/call_arguments'

Modified: MacRuby/trunk/spec/frozen/core/proc/yield_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/yield_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/proc/yield_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,9 +1,12 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/shared/call'
 
+language_version __FILE__, "call"
+
 ruby_version_is "1.9" do
   describe "Proc#yield" do
     it_behaves_like :proc_call, :yield
+    it_behaves_like :proc_call_block_args, :yield
   end
 
   describe "Proc#yield on a Proc created with Proc.new" do

Modified: MacRuby/trunk/spec/frozen/core/process/abort_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/process/abort_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/process/abort_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,15 +2,22 @@
 
 # TODO: share with Kernel.abort, abort.
 describe "Process.abort" do
+  before :each do
+    @name = tmp("process_abort.txt")
+  end
+
+  after :each do
+    rm_r @name
+  end
+
   platform_is_not :windows do
     it "terminates execution immediately" do
-      @file = '/tmp/i_exist'
-      File.delete(@file) if File.exist?(@file)
-      pid = Process.fork {
+      Process.fork do
         Process.abort
-        File.open(@file,'w'){|f| f.write 'rubinius'}
-      }
-      File.exist?(@file).should == false
+        touch(@name) { |f| f.write 'rubinius' }
+      end
+
+      File.exists?(@name).should == false
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/process/detach_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/process/detach_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/process/detach_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,7 +8,7 @@
 
     it "returns a thread" do
       p1 = Process.fork { Process.exit! }
-      Process.detach(p1).class.should == Thread
+      Process.detach(p1).should be_kind_of(Thread)
     end
 
     platform_is_not :openbsd do

Modified: MacRuby/trunk/spec/frozen/core/process/euid_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/process/euid_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/process/euid_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,7 @@
 
 describe "Process.euid" do
   it "returns the effective user ID for this process" do
-    Process.euid.class.should == Fixnum
+    Process.euid.should be_kind_of(Fixnum)
   end
 
   it "also goes by Process::UID.eid" do

Modified: MacRuby/trunk/spec/frozen/core/process/fork_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/process/fork_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/process/fork_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -14,11 +14,11 @@
   not_supported_on :jruby, :windows do
     before :each do
       @file = tmp('i_exist')
-      File.delete(@file) if File.exist?(@file)
+      rm_r @file
     end
 
     after :each do
-      File.delete(@file) if File.exist?(@file)
+      rm_r @file
     end
 
     it "is implemented" do
@@ -28,7 +28,7 @@
     it "return nil for the child process" do
       child_id = Process.fork
       if child_id == nil
-        File.open(@file,'w'){|f| f.write 'rubinius'}
+        touch(@file) { |f| f.write 'rubinius' }
         Process.exit!
       else
         Process.waitpid(child_id)
@@ -38,7 +38,7 @@
 
     it "runs a block in a child process" do
       pid = Process.fork {
-        File.open(@file,'w'){|f| f.write 'rubinius'}
+        touch(@file) { |f| f.write 'rubinius' }
         Process.exit!
       }
       Process.waitpid(pid)

Modified: MacRuby/trunk/spec/frozen/core/process/getpriority_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/process/getpriority_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/process/getpriority_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,15 +10,15 @@
     end
 
     it "gets the scheduling priority for a specified process" do
-      Process.getpriority(Process::PRIO_PROCESS, 0).class.should == Fixnum
+      Process.getpriority(Process::PRIO_PROCESS, 0).should be_kind_of(Fixnum)
     end
 
     it "gets the scheduling priority for a specified process group" do
-      Process.getpriority(Process::PRIO_PGRP, 0).class.should == Fixnum
+      Process.getpriority(Process::PRIO_PGRP, 0).should be_kind_of(Fixnum)
     end
 
     it "gets the scheduling priority for a specified user" do
-      Process.getpriority(Process::PRIO_USER, 0).class.should == Fixnum
+      Process.getpriority(Process::PRIO_USER, 0).should be_kind_of(Fixnum)
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/process/maxgroups_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/process/maxgroups_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/process/maxgroups_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,7 @@
 
 describe "Process.maxgroups" do
   it "returns the maximum number of gids allowed in the supplemental group access list" do
-    Process.maxgroups.class.should == Fixnum
+    Process.maxgroups.should be_kind_of(Fixnum)
   end
 
   it "sets the maximum number of gids allowed in the supplemental group access list" do

Modified: MacRuby/trunk/spec/frozen/core/process/pid_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/process/pid_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/process/pid_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 describe "Process.pid" do
   it "returns the process id of this process" do
     pid = Process.pid
-    pid.class.should == Fixnum
+    pid.should be_kind_of(Fixnum)
     Process.pid.should == pid 
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/process/wait_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/process/wait_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/process/wait_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -18,7 +18,7 @@
     it "sets $? to a Process::Status" do
       pid = Process.fork { Process.exit! }
       Process.wait
-      $?.class.should == Process::Status
+      $?.should be_kind_of(Process::Status)
       $?.pid.should == pid
     end
 
@@ -67,8 +67,16 @@
 
     # This spec is probably system-dependent.
     it "doesn't block if no child is available when WNOHANG is used" do
-      pid = Process.fork { 10.times { sleep(1) }; Process.exit! }
+      pid = Process.fork do
+        Signal.trap("TERM") { Process.exit! }
+        10.times { sleep(1) }
+        Process.exit!
+      end
       Process.wait(pid, Process::WNOHANG).should == nil
+
+      # sleep slightly to allow the child to at least start up and
+      # setup it's TERM handler
+      sleep 0.25
       Process.kill("TERM", pid)
       Process.wait.should == pid
     end

Modified: MacRuby/trunk/spec/frozen/core/process/waitall_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/process/waitall_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/process/waitall_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -31,14 +31,14 @@
       pids << Process.fork { Process.exit! 1 }
       pids << Process.fork { Process.exit! 0 }
       a = Process.waitall
-      a.class.should == Array
+      a.should be_kind_of(Array)
       a.size.should == 3
       pids.each { |pid|
         pid_status = a.assoc(pid)
-        pid_status.class.should == Array
+        pid_status.should be_kind_of(Array)
         pid_status.size.should == 2
         pid_status.first.should == pid
-        pid_status.last.class.should == Process::Status
+        pid_status.last.should be_kind_of(Process::Status)
       }
     end
   end

Modified: MacRuby/trunk/spec/frozen/core/range/cover_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/range/cover_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/range/cover_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,6 +1,6 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 
-ruby_version_is "1.9" do
+ruby_version_is "1.8.8" do
   describe "Range#cover?" do
 
     it "raises an ArgumentError without exactly one argument" do

Modified: MacRuby/trunk/spec/frozen/core/range/step_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/range/step_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/range/step_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -28,7 +28,7 @@
   it "raises a TypeError if the first element does not respond to #succ" do
     b = mock('x')
     (a = mock('1')).should_receive(:<=>).with(b).and_return(1)
-    a.should_not respond_to?(:succ)
+    a.should_not respond_to(:succ)
         
     lambda { (a..b).step(1) { |i| i } }.should raise_error(TypeError)
   end

Modified: MacRuby/trunk/spec/frozen/core/regexp/match_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/regexp/match_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/regexp/match_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,6 +7,11 @@
 
 describe "Regexp#match" do
   it_behaves_like(:regexp_match, :match)
+
+  it "should coerce Exceptions into strings" do
+    f = Exception.new("foo")
+    /foo/.match(f)[0].should == "foo"
+  end
 end
 
 describe "Regexp#~" do
@@ -24,6 +29,15 @@
 
 describe "Regexp#match on a successful match" do
   it "returns a MatchData object" do
-    (/(.)(.)(.)/.match "abc").class.should == MatchData
+    /(.)(.)(.)/.match("abc").should be_kind_of(MatchData)
   end
+
+  it "resets $~ if passed nil" do
+    # set $~
+    /./.match("a")
+    $~.should be_kind_of(MatchData)
+
+    /1/.match(nil)
+    $~.should be_nil
+  end
 end

Modified: MacRuby/trunk/spec/frozen/core/regexp/options_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/regexp/options_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/regexp/options_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,8 +2,8 @@
 
 describe "Regexp#options" do
   it "returns a Fixnum bitvector of regexp options for the Regexp object" do
-    /cat/.options.class.should == Fixnum
-    /cat/ix.options.class.should == Fixnum
+    /cat/.options.should be_kind_of(Fixnum)
+    /cat/ix.options.should be_kind_of(Fixnum)
   end
 
   it "allows checking for presence of a certain option with bitwise &" do

Modified: MacRuby/trunk/spec/frozen/core/regexp/shared/new.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/regexp/shared/new.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/regexp/shared/new.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -15,10 +15,10 @@
 
     class RegexpSpecsSubclassTwo < Regexp; end
 
-    RegexpSpecsSubclass.send(@method, "hi").class.should == RegexpSpecsSubclass
+    RegexpSpecsSubclass.send(@method, "hi").should be_kind_of(RegexpSpecsSubclass)
     RegexpSpecsSubclass.send(@method, "hi").args.first.should == "hi"
 
-    RegexpSpecsSubclassTwo.send(@method, "hi").class.should == RegexpSpecsSubclassTwo
+    RegexpSpecsSubclassTwo.send(@method, "hi").should be_kind_of(RegexpSpecsSubclassTwo)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/string/capitalize_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/capitalize_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/capitalize_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -24,8 +24,8 @@
   end
 
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("hello").capitalize.class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("Hello").capitalize.class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("hello").capitalize.should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("Hello").capitalize.should be_kind_of(StringSpecs::MyString)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/string/center_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/center_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/center_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -89,11 +89,11 @@
   end
   
   it "returns subclass instances when called on subclasses" do
-    StringSpecs::MyString.new("").center(10).class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").center(10).class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").center(10, StringSpecs::MyString.new("x")).class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("").center(10).should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").center(10).should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").center(10, StringSpecs::MyString.new("x")).should be_kind_of(StringSpecs::MyString)
     
-    "".center(10, StringSpecs::MyString.new("x")).class.should == String
-    "foo".center(10, StringSpecs::MyString.new("x")).class.should == String
+    "".center(10, StringSpecs::MyString.new("x")).should be_kind_of(String)
+    "foo".center(10, StringSpecs::MyString.new("x")).should be_kind_of(String)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/string/chomp_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/chomp_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/chomp_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -84,9 +84,9 @@
   end
   
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("hello\n").chomp.class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("hello").chomp.class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("").chomp.class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("hello\n").chomp.should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("hello").chomp.should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("").chomp.should be_kind_of(StringSpecs::MyString)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/string/chop_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/chop_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/chop_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -56,9 +56,9 @@
   end
   
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("hello\n").chop.class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("hello").chop.class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("").chop.class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("hello\n").chop.should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("hello").chop.should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("").chop.should be_kind_of(StringSpecs::MyString)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/string/count_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/count_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/count_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -59,10 +59,6 @@
     s.count("(--").should == s.count("()*+,-")
     s.count("A-a").should == s.count("A-Z[\\]^_`a")
     
-    # empty sequences (end before start)
-    s.count("h-e").should == 0
-    s.count("^h-e").should == s.size
-
     # negated sequences
     s.count("^e-h").should == s.size - s.count("e-h")
     s.count("^^-^").should == s.size - s.count("^")
@@ -76,6 +72,25 @@
     "abcde".count("^ac-e").should == 1
   end
 
+  ruby_version_is ""..."1.9" do
+    it "regards invaid sequences as empty" do
+      s = "hel-[()]-lo012^"
+
+      # empty sequences (end before start)
+      s.count("h-e").should == 0
+      s.count("^h-e").should == s.size
+    end
+  end
+
+  ruby_version_is "1.9" do
+    it "raises if the given sequences are invaid" do
+      s = "hel-[()]-lo012^"
+
+      lambda { s.count("h-e") }.should raise_error(ArgumentError)
+      lambda { s.count("^h-e") }.should raise_error(ArgumentError)
+    end
+  end
+
   it "calls #to_str to convert each set arg to a String" do
     other_string = mock('lo')
     other_string.should_receive(:to_str).and_return("lo")

Modified: MacRuby/trunk/spec/frozen/core/string/crypt_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/crypt_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/crypt_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -99,8 +99,8 @@
   end
 
   it "doesn't return subclass instances" do
-    StringSpecs::MyString.new("hello").crypt("aa").class.should == String
-    "hello".crypt(StringSpecs::MyString.new("aa")).class.should == String
-    StringSpecs::MyString.new("hello").crypt(StringSpecs::MyString.new("aa")).class.should == String
+    StringSpecs::MyString.new("hello").crypt("aa").should be_kind_of(String)
+    "hello".crypt(StringSpecs::MyString.new("aa")).should be_kind_of(String)
+    StringSpecs::MyString.new("hello").crypt(StringSpecs::MyString.new("aa")).should be_kind_of(String)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/string/delete_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/delete_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/delete_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -34,8 +34,6 @@
     "hel-lo".delete("---").should == "hello"
     "hel-012".delete("--2").should == "hel"
     "hel-()".delete("(--").should == "hel"
-    "hello".delete("h-e").should == "hello"
-    "hello".delete("^h-e").should == ""
     "hello".delete("^e-h").should == "he"
     "hello^".delete("^^-^").should == "^"
     "hel--lo".delete("^---").should == "--"
@@ -50,6 +48,20 @@
     "ABCabc[]".delete("A-a").should == "bc"
   end
 
+  ruby_version_is ""..."1.9" do
+    it "regards invalid ranges as nothing" do
+      "hello".delete("h-e").should == "hello"
+      "hello".delete("^h-e").should == ""
+    end
+  end
+
+  ruby_version_is "1.9" do
+    it "raises if the given ranges are invalid" do
+      lambda { "hello".delete("h-e") }.should raise_error(ArgumentError)
+      lambda { "hello".delete("^h-e") }.should raise_error(ArgumentError)
+    end
+  end
+
   it "taints result when self is tainted" do
     "hello".taint.delete("e").tainted?.should == true
     "hello".taint.delete("a-z").tainted?.should == true
@@ -74,7 +86,7 @@
   end
 
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("oh no!!!").delete("!").class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("oh no!!!").delete("!").should be_kind_of(StringSpecs::MyString)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/string/downcase_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/downcase_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/downcase_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -27,7 +27,7 @@
   end
 
   it "returns a subclass instance for subclasses" do
-    StringSpecs::MyString.new("FOObar").downcase.class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("FOObar").downcase.should be_kind_of(StringSpecs::MyString)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/string/dump_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/dump_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/dump_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -49,6 +49,6 @@
   end
   
   it "returns a subclass instance for subclasses" do
-    StringSpecs::MyString.new("hi!").dump.class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("hi!").dump.should be_kind_of(StringSpecs::MyString)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/string/each_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/each_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/each_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,7 +8,9 @@
   end
 
   ruby_version_is '1.9' do
-    lambda { "gone in 1.9".each }.should raise_error(NoMethodError)
+    it "raises a NoMethodError" do
+      lambda { "gone in 1.9".each }.should raise_error(NoMethodError)
+    end
   end
 
 end

Modified: MacRuby/trunk/spec/frozen/core/string/encode_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/encode_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/encode_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,14 +2,52 @@
 require File.dirname(__FILE__) + '/shared/encode'
 
 ruby_version_is "1.9" do
+  describe "String#encode with no arguments" do
+    before(:each) do
+      @original_encoding = Encoding.default_internal
+    end
+
+    after(:each) do
+      Encoding.default_internal = @original_encoding
+    end
+
+    it "returns a copy of self" do
+      str = "strung"
+      copy = str.encode
+      copy.object_id.should_not == str.object_id
+
+      # make sure that there is no sharing on byte level
+      copy[0] = 'X'
+      str.should == "strung"
+    end
+
+    it "returns a copy of self transcoded to Encoding.default_internal" do
+      Encoding.default_internal = Encoding::UTF_8
+      str = "strung"
+      copy = str.encode
+      copy.object_id.should_not == str.object_id
+
+      # make sure that there is no sharing on byte level
+      copy[0] = 'X'
+      str.should == "strung"
+
+      copy.encoding.should == Encoding::UTF_8
+    end
+  end
+
   describe "String#encode" do
     it_behaves_like :encode_string, :encode
-    
+
     it "returns a copy of self when called with only a target encoding" do
       str = "strung".force_encoding(Encoding::UTF_8)
       copy = str.encode('ascii')
       str.encoding.should == Encoding::UTF_8
       copy.encoding.should == Encoding::US_ASCII
+
+      str = "caf\xe9".force_encoding("iso-8859-1")
+      copy = str.encode("utf-8")
+      copy.encoding.should == Encoding::UTF_8
+      copy.should == "caf\u00E9".force_encoding(Encoding::UTF_8)
     end
 
     it "returns self when called with only a target encoding" do

Modified: MacRuby/trunk/spec/frozen/core/string/force_encoding_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/force_encoding_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/force_encoding_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,20 +2,25 @@
 ruby_version_is "1.9" do
   describe "String#force_encoding" do
     it "requires exactly one argument" do
-      lambda { "glark".force_encoding }.should 
-        raise_error(ArgumentError)
-      lambda { "glark".force_encoding('h','d') }.should 
-        raise_error(ArgumentError)
+      lambda {
+        "glark".force_encoding
+      }.should  raise_error(ArgumentError)
+
+      lambda {
+        "glark".force_encoding('h','d')
+      }.should raise_error(ArgumentError)
     end
 
     it "accepts the encoding name as a String" do
-      lambda { str.force_encoding('shift_jis') }.should_not
-        raise_error(ArgumentError)
+      lambda {
+        str.force_encoding('shift_jis')
+      }.should_not raise_error(ArgumentError)
     end
 
     it "accepts the encoding name as an Encoding object" do
-      lambda { str.force_encoding(Encoding::SHIFT_JIS) }.should_not
-        raise_error(ArgumentError)
+      lambda {
+        str.force_encoding(Encoding::SHIFT_JIS)
+      }.should_not raise_error(ArgumentError)
     end
 
     it "tags the String with the given encoding" do
@@ -32,18 +37,19 @@
     end
 
     it "does not care if self would be invalid in given encoding" do
-     str = "\u{9765}"
-     str.force_encoding('euc-jp')
-     str.encoding.should == Encoding::EUC_JP
-     str.valid_encoding?.should be_false
+      str = "\u{9765}"
+      str.force_encoding('euc-jp')
+      str.encoding.should == Encoding::EUC_JP
+      str.valid_encoding?.should be_false
     end
 
     it "does not care if self is already tagged with the given encoding" do
-     str = "\u{9765}"
-     str.encoding.should == Encoding::UTF_8
-     lambda { str.force_encoding('utf-8') }.should_not 
-       raise_error(ArgumentError)
+      str = "\u{9765}"
       str.encoding.should == Encoding::UTF_8
+      lambda {
+        str.force_encoding('utf-8')
+      }.should_not raise_error(ArgumentError)
+      str.encoding.should == Encoding::UTF_8
     end
 
     it "does not transcode self" do

Modified: MacRuby/trunk/spec/frozen/core/string/getbyte_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/getbyte_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/getbyte_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,7 +1,7 @@
 # coding: utf-8
 require File.dirname(__FILE__) + '/../../spec_helper'
 
-ruby_version_is "1.9" do
+ruby_version_is "1.8.8" do
   describe "String#getbyte" do
     it "returns an Integer if given a valid index" do
       "a".getbyte(0).should be_kind_of(Integer)

Modified: MacRuby/trunk/spec/frozen/core/string/gsub_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/gsub_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/gsub_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -206,10 +206,10 @@
   end
   
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("").gsub(//, "").class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("").gsub(/foo/, "").class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").gsub(/foo/, "").class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").gsub("foo", "").class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("").gsub(//, "").should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("").gsub(/foo/, "").should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").gsub(/foo/, "").should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").gsub("foo", "").should be_kind_of(StringSpecs::MyString)
   end
 
   # Note: $~ cannot be tested because mspec messes with it

Modified: MacRuby/trunk/spec/frozen/core/string/hex_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/hex_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/hex_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -19,6 +19,12 @@
       "a____b".hex.should == 0xab
       "a___f".hex.should == 0xaf
     end
+
+    it "accepts a sequence of underscores in front of string as part of a number" do
+      "_a".hex.should == 0xa
+      "___b".hex.should == 0xb
+      "___0xc".hex.should == 0xc
+    end
   end
   
   ruby_version_is "1.8.7" do
@@ -50,4 +56,12 @@
     "wombat".hex.should == 0
     "0x0x42".hex.should == 0
   end
+
+  ruby_version_is "1.9" do
+    it "returns 0 if sequence begins with underscore" do
+      "_a".hex.should == 0
+      "___b".hex.should == 0
+      "___0xc".hex.should == 0
+    end
+  end
 end

Modified: MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -15,7 +15,7 @@
     end
 
     it "returns a string with nonprinting, non-ASCII characters replaced by \\u notation for Unicode strings" do
-      (127..150).map{|o| o.chr('utf-8')}.to_a.join('').inspect.should == "\"\\u007F\\u0080\\u0081\\u0082\\u0083\\u0084\\u0085\\u0086\\u0087\\u0088\\u0089\\u008A\\u008B\\u008C\\u008D\\u008E\\u008F\\u0090\\u0091\\u0092\\u0093\\u0094\\u0095\\u0096\""
+      (127..150).map{|o| o.chr('utf-8')}.to_a.join('').inspect.should == "\u007F\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F\u0090\u0091\u0092\u0093\u0094\u0095\u0096".inspect
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/string/ljust_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/ljust_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/ljust_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -72,11 +72,11 @@
   end
   
   it "returns subclass instances when called on subclasses" do
-    StringSpecs::MyString.new("").ljust(10).class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").ljust(10).class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").ljust(10, StringSpecs::MyString.new("x")).class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("").ljust(10).should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").ljust(10).should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").ljust(10, StringSpecs::MyString.new("x")).should be_kind_of(StringSpecs::MyString)
     
-    "".ljust(10, StringSpecs::MyString.new("x")).class.should == String
-    "foo".ljust(10, StringSpecs::MyString.new("x")).class.should == String
+    "".ljust(10, StringSpecs::MyString.new("x")).should be_kind_of(String)
+    "foo".ljust(10, StringSpecs::MyString.new("x")).should be_kind_of(String)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/string/modulo_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/modulo_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/modulo_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -191,7 +191,7 @@
       "%f", "%g", "%G", "%i", "%o", "%p",
       "%s", "%u", "%x", "%X"
     ].each do |format|
-      (StringSpecs::MyString.new(format) % universal).class.should == String
+      (StringSpecs::MyString.new(format) % universal).should be_kind_of(String)
     end
   end
 
@@ -336,6 +336,30 @@
       ("%04#{f}" % 10).should == "0010"
       ("%*#{f}" % [10, 4]).should == "         4"
     end
+
+    it "supports negative integers using #{format}" do
+      ("%#{f}" % -5).should == "-5"
+      ("%3#{f}" % -5).should == " -5"
+      ("%03#{f}" % -5).should == "-05"
+      ("%+03#{f}" % -5).should == "-05"
+      ("%-3#{f}" % -5).should == "-5 "
+    end
+
+    # The following version inconsistency in negative-integers is explained in
+    # http://ujihisa.blogspot.com/2009/12/string-differs-between-ruby-18-and-19.html
+    ruby_version_is ""..."1.9" do
+      it "supports negative integers using #{format}, giving priority to `0`" do
+        ("%-03#{f}" % -5).should == "-05"
+        ("%+-03#{f}" % -5).should == "-05"
+      end
+    end
+
+    ruby_version_is "1.9" do
+      it "supports negative integers using #{format}, giving priority to `-`" do
+        ("%-03#{f}" % -5).should == "-5 "
+        ("%+-03#{f}" % -5).should == "-5 "
+      end
+    end
   end
 
   it "supports float formats using %e" do
@@ -417,7 +441,7 @@
         ("%E" % (-0e0/0)).should == "NAN"
       end
     end
-    
+
     # TODO: If http://redmine.ruby-lang.org/issues/show/1566 is confirmed, we
     # can guard the behaviour of capitalising Inf and NaN as a bug, and
     # removed the compliance guards.
@@ -438,7 +462,7 @@
         end
       end
     end
-    
+
     ruby_version_is "1.9" do
       it "pads with spaces for %E with Inf, -Inf, and NaN" do
         ("%010E" % -1e1020).should == "      -Inf"
@@ -556,13 +580,15 @@
   end
 
   it "supports string formats using %s" do
+    ("%s" % "hello").should == "hello"
+    ("%s" % "").should == ""
     ("%s" % 10).should == "10"
     ("%1$s" % [10, 8]).should == "10"
     ("%-5s" % 10).should == "10   "
     ("%*s" % [10, 9]).should == "         9"
   end
 
-  it "calls to_s on arguments for %s format" do
+  it "calls to_s on non-String arguments for %s format" do
     obj = mock('obj')
     def obj.to_s() "obj" end
 
@@ -653,7 +679,7 @@
       ("%d" % -(2 ** 64 + 5)).should == "-18446744073709551621"
     end
   end
-  
+
   it "supports hex formats using %x for positive numbers" do
     ("%x" % 10).should == "a"
     ("% x" % 10).should == " a"
@@ -786,7 +812,7 @@
       obj.should_receive(:to_int).and_return(6)
       (format % obj).should == (format % 6)
     end
-    
+
     # 1.9 raises a TypeError for Kernel.Integer(nil), so we version guard this
     # case
     ruby_version_is ""..."1.9" do
@@ -795,7 +821,7 @@
           format = "%" + f
           (format % nil).should == (format % Kernel.Integer(nil))
         end
-      end   
+      end
     end
 
     it "doesn't taint the result for #{format} when argument is tainted" do

Modified: MacRuby/trunk/spec/frozen/core/string/multiply_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/multiply_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/multiply_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -28,9 +28,9 @@
   end
   
   it "returns subclass instances" do
-    (StringSpecs::MyString.new("cool") * 0).class.should == StringSpecs::MyString
-    (StringSpecs::MyString.new("cool") * 1).class.should == StringSpecs::MyString
-    (StringSpecs::MyString.new("cool") * 2).class.should == StringSpecs::MyString
+    (StringSpecs::MyString.new("cool") * 0).should be_kind_of(StringSpecs::MyString)
+    (StringSpecs::MyString.new("cool") * 1).should be_kind_of(StringSpecs::MyString)
+    (StringSpecs::MyString.new("cool") * 2).should be_kind_of(StringSpecs::MyString)
   end
   
   it "always taints the result when self is tainted" do

Modified: MacRuby/trunk/spec/frozen/core/string/plus_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/plus_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/plus_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -22,13 +22,13 @@
   end
 
   it "doesn't return subclass instances" do
-    (StringSpecs::MyString.new("hello") + "").class.should == String
-    (StringSpecs::MyString.new("hello") + "foo").class.should == String
-    (StringSpecs::MyString.new("hello") + StringSpecs::MyString.new("foo")).class.should == String
-    (StringSpecs::MyString.new("hello") + StringSpecs::MyString.new("")).class.should == String
-    (StringSpecs::MyString.new("") + StringSpecs::MyString.new("")).class.should == String
-    ("hello" + StringSpecs::MyString.new("foo")).class.should == String
-    ("hello" + StringSpecs::MyString.new("")).class.should == String
+    (StringSpecs::MyString.new("hello") + "").should be_kind_of(String)
+    (StringSpecs::MyString.new("hello") + "foo").should be_kind_of(String)
+    (StringSpecs::MyString.new("hello") + StringSpecs::MyString.new("foo")).should be_kind_of(String)
+    (StringSpecs::MyString.new("hello") + StringSpecs::MyString.new("")).should be_kind_of(String)
+    (StringSpecs::MyString.new("") + StringSpecs::MyString.new("")).should be_kind_of(String)
+    ("hello" + StringSpecs::MyString.new("foo")).should be_kind_of(String)
+    ("hello" + StringSpecs::MyString.new("")).should be_kind_of(String)
   end
 
   it "taints the result when self or other is tainted" do

Modified: MacRuby/trunk/spec/frozen/core/string/rjust_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/rjust_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/rjust_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -72,11 +72,11 @@
   end
   
   it "returns subclass instances when called on subclasses" do
-    StringSpecs::MyString.new("").rjust(10).class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").rjust(10).class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").rjust(10, StringSpecs::MyString.new("x")).class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("").rjust(10).should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").rjust(10).should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").rjust(10, StringSpecs::MyString.new("x")).should be_kind_of(StringSpecs::MyString)
     
-    "".rjust(10, StringSpecs::MyString.new("x")).class.should == String
-    "foo".rjust(10, StringSpecs::MyString.new("x")).class.should == String
+    "".rjust(10, StringSpecs::MyString.new("x")).should be_kind_of(String)
+    "foo".rjust(10, StringSpecs::MyString.new("x")).should be_kind_of(String)
   end
 end

Modified: MacRuby/trunk/spec/frozen/core/string/setbyte_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/setbyte_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/setbyte_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,6 +1,6 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 
-ruby_version_is "1.9" do
+ruby_version_is "1.8.8" do
   describe "String#setbyte" do
     it "returns an Integer" do
       "a".setbyte(0,1).should be_kind_of(Integer)

Modified: MacRuby/trunk/spec/frozen/core/string/shared/slice.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/shared/slice.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/shared/slice.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -137,9 +137,9 @@
 
   it "returns subclass instances" do
     s = StringSpecs::MyString.new("hello")
-    s.send(@method, 0,0).class.should == StringSpecs::MyString
-    s.send(@method, 0,4).class.should == StringSpecs::MyString
-    s.send(@method, 1,4).class.should == StringSpecs::MyString
+    s.send(@method, 0,0).should be_kind_of(StringSpecs::MyString)
+    s.send(@method, 0,4).should be_kind_of(StringSpecs::MyString)
+    s.send(@method, 1,4).should be_kind_of(StringSpecs::MyString)
   end
 end
 
@@ -210,9 +210,9 @@
 
   it "returns subclass instances" do
     s = StringSpecs::MyString.new("hello")
-    s.send(@method, 0...0).class.should == StringSpecs::MyString
-    s.send(@method, 0..4).class.should == StringSpecs::MyString
-    s.send(@method, 1..4).class.should == StringSpecs::MyString
+    s.send(@method, 0...0).should be_kind_of(StringSpecs::MyString)
+    s.send(@method, 0..4).should be_kind_of(StringSpecs::MyString)
+    s.send(@method, 1..4).should be_kind_of(StringSpecs::MyString)
   end
 
   it "calls to_int on range arguments" do
@@ -266,8 +266,8 @@
 
   it "returns subclass instances" do
     s = StringSpecs::MyString.new("hello")
-    s.send(@method, //).class.should == StringSpecs::MyString
-    s.send(@method, /../).class.should == StringSpecs::MyString
+    s.send(@method, //).should be_kind_of(StringSpecs::MyString)
+    s.send(@method, /../).should be_kind_of(StringSpecs::MyString)
   end
 
   it "sets $~ to MatchData when there is a match and nil when there's none" do
@@ -346,8 +346,8 @@
 
   it "returns subclass instances" do
     s = StringSpecs::MyString.new("hello")
-    s.send(@method, /(.)(.)/, 0).class.should == StringSpecs::MyString
-    s.send(@method, /(.)(.)/, 1).class.should == StringSpecs::MyString
+    s.send(@method, /(.)(.)/, 0).should be_kind_of(StringSpecs::MyString)
+    s.send(@method, /(.)(.)/, 1).should be_kind_of(StringSpecs::MyString)
   end
 
   it "sets $~ to MatchData when there is a match and nil when there's none" do
@@ -403,7 +403,7 @@
     s = StringSpecs::MyString.new("el")
     r = "hello".send(@method, s)
     r.should == "el"
-    r.class.should == StringSpecs::MyString
+    r.should be_kind_of(StringSpecs::MyString)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/string/shared/succ.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/shared/succ.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/shared/succ.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -58,9 +58,9 @@
   end
 
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("").send(@method).class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("a").send(@method).class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("z").send(@method).class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("").send(@method).should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("a").send(@method).should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("z").send(@method).should be_kind_of(StringSpecs::MyString)
   end
 
   it "taints the result if self is tainted" do

Modified: MacRuby/trunk/spec/frozen/core/string/shared/to_s.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/shared/to_s.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/shared/to_s.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,7 +8,7 @@
     a = StringSpecs::MyString.new("a string")
     s = a.send(@method)
     s.should == "a string"
-    s.class.should == String
+    s.should be_kind_of(String)
   end
 
   it "taints the result when self is tainted" do

Modified: MacRuby/trunk/spec/frozen/core/string/shared/versions/slice_1.9.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/shared/versions/slice_1.9.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/shared/versions/slice_1.9.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -65,7 +65,7 @@
 
   it "returns subclass instances" do
     s = StringSpecs::MyString.new("hello")
-    s.send(@method, /(?<q>.)/, 'q').class.should == StringSpecs::MyString
+    s.send(@method, /(?<q>.)/, 'q').should be_kind_of(StringSpecs::MyString)
   end
 
   it "sets $~ to MatchData when there is a match and nil when there's none" do

Modified: MacRuby/trunk/spec/frozen/core/string/slice_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/slice_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/slice_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -148,8 +148,8 @@
 
   it "returns subclass instances" do
     s = StringSpecs::MyString.new("hello")
-    s.slice!(0, 0).class.should == StringSpecs::MyString
-    s.slice!(0, 4).class.should == StringSpecs::MyString
+    s.slice!(0, 0).should be_kind_of(StringSpecs::MyString)
+    s.slice!(0, 4).should be_kind_of(StringSpecs::MyString)
   end
 end
 
@@ -187,8 +187,8 @@
 
   it "returns subclass instances" do
     s = StringSpecs::MyString.new("hello")
-    s.slice!(0...0).class.should == StringSpecs::MyString
-    s.slice!(0..4).class.should == StringSpecs::MyString
+    s.slice!(0...0).should be_kind_of(StringSpecs::MyString)
+    s.slice!(0..4).should be_kind_of(StringSpecs::MyString)
   end
 
   it "calls to_int on range arguments" do
@@ -286,8 +286,8 @@
 
   it "returns subclass instances" do
     s = StringSpecs::MyString.new("hello")
-    s.slice!(//).class.should == StringSpecs::MyString
-    s.slice!(/../).class.should == StringSpecs::MyString
+    s.slice!(//).should be_kind_of(StringSpecs::MyString)
+    s.slice!(/../).should be_kind_of(StringSpecs::MyString)
   end
 
   # This currently fails, but passes in a pure Rubinius environment (without mspec)
@@ -373,8 +373,8 @@
 
   it "returns subclass instances" do
     s = StringSpecs::MyString.new("hello")
-    s.slice!(/(.)(.)/, 0).class.should == StringSpecs::MyString
-    s.slice!(/(.)(.)/, 1).class.should == StringSpecs::MyString
+    s.slice!(/(.)(.)/, 0).should be_kind_of(StringSpecs::MyString)
+    s.slice!(/(.)(.)/, 1).should be_kind_of(StringSpecs::MyString)
   end
 
   it "sets $~ to MatchData when there is a match and nil when there's none" do
@@ -457,7 +457,7 @@
     s = StringSpecs::MyString.new("el")
     r = "hello".slice!(s)
     r.should == "el"
-    r.class.should == StringSpecs::MyString
+    r.should be_kind_of(StringSpecs::MyString)
   end
 
   ruby_version_is ""..."1.9" do 

Modified: MacRuby/trunk/spec/frozen/core/string/split_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/split_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/split_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,7 +5,7 @@
   it "returns an array of substrings based on splitting on the given string" do
     "mellow yellow".split("ello").should == ["m", "w y", "w"]
   end
-  
+
   it "suppresses trailing empty fields when limit isn't given or 0" do
     "1,2,,3,4,,".split(',').should == ["1", "2", "", "3", "4"]
     "1,2,,3,4,,".split(',', 0).should == ["1", "2", "", "3", "4"]
@@ -38,24 +38,24 @@
     "xxx".split('x', 3).should == ["", "", "x"]
     "xxx".split('x', 4).should == ["", "", "", ""]
   end
-  
+
   it "doesn't suppress or limit fields when limit is negative" do
     "1,2,,3,4,,".split(',', -1).should == ["1", "2", "", "3", "4", "", ""]
     "1,2,,3,4,,".split(',', -5).should == ["1", "2", "", "3", "4", "", ""]
     "  a  b  c\nd  ".split("  ", -1).should == ["", "a", "b", "c\nd", ""]
     ",".split(",", -1).should == ["", ""]
   end
-  
+
   it "defaults to $; when string isn't given or nil" do
     begin
       old_fs = $;
-    
+
       [",", ":", "", "XY", nil].each do |fs|
         $; = fs
-        
+
         ["x,y,z,,,", "1:2:", "aXYbXYcXY", ""].each do |str|
           expected = str.split(fs || " ")
-          
+
           str.split(nil).should == expected
           str.split.should == expected
 
@@ -66,9 +66,9 @@
       end
     ensure
       $; = old_fs
-    end    
+    end
   end
-    
+
   it "ignores leading and continuous whitespace when string is a single space" do
     " now's  the time  ".split(' ').should == ["now's", "the", "time"]
     " now's  the time  ".split(' ', -1).should == ["now's", "the", "time", ""]
@@ -76,57 +76,57 @@
     "\t\n a\t\tb \n\r\r\nc\v\vd\v ".split(' ').should == ["a", "b", "c", "d"]
     "a\x00a b".split(' ').should == ["a\x00a", "b"]
   end
-  
+
   it "splits between characters when its argument is an empty string" do
     "hi!".split("").should == ["h", "i", "!"]
     "hi!".split("", -1).should == ["h", "i", "!", ""]
     "hi!".split("", 2).should == ["h", "i!"]
   end
-  
+
   it "tries converting its pattern argument to a string via to_str" do
     obj = mock('::')
     obj.should_receive(:to_str).and_return("::")
 
     "hello::world".split(obj).should == ["hello", "world"]
   end
-  
+
   it "tries converting limit to an integer via to_int" do
     obj = mock('2')
     obj.should_receive(:to_int).and_return(2)
 
     "1.2.3.4".split(".", obj).should == ["1", "2.3.4"]
   end
-  
+
   it "doesn't set $~" do
     $~ = nil
     "x.y.z".split(".")
     $~.should == nil
   end
-  
+
   it "returns subclass instances based on self" do
     ["", "x.y.z.", "  x  y  "].each do |str|
       ["", ".", " "].each do |pat|
         [-1, 0, 1, 2].each do |limit|
           StringSpecs::MyString.new(str).split(pat, limit).each do |x|
-            x.class.should == StringSpecs::MyString
+            x.should be_kind_of(StringSpecs::MyString)
           end
-          
+
           str.split(StringSpecs::MyString.new(pat), limit).each do |x|
-            x.class.should == String 
+            x.should be_kind_of(String)
           end
         end
       end
     end
   end
-  
+
   it "does not call constructor on created subclass instances" do
     # can't call should_not_receive on an object that doesn't yet exist
     # so failure here is signalled by exception, not expectation failure
-    
+
     s = StringSpecs::StringWithRaisingConstructor.new('silly:string')
     s.split(':').first.should == 'silly'
   end
-    
+
   it "taints the resulting strings if self is tainted" do
     ["", "x.y.z.", "  x  y  "].each do |str|
       ["", ".", " "].each do |pat|
@@ -134,13 +134,13 @@
           str.dup.taint.split(pat).each do |x|
             x.tainted?.should == true
           end
-          
+
           str.split(pat.dup.taint).each do |x|
             x.tainted?.should == false
           end
         end
       end
-    end    
+    end
   end
 end
 
@@ -155,7 +155,7 @@
   it "treats negative limits as no limit" do
     "".split(%r!/+!, -1).should == []
   end
-  
+
   it "suppresses trailing empty fields when limit isn't given or 0" do
     "1,2,,3,4,,".split(/,/).should == ["1", "2", "", "3", "4"]
     "1,2,,3,4,,".split(/,/, 0).should == ["1", "2", "", "3", "4"]
@@ -188,24 +188,24 @@
     "xxx".split(/x/, 3).should == ["", "", "x"]
     "xxx".split(/x/, 4).should == ["", "", "", ""]
   end
-  
+
   it "doesn't suppress or limit fields when limit is negative" do
     "1,2,,3,4,,".split(/,/, -1).should == ["1", "2", "", "3", "4", "", ""]
     "1,2,,3,4,,".split(/,/, -5).should == ["1", "2", "", "3", "4", "", ""]
     "  a  b  c\nd  ".split(/\s+/, -1).should == ["", "a", "b", "c", "d", ""]
     ",".split(/,/, -1).should == ["", ""]
   end
-  
+
   it "defaults to $; when regexp isn't given or nil" do
     begin
       old_fs = $;
-    
+
       [/,/, /:/, //, /XY/, /./].each do |fs|
         $; = fs
-        
+
         ["x,y,z,,,", "1:2:", "aXYbXYcXY", ""].each do |str|
           expected = str.split(fs)
-          
+
           str.split(nil).should == expected
           str.split.should == expected
 
@@ -216,17 +216,17 @@
       end
     ensure
       $; = old_fs
-    end    
+    end
   end
-  
+
   it "splits between characters when regexp matches a zero-length string" do
     "hello".split(//).should == ["h", "e", "l", "l", "o"]
     "hello".split(//, -1).should == ["h", "e", "l", "l", "o", ""]
     "hello".split(//, 2).should == ["h", "ello"]
-    
+
     "hi mom".split(/\s*/).should == ["h", "i", "m", "o", "m"]
   end
-  
+
   it "includes all captures in the result array" do
     "hello".split(/(el)/).should == ["h", "el", "lo"]
     "hi!".split(/()/).should == ["h", "", "i", "", "!"]
@@ -250,23 +250,23 @@
     lambda {"1.2.3.4".split(".", "three")}.should raise_error(TypeError)
     lambda {"1.2.3.4".split(".", nil)    }.should raise_error(TypeError)
   end
-  
+
   it "doesn't set $~" do
     $~ = nil
     "x:y:z".split(/:/)
     $~.should == nil
   end
-  
+
   it "returns the original string if no matches are found" do
     "foo".split("\n").should == ["foo"]
   end
-  
+
   it "returns subclass instances based on self" do
     ["", "x:y:z:", "  x  y  "].each do |str|
       [//, /:/, /\s+/].each do |pat|
         [-1, 0, 1, 2].each do |limit|
           StringSpecs::MyString.new(str).split(pat, limit).each do |x|
-            x.class.should == StringSpecs::MyString
+            x.should be_kind_of(StringSpecs::MyString)
           end
         end
       end
@@ -276,11 +276,11 @@
   it "does not call constructor on created subclass instances" do
     # can't call should_not_receive on an object that doesn't yet exist
     # so failure here is signalled by exception, not expectation failure
-    
+
     s = StringSpecs::StringWithRaisingConstructor.new('silly:string')
     s.split(/:/).first.should == 'silly'
   end
-  
+
   it "taints the resulting strings if self is tainted" do
     ["", "x:y:z:", "  x  y  "].each do |str|
       [//, /:/, /\s+/].each do |pat|
@@ -288,12 +288,12 @@
           str.dup.taint.split(pat).each do |x|
             x.tainted?.should == true
           end
-          
+
           str.split(pat.dup.taint).each do |x|
             x.tainted?.should == false
           end
         end
       end
-    end    
-  end  
+    end
+  end
 end

Modified: MacRuby/trunk/spec/frozen/core/string/squeeze_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/squeeze_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/squeeze_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -31,8 +31,6 @@
     s.squeeze("---").should == "-subbookkeeper-"
     "ook--001122".squeeze("--2").should == "ook-012"
     "ook--(())".squeeze("(--").should == "ook-()"
-    s.squeeze("e-b").should == s
-    s.squeeze("^e-b").should == s.squeeze
     s.squeeze("^b-e").should == "-subbokeeper-"
     "^^__^^".squeeze("^^-^").should == "^^_^^"
     "^^--^^".squeeze("^---").should == "^--^"
@@ -47,6 +45,22 @@
     "AABBCCaabbcc[[]]".squeeze("A-a").should == "ABCabbcc[]"
   end
 
+  ruby_version_is "1.8" ... "1.9" do
+    it "doesn't change chars when the parameter is out of the sequence" do
+      s = "--subbookkeeper--"
+      s.squeeze("e-b").should == s
+      s.squeeze("^e-b").should == s.squeeze
+    end
+  end
+
+  ruby_version_is "1.9" do
+    it "raises an error when the parameter is out of the sequence" do
+      s = "--subbookkeeper--"
+      lambda { s.squeeze("e-b") }.should raise_error(ArgumentError)
+      lambda { s.squeeze("^e-b") }.should raise_error(ArgumentError)
+    end
+  end
+
   it "taints the result when self is tainted" do
     "hello".taint.squeeze("e").tainted?.should == true
     "hello".taint.squeeze("a-z").tainted?.should == true
@@ -72,7 +86,7 @@
   end
 
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("oh no!!!").squeeze("!").class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("oh no!!!").squeeze("!").should be_kind_of(StringSpecs::MyString)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/string/sub_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/sub_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/sub_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -175,10 +175,10 @@
   end
 
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("").sub(//, "").class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("").sub(/foo/, "").class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").sub(/foo/, "").class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("foo").sub("foo", "").class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("").sub(//, "").should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("").sub(/foo/, "").should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").sub(/foo/, "").should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("foo").sub("foo", "").should be_kind_of(StringSpecs::MyString)
   end
 
   it "sets $~ to MatchData of match and nil when there's none" do

Modified: MacRuby/trunk/spec/frozen/core/string/swapcase_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/swapcase_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/swapcase_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -21,8 +21,8 @@
   end
 
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("").swapcase.class.should == StringSpecs::MyString
-    StringSpecs::MyString.new("hello").swapcase.class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("").swapcase.should be_kind_of(StringSpecs::MyString)
+    StringSpecs::MyString.new("hello").swapcase.should be_kind_of(StringSpecs::MyString)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/string/tr_s_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/tr_s_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/tr_s_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -45,7 +45,7 @@
   end
 
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("hello").tr_s("e", "a").class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("hello").tr_s("e", "a").should be_kind_of(StringSpecs::MyString)
   end
 
   it "taints the result when self is tainted" do

Modified: MacRuby/trunk/spec/frozen/core/string/tr_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/tr_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/tr_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -46,7 +46,7 @@
   end
 
   it "returns subclass instances when called on a subclass" do
-    StringSpecs::MyString.new("hello").tr("e", "a").class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("hello").tr("e", "a").should be_kind_of(StringSpecs::MyString)
   end
 
   it "taints the result when self is tainted" do

Modified: MacRuby/trunk/spec/frozen/core/string/unpack_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/unpack_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/unpack_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -151,15 +151,15 @@
     it "returns Bignums for big numeric values on big-endian platforms" do
       "\xF3\x02\x00\x42\x32\x23\xB3\xF0".unpack('Q')[0].class.should ==
         17344245288696546035.class
-      "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFE".unpack('q')[0].class.should == Fixnum
+      "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFE".unpack('q')[0].should be_kind_of(Fixnum)
     end
   end
 
   it "returns Fixnums for small numeric values" do
     "\x00\x00\x00\x00\x00\x00\x00\x00".unpack('Q').should == [0]
     "\x00\x00\x00\x00\x00\x00\x00\x00".unpack('q').should == [0]
-    "\x00\x00\x00\x00\x00\x00\x00\x00".unpack('Q')[0].class.should == Fixnum
-    "\x00\x00\x00\x00\x00\x00\x00\x00".unpack('q')[0].class.should == Fixnum
+    "\x00\x00\x00\x00\x00\x00\x00\x00".unpack('Q')[0].should be_kind_of(Fixnum)
+    "\x00\x00\x00\x00\x00\x00\x00\x00".unpack('q')[0].should be_kind_of(Fixnum)
   end
 end
 
@@ -337,8 +337,49 @@
       end
     end
   end
+
+  it "uses sizeof(int) as an integer" do
+    little_endian do
+      "\000\000\001\000".unpack("i").should == [65536]
+      "\000\000\001\000\000\000\001\000".unpack("i2").should == [65536, 65536]
+      "\000\000\001\000\000\000\001\000hello".unpack("i2a5").should == [65536, 65536, "hello"]
+      "\377\377\377\377".unpack("i").should == [-1]
+      "\377\377\377\377".unpack("I").should == [4294967295]
+      "\000\000\000\000\000\000\000\000".unpack("I*").should == [0,0]
+    end
+  end
+
+  it "ignores the result if there aren't 4 bytes" do
+    little_endian do
+      "\000".unpack("I").should == [nil]
+      "\000".unpack("I2").should == [nil, nil]
+      "\000".unpack("I*").should == []
+      "\000\000\000\000\000\000\000\000\000".unpack("I*").should == [0,0]
+    end
+  end
 end
 
+describe "String#unpack with 'lL'" do
+  it "uses 4 bytes for an integer" do
+    little_endian do
+      "\000\000\001\000".unpack("l").should == [65536]
+      "\000\000\001\000\000\000\001\000".unpack("l2").should == [65536, 65536]
+      "\000\000\001\000\000\000\001\000hello".unpack("l2a5").should == [65536, 65536, "hello"]
+      "\377\377\377\377".unpack("l").should == [-1]
+      "\377\377\377\377".unpack("L").should == [4294967295]
+    end
+  end
+
+  it "ignores the result if there aren't 4 bytes" do
+    little_endian do
+      "\000".unpack("L").should == [nil]
+      "\000".unpack("L2").should == [nil, nil]
+      "\000".unpack("L*").should == []
+      "\000\000\000\000\000\000\000\000\000".unpack("I*").should == [0,0]
+    end
+  end
+end
+
 describe "String#unpack with 'U' directive" do
   it "returns an array by decoding self according to the format string" do
     "\xFD\x80\x80\xB7\x80\x80".unpack('U').should == [1073967104]

Modified: MacRuby/trunk/spec/frozen/core/string/upcase_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/upcase_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/string/upcase_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -27,7 +27,7 @@
   end
 
   it "returns a subclass instance for subclasses" do
-    StringSpecs::MyString.new("fooBAR").upcase.class.should == StringSpecs::MyString
+    StringSpecs::MyString.new("fooBAR").upcase.should be_kind_of(StringSpecs::MyString)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/struct/element_reference_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/struct/element_reference_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/struct/element_reference_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Struct[]" do
   it "is a synonym for new" do
-    Struct::Ruby['2.0', 'i686'].class.should == Struct::Ruby
+    Struct::Ruby['2.0', 'i686'].should be_kind_of(Struct::Ruby)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/struct/hash_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/struct/hash_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/struct/hash_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,7 +6,7 @@
   it "returns the same fixnum for structs with the same content" do
     [Struct::Ruby.new("1.8.6", "PPC"), Struct::Car.new("Hugo", "Foo", "1972")].each do |stc|
       stc.hash.should == stc.dup.hash
-      stc.hash.class.should == Fixnum
+      stc.hash.should be_kind_of(Fixnum)
     end
   end
   

Modified: MacRuby/trunk/spec/frozen/core/struct/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/struct/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/struct/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -36,13 +36,13 @@
     it "creates a new anonymous class with nil first argument" do
       struct = Struct.new(nil, :foo)
       struct.new("bar").foo.should == "bar"
-      struct.class.should == Class
+      struct.should be_kind_of(Class)
       struct.name.should == ""
     end
 
     it "creates a new anonymous class with symbol arguments" do
       struct = Struct.new(:make, :model)
-      struct.class.should == Class
+      struct.should be_kind_of(Class)
       struct.name.should == ""
     end
   end
@@ -51,13 +51,13 @@
     it "creates a new anonymous class with nil first argument" do
       struct = Struct.new(nil, :foo)
       struct.new("bar").foo.should == "bar"
-      struct.class.should == Class
+      struct.should be_kind_of(Class)
       struct.name.should be_nil
     end
 
     it "creates a new anonymous class with symbol arguments" do
       struct = Struct.new(:make, :model)
-      struct.class.should == Class
+      struct.should be_kind_of(Class)
       struct.name.should == nil
     end
   end

Modified: MacRuby/trunk/spec/frozen/core/struct/select_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/struct/select_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/struct/select_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -13,6 +13,6 @@
   
   it "returns an instance of Array" do
     struct = Struct::Car.new("Ford", "Escort", "1995")
-    struct.select { true }.class.should == Array
+    struct.select { true }.should be_kind_of(Array)
   end
 end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/core/thread/current_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/current_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/thread/current_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 describe "Thread.current" do
   it "returns a thread" do
     current = Thread.current
-    current.class.should == Thread
+    current.should be_kind_of(Thread)
   end
 
   it "returns the current thread" do

Modified: MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -31,13 +31,13 @@
   it "raises the given exception" do
     @thr.raise Exception
     Thread.pass while @thr.status
-    ScratchPad.recorded.class.should == Exception
+    ScratchPad.recorded.should be_kind_of(Exception)
   end
 
   it "raises the given exception with the given message" do
     @thr.raise Exception, "get to work"
     Thread.pass while @thr.status
-    ScratchPad.recorded.class.should == Exception
+    ScratchPad.recorded.should be_kind_of(Exception)
     ScratchPad.recorded.message.should == "get to work"
   end
 
@@ -50,8 +50,8 @@
     lambda {t.value}.should raise_error(RuntimeError)
   end
 
-  ruby_version_is "" ... "1.9" do
-    it "re-raises active exception" do
+  ruby_version_is "1.9" do
+    it "raises a RuntimeError when called with no arguments" do
       t = Thread.new do
         begin
           1/0
@@ -59,10 +59,13 @@
           sleep 3
         end
       end
-  
-      Thread.pass while t.status and t.status != "sleep"
-      t.raise
-      lambda {t.value}.should raise_error(ZeroDivisionError)
+      begin
+        raise RangeError
+      rescue
+        Thread.pass while t.status and t.status != "sleep"
+        t.raise
+      end
+      lambda {t.value}.should raise_error(RuntimeError)
       t.kill
     end
   end
@@ -88,13 +91,13 @@
   it "raises the given exception" do
     @thr.raise Exception
     Thread.pass while @thr.status
-    ScratchPad.recorded.class.should == Exception
+    ScratchPad.recorded.should be_kind_of(Exception)
   end
 
   it "raises the given exception with the given message" do
     @thr.raise Exception, "get to work"
     Thread.pass while @thr.status
-    ScratchPad.recorded.class.should == Exception
+    ScratchPad.recorded.should be_kind_of(Exception)
     ScratchPad.recorded.message.should == "get to work"
   end
 
@@ -108,7 +111,7 @@
   end
 
   ruby_version_is "" ... "1.9" do
-    it "re-raises active exception" do
+    it "raise the given argument even when there is an active exception" do
       raised = false
       t = Thread.new do
         begin
@@ -118,11 +121,15 @@
           loop { }
         end
       end
-  
-      Thread.pass until raised || !t.alive?
-      t.raise
-      lambda {t.value}.should raise_error(ZeroDivisionError)
+      begin
+        raise "Create an active exception for the current thread too"
+      rescue
+        Thread.pass until raised || !t.alive?
+        t.raise RangeError
+        lambda {t.value}.should raise_error(RangeError)
+      end
     end
+
   end
 end
 

Deleted: MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb.orig
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb.orig	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb.orig	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,131 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes'
-require File.dirname(__FILE__) + '/../../shared/kernel/raise'
-
-describe "Thread#raise" do
-  it "ignores dead threads" do
-    t = Thread.new { :dead }
-    Thread.pass while t.alive?
-    lambda {t.raise("Kill the thread")}.should_not raise_error
-    lambda {t.value}.should_not raise_error
-  end
-end
-
-describe "Thread#raise on a sleeping thread" do
-  before :each do
-    ScratchPad.clear
-    @thr = ThreadSpecs.sleeping_thread
-    Thread.pass while @thr.status and @thr.status != "sleep"
-  end
-
-  after :each do
-    @thr.kill
-  end
-
-  it "raises a RuntimeError if no exception class is given" do
-    @thr.raise
-    Thread.pass while @thr.status
-    ScratchPad.recorded.should be_kind_of(RuntimeError)
-  end
-
-  it "raises the given exception" do
-    @thr.raise Exception
-    Thread.pass while @thr.status
-    ScratchPad.recorded.class.should == Exception
-  end
-
-  it "raises the given exception with the given message" do
-    @thr.raise Exception, "get to work"
-    Thread.pass while @thr.status
-    ScratchPad.recorded.class.should == Exception
-    ScratchPad.recorded.message.should == "get to work"
-  end
-
-  it "can go unhandled" do
-    t = Thread.new do
-      sleep
-    end
-
-    t.raise
-    lambda {t.value}.should raise_error(RuntimeError)
-  end
-
-  ruby_version_is "" ... "1.9" do
-    it "re-raises active exception" do
-      t = Thread.new do
-        begin
-          1/0
-        rescue ZeroDivisionError
-          sleep 3
-        end
-      end
-  
-      Thread.pass while t.status and t.status != "sleep"
-      t.raise
-      lambda {t.value}.should raise_error(ZeroDivisionError)
-      t.kill
-    end
-  end
-end
-
-describe "Thread#raise on a running thread" do
-  before :each do
-    ScratchPad.clear
-    @thr = ThreadSpecs.running_thread
-    Thread.pass while @thr.status and @thr.status != "run"
-  end
-  
-  after :each do
-    @thr.kill
-  end
-
-  it "raises a RuntimeError if no exception class is given" do
-    @thr.raise
-    Thread.pass while @thr.status
-    ScratchPad.recorded.should be_kind_of(RuntimeError)
-  end
-
-  it "raises the given exception" do
-    @thr.raise Exception
-    Thread.pass while @thr.status
-    ScratchPad.recorded.class.should == Exception
-  end
-
-  it "raises the given exception with the given message" do
-    @thr.raise Exception, "get to work"
-    Thread.pass while @thr.status
-    ScratchPad.recorded.class.should == Exception
-    ScratchPad.recorded.message.should == "get to work"
-  end
-
-  it "can go unhandled" do
-    t = Thread.new do
-      loop {}
-    end
-
-    t.raise
-    lambda {t.value}.should raise_error(RuntimeError)
-  end
-
-  ruby_version_is "" ... "1.9" do
-    it "re-raises active exception" do
-      raised = false
-      t = Thread.new do
-        begin
-          1/0
-        rescue ZeroDivisionError
-          raised = true
-          loop { }
-        end
-      end
-  
-      Thread.pass until raised || !t.alive?
-      t.raise
-      lambda {t.value}.should raise_error(ZeroDivisionError)
-    end
-  end
-end
-
-describe "Thread#raise on same thread" do
-  it_behaves_like :kernel_raise, :raise, Thread.current
-end

Deleted: MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb.rej
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb.rej	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb.rej	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,92 +0,0 @@
-***************
-*** 50,68 ****
-      lambda {t.value}.should raise_error(RuntimeError)
-    end
-  
--   it "re-raises active exception" do
--     t = Thread.new do
-        begin
--         1/0
--       rescue ZeroDivisionError
--         sleep 3
-        end
-      end
-- 
--     Thread.pass while t.status and t.status != "sleep"
--     t.raise
--     lambda {t.value}.should raise_error(ZeroDivisionError)
--     t.kill
-    end
-  end
-  
---- 50,73 ----
-      lambda {t.value}.should raise_error(RuntimeError)
-    end
-  
-+   ruby_version_is "1.9" do
-+     it "raises a RuntimeError when called with no arguments" do
-+       t = Thread.new do
-+         begin
-+           1/0
-+         rescue ZeroDivisionError
-+           sleep 3
-+         end
-+       end
-        begin
-+         raise RangeError
-+       rescue
-+         Thread.pass while t.status and t.status != "sleep"
-+         t.raise
-        end
-+       lambda {t.value}.should raise_error(RuntimeError)
-+       t.kill
-      end
-    end
-  end
-  
-***************
-*** 105,111 ****
-      lambda {t.value}.should raise_error(RuntimeError)
-    end
-  
--   it "re-raises active exception" do
-      raised = false
-      t = Thread.new do
-        begin
---- 110,116 ----
-      lambda {t.value}.should raise_error(RuntimeError)
-    end
-  
-+   it "raise the given argument even when there is an active exception" do
-      raised = false
-      t = Thread.new do
-        begin
-***************
-*** 115,125 ****
-          loop { }
-        end
-      end
-- 
--     Thread.pass until raised || !t.alive?
--     t.raise
--     lambda {t.value}.should raise_error(ZeroDivisionError)
-    end
-  end
-  
-  describe "Thread#raise on same thread" do
---- 120,134 ----
-          loop { }
-        end
-      end
-+     begin
-+       raise "Create an active exception for the current thread too"
-+     rescue
-+       Thread.pass until raised || !t.alive?
-+       t.raise RangeError
-+       lambda {t.value}.should raise_error(RangeError)
-+     end
-    end
-+ 
-  end
-  
-  describe "Thread#raise on same thread" do

Modified: MacRuby/trunk/spec/frozen/core/time/fixtures/methods.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/time/fixtures/methods.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/time/fixtures/methods.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -24,7 +24,7 @@
 # Time.at(seconds).inspect on MRI 1.8
 def localtime_18(seconds)
   platform_is :os => [:darwin, :bsd] do
-    return `LC_ALL=C date -r #{seconds} +'%a %b %d %H:%M:%S %z %Y'`.chomp
+    return `LC_ALL=C /bin/date -r #{seconds} +'%a %b %d %H:%M:%S %z %Y'`.chomp
   end
 
   platform_is :os => :linux do
@@ -38,7 +38,7 @@
 # Time.at(seconds).inspect on MRI 1.9
 def localtime_19(seconds)
   platform_is :os => [:darwin, :bsd] do
-    return `LC_ALL=C date -r #{seconds} +'%F %H:%M:%S %z'`.chomp
+    return `LC_ALL=C /bin/date -r #{seconds} +'%F %H:%M:%S %z'`.chomp
   end
 
   platform_is :os => :linux do

Modified: MacRuby/trunk/spec/frozen/core/time/inspect_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/time/inspect_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/time/inspect_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,2 +1,7 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/fixtures/methods'
+require File.dirname(__FILE__) + '/shared/inspect'
+
+describe "Time.inspect" do
+  it_behaves_like :inspect, :inspect
+end

Added: MacRuby/trunk/spec/frozen/core/time/shared/inspect.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/time/shared/inspect.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/core/time/shared/inspect.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,25 @@
+describe :inspect, :shared => true do
+  ruby_version_is ""..."1.9" do
+    it "formats the time following the pattern 'EEE MMM dd HH:mm:ss Z yyyy'" do
+      with_timezone("PST", +1) do
+        Time.local("1", "15", "20", "1", "1", "2000", :ignored, :ignored, :ignored, :ignored).send(@method).should == "Sat Jan 01 20:15:01 +0100 2000"
+      end
+    end
+
+    it "formats the UTC time following the pattern 'EEE MMM dd HH:mm:ss UTC yyyy'" do
+      Time.utc("1", "15", "20", "1", "1", "2000", :ignored, :ignored, :ignored, :ignored).send(@method).should == "Sat Jan 01 20:15:01 UTC 2000"
+    end
+  end
+
+  ruby_version_is "1.9" do
+    it "formats the time following the pattern 'yyyy-MM-dd HH:mm:ss Z'" do
+      with_timezone("PST", +1) do
+        Time.local("1", "15", "20", "1", "1", "2000", :ignored, :ignored, :ignored, :ignored).send(@method).should == "2000-01-01 20:15:01 +0100"
+      end
+    end
+
+    it "formats the UTC time following the pattern 'yyyy-MM-dd HH:mm:ss UTC'" do
+      Time.utc("1", "15", "20", "1", "1", "2000", :ignored, :ignored, :ignored, :ignored).send(@method).should == "2000-01-01 20:15:01 UTC"
+    end
+  end
+end

Modified: MacRuby/trunk/spec/frozen/core/time/shared/now.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/time/shared/now.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/time/shared/now.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,7 @@
   platform_is_not :windows do
     it "creates a time based on the current system time" do
       unless `which date` == ""
-        Time.__send__(@method).to_i.should.be_close(`date +%s`.to_i,1)
+        Time.__send__(@method).to_i.should be_close(`date +%s`.to_i, 2)
       end
     end
   end

Modified: MacRuby/trunk/spec/frozen/core/time/shared/time_params.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/time/shared/time_params.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/time/shared/time_params.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -36,18 +36,7 @@
       end
 
       platform_is :wordsize => 64 do
-        darwin = false
-        platform_is :darwin do
-          not_compliant_on :jruby do # JRuby exhibits platform-independent behavior
-            darwin = true
-            lambda { Time.send(@method, 1900, 12, 31, 23, 59, 59, 0) }.should raise_error(ArgumentError) # mon
-          end
-        end
-
-        unless darwin
-          Time.send(@method, 1900, 12, 31, 23, 59, 59, 0).wday.should == 1
-        end
-
+        Time.send(@method, 1900, 12, 31, 23, 59, 59, 0).wday.should == 1
         Time.send(@method, 2038, 12, 31, 23, 59, 59, 0).wday.should == 5
       end
     end

Modified: MacRuby/trunk/spec/frozen/core/time/to_s_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/time/to_s_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/time/to_s_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,2 +1,7 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/fixtures/methods'
+require File.dirname(__FILE__) + '/shared/inspect'
+
+describe "Time.to_s" do
+  it_behaves_like :inspect, :to_s
+end

Modified: MacRuby/trunk/spec/frozen/core/unboundmethod/bind_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/unboundmethod/bind_spec_disabled.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/unboundmethod/bind_spec_disabled.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -14,14 +14,14 @@
   end
 
   it "returns Method for any object that is kind_of? the Module method was extracted from" do
-    @normal_um.bind(UnboundMethodSpecs::Methods.new).class.should == Method
+    @normal_um.bind(UnboundMethodSpecs::Methods.new).should be_kind_of(Method)
   end
 
   deviates_on :rubinius do
     it "returns Method for any object kind_of? the Module the method is defined in" do
-      @parent_um.bind(UnboundMethodSpecs::Child1.new).class.should == Method
-      @child1_um.bind(UnboundMethodSpecs::Parent.new).class.should == Method
-      @child2_um.bind(UnboundMethodSpecs::Child1.new).class.should == Method
+      @parent_um.bind(UnboundMethodSpecs::Child1.new).should be_kind_of(Method)
+      @child1_um.bind(UnboundMethodSpecs::Parent.new).should be_kind_of(Method)
+      @child2_um.bind(UnboundMethodSpecs::Child1.new).should be_kind_of(Method)
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/core/unboundmethod/equal_value_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/unboundmethod/equal_value_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/unboundmethod/equal_value_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,8 +3,8 @@
 
 context "Creating UnboundMethods" do
   specify "there is no difference between Method#unbind and Module#instance_method" do
-    UnboundMethodSpecs::Methods.instance_method(:foo).class.should == UnboundMethod
-    UnboundMethodSpecs::Methods.new.method(:foo).unbind.class.should == UnboundMethod
+    UnboundMethodSpecs::Methods.instance_method(:foo).should be_kind_of(UnboundMethod)
+    UnboundMethodSpecs::Methods.new.method(:foo).unbind.should be_kind_of(UnboundMethod)
   end
 end
 

Modified: MacRuby/trunk/spec/frozen/core/unboundmethod/shared/to_s.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/unboundmethod/shared/to_s.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/core/unboundmethod/shared/to_s.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,8 +8,8 @@
   end
 
   it "returns a String" do
-    @from_module.send(@method).class.should == String
-    @from_method.send(@method).class.should == String
+    @from_module.send(@method).should be_kind_of(String)
+    @from_method.send(@method).should be_kind_of(String)
   end
 
   it "the String reflects that this is an UnboundMethod object" do

Modified: MacRuby/trunk/spec/frozen/language/array_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/array_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/array_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 describe "Array literals" do
   it "[] should return a new array populated with the given elements" do
     array = [1, 'a', nil]
-    array.class.should == Array
+    array.should be_kind_of(Array)
     array[0].should == 1
     array[1].should == 'a'
     array[2].should == nil

Modified: MacRuby/trunk/spec/frozen/language/break_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/break_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/break_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -25,6 +25,11 @@
 end
 
 describe "Executing break from within a block" do
+
+  before :each do
+    ScratchPad.clear
+  end
+
   it "returns from the invoking singleton method" do
     obj = Object.new
     def obj.meth_with_block
@@ -93,6 +98,43 @@
     res.should == :return_value
 
   end
+
+  class BreakTest2
+    def one
+      two { yield }
+    end
+
+    def two
+      yield
+    ensure
+      ScratchPad << :two_ensure
+    end
+
+    def three
+      begin
+        one { break }
+        ScratchPad << :three_post
+      ensure
+        ScratchPad << :three_ensure
+      end
+    end
+  end
+
+  it "runs ensures when continuing upward" do
+    ScratchPad.record []
+
+    bt2 = BreakTest2.new
+    bt2.one { break }
+    ScratchPad.recorded.should == [:two_ensure]
+  end
+
+  it "doesn't run ensures in the destination method" do
+    ScratchPad.record []
+
+    bt2 = BreakTest2.new
+    bt2.three
+    ScratchPad.recorded.should == [:two_ensure, :three_post, :three_ensure]
+  end
 end
 
 describe "Breaking out of a loop with a value" do
@@ -110,19 +152,27 @@
     a = loop do break [*[1,2]]; end; a.should == [1,2]
   end
 
+  it "assigns splatted objects" do
+    a = loop do break *[1,2]; end;    a.should == [1,2]
+    a = loop do break *[*[1,2]]; end; a.should == [1,2]
+  end
+
   ruby_version_is "" ... "1.9" do
-    it "assigns splatted objects" do
+    it "assigns nil objects when the splatted object is nil, an empty array or contains a nil object" do
       a = loop do break *nil; end;      a.should == nil
       a = loop do break *[]; end;       a.should == nil
-      a = loop do break *1; end;        a.should == 1
-      a = loop do break *[1]; end;      a.should == 1
       a = loop do break *[nil]; end;    a.should == nil
+      a = loop do break *[*[]]; end;    a.should == nil
+    end
+
+    it "assigns an empty array when the splatted array contains an empty array" do
       a = loop do break *[[]]; end;     a.should == []
-      a = loop do break *[*[]]; end;    a.should == nil
+    end
+
+    it "assigns the splatted object if it doesn't respont to to_ary" do
+      a = loop do break *1; end;        a.should == 1
       a = loop do break *[1]; end;      a.should == 1
       a = loop do break *[*[1]]; end;   a.should == 1
-      a = loop do break *[1,2]; end;    a.should == [1,2]
-      a = loop do break *[*[1,2]]; end; a.should == [1,2]
     end
   end
 
@@ -130,23 +180,32 @@
     it "assigns splatted objects" do
       a = loop do break *nil; end;      a.should == []
       a = loop do break *[]; end;       a.should == []
+      a = loop do break *[*[]]; end;    a.should == []
+    end
+
+    it "assigns an array containing an empty array when the splatted array contains an empty array" do
+      a = loop do break *[[]]; end;     a.should == [[]]
+    end
+
+    it "assigns an array with a nil object when the splatted object contains a nil object" do
+      a = loop do break *[nil]; end;    a.should == [nil]
+    end
+
+    it "assigns an array that contains the splatted object if the splatted objects doesn't respond to to_a" do
       a = loop do break *1; end;        a.should == [1]
       a = loop do break *[1]; end;      a.should == [1]
-      a = loop do break *[nil]; end;    a.should == [nil]
-      a = loop do break *[[]]; end;     a.should == [[]]
-      a = loop do break *[*[]]; end;    a.should == []
-      a = loop do break *[1]; end;      a.should == [1]
       a = loop do break *[*[1]]; end;   a.should == [1]
-      a = loop do break *[1,2]; end;    a.should == [1,2]
-      a = loop do break *[*[1,2]]; end; a.should == [1,2]
     end
   end
 
+  it "assigns to a splatted reference" do
+    *a = loop do break; end;          a.should == [nil]
+    *a = loop do break nil; end;      a.should == [nil]
+    *a = loop do break 1; end;        a.should == [1]
+  end
+
   ruby_version_is "" ... "1.9" do
-    it "assigns to a splatted reference" do
-      *a = loop do break; end;          a.should == [nil]
-      *a = loop do break nil; end;      a.should == [nil]
-      *a = loop do break 1; end;        a.should == [1]
+    it "assigns arrays into another array to a splatted reference" do
       *a = loop do break []; end;       a.should == [[]]
       *a = loop do break [1]; end;      a.should == [[1]]
       *a = loop do break [nil]; end;    a.should == [[nil]]
@@ -159,10 +218,7 @@
   end
 
   ruby_version_is "1.9" do
-    it "assigns to a splatted reference" do
-      *a = loop do break; end;          a.should == [nil]
-      *a = loop do break nil; end;      a.should == [nil]
-      *a = loop do break 1; end;        a.should == [1]
+    it "assigns arrays to a splatted reference" do
       *a = loop do break []; end;       a.should == []
       *a = loop do break [1]; end;      a.should == [1]
       *a = loop do break [nil]; end;    a.should == [nil]
@@ -174,64 +230,71 @@
     end
   end
 
+  it "assings splatted objects to a splatted reference" do
+    *a = loop do break *1; end;        a.should == [1]
+    *a = loop do break *[1]; end;      a.should == [1]
+    *a = loop do break *[nil]; end;    a.should == [nil]
+    *a = loop do break *[[]]; end;     a.should == [[]]
+    *a = loop do break *[*[1]]; end;   a.should == [1]
+  end
+
   ruby_version_is "" ... "1.9" do
-    it "assigns splatted objects to a splatted reference" do
+    it "assigns arrays with nil objects to a splatted reference" do
       *a = loop do break *nil; end;      a.should == [nil]
       *a = loop do break *[]; end;       a.should == [nil]
+      *a = loop do break *[*[]]; end;    a.should == [nil]
+    end
+
+    it "assigns an array containing an array to splatted reference when the object is an splatted array" do
       *a = loop do break *[1,2]; end;    a.should == [[1,2]]
-      *a = loop do break *[*[]]; end;    a.should == [nil]
       *a = loop do break *[*[1,2]]; end; a.should == [[1,2]]
-      *a = loop do break *1; end;        a.should == [1]
-      *a = loop do break *[1]; end;      a.should == [1]
-      *a = loop do break *[nil]; end;    a.should == [nil]
-      *a = loop do break *[[]]; end;     a.should == [[]]
-      *a = loop do break *[*[1]]; end;   a.should == [1]
     end
   end
 
   ruby_version_is "1.9" do
-    it "assigns splatted objects to a splatted reference" do
+    it "assigns empty arrays to a splatted reference" do
       *a = loop do break *nil; end;      a.should == []
       *a = loop do break *[]; end;       a.should == []
+      *a = loop do break *[*[]]; end;    a.should == []
+    end
+
+    it "assigns an array to splatted reference when the object is an splatted array" do
       *a = loop do break *[1,2]; end;    a.should == [1,2]
-      *a = loop do break *[*[]]; end;    a.should == []
       *a = loop do break *[*[1,2]]; end; a.should == [1,2]
-      *a = loop do break *1; end;        a.should == [1]
-      *a = loop do break *[1]; end;      a.should == [1]
-      *a = loop do break *[nil]; end;    a.should == [nil]
-      *a = loop do break *[[]]; end;     a.should == [[]]
-      *a = loop do break *[*[1]]; end;   a.should == [1]
     end
   end
 
+  it "assigns splatted objects to a splatted reference from a splatted loop" do
+    *a = *loop do break *1; end;        a.should == [1]
+    *a = *loop do break *[1]; end;      a.should == [1]
+    *a = *loop do break *[nil]; end;    a.should == [nil]
+    *a = *loop do break *[1,2]; end;    a.should == [1,2]
+    *a = *loop do break *[*[1]]; end;   a.should == [1]
+    *a = *loop do break *[*[1,2]]; end; a.should == [1,2]
+  end
+
   ruby_version_is "" ... "1.9" do
-    it "assigns splatted objects to a splatted reference from a splatted loop" do
+    it "assigns arrays with a nil object to a splatted reference from a splatted loop" do
       *a = *loop do break *nil; end;      a.should == [nil]
       *a = *loop do break *[]; end;       a.should == [nil]
-      *a = *loop do break *[[]]; end;     a.should == []
       *a = *loop do break *[*[]]; end;    a.should == [nil]
-      *a = *loop do break *1; end;        a.should == [1]
-      *a = *loop do break *[1]; end;      a.should == [1]
-      *a = *loop do break *[nil]; end;    a.should == [nil]
-      *a = *loop do break *[1,2]; end;    a.should == [1,2]
-      *a = *loop do break *[*[1]]; end;   a.should == [1]
-      *a = *loop do break *[*[1,2]]; end; a.should == [1,2]
     end
+
+    it "assigns an empty array to a splatted reference when the splatted array from a splatted loop contains an empty array" do
+      *a = *loop do break *[[]]; end;     a.should == []
+    end
   end
 
   ruby_version_is "1.9" do
-    it "assigns splatted objects to a splatted reference from a splatted loop" do
+    it "assigns empty arrays to a splatted reference from a splatted loop" do
       *a = *loop do break *nil; end;      a.should == []
       *a = *loop do break *[]; end;       a.should == []
-      *a = *loop do break *[[]]; end;     a.should == [[]]
       *a = *loop do break *[*[]]; end;    a.should == []
-      *a = *loop do break *1; end;        a.should == [1]
-      *a = *loop do break *[1]; end;      a.should == [1]
-      *a = *loop do break *[nil]; end;    a.should == [nil]
-      *a = *loop do break *[1,2]; end;    a.should == [1,2]
-      *a = *loop do break *[*[1]]; end;   a.should == [1]
-      *a = *loop do break *[*[1,2]]; end; a.should == [1,2]
     end
+
+    it "assigns an array containing an empty array to a splatter reference when the splatter array from a splatted loop contains an empty array" do
+      *a = *loop do break *[[]]; end;     a.should == [[]]
+    end
   end
 
   it "assigns objects to multiple block variables" do
@@ -248,33 +311,27 @@
     a,b,*c = loop do break [*[1,2]]; end; [a,b,c].should == [1,2,[]]
   end
 
+  it "assigns splatted objects to multiple block variables" do
+    a,b,*c = loop do break *nil; end;      [a,b,c].should == [nil,nil,[]]
+    a,b,*c = loop do break *1; end;        [a,b,c].should == [1,nil,[]]
+    a,b,*c = loop do break *[]; end;       [a,b,c].should == [nil,nil,[]]
+    a,b,*c = loop do break *[1]; end;      [a,b,c].should == [1,nil,[]]
+    a,b,*c = loop do break *[nil]; end;    [a,b,c].should == [nil,nil,[]]
+    a,b,*c = loop do break *[1,2]; end;    [a,b,c].should == [1,2,[]]
+    a,b,*c = loop do break *[*[]]; end;    [a,b,c].should == [nil,nil,[]]
+    a,b,*c = loop do break *[*[1]]; end;   [a,b,c].should == [1,nil,[]]
+    a,b,*c = loop do break *[*[1,2]]; end; [a,b,c].should == [1,2,[]]
+  end
+
   ruby_version_is "" ... "1.9" do
-    it "assigns splatted objects to multiple block variables" do
-      a,b,*c = loop do break *nil; end;      [a,b,c].should == [nil,nil,[]]
-      a,b,*c = loop do break *1; end;        [a,b,c].should == [1,nil,[]]
-      a,b,*c = loop do break *[]; end;       [a,b,c].should == [nil,nil,[]]
-      a,b,*c = loop do break *[1]; end;      [a,b,c].should == [1,nil,[]]
-      a,b,*c = loop do break *[nil]; end;    [a,b,c].should == [nil,nil,[]]
+    it "assigns nil to variables when the splatted value is an empty array" do
       a,b,*c = loop do break *[[]]; end;     [a,b,c].should == [nil,nil,[]]
-      a,b,*c = loop do break *[1,2]; end;    [a,b,c].should == [1,2,[]]
-      a,b,*c = loop do break *[*[]]; end;    [a,b,c].should == [nil,nil,[]]
-      a,b,*c = loop do break *[*[1]]; end;   [a,b,c].should == [1,nil,[]]
-      a,b,*c = loop do break *[*[1,2]]; end; [a,b,c].should == [1,2,[]]
     end
   end
 
   ruby_version_is "1.9" do
-    it "assigns splatted objects to multiple block variables" do
-      a,b,*c = loop do break *nil; end;      [a,b,c].should == [nil,nil,[]]
-      a,b,*c = loop do break *1; end;        [a,b,c].should == [1,nil,[]]
-      a,b,*c = loop do break *[]; end;       [a,b,c].should == [nil,nil,[]]
-      a,b,*c = loop do break *[1]; end;      [a,b,c].should == [1,nil,[]]
-      a,b,*c = loop do break *[nil]; end;    [a,b,c].should == [nil,nil,[]]
+    it "assigns an empty array to variables when the splatted value is an empty array" do
       a,b,*c = loop do break *[[]]; end;     [a,b,c].should == [[],nil,[]]
-      a,b,*c = loop do break *[1,2]; end;    [a,b,c].should == [1,2,[]]
-      a,b,*c = loop do break *[*[]]; end;    [a,b,c].should == [nil,nil,[]]
-      a,b,*c = loop do break *[*[1]]; end;   [a,b,c].should == [1,nil,[]]
-      a,b,*c = loop do break *[*[1,2]]; end; [a,b,c].should == [1,2,[]]
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/language/class_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/class_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/class_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,8 +9,8 @@
 
 describe "A class definition" do
   it "creates a new class" do
-    ClassSpecs::A.class.should == Class
-    ClassSpecs::A.new.class.should == ClassSpecs::A
+    ClassSpecs::A.should be_kind_of(Class)
+    ClassSpecs::A.new.should be_kind_of(ClassSpecs::A)
   end
   
   it "has no class variables" do

Modified: MacRuby/trunk/spec/frozen/language/def_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/def_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/def_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -219,7 +219,7 @@
     def foo(x = caller())
       x
     end
-    foo.shift.class.should == String
+    foo.shift.should be_kind_of(String)
   end
 
   it "evaluates the defaults in the method's scope" do
@@ -258,7 +258,7 @@
     def a.foo(x = caller())
       x
     end
-    a.foo.shift.class.should == String
+    a.foo.shift.should be_kind_of(String)
   end
 
   it "evaluates the defaults in the singleton scope" do

Modified: MacRuby/trunk/spec/frozen/language/defined_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/defined_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/defined_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -31,6 +31,44 @@
     end
   end
 
+  class LanguageDefinedSubclassDM < LanguageDefinedSpecs
+    define_method(:no_args) {
+      defined?(super)
+    }
+
+    define_method(:args) {
+      defined?(super())
+    }
+  end
+
+  class LanguageDefinedSubclassBlock < LanguageDefinedSpecs
+    def no_args
+      ret = nil
+      1.times { ret = defined?(super) }
+      ret
+    end
+
+    def args
+      ret = nil
+      1.times { ret = defined?( super() ) }
+      ret
+    end
+  end
+
+  class LanguageDefinedSubclassDMBlock < LanguageDefinedSpecs
+    define_method(:no_args) {
+      ret = nil
+      1.times { ret = defined?(super) }
+      ret
+    }
+
+    define_method(:args) {
+      ret = nil
+      1.times { ret = defined?(super()) }
+      ret
+    }
+  end
+
   module AAA
     self::FOO = 'x' unless defined? self::FOO rescue nil
   end
@@ -176,43 +214,61 @@
     end
   end
 
+  it "returns 'super' when Subclass#no_args uses defined?" do
+    ret = (LanguageDefinedSubclass.new.no_args)
+    ret.should == "super"
+  end
+
+  it "returns 'super' when Subclass#args uses defined?" do
+    ret = (LanguageDefinedSubclass.new.args)
+    ret.should == "super"
+  end
+
+  it "returns 'super' when Subclass#no_args and created with define_method" do
+    ret = (LanguageDefinedSubclassDM.new.no_args)
+    ret.should == "super"
+  end
+
+  it "returns 'super' when Subclass#args and created with define_method" do
+    ret = (LanguageDefinedSubclassDM.new.args)
+    ret.should == "super"
+  end
+
+  it "returns 'super' when Subclass#no_args uses a block" do
+    ret = (LanguageDefinedSubclassBlock.new.no_args)
+    ret.should == "super"
+  end
+
+  it "returns 'super' when Subclass#args uses a block" do
+    ret = (LanguageDefinedSubclassBlock.new.args)
+    ret.should == "super"
+  end
+
+  it "returns 'super' when Subclass#no_args uses a block in define_method" do
+    ret = (LanguageDefinedSubclassDMBlock.new.no_args)
+    ret.should == "super"
+  end
+
+  it "returns 'super' when Subclass#args uses a block in define_method" do
+    ret = (LanguageDefinedSubclassDMBlock.new.args)
+    ret.should == "super"
+  end
+
   not_compliant_on :rubinius do
     ruby_version_is "" ... "1.9" do
-      # I (Evan) am not certain we'll support defined?(super) ever.
-      # for now, i'm marking these as compliant.
-      it "returns 'super' when Subclass#no_args uses defined?" do
-        ret = (LanguageDefinedSubclass.new.no_args)
-        ret.should == "super"
-      end
-  
-      it "returns 'super' when Subclass#args uses defined?" do
-        ret = (LanguageDefinedSubclass.new.args)
-        ret.should == "super"
-      end
-
       it "returns 'local-variable(in-block)' when defined? is called on a block var" do
         block = Proc.new { |xxx| defined?(xxx) }
         ret = block.call(1)
         ret.should == 'local-variable(in-block)'
       end
     end
+  end
 
-    ruby_version_is "1.9" do
-      it "returns 'super' when Subclass#no_args uses defined?" do
-        ret = (LanguageDefinedSubclass.new.no_args)
-        ret.should == "super"
-      end
-  
-      it "returns 'super' when Subclass#args uses defined?" do
-        ret = (LanguageDefinedSubclass.new.args)
-        ret.should == "super"
-      end
-
-      it "returns 'local-variable' when defined? is called on a block var" do
-        block = Proc.new { |xxx| defined?(xxx) }
-        ret = block.call(1)
-        ret.should == 'local-variable'
-      end
+  ruby_version_is "1.9" do
+    it "returns 'local-variable' when defined? is called on a block var" do
+      block = Proc.new { |xxx| defined?(xxx) }
+      ret = block.call(1)
+      ret.should == 'local-variable'
     end
   end
 

Modified: MacRuby/trunk/spec/frozen/language/eigenclass_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/eigenclass_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/eigenclass_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -101,13 +101,6 @@
     end
   end
 
-  deviates_on(:rubinius) do 
-    it "is a MetaClass instance" do
-      cls = class << mock('x'); self; end
-      cls.is_a?(MetaClass).should == true
-    end
-
-  end
 end
 
 describe "A constant on an eigenclass" do

Modified: MacRuby/trunk/spec/frozen/language/file_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/file_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/file_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -11,7 +11,7 @@
     eval("__FILE__").should == "(eval)"
   end
 
-  ruby_version_is "".."1.9" do
+  ruby_version_is "".."1.8.7" do
     it "equals a relative path when required using a relative path" do
       base_path = File.dirname(File.dirname(fixture(__FILE__, "file.rb")))
       path = "fixtures/file.rb"
@@ -22,7 +22,7 @@
     end
   end
 
-  ruby_version_is "1.9" do
+  ruby_version_is "1.8.8".."1.9" do
     it "equals an absolute path when required using a relative path" do
       base_path = File.dirname(File.dirname(fixture(__FILE__, "file.rb")))
       path = "./fixtures/file.rb"

Modified: MacRuby/trunk/spec/frozen/language/fixtures/return.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/fixtures/return.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/fixtures/return.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -45,4 +45,44 @@
       ScratchPad.record :after_invoke2
     end
   end
+
+  class ThroughDefineMethod
+    lamb = proc { |x| x.call }
+    define_method :foo, lamb
+
+    def mp(&b); b; end
+
+    def outer
+      pr = mp { return :good }
+
+      foo(pr)
+      return :bad
+    end
+  end
+
+  class DefineMethod
+    lamb = proc { return :good }
+    define_method :foo, lamb
+
+    def outer
+      val = :bad
+
+      # This is tricky, but works. If lamb properly returns, then the
+      # return value will go into val before we run the ensure.
+      #
+      # If lamb's return keeps unwinding incorrectly, val will still
+      # have it's old value.
+      #
+      # We can therefore use val to figure out what happened.
+      begin
+        val = foo()
+      ensure
+        if val != :good
+          return :bad
+        end
+      end
+
+      return val
+    end
+  end
 end

Modified: MacRuby/trunk/spec/frozen/language/fixtures/super.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/fixtures/super.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/fixtures/super.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -80,6 +80,28 @@
     end
   end
 
+  class S5
+    def here
+      :good
+    end
+  end
+
+  class S6 < S5
+    def under
+      yield
+    end
+
+    def here
+      under {
+        super
+      }
+    end
+  end
+
+  class S7 < S5
+    define_method(:here) { super() }
+  end
+
   module MS1
     module ModA
       def foo(a)

Modified: MacRuby/trunk/spec/frozen/language/if_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/if_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/if_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -212,6 +212,36 @@
 
     if false then 123; else 456; end.should == 456
   end
+
+  describe "with a boolean range ('flip-flop' operator)" do
+    before :each do
+      ScratchPad.record []
+    end
+
+    after :each do
+      ScratchPad.clear
+    end
+
+    it "mimics an awk conditional with a single-element inclusive-end range" do
+      10.times { |i| ScratchPad << i if (i == 4)..(i == 4) }
+      ScratchPad.recorded.should == [4]
+    end
+
+    it "mimics an awk conditional with a many-element inclusive-end range" do
+      10.times { |i| ScratchPad << i if (i == 4)..(i == 7) }
+      ScratchPad.recorded.should == [4, 5, 6, 7]
+    end
+
+    it "mimics a sed conditional with a zero-element exclusive-end range" do
+      10.times { |i| ScratchPad << i if (i == 4)...(i == 4) }
+      ScratchPad.recorded.should == [4, 5, 6, 7, 8, 9]
+    end
+
+    it "mimics a sed conditional with a many-element exclusive-end range" do
+      10.times { |i| ScratchPad << i if (i == 4)...(i == 5) }
+      ScratchPad.recorded.should == [4, 5]
+    end
+  end
 end
 
 describe "The postfix if form" do
@@ -276,4 +306,4 @@
   end
 end
 
-language_version __FILE__, "if"
\ No newline at end of file
+language_version __FILE__, "if"

Modified: MacRuby/trunk/spec/frozen/language/metaclass_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/metaclass_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/metaclass_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -27,18 +27,6 @@
     cls.is_a?(Class).should == true
     cls.should_not equal(Object)
   end
-
-  deviates_on(:rubinius) do
-    it "is a MetaClass instance" do
-      cls = class << mock('x'); self; end
-      cls.is_a?(MetaClass).should == true
-    end
-
-    it "has the object's class as superclass" do
-      cls = class << "blah"; self; end
-      cls.superclass.should == String
-    end
-  end
 end
 
 describe "A constant on a metaclass" do
@@ -132,4 +120,4 @@
       CONST.should_not be_nil
     end
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/language/method_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/method_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/method_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -90,7 +90,7 @@
   it "with block argument converts the block to proc" do
     def makeproc(&b) b end
     makeproc { "hello" }.call.should == "hello"
-    makeproc { "hello" }.class.should == Proc
+    makeproc { "hello" }.should be_kind_of(Proc)
 
     # check that converted proc is indeed behaves like proc,
     # not like lambda

Modified: MacRuby/trunk/spec/frozen/language/next_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/next_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/next_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -87,49 +87,103 @@
     r([1]){next [*[1]]}
     r([1,2]){next [*[1,2]]}
   end
-  
-  it "assigns splatted objects" do
-    def r(val); a = yield(); val.should == a; end
-    r(nil){next *nil}
-    r(1){next *1}
-    r(nil){next *[]}
-    r(1){next *[1]}
-    r(nil){next *[nil]}
-    r([]){next *[[]]}
-    r(nil){next *[*[]]}
-    r(1){next *[*[1]]}
-    r([1,2]){next *[*[1,2]]}
+
+  ruby_version_is ""..."1.9" do
+    it "assigns splatted objects" do
+      def r(val); a = yield(); val.should == a; end
+      r(nil){next *nil}
+      r(1){next *1}
+      r(nil){next *[]}
+      r(1){next *[1]}
+      r(nil){next *[nil]}
+      r([]){next *[[]]}
+      r(nil){next *[*[]]}
+      r(1){next *[*[1]]}
+      r([1,2]){next *[*[1,2]]}
+    end
   end
-  
-  it "assigns objects to a splatted reference" do
-    def r(val); *a = yield(); val.should == a; end
-    r([nil]){next}
-    r([nil]){next nil}
-    r([1]){next 1}
-    r([[]]){next []}
-    r([[1]]){next [1]}
-    r([[nil]]){next [nil]}
-    r([[[]]]){next [[]]}
-    r([[1,2]]){next [1,2]}
-    r([[]]){next [*[]]}
-    r([[1]]){next [*[1]]}
-    r([[1,2]]){next [*[1,2]]}
+
+  ruby_version_is "1.9" do
+    it "assigns splatted objects" do
+      def r(val); a = yield(); val.should == a; end
+      r([]){next *nil}
+      r([1]){next *1}
+      r([]){next *[]}
+      r([1]){next *[1]}
+      r([nil]){next *[nil]}
+      r([[]]){next *[[]]}
+      r([]){next *[*[]]}
+      r([1]){next *[*[1]]}
+      r([1,2]){next *[*[1,2]]}
+    end
   end
-  
-  it "assigns splatted objects to a splatted reference via a splatted yield" do
-    def r(val); *a = *yield(); val.should == a; end
-    r([nil]){next *nil}
-    r([1]){next *1}
-    r([nil]){next *[]}
-    r([1]){next *[1]}
-    r([nil]){next *[nil]}
-    r([]){next *[[]]}
-    r([1,2]){next *[1,2]}
-    r([nil]){next *[*[]]}
-    r([1]){next *[*[1]]}
-    r([1,2]){next *[*[1,2]]}
+
+  ruby_version_is ""..."1.9" do
+    it "assigns objects to a splatted reference" do
+      def r(val); *a = yield(); val.should == a; end
+      r([nil]){next}
+      r([nil]){next nil}
+      r([1]){next 1}
+      r([[]]){next []}
+      r([[1]]){next [1]}
+      r([[nil]]){next [nil]}
+      r([[[]]]){next [[]]}
+      r([[1,2]]){next [1,2]}
+      r([[]]){next [*[]]}
+      r([[1]]){next [*[1]]}
+      r([[1,2]]){next [*[1,2]]}
+    end
   end
-  
+
+  ruby_version_is "1.9" do
+    it "assigns objects to a splatted reference" do
+      def r(val); *a = yield(); val.should == a; end
+      r([nil]){next}
+      r([nil]){next nil}
+      r([1]){next 1}
+      r([]){next []}
+      r([1]){next [1]}
+      r([nil]){next [nil]}
+      r([[]]){next [[]]}
+      r([1,2]){next [1,2]}
+      r([]){next [*[]]}
+      r([1]){next [*[1]]}
+      r([1,2]){next [*[1,2]]}
+    end
+  end
+
+  ruby_version_is ""..."1.9" do
+    it "assigns splatted objects to a splatted reference via a splatted yield" do
+      def r(val); *a = *yield(); val.should == a; end
+      r([nil]){next *nil}
+      r([1]){next *1}
+      r([nil]){next *[]}
+      r([1]){next *[1]}
+      r([nil]){next *[nil]}
+      r([]){next *[[]]}
+      r([1,2]){next *[1,2]}
+      r([nil]){next *[*[]]}
+      r([1]){next *[*[1]]}
+      r([1,2]){next *[*[1,2]]}
+    end
+  end
+
+  ruby_version_is "1.9" do
+    it "assigns splatted objects to a splatted reference via a splatted yield" do
+      def r(val); *a = *yield(); val.should == a; end
+      r([]){next *nil}
+      r([1]){next *1}
+      r([]){next *[]}
+      r([1]){next *[1]}
+      r([nil]){next *[nil]}
+      r([[]]){next *[[]]}
+      r([1,2]){next *[1,2]}
+      r([]){next *[*[]]}
+      r([1]){next *[*[1]]}
+      r([1,2]){next *[*[1,2]]}
+    end
+  end
+
   it "assigns objects to multiple variables" do
     def r(val); a,b,*c = yield(); val.should == [a,b,c]; end
     r([nil,nil,[]]){next}
@@ -145,19 +199,37 @@
     r([1,2,[]]){next [*[1,2]]}
   end
 
-  it "assigns splatted objects to multiple variables" do
-   def r(val); a,b,*c = *yield(); val.should == [a,b,c]; end
-   r([nil,nil,[]]){next *nil}
-   r([1,nil,[]]){next *1}
-   r([nil,nil,[]]){next *[]}
-   r([1,nil,[]]){next *[1]}
-   r([nil,nil,[]]){next *[nil]}
-   r([nil,nil,[]]){next *[[]]}
-   r([1,2,[]]){next *[1,2]}
-   r([nil,nil,[]]){next *[*[]]}
-   r([1,nil,[]]){next *[*[1]]}
-   r([1,2,[]]){next *[*[1,2]]}
- end
+  ruby_version_is ""..."1.9" do
+    it "assigns splatted objects to multiple variables" do
+      def r(val); a,b,*c = *yield(); val.should == [a,b,c]; end
+      r([nil,nil,[]]){next *nil}
+      r([1,nil,[]]){next *1}
+      r([nil,nil,[]]){next *[]}
+      r([1,nil,[]]){next *[1]}
+      r([nil,nil,[]]){next *[nil]}
+      r([nil,nil,[]]){next *[[]]}
+      r([1,2,[]]){next *[1,2]}
+      r([nil,nil,[]]){next *[*[]]}
+      r([1,nil,[]]){next *[*[1]]}
+      r([1,2,[]]){next *[*[1,2]]}
+    end
+  end
+
+  ruby_version_is "1.9" do
+    it "assigns splatted objects to multiple variables" do
+      def r(val); a,b,*c = *yield(); val.should == [a,b,c]; end
+      r([nil,nil,[]]){next *nil}
+      r([1,nil,[]]){next *1}
+      r([nil,nil,[]]){next *[]}
+      r([1,nil,[]]){next *[1]}
+      r([nil,nil,[]]){next *[nil]}
+      r([[],nil,[]]){next *[[]]}
+      r([1,2,[]]){next *[1,2]}
+      r([nil,nil,[]]){next *[*[]]}
+      r([1,nil,[]]){next *[*[1]]}
+      r([1,2,[]]){next *[*[1,2]]}
+    end
+  end
 end
 
-language_version __FILE__, "next"
\ No newline at end of file
+language_version __FILE__, "next"

Modified: MacRuby/trunk/spec/frozen/language/predefined_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/predefined_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/predefined_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -48,11 +48,11 @@
 describe "Predefined global $~" do
   it "is set to contain the MatchData object of the last match if successful" do
     md = /foo/.match 'foo'
-    $~.class.should == MatchData
+    $~.should be_kind_of(MatchData)
     $~.object_id.should == md.object_id
 
     /bar/ =~ 'bar'
-    $~.class.should == MatchData
+    $~.should be_kind_of(MatchData)
     $~.object_id.should_not == md.object_id
   end   
 
@@ -392,7 +392,7 @@
 
 describe "The predefined standard object nil" do
   it "is an instance of NilClass" do
-    nil.class.should == NilClass
+    nil.should be_kind_of(NilClass)
   end
   
   # this needs to be tested with a subprocess because
@@ -402,7 +402,7 @@
 
 describe "The predefined standard object true" do
   it "is an instance of TrueClass" do
-    true.class.should == TrueClass
+    true.should be_kind_of(TrueClass)
   end
   
   # this needs to be tested with a subprocess because
@@ -412,7 +412,7 @@
 
 describe "The predefined standard object false" do
   it "is an instance of FalseClass" do
-    false.class.should == FalseClass
+    false.should be_kind_of(FalseClass)
   end
   
   # this needs to be tested with a subprocess because

Modified: MacRuby/trunk/spec/frozen/language/regexp_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/regexp_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/regexp_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -13,7 +13,7 @@
   end
 
   it "yields a Regexp" do
-    /Hello/.class.should == Regexp
+    /Hello/.should be_kind_of(Regexp)
   end
   
   it "caches the Regexp object" do

Modified: MacRuby/trunk/spec/frozen/language/return_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/return_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/return_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -263,4 +263,14 @@
       f.should be_true
     end
   end
+
+  describe "within define_method" do
+    it "goes through the method via a closure" do
+      ReturnSpecs::ThroughDefineMethod.new.outer.should == :good
+    end
+
+    it "stops at the method when the return is used directly" do
+      ReturnSpecs::DefineMethod.new.outer.should == :good
+    end
+  end
 end

Added: MacRuby/trunk/spec/frozen/language/splat_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/splat_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/language/splat_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,182 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe "Splat operator" do
+  describe "used to assign a splatted object to an object" do
+    ruby_version_is ""..."1.9" do
+      it "assigns nil when the splatted object is nil" do
+        a = *nil; a.should == nil
+      end
+
+      it "assigns nil when the splatted object is an empty array" do
+        a = *[]; a.should == nil
+      end
+
+      it "assigns the splatted object when the splatted object doesn't respond to to_ary" do
+        a = *1; a.should == 1
+      end
+
+      it "assigns the first element of the returned value of to_ary when the splatted object responds to to_ary and it has one element" do
+        o = mock(Object)
+        o.should_receive(:to_ary).once.and_return(["foo"])
+        a = *o; a.should == "foo"
+      end
+
+      it "assigns nil when the content of the splatted array is nil" do
+        a = *[nil]; a.should == nil
+      end
+
+      it "assigns an empty array when the content of the splatted array is an empty array" do
+        a = *[[]]; a.should == []
+      end
+
+      it "assigns nil when the content of the splatted array is an empty splatted array" do
+        a = *[*[]]; a.should == nil
+      end
+
+      it "assign the content of the second splatted array when the splatted array contains a splatted array with one element" do
+        a = *[*[1]]; a.should == 1
+      end
+
+    end
+
+    ruby_version_is "1.9" do
+      it "assigns an empty array when the splatted object is nil" do
+        a = *nil; a.should == []
+      end
+
+      it "assigns an empty array when the splatted object is an empty array" do
+        a = *[]; a.should == []
+      end
+
+      it "assigns the splatted object contained into an array when the splatted object doesn't respond to to_a" do
+        a = *1; a.should == [1]
+      end
+
+      it "assigns the returned value of to_a when the splatted object responds to to_a" do
+        o = mock(Object)
+        o.should_receive(:to_a).once.and_return(["foo"])
+        a = *o; a.should == ["foo"]
+      end
+
+      it "assigns an array with nil object if the content of the splatted array is nil" do
+        a = *[nil]; a.should == [nil]
+      end
+
+      it "assings an array with an empty array when the splatted array contains an empty array" do
+        a = *[[]]; a.should == [[]]
+      end
+
+      it "assigns an empty array when the content of the splatted array is an empty splatted array" do
+        a = *[*[]]; a.should == []
+      end
+
+      it "assigns the second array when the content of the splatted array is a non empty splatted array" do
+        a = *[*[1]]; a.should == [1]
+      end
+    end
+
+    it "assigns the second array when the splatted array contains a splatted array with more than one element" do
+      a = *[*[1, 2]]; a.should == [1, 2]
+    end
+  end
+
+  describe "used to assign an object to a splatted reference" do
+    it "assigns an array with a nil object when the object is nil" do
+      *a = nil; a.should == [nil]
+    end
+
+    it "assigns an array containing the object when the object is not an array" do
+      *a = 1; a.should == [1]
+    end
+
+    ruby_version_is ""..."1.9" do
+      it "assigns an array wrapping the object when the object is not an splatted array" do
+        *a = []; a.should == [[]]
+        *a = [1]; a.should == [[1]]
+        *a = [nil]; a.should == [[nil]]
+        *a = [1,2]; a.should == [[1,2]]
+      end
+
+      it "assigns an array containing another array when the object is an array that contains an splatted array" do
+        *a = [*[]]; a.should == [[]]
+        *a = [*[1]]; a.should == [[1]]
+        *a = [*[1,2]]; a.should == [[1,2]]
+      end
+    end
+
+    ruby_version_is "1.9" do
+      it "assigns the object when the object is an array" do
+        *a = []; a.should == []
+        *a = [1]; a.should == [1]
+        *a = [nil]; a.should == [nil]
+        *a = [1,2]; a.should == [1,2]
+      end
+
+      it "assigns the splatted array when the object is an array that contains an splatted array" do
+        *a = [*[]]; a.should == []
+        *a = [*[1]]; a.should == [1]
+        *a = [*[1,2]]; a.should == [1,2]
+      end
+    end
+  end
+
+  describe "used to assign a splatted object to a splatted reference" do
+    it "assigns an empty array when the splatted object is an empty array" do
+      *a = *[]; a.should == []
+    end
+
+    it "assigns an array containing the splatted object when the splatted object is not an array" do
+      *a = *1; a.should == [1]
+    end
+
+    it "assigns an array when the splatted object is an array" do
+      *a = *[1,2]; a.should == [1,2]
+      *a = *[1]; a.should == [1]
+      *a = *[nil]; a.should == [nil]
+    end
+
+    it "assigns an empty array when the splatted object is an array that contains an empty splatted array" do
+      *a = *[*[]]; a.should == []
+      *a = *[*[1]]; a.should == [1]
+      *a = *[*[1,2]]; a.should == [1,2]
+    end
+
+    ruby_version_is ""..."1.9" do
+      it "assigns an array with a nil object when the splatted object is nil" do
+        *a = *nil; a.should == [nil]
+      end
+    end
+
+    ruby_version_is "1.9" do
+      it "assigns an empty array when the splatted object is nil" do
+        *a = *nil; a.should == []
+      end
+    end
+  end
+
+  describe "used to assign splatted objects to multiple block variables" do
+    it "assigns nil to normal variables but empty array to references when the splatted object is nil" do
+      a,b,*c = *nil; [a,b,c].should == [nil, nil, []]
+    end
+
+    it "assigns nil to normal variables but empty array to references when the splatted object is an empty array" do
+      a,b,*c = *[]; [a,b,c].should == [nil, nil, []]
+    end
+
+    it "assigns the splatted object to the first variable and behaves like nil when the splatted object is not an array" do
+      a,b,*c = *1; [a,b,c].should == [1, nil, []]
+    end
+
+    it "assigns array values to normal variables but arrays containing elements to references" do
+      a,b,*c = *[1,2,3]; [a,b,c].should == [1,2,[3]]
+    end
+
+    it "assigns and empty array to the variable if the splatted object contains an empty array" do
+      a,b,*c = *[[]]; [a,b,c].should == [[], nil, []]
+    end
+
+    it "assigns the values of a splatted array when the splatted object contains an splatted array" do
+      a,b,*c = *[*[1,2,3]]; [a,b,c].should == [1,2,[3]]
+    end
+  end
+end

Modified: MacRuby/trunk/spec/frozen/language/super_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/super_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/super_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -76,6 +76,14 @@
     end
   end
 
+  it "calls the superclass method when in a block" do
+    Super::S6.new.here.should == :good
+  end
+
+  it "calls the superclass method when initial method is defined_method'd" do
+    Super::S7.new.here.should == :good
+  end
+
   # MacRuby TODO: compile error
   # it "supers up appropriate name even if used for multiple method names" do
   #   sup = Class.new do

Modified: MacRuby/trunk/spec/frozen/language/symbol_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/symbol_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/symbol_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -41,17 +41,17 @@
 
   it "is converted to a literal, unquoted representation if the symbol contains only valid characters" do
     a, b, c = :'foo', :'+', :'Foo__9'
-    a.class.should == Symbol
+    a.should be_kind_of(Symbol)
     a.inspect.should == ':foo'
-    b.class.should == Symbol
+    b.should be_kind_of(Symbol)
     b.inspect.should == ':+'
-    c.class.should == Symbol
+    c.should be_kind_of(Symbol)
     c.inspect.should == ':Foo__9'
   end
 
   it "can be created by the %s-delimited expression" do
     a, b = :'foo bar', %s{foo bar}
-    b.class.should == Symbol
+    b.should be_kind_of(Symbol)
     b.inspect.should == ':"foo bar"'
     b.should == a
   end

Modified: MacRuby/trunk/spec/frozen/language/variables_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/variables_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/variables_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -227,6 +227,13 @@
     b.should == 1
   end
 
+  it "returns the rhs values used for assignment as an array" do
+    o = Object.new
+    def o.masgn; a, b, c = 1, 2, 3; end
+
+    o.masgn.should == [1,2,3]
+  end
+
   it "evaluates rhs left-to-right" do
     a = VariablesSpecs::ParAsgn.new
     d,e,f = a.inc, a.inc, a.inc

Modified: MacRuby/trunk/spec/frozen/language/versions/method_1.9.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/versions/method_1.9.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/versions/method_1.9.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -16,8 +16,45 @@
      fooP1O1RQ1(1,2).should == [1, 9, [], 2]
      fooP1O1RQ1(1,2,3).should == [1, 2, [], 3]
      fooP1O1RQ1(1,2,3,4).should == [1, 2, [3], 4]
+
+     def fooP1O1RQ2(a, b=9, *r, q, t); [a, b, r, q, t]; end
+     fooP1O1RQ2(1,2,3).should == [1, 9, [], 2, 3]
+     fooP1O1RQ2(1,2,3,4).should == [1, 2, [], 3, 4]
+     fooP1O1RQ2(1,2,3,4,5).should == [1, 2, [3], 4, 5]
   end
 
+  it "works with optional arguments not at the end" do
+    def fooO1P1(a=1, b); [a,b]; end
+    fooO1P1(0,1).should == [0,1]
+    fooO1P1(2).should == [1,2]
+
+    def fooP1O1P1(a,b=2,c); [a,b,c]; end
+    fooP1O1P1(2,3,4).should == [2,3,4]
+    fooP1O1P1(1,3).should == [1,2,3]
+
+    def fooP2O1P1(a,b,c=3,d); [a,b,c,d]; end
+    fooP2O1P1(1,2,4).should == [1,2,3,4]
+
+    def fooP2O2P1(a,b,c=3,d=4,e); [a,b,c,d,e]; end
+    fooP2O2P1(1,2,3,4,5).should == [1,2,3,4,5]
+    fooP2O2P1(1,2,3,5).should == [1,2,3,4,5]
+    fooP2O2P1(1,2,5).should == [1,2,3,4,5]
+
+    def fooO4P1(a=1,b=2,c=3,d=4,e); [a,b,c,d,e]; end
+    fooO4P1(1,2,3,4,5).should == [1,2,3,4,5]
+    fooO4P1(1,2,3,5).should == [1,2,3,4,5]
+    fooO4P1(1,2,5).should == [1,2,3,4,5]
+    fooO4P1(1,5).should == [1,2,3,4,5]
+    fooO4P1(5).should == [1,2,3,4,5]
+
+    def fooO4P2(a=1,b=2,c=3,d=4,e,f); [a,b,c,d,e,f]; end
+    fooO4P2(1,2,3,4,5,6).should == [1,2,3,4,5,6]
+    fooO4P2(1,2,3,5,6).should == [1,2,3,4,5,6]
+    fooO4P2(1,2,5,6).should == [1,2,3,4,5,6]
+    fooO4P2(1,5,6).should == [1,2,3,4,5,6]
+    fooO4P2(5,6).should == [1,2,3,4,5,6]
+  end
+
   it "works with block arguments" do
     def fooP0Q0B(&a); [a.(1)]; end
     fooP0Q0B() { |z| z }.should == [1]

Modified: MacRuby/trunk/spec/frozen/language/versions/symbol_1.9.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/versions/symbol_1.9.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/language/versions/symbol_1.9.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,7 +1,7 @@
 describe "A Symbol literal" do
   it "can be an empty string" do
     c = :''
-    c.class.should == Symbol
+    c.should be_kind_of(Symbol)
     c.inspect.should == ':""'
   end
 

Modified: MacRuby/trunk/spec/frozen/library/bigdecimal/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/bigdecimal/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/bigdecimal/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 describe "BigDecimal.new" do
 
   it "creates a new object of class BigDecimal" do
-    BigDecimal.new("3.14159").class.should == BigDecimal
+    BigDecimal.new("3.14159").should be_kind_of(BigDecimal)
     (0..9).each {|i|
       BigDecimal.new("1#{i}").should == 10 + i
       BigDecimal.new("-1#{i}").should == -10 - i

Modified: MacRuby/trunk/spec/frozen/library/bigdecimal/shared/to_int.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/bigdecimal/shared/to_int.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/bigdecimal/shared/to_int.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,9 +1,11 @@
 require 'bigdecimal'
 
 describe :bigdecimal_to_int , :shared => true do
-  it "returns nil if BigDecimal is infinity or NaN" do
-    BigDecimal("Infinity").send(@method).should == nil
-    BigDecimal("NaN").send(@method).should == nil
+  ruby_bug "fixed_in_ruby_1_8_7 at 25799", "1.8.7.202" do
+    it "returns nil if BigDecimal is infinity or NaN" do
+      BigDecimal("Infinity").send(@method).should == nil
+      BigDecimal("NaN").send(@method).should == nil
+    end
   end
 
   it "returns Integer or Bignum otherwise" do

Modified: MacRuby/trunk/spec/frozen/library/bigdecimal/to_f_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/bigdecimal/to_f_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/bigdecimal/to_f_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -20,9 +20,9 @@
   end
 
   it "returns number of type float" do
-    BigDecimal("3.14159").to_f.class.should == Float
-    @vals.each { |val| val.to_f.class.should == Float }
-    @spec_vals.each { |val| val.to_f.class.should == Float }
+    BigDecimal("3.14159").to_f.should be_kind_of(Float)
+    @vals.each { |val| val.to_f.should be_kind_of(Float) }
+    @spec_vals.each { |val| val.to_f.should be_kind_of(Float) }
   end
 
   it "Floating point rounding occurs" do
@@ -32,8 +32,11 @@
     @two.to_f.should == 2.0
     @three.to_f.should be_close(3.0, TOLERANCE)
     @one_minus.to_f.should == -1.0
+
+    # regression test for [ruby-talk:338957]
+    BigDecimal("10.03").to_f.should == 10.03
   end
-  
+
   it "properly handles special values" do
     @zero.to_f.should == 0
     @zero.to_f.to_s.should == "0.0"

Modified: MacRuby/trunk/spec/frozen/library/complex/math/shared/atan2.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/complex/math/shared/atan2.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/complex/math/shared/atan2.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -12,7 +12,7 @@
     Math.atan2(Complex(3, 4), Complex(3.5, -4)).should be_close(Complex(-0.641757436698881, 1.10829873031207), TOLERANCE)
   end
 
-  it "returns the arc tangeng for Complex and real numbers" do
+  it "returns the arc tangent for Complex and real numbers" do
     Math.atan2(Complex(3, 4), -7).should be_close(Complex(2.61576754731561, -0.494290673139855), TOLERANCE)
     Math.atan2(5, Complex(3.5, -4)).should be_close(Complex(0.739102348493673, 0.487821626522923), TOLERANCE)
   end

Modified: MacRuby/trunk/spec/frozen/library/complex/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/complex/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/complex/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,7 +6,7 @@
 
   describe "Complex.new" do
     it "returns a new Complex number" do
-      Complex.new(1, 2).class.should == Complex
+      Complex.new(1, 2).should be_kind_of(Complex)
     end
     
     it "raises a TypeError when one of the given arguments is not Numeric" do
@@ -22,7 +22,7 @@
 
   describe "Complex.new!" do
     it "returns a new Complex number" do
-      Complex.new(1, 2).class.should == Complex
+      Complex.new(1, 2).should be_kind_of(Complex)
     end
     
     it "defaults to 0 for the imaginery part" do

Modified: MacRuby/trunk/spec/frozen/library/date/strptime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/date/strptime_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/date/strptime_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,67 +3,67 @@
 
 describe "Date#strptime" do
 
-  it "should be able to parse without arguments" do
+  it "returns January 1, 4713 BCE when given no arguments" do
     Date.strptime.should == Date.civil(-4712, 1, 1)
   end
 
-  it "should be able to parse the default date format" do
+  it "uses the default format when not given a date format" do
     Date.strptime("2000-04-06").should == Date.civil(2000, 4, 6)
     Date.civil(2000, 4, 6).strftime.should == Date.civil(2000, 4, 6).to_s
   end
 
-  it "should be able to parse the full day name" do
+  it "parses a full day name" do
     d = Date.today
+    expected_date = Date.commercial(d.cwyear, d.cweek, 4)
     # strptime assumed week that start on sunday, not monday
-    week = d.cweek
-    week += 1 if d.cwday == 7
-    Date.strptime("Thursday", "%A").should == Date.commercial(d.cwyear, week, 4)
+    expected_date += 7 if d.cwday == 7
+    Date.strptime("Thursday", "%A").should == expected_date
   end
 
-  it "should be able to parse the short day name" do
+  it "parses a short day name" do
     d = Date.today
+    expected_date = Date.commercial(d.cwyear, d.cweek, 4)
     # strptime assumed week that start on sunday, not monday
-    week = d.cweek
-    week += 1 if d.cwday == 7
-    Date.strptime("Thu", "%a").should == Date.commercial(d.cwyear, week, 4)
+    expected_date += 7 if d.cwday == 7
+    Date.strptime("Thu", "%a").should == expected_date
   end
 
-  it "should be able to parse the full month name" do
+  it "parses a full month name" do
     d = Date.today
     Date.strptime("April", "%B").should == Date.civil(d.year, 4, 1)
   end
 
-  it "should be able to parse the short month name" do
+  it "parses a short month name" do
     d = Date.today
     Date.strptime("Apr", "%b").should == Date.civil(d.year, 4, 1)
     Date.strptime("Apr", "%h").should == Date.civil(d.year, 4, 1)
   end
 
-  it "should be able to parse the century" do
+  it "parses a century" do
     Date.strptime("06 20", "%y %C").should == Date.civil(2006, 1, 1)
   end
 
-  it "should be able to parse the month day with leading zeroes" do
+  it "parses a month day with leading zeroes" do
     d = Date.today
     Date.strptime("06", "%d").should == Date.civil(d.year, d.month, 6)
   end
 
-  it "should be able to parse the month day with leading spaces" do
+  it "parses a month day with leading spaces" do
     d = Date.today
     Date.strptime(" 6", "%e").should == Date.civil(d.year, d.month, 6)
   end
 
-  it "should be able to parse the commercial year with leading zeroes" do
+  it "parses a commercial year with leading zeroes" do
     Date.strptime("2000", "%G").should == Date.civil(2000,  1,  3)
     Date.strptime("2002", "%G").should == Date.civil(2001, 12, 31)
   end
 
-  it "should be able to parse the commercial year with only two digits" do
+  it "parses a commercial year with only two digits" do
     Date.strptime("68", "%g").should == Date.civil(2068,  1,  2)
     Date.strptime("69", "%g").should == Date.civil(1968, 12, 30)
   end
 
-  it "should be able to parse the year day with leading zeroes" do
+  it "parses a year day with leading zeroes" do
     d = Date.today
     if Date.gregorian_leap?(Date.today.year)
       Date.strptime("097", "%j").should == Date.civil(d.year, 4, 6)
@@ -72,37 +72,42 @@
     end
   end
 
-  it "should be able to parse the month with leading zeroes" do
+  it "parses a month with leading zeroes" do
     d = Date.today
     Date.strptime("04", "%m").should == Date.civil(d.year, 4, 1)
   end
 
-  it "should be able to show the week number with the week starting on sunday and monday" do
-    d = Date.today
-    Date.strptime("14", "%U").should == Date.commercial(d.cwyear, 14, 7)
-    Date.strptime("14", "%W").should == Date.commercial(d.cwyear, 15, 7)
+  it "parses a week number for a week starting on Sunday" do
+    Date.strptime("2010/1", "%Y/%U").should == Date.civil(2010, 1, 3)
   end
-  
-  it "should be able to show the commercial week day" do
+
+  # See http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=24500
+  ruby_bug "http://redmine.ruby-lang.org/issues/show/2556", "1.8" do
+    it "parses a week number for a week starting on Monday" do
+      Date.strptime("2010/1", "%Y/%W").should == Date.civil(2010, 1, 4)
+    end
+  end
+
+  it "parses a commercial week day" do
     Date.strptime("2008 1", "%G %u").should == Date.civil(2007, 12, 31)
   end
 
-  it "should be able to show the commercial week" do
-    d = Date.commercial(Date.today.year,1,1)
+  it "parses a commercial week" do
+    d = Date.commercial(Date.today.cwyear,1,1)
     Date.strptime("1", "%V").should == d
     Date.strptime("15", "%V").should == Date.commercial(d.cwyear, 15, 1)
   end
-  
-  it "should be able to show the week day" do
+
+  it "parses a week day" do
     d = Date.today
     Date.strptime("2007 4", "%Y %w").should == Date.civil(2007, 1, 4)
   end
 
-  it "should be able to show the year in YYYY format" do
+  it "parses a year in YYYY format" do
     Date.strptime("2007", "%Y").should == Date.civil(2007, 1, 1)
   end
 
-  it "should be able to show the year in YY format" do
+  it "parses a year in YY format" do
     Date.strptime("00", "%y").should == Date.civil(2000, 1, 1)
   end
 
@@ -110,32 +115,32 @@
   # Specs that combine stuff #
   ############################
 
-  it "should be able to parse the date in full" do
+  it "parses a full date" do
     Date.strptime("Thu Apr  6 00:00:00 2000", "%c").should == Date.civil(2000, 4, 6)
     Date.strptime("Thu Apr  6 00:00:00 2000", "%a %b %e %H:%M:%S %Y").should == Date.civil(2000, 4, 6)
   end
 
-  it "should be able to parse the date with slashes" do
+  it "parses a date with slashes" do
     Date.strptime("04/06/00", "%D").should == Date.civil(2000, 4, 6)
     Date.strptime("04/06/00", "%m/%d/%y").should == Date.civil(2000, 4, 6)
   end
 
-  it "should be able to parse the date as YYYY-MM-DD" do
+  it "parses a date given as YYYY-MM-DD" do
     Date.strptime("2000-04-06", "%F").should == Date.civil(2000, 4, 6)
     Date.strptime("2000-04-06", "%Y-%m-%d").should == Date.civil(2000, 4, 6)
   end
 
-  it "should be able to show the commercial week" do
+  it "parses a commercial week" do
     Date.strptime(" 9-Apr-2000", "%v").should == Date.civil(2000, 4, 9)
     Date.strptime(" 9-Apr-2000", "%e-%b-%Y").should == Date.civil(2000, 4, 9)
   end
   
-  it "should be able to show MM/DD/YY" do
+  it "parses a date given MM/DD/YY" do
     Date.strptime("04/06/00", "%x").should == Date.civil(2000, 4, 6)
     Date.strptime("04/06/00", "%m/%d/%y").should == Date.civil(2000, 4, 6)
   end
   
-  it "should be able to show a full notation" do
+  it "parses a date given in full notation" do
     Date.strptime("Sun Apr  9 00:00:00 +00:00 2000", "%+").should == Date.civil(2000, 4, 9)
     Date.strptime("Sun Apr  9 00:00:00 +00:00 2000", "%a %b %e %H:%M:%S %Z %Y").should == Date.civil(2000, 4, 9)
   end

Added: MacRuby/trunk/spec/frozen/library/delegate/marshal_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/delegate/marshal_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/delegate/marshal_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,23 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require 'delegate'
+
+describe "SimpleDelegator" do
+  before :each do
+    @obj = "hello"
+    @delegate = SimpleDelegator.new(@obj)
+  end
+
+  it "can be marshalled" do
+    m = Marshal.load(Marshal.dump(@delegate))
+    m.class.should == SimpleDelegator
+    (m == @obj).should be_true
+  end
+
+  ruby_bug "redmine:1744", "1.8.7" do
+    it "can be marshalled with its instance variables intact" do
+      @delegate.instance_variable_set(:@foo, "bar")
+      m = Marshal.load(Marshal.dump(@delegate))
+      m.instance_variable_get(:@foo).should == "bar"
+    end
+  end
+end

Modified: MacRuby/trunk/spec/frozen/library/ftools/chmod_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/ftools/chmod_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/ftools/chmod_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,26 +2,29 @@
 
 ruby_version_is ""..."1.9" do
 
-  require 'ftools'
+  # the tests below are windows-hostile
+  platform_is_not :windows do
+    require 'ftools'
 
-  describe "File.chmod" do
-    before(:each) do
-      (1..2).each do |n|
-        system "echo 'hello rubinius' > chmod_test_#{n}"
-        system "chmod 0777 chmod_test_#{n}"
+    describe "File.chmod" do
+      before(:each) do
+        (1..2).each do |n|
+          system "echo 'hello rubinius' > chmod_test_#{n}"
+          system "chmod 0777 chmod_test_#{n}"
+        end
       end
+
+      after(:each) do
+        (1..2).each { |n| File.unlink "chmod_test_#{n}" rescue nil }
+      end
+
+      it "changes the mode to 1st arg for files in 2nd arg" do
+        `ls -l chmod_test_1`.should =~ /^-rwxrwxrwx /
+        `ls -l chmod_test_2`.should =~ /^-rwxrwxrwx /
+        File.chmod 0644, "chmod_test_1", "chmod_test_2"
+        `ls -l chmod_test_1`.should =~ /^-rw-r--r-- /
+        `ls -l chmod_test_2`.should =~ /^-rw-r--r-- /
+      end
     end
-    
-    after(:each) do
-      (1..2).each { |n| File.unlink "chmod_test_#{n}" rescue nil }
-    end
-    
-    it "changes the mode to 1st arg for files in 2nd arg" do
-      `ls -l chmod_test_1`.should =~ /^-rwxrwxrwx /
-      `ls -l chmod_test_2`.should =~ /^-rwxrwxrwx /
-      File.chmod 0644, "chmod_test_1", "chmod_test_2"
-      `ls -l chmod_test_1`.should =~ /^-rw-r--r-- /
-      `ls -l chmod_test_2`.should =~ /^-rw-r--r-- /
-    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/ftools/copy_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/ftools/copy_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/ftools/copy_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,10 +6,14 @@
 
   describe "File.copy" do
     before(:each) do
-      system "echo 'hello rubinius' > copy_test"
-      system "chmod a+x copy_test"
+      File.open('copy_test', 'w+') do |f|
+        f.puts('hello rubinius')
+      end
+      platform_is_not :windows do
+        system "chmod a+x copy_test"
+      end
     end
-    
+
     after(:each) do
       File.unlink "copy_test"
       File.unlink "copy_test_dest" rescue nil

Modified: MacRuby/trunk/spec/frozen/library/ftools/install_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/ftools/install_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/ftools/install_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,20 +4,23 @@
   
   require 'ftools'
 
-  describe "File.install" do
-    before(:each) do
-      system "echo 'hello rubinius' > install_test_1"
-      system "chmod 0777 install_test_1"
+  # the tests below are windows-hostile
+  platform_is_not :windows do
+    describe "File.install" do
+      before(:each) do
+        system "echo 'hello rubinius' > install_test_1"
+        system "chmod 0777 install_test_1"
+      end
+
+      after(:each) do
+        (1..2).each { |n| File.unlink "install_test_#{n}" rescue nil }
+      end
+
+      it "changes the mode to 1st arg for files in 2nd arg" do
+        `ls -l install_test_1`.should =~ /^-rwxrwxrwx /
+        File.install "install_test_1", "install_test_2", 0644
+        `ls -l install_test_2`.should =~ /^-rw-r--r-- /
+      end
     end
-    
-    after(:each) do
-      (1..2).each { |n| File.unlink "install_test_#{n}" rescue nil }
-    end
-    
-    it "changes the mode to 1st arg for files in 2nd arg" do
-      `ls -l install_test_1`.should =~ /^-rwxrwxrwx /
-      File.install "install_test_1", "install_test_2", 0644
-      `ls -l install_test_2`.should =~ /^-rw-r--r-- /
-    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/ftools/makedirs_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/ftools/makedirs_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/ftools/makedirs_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,21 +5,21 @@
   require 'ftools'
 
   describe "File.makedirs" do
-    before(:each) do
+    before :each do
+      @dir = tmp "file_makedirs"
     end
-    
+
     after(:each) do
-      FileUtils.rm_rf("makedirs_test")
-      flunk if File.exist?("makedirs_test")
+      rm_r @dir
     end
-    
+
     it "creates the dirs from arg" do
-      File.exist?("makedirs_test").should == false
-      File.makedirs("makedirs_test/second_dir")
-      File.exist?("makedirs_test").should == true
-      File.directory?("makedirs_test").should == true
-      File.exist?("makedirs_test/second_dir").should == true
-      File.directory?("makedirs_test/second_dir").should == true
+      File.exist?(@dir).should == false
+      File.makedirs("#{@dir}/second_dir")
+      File.exist?(@dir).should == true
+      File.directory?(@dir).should == true
+      File.exist?("#{@dir}/second_dir").should == true
+      File.directory?("#{@dir}/second_dir").should == true
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/ftools/move_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/ftools/move_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/ftools/move_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,15 +6,19 @@
 
   describe "File.move" do
     before(:each) do
-      system "echo 'hello rubinius' > move_test"
-      system "chmod a+x move_test"
+      File.open('move_test', 'w+') do |f|
+        f.puts('hello rubinius')
+      end
+      platform_is_not :windows do
+        system "chmod a+x move_test"
+      end
     end
-    
+
     after(:each) do
       File.unlink "move_test_dest"
       File.unlink "move_test" rescue nil
     end
-    
+
     it "moves the file at 1st arg to the file at 2nd arg" do
       omode = File.stat("move_test").mode
       File.move("move_test", "move_test_dest")

Modified: MacRuby/trunk/spec/frozen/library/ftools/syscopy_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/ftools/syscopy_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/ftools/syscopy_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,15 +6,19 @@
 
   describe "File.syscopy" do
     before(:each) do
-      system "echo 'hello rubinius' > syscopy_test"
-      system "chmod a+x syscopy_test"
+      File.open('syscopy_test', 'w+') do |f|
+        f.puts('hello rubinius')
+      end
+      platform_is_not :windows do
+        system "chmod a+x syscopy_test"
+      end
     end
-    
+
     after(:each) do
       File.unlink "syscopy_test"
       File.unlink "syscopy_test_dest" rescue nil
     end
-    
+
     it "copies the file at 1st arg to the file at 2nd arg" do
       File.syscopy("syscopy_test", "syscopy_test_dest")
       fd = File.open("syscopy_test_dest")

Modified: MacRuby/trunk/spec/frozen/library/iconv/shared/new.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/iconv/shared/new.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/iconv/shared/new.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -14,7 +14,7 @@
   it "when called from a subclass of Iconv instantiates an object of that class" do
     obj = IconvSpecs::IconvSubclass.send(@method, "us-ascii", "us-ascii")
     begin
-      obj.class.should == IconvSpecs::IconvSubclass
+      obj.should be_kind_of(IconvSpecs::IconvSubclass)
     ensure
       obj.close
     end

Modified: MacRuby/trunk/spec/frozen/library/logger/application/log_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/application/log_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/application/log_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -60,6 +60,7 @@
   end
 
   after :all do
+    @log_file.close
     File.unlink(@file_path) if File.exists?(@file_path)
   end
 

Modified: MacRuby/trunk/spec/frozen/library/logger/logger/add_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/logger/add_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/logger/add_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,6 +9,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end

Modified: MacRuby/trunk/spec/frozen/library/logger/logger/datetime_format_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/logger/datetime_format_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/logger/datetime_format_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,6 +9,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end
@@ -32,6 +33,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end

Modified: MacRuby/trunk/spec/frozen/library/logger/logger/debug_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/logger/debug_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/logger/debug_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,6 +9,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end
@@ -32,6 +33,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end

Modified: MacRuby/trunk/spec/frozen/library/logger/logger/error_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/logger/error_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/logger/error_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,6 +9,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end
@@ -32,6 +33,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end

Modified: MacRuby/trunk/spec/frozen/library/logger/logger/fatal_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/logger/fatal_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/logger/fatal_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,6 +9,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end
@@ -32,6 +33,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end

Modified: MacRuby/trunk/spec/frozen/library/logger/logger/info_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/logger/info_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/logger/info_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,6 +9,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end
@@ -32,6 +33,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end

Modified: MacRuby/trunk/spec/frozen/library/logger/logger/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/logger/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/logger/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -24,16 +24,17 @@
 
      @log_file.rewind
      LoggerSpecs::strip_date(@log_file.readline).should == "WARN -- : Test message\n"
+     l.close
    end
 
   it "receives a frequency rotation as second argument" do
-     lambda { Logger.new(@log_file, "daily")}.should_not raise_error
-     lambda { Logger.new(@log_file, "weekly")}.should_not raise_error
-     lambda { Logger.new(@log_file, "monthly")}.should_not raise_error
+     lambda { Logger.new(@log_file, "daily") }.should_not raise_error
+     lambda { Logger.new(@log_file, "weekly") }.should_not raise_error
+     lambda { Logger.new(@log_file, "monthly") }.should_not raise_error
   end
   
   it "also receives a number of log files to keep as second argument" do
-    lambda { Logger.new(@log_file, 1)}.should_not raise_error
+    lambda { Logger.new(@log_file, 1).close }.should_not raise_error
   end
 
   it "receivs a maximum logfile size as third argument" do
@@ -49,9 +50,14 @@
     File.exists?(path + ".0").should be_true 
 
     # first line will be a comment so we'll have to skip it.
-    LoggerSpecs::strip_date(File.open(path + ".0").readlines.last).should == "WARN -- : foo\n"
-    LoggerSpecs::strip_date(File.open(path).readlines.last).should == "WARN -- : bar\n"
+    f = File.open(path)
+    f1 = File.open(path + ".0")
+    LoggerSpecs::strip_date(f1.readlines.last).should == "WARN -- : foo\n"
+    LoggerSpecs::strip_date(f.readlines.last).should == "WARN -- : bar\n"
 
+    l.close
+    f.close
+    f1.close
     File.unlink(path)
     File.unlink(path + ".0")
   end

Modified: MacRuby/trunk/spec/frozen/library/logger/logger/unknown_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/logger/unknown_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/logger/unknown_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,6 +9,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end

Modified: MacRuby/trunk/spec/frozen/library/logger/logger/warn_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/logger/logger/warn_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/logger/logger/warn_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,6 +9,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end
@@ -32,6 +33,7 @@
   end
 
   after :each do
+    @logger.close
     @log_file.close unless @log_file.closed?
     File.unlink(@path) if File.exists?(@path)
   end

Modified: MacRuby/trunk/spec/frozen/library/mathn/bignum/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/bignum/exponent_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/mathn/bignum/exponent_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -11,8 +11,10 @@
     (@bignum ** 1.2).should be_close(57262152889751597425762.57804, TOLERANCE)
   end
 
-  it "returns a complex number when negative and raised to a fractional power" do
-    ((- at bignum) ** (1/3)).should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
-    ((- at bignum) ** (1.0/3)).should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
+  ruby_version_is '1.9' do
+    it "returns a complex number when negative and raised to a fractional power" do
+      ((- at bignum) ** (1/3)).should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
+      ((- at bignum) ** (1.0/3)).should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
+    end
   end
 end

Added: MacRuby/trunk/spec/frozen/library/mathn/complex/Complex_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/complex/Complex_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/mathn/complex/Complex_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,13 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+require 'mathn'
+
+ruby_version_is '1.9' do
+  describe 'Kernel#Complex' do
+    it 'returns an Integer if imaginary part is 0' do
+      Complex(42,0).should == 42
+      Complex(42,0).should be_kind_of(Fixnum)
+      Complex(bignum_value,0).should == bignum_value
+      Complex(bignum_value,0).should be_kind_of(Bignum)
+    end
+  end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/mathn/fixnum/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/fixnum/exponent_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/mathn/fixnum/exponent_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,8 +7,10 @@
     (2 ** 1.2).should be_close(2.2973967, TOLERANCE)
   end
 
-  it "returns a complex number when negative and raised to a fractional power" do
-    ((-8) ** (1/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
-    ((-8) ** (1.0/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+  ruby_version_is '1.9' do
+    it "returns a complex number when negative and raised to a fractional power" do
+      ((-8) ** (1/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+      ((-8) ** (1.0/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/mathn/float/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/float/exponent_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/mathn/float/exponent_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,8 +7,10 @@
     (2.0 ** 1.2).should be_close(2.2973967, TOLERANCE)
   end
 
-  it "returns a complex number when negative and raised to a fractional power" do
-    ((-8.0) ** (1/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
-    ((-8.0) ** (1.0/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+  ruby_version_is '1.9' do
+    it "returns a complex number when negative and raised to a fractional power" do
+      ((-8.0) ** (1/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+      ((-8.0) ** (1.0/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/mathn/integer/gcd2_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/integer/gcd2_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/mathn/integer/gcd2_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,16 +1,18 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
 require 'mathn'
 
-describe "Integer#gcd2" do
-  it "Returns the greatest common divisor of the two numbers" do
-    15.gcd2(5).should == 5
-    15.gcd2(-6).should == 3
-    -23.gcd2(19).should == 1
-    -10.gcd2(-2).should == 2
-  end
+ruby_version_is ''...'1.9' do
+  describe "Integer#gcd2" do
+    it "Returns the greatest common divisor of the two numbers" do
+      15.gcd2(5).should == 5
+      15.gcd2(-6).should == 3
+      -23.gcd2(19).should == 1
+      -10.gcd2(-2).should == 2
+    end
 
-  it "raises a ZeroDivisionError when is called on zero" do
-    lambda { 0.gcd2(2) }.should raise_error(ZeroDivisionError)
-    lambda { 2.gcd2(0) }.should raise_error(ZeroDivisionError)
+    it "raises a ZeroDivisionError when is called on zero" do
+      lambda { 0.gcd2(2) }.should raise_error(ZeroDivisionError)
+      lambda { 2.gcd2(0) }.should raise_error(ZeroDivisionError)
+    end
   end
-end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/mathn/prime/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/prime/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/mathn/prime/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Prime.new" do
   it "returns a new Prime number" do
-    Prime.new.class.should == Prime
+    Prime.new.should be_kind_of(Prime)
   end
    
   it "raises a TypeError when is called with some arguments" do

Added: MacRuby/trunk/spec/frozen/library/mathn/rational/Rational_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/rational/Rational_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/mathn/rational/Rational_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,13 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+require 'mathn'
+
+ruby_version_is '1.9' do
+  describe 'Kernel#Rational' do
+    it 'returns an Integer if denominator divides numerator evenly' do
+      Rational(42,6).should == 7
+      Rational(42,6).should be_kind_of(Fixnum)
+      Rational(bignum_value,1).should == bignum_value
+      Rational(bignum_value,1).should be_kind_of(Bignum)
+    end
+  end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/mathn/rational/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/rational/exponent_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/mathn/rational/exponent_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,69 +1,71 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
 require 'mathn'
 
-describe "Rational#** when passed [Rational]" do
-  it "returns Rational.new!(1, 1) when the passed argument is 0" do
-    (Rational.new!(3, 4) ** Rational.new!(0, 3)).should == Rational.new!(1,1)
-    (Rational.new!(-3, 4) ** Rational.new!(0, 3)).should == Rational.new!(1,1)
-    (Rational.new!(3, -4) ** Rational.new!(0, 3)).should == Rational.new!(1,1)
-    (Rational.new!(3, 4) ** Rational.new!(0, -3)).should == Rational.new!(1,1)
-  end
+ruby_version_is ''...'1.9' do
+  describe "Rational#** when passed [Rational]" do
+    it "returns Rational.new!(1, 1) when the passed argument is 0" do
+      (Rational.new!(3, 4) ** Rational.new!(0, 3)).should == Rational.new!(1,1)
+      (Rational.new!(-3, 4) ** Rational.new!(0, 3)).should == Rational.new!(1,1)
+      (Rational.new!(3, -4) ** Rational.new!(0, 3)).should == Rational.new!(1,1)
+      (Rational.new!(3, 4) ** Rational.new!(0, -3)).should == Rational.new!(1,1)
+    end
 
-  it "returns Rational.new!(1, 1) when self is 1" do
-    (Rational.new!(1,1) ** Rational.new!(2, 3)).should == Rational.new!(1,1)
-    (Rational.new!(1,1) ** Rational.new!(-2, 3)).should == Rational.new!(1,1)
-    (Rational.new!(1,1) ** Rational.new!(2, -3)).should == Rational.new!(1,1)
-    (Rational.new!(1,1) ** Rational.new!(-2, -3)).should == Rational.new!(1,1)
-  end
+    it "returns Rational.new!(1, 1) when self is 1" do
+      (Rational.new!(1,1) ** Rational.new!(2, 3)).should == Rational.new!(1,1)
+      (Rational.new!(1,1) ** Rational.new!(-2, 3)).should == Rational.new!(1,1)
+      (Rational.new!(1,1) ** Rational.new!(2, -3)).should == Rational.new!(1,1)
+      (Rational.new!(1,1) ** Rational.new!(-2, -3)).should == Rational.new!(1,1)
+    end
 
-  it "returns Rational.new!(0, 1) when self is 0" do
-    (Rational.new!(0,1) ** Rational.new!(2, 3)).should == Rational.new!(0,1)
-    (Rational.new!(0,1) ** Rational.new!(-2, 3)).should == Rational.new!(0,1)
-    (Rational.new!(0,1) ** Rational.new!(2, -3)).should == Rational.new!(0,1)
-    (Rational.new!(0,1) ** Rational.new!(-2, -3)).should == Rational.new!(0,1)
-  end
+    it "returns Rational.new!(0, 1) when self is 0" do
+      (Rational.new!(0,1) ** Rational.new!(2, 3)).should == Rational.new!(0,1)
+      (Rational.new!(0,1) ** Rational.new!(-2, 3)).should == Rational.new!(0,1)
+      (Rational.new!(0,1) ** Rational.new!(2, -3)).should == Rational.new!(0,1)
+      (Rational.new!(0,1) ** Rational.new!(-2, -3)).should == Rational.new!(0,1)
+    end
 
-  it "returns a Complex number when self is negative" do
-    (Rational.new!(-1,2) ** Rational.new!(2, 3)).should be_close(Complex(-0.314980262473718, 0.545561817985861), TOLERANCE)
-    (Rational.new!(-1,2) ** Rational.new!(-2, 3)).should be_close(Complex(-0.793700525984099, -1.3747296369986), TOLERANCE)
-    (Rational.new!(-1,2) ** Rational.new!(2, -3)).should be_close(Complex(-0.793700525984099, -1.3747296369986), TOLERANCE)
+    it "returns a Complex number when self is negative" do
+      (Rational.new!(-1,2) ** Rational.new!(2, 3)).should be_close(Complex(-0.314980262473718, 0.545561817985861), TOLERANCE)
+      (Rational.new!(-1,2) ** Rational.new!(-2, 3)).should be_close(Complex(-0.793700525984099, -1.3747296369986), TOLERANCE)
+      (Rational.new!(-1,2) ** Rational.new!(2, -3)).should be_close(Complex(-0.793700525984099, -1.3747296369986), TOLERANCE)
+    end
   end
-end
 
-describe "Rational#** when passed [Integer]" do
-  it "returns the Rational value of self raised to the passed argument" do
-    (Rational.new!(3, 4) ** 4).should == Rational.new!(81, 256)
-    (Rational.new!(3, 4) ** -4).should == Rational.new!(256, 81)
-    (Rational.new!(-3, 4) ** -4).should == Rational.new!(256, 81)
-    (Rational.new!(3, -4) ** -4).should == Rational.new!(256, 81)
-  end
-  
-  it "returns Rational.new!(1, 1) when the passed argument is 0" do
-    (Rational.new!(3, 4) ** 0).should == Rational.new!(1, 1)
-    (Rational.new!(-3, 4) ** 0).should == Rational.new!(1, 1)
-    (Rational.new!(3, -4) ** 0).should == Rational.new!(1, 1)
+  describe "Rational#** when passed [Integer]" do
+    it "returns the Rational value of self raised to the passed argument" do
+      (Rational.new!(3, 4) ** 4).should == Rational.new!(81, 256)
+      (Rational.new!(3, 4) ** -4).should == Rational.new!(256, 81)
+      (Rational.new!(-3, 4) ** -4).should == Rational.new!(256, 81)
+      (Rational.new!(3, -4) ** -4).should == Rational.new!(256, 81)
+    end
 
-    (Rational.new!(bignum_value, 4) ** 0).should == Rational.new!(1, 1)
-    (Rational.new!(3, -bignum_value) ** 0).should == Rational.new!(1, 1)
+    it "returns Rational.new!(1, 1) when the passed argument is 0" do
+      (Rational.new!(3, 4) ** 0).should == Rational.new!(1, 1)
+      (Rational.new!(-3, 4) ** 0).should == Rational.new!(1, 1)
+      (Rational.new!(3, -4) ** 0).should == Rational.new!(1, 1)
+
+      (Rational.new!(bignum_value, 4) ** 0).should == Rational.new!(1, 1)
+      (Rational.new!(3, -bignum_value) ** 0).should == Rational.new!(1, 1)
+    end
   end
-end
 
-describe "Rational#** when passed [Float]" do
-  it "returns self converted to Float and raised to the passed argument" do
-    (Rational.new!(3, 1) ** 3.0).should == 27.0
-    (Rational.new!(3, 1) ** 1.5).should be_close(5.19615242270663, TOLERANCE)
-    (Rational.new!(3, 1) ** -1.5).should be_close(0.192450089729875, TOLERANCE)
+  describe "Rational#** when passed [Float]" do
+    it "returns self converted to Float and raised to the passed argument" do
+      (Rational.new!(3, 1) ** 3.0).should == 27.0
+      (Rational.new!(3, 1) ** 1.5).should be_close(5.19615242270663, TOLERANCE)
+      (Rational.new!(3, 1) ** -1.5).should be_close(0.192450089729875, TOLERANCE)
+    end
+
+    it "returns 1.0 when the passed argument is 0" do
+      (Rational.new!(3, 4) ** 0.0).should == 1.0
+      (Rational.new!(-3, 4) ** 0.0).should == 1.0
+      (Rational.new!(-3, 4) ** 0.0).should == 1.0
+    end
+
+    it "returns NaN if self is negative and the passed argument is not 0" do
+      (Rational.new!(-3, 2) ** 1.5).nan?.should be_true
+      (Rational.new!(3, -2) ** 1.5).nan?.should be_true
+      (Rational.new!(3, -2) ** -1.5).nan?.should be_true
+    end
   end
-  
-  it "returns 1.0 when the passed argument is 0" do
-    (Rational.new!(3, 4) ** 0.0).should == 1.0
-    (Rational.new!(-3, 4) ** 0.0).should == 1.0
-    (Rational.new!(-3, 4) ** 0.0).should == 1.0
-  end
-  
-  it "returns NaN if self is negative and the passed argument is not 0" do
-    (Rational.new!(-3, 2) ** 1.5).nan?.should be_true
-    (Rational.new!(3, -2) ** 1.5).nan?.should be_true
-    (Rational.new!(3, -2) ** -1.5).nan?.should be_true
-  end
-end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/mathn/rational/inspect_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/rational/inspect_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/mathn/rational/inspect_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,11 +2,23 @@
 require 'mathn'
 
 describe "Rational#inspect" do
-  it "returns a string representation of self" do
-    Rational.new!(3, 4).inspect.should == "3/4"
-    Rational.new!(-5, 8).inspect.should == "-5/8"
-    Rational.new!(-1, -2).inspect.should == "1/2"
-    Rational.new!(0, 2).inspect.should == "0/2"
-    Rational.new!(bignum_value, 1).inspect.should == "#{bignum_value}/1"
+  ruby_version_is ''...'1.9' do
+    it "returns a string representation of self" do
+      Rational.new!(3, 4).inspect.should == "3/4"
+      Rational.new!(-5, 8).inspect.should == "-5/8"
+      Rational.new!(-1, -2).inspect.should == "1/2"
+      Rational.new!(0, 2).inspect.should == "0/2"
+      Rational.new!(bignum_value, 1).inspect.should == "#{bignum_value}/1"
+    end
   end
+
+  ruby_version_is '1.9' do
+    it "returns a string representation of self" do
+      Rational(3, 4).inspect.should == "(3/4)"
+      Rational(-5, 8).inspect.should == "(-5/8)"
+      Rational(-1, -2).inspect.should == "(1/2)"
+      Rational(0, 2).inspect.should == "0"
+      Rational(bignum_value, 1).inspect.should == "#{bignum_value}"
+    end
+  end
 end

Modified: MacRuby/trunk/spec/frozen/library/matrix/clone_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/clone_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/matrix/clone_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,7 +9,7 @@
   it "returns a shallow copy of the matrix" do
     b = @a.clone
     @a.should_not equal(b)
-    b.class.should == Matrix
+    b.should be_kind_of(Matrix)
     b.should == @a
     0.upto(@a.row_size - 1) do |i|
       @a.row(i).should_not equal(b.row(i))

Modified: MacRuby/trunk/spec/frozen/library/matrix/diagonal_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/diagonal_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/matrix/diagonal_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,7 +7,7 @@
   end
   
   it "returns an object of type Matrix" do
-    @m.class.should == Matrix
+    @m.should be_kind_of(Matrix)
   end
 
   it "returns a square Matrix of the right size" do

Modified: MacRuby/trunk/spec/frozen/library/matrix/rows_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/rows_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/matrix/rows_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,7 +9,7 @@
   end
 
   it "returns a Matrix" do
-    @m.class.should == Matrix
+    @m.should be_kind_of(Matrix)
   end
 
   it "creates a matrix from argument rows" do

Modified: MacRuby/trunk/spec/frozen/library/matrix/scalar_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/scalar_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/matrix/scalar_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,7 +10,7 @@
   end
   
   it "returns a Matrix" do
-    @a.class.should == Matrix
+    @a.should be_kind_of(Matrix)
   end
   
   it "returns a n x n matrix" do
@@ -41,7 +41,7 @@
   end
   
   it "returns a Matrix" do
-    @a.class.should == Matrix
+    @a.should be_kind_of(Matrix)
   end
   
   it "returns a square matrix, where the first argument specifies the side of the square" do

Modified: MacRuby/trunk/spec/frozen/library/matrix/shared/identity.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/shared/identity.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/matrix/shared/identity.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,7 +2,7 @@
 
 describe :matrix_identity, :shared => true do
   it "returns a Matrix" do
-    Matrix.send(@method, 2).class.should == Matrix
+    Matrix.send(@method, 2).should be_kind_of(Matrix)
   end
 
   it "returns a n x n identity matrix" do

Modified: MacRuby/trunk/spec/frozen/library/matrix/shared/inverse.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/shared/inverse.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/matrix/shared/inverse.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -26,8 +26,9 @@
   end
 
   it "raises a ErrDimensionMismatch if the Matrix is not square" do
-    lambda{ Matrix[ [1,2], [1] ].send(@method) }.should
-      raise_error(Matrix::ErrDimensionMismatch)
+    lambda{
+      Matrix[ [1,2], [1] ].send(@method)
+    }.should raise_error(Matrix::ErrDimensionMismatch)
   end
 
 end

Modified: MacRuby/trunk/spec/frozen/library/matrix/spec_helper.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/spec_helper.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/matrix/spec_helper.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,5 +1,6 @@
 class BeCloseToMatrixMatcher
   def initialize(expected, tolerance = TOLERANCE)
+    SpecExpectation.matcher! rescue "Used with the balance_should_and_match branch of mspec"
     @expected = Matrix[*expected]
     @tolerance = tolerance
   end

Added: MacRuby/trunk/spec/frozen/library/matrix/vector/each2_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/vector/each2_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/matrix/vector/each2_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,62 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+require 'matrix'
+
+describe "Vector.each2" do
+  before :all do
+    @v = Vector[1, 2, 3]
+    @v2 = Vector[4, 5, 6]
+  end
+
+  it "requires one argument" do
+    lambda { @v.each2(@v2, @v2){} }.should raise_error(ArgumentError)
+    lambda { @v.each2(){} }.should raise_error(ArgumentError)
+  end
+
+  describe "given one argument" do
+    ruby_bug "redmine:2495", "1.9.1" do
+      it "requires the argument to be a Vector or an Array" do
+        lambda { @v.each2(5){}        }.should raise_error(TypeError)
+        lambda { @v.each2(nil){}      }.should raise_error(TypeError)
+      end
+    end
+
+    it "accepts an Array argument" do
+      a = []
+      @v.each2([7, 8, 9]){|x, y| a << x << y}
+      a.should == [1, 7, 2, 8, 3, 9]
+    end
+
+    it "raises a DimensionMismatch error if the Vector size is different" do
+      lambda { @v.each2(Vector[1,2]){}     }.should raise_error(Vector::ErrDimensionMismatch)
+      lambda { @v.each2(Vector[1,2,3,4]){} }.should raise_error(Vector::ErrDimensionMismatch)
+    end
+
+    it "yields arguments in sequence" do
+      a = []
+      @v.each2(@v2){|first, second| a << [first, second]}
+      a.should == [[1, 4], [2, 5], [3, 6]]
+    end
+
+    ruby_bug "to be submitted", "1.9.1" do
+      it "yield arguments in pairs" do
+        a = []
+        @v.each2(@v2){|pair| a << pair}
+        a.should == [[1, 4], [2, 5], [3, 6]]
+      end
+    end
+
+    ruby_bug "to be submitted", "1.9.1" do
+      it "returns self when given a block" do
+        @v.each2(@v2){}.should equal(@v)
+      end
+    end
+
+    ruby_version_is "1.9" do
+      it "returns an enumerator if no block given" do
+        enum = @v.each2(@v2)
+        enum.should be_kind_of(enumerator_class)
+        enum.to_a.should == [[1, 4], [2, 5], [3, 6]]
+      end
+    end
+  end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/matrix/zero_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/zero_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/matrix/zero_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Matrix.zero" do
   it "returns an object of type Matrix" do
-    Matrix.zero(3).class.should == Matrix
+    Matrix.zero(3).should be_kind_of(Matrix)
   end
   
   it "creates a n x n matrix" do

Modified: MacRuby/trunk/spec/frozen/library/mutex/unlock_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mutex/unlock_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/mutex/unlock_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -36,9 +36,4 @@
     lambda { mutex.unlock }.should raise_error(ThreadError)
   end
 
-  it "returns nil if successful" do
-    mutex = Mutex.new
-    mutex.lock
-    mutex.unlock.should.be_nil
-  end
 end

Modified: MacRuby/trunk/spec/frozen/library/net/ftp/fixtures/server.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/net/ftp/fixtures/server.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/net/ftp/fixtures/server.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -246,4 +246,4 @@
       self.response("230 User logged in, proceed. (USER #{name})")
     end
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/library/net/ftp/shared/getbinaryfile.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/net/ftp/shared/getbinaryfile.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/net/ftp/shared/getbinaryfile.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -15,6 +15,8 @@
     @ftp.quit rescue nil
     @ftp.close
     @server.stop
+
+    rm_r @tmp_file
   end
   
   it "sends the RETR command to the server" do
@@ -172,4 +174,4 @@
       lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
     end
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/library/net/ftp/shared/gettextfile.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/net/ftp/shared/gettextfile.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/net/ftp/shared/gettextfile.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -14,6 +14,8 @@
     @ftp.quit rescue nil
     @ftp.close
     @server.stop
+
+    rm_r @tmp_file
   end
   
   it "sends the RETR command to the server" do
@@ -122,4 +124,4 @@
       lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
     end
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/library/net/ftp/shared/putbinaryfile.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/net/ftp/shared/putbinaryfile.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/net/ftp/shared/putbinaryfile.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -15,6 +15,8 @@
     @ftp.quit rescue nil
     @ftp.close
     @server.stop
+
+    rm_r @remote_tmp_file
   end
 
   it "sends the STOR command to the server" do
@@ -56,7 +58,7 @@
       
       @ftp.resume = true
     end
-    
+
     it "sends the remaining content of the passed local_file to the passed remote_file" do
       @ftp.send(@method, @local_fixture_file, "binary")
       File.read(@remote_tmp_file).should == File.read(@local_fixture_file)
@@ -189,4 +191,4 @@
       lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
     end
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/library/net/ftp/shared/puttextfile.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/net/ftp/shared/puttextfile.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/net/ftp/shared/puttextfile.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -15,10 +15,8 @@
     @ftp.quit rescue nil
     @ftp.close
     @server.stop
-  end
 
-  after :all do
-    File.unlink(tmp("textfile")) if File.exists?(tmp("textfile"))
+    rm_r @remote_tmp_file
   end
 
   it "sends the STOR command to the server" do

Modified: MacRuby/trunk/spec/frozen/library/net/ftp/storbinary_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/net/ftp/storbinary_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/net/ftp/storbinary_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,6 +8,7 @@
     @server.serve_once
 
     @local_fixture_file  = File.dirname(__FILE__) + "/fixtures/putbinaryfile"
+    @tmp_file = tmp("binaryfile")
 
     @ftp = Net::FTP.new
     @ftp.connect("localhost", 9921)
@@ -17,6 +18,8 @@
     @ftp.quit rescue nil
     @ftp.close
     @server.stop
+
+    rm_r @tmp_file
   end
   
   it "sends the passed command and the passed File object's content to the server" do

Modified: MacRuby/trunk/spec/frozen/library/net/ftp/storlines_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/net/ftp/storlines_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/net/ftp/storlines_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,6 +8,7 @@
     @server.serve_once
 
     @local_fixture_file  = File.dirname(__FILE__) + "/fixtures/puttextfile"
+    @tmp_file = tmp("textfile")
 
     @ftp = Net::FTP.new
     @ftp.connect("localhost", 9921)
@@ -17,6 +18,8 @@
     @ftp.quit rescue nil
     @ftp.close
     @server.stop
+
+    rm_r @tmp_file
   end
   
   it "sends the passed command and the passed File object's content to the server" do

Modified: MacRuby/trunk/spec/frozen/library/openssl/hmac/digest_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/openssl/hmac/digest_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/openssl/hmac/digest_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,6 @@
 require 'openssl'
 
 describe "OpenSSL::HMAC.digest" do
-  include HMACConstants
   it 'returns an SHA1 digest' do
     cur_digest = OpenSSL::Digest::Digest.new('SHA1')
     cur_digest.digest.should == HMACConstants::BlankSHA1Digest

Modified: MacRuby/trunk/spec/frozen/library/openssl/hmac/hexdigest_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/openssl/hmac/hexdigest_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/openssl/hmac/hexdigest_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,6 @@
 require 'openssl'
 
 describe "OpenSSL::HMAC.hexdigest" do
-  include HMACConstants
   it 'returns an SHA1 hex digest' do
     cur_digest = OpenSSL::Digest::Digest.new('SHA1')
     cur_digest.hexdigest.should == HMACConstants::BlankSHA1HexDigest

Modified: MacRuby/trunk/spec/frozen/library/openssl/random/shared/random_bytes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/openssl/random/shared/random_bytes.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/openssl/random/shared/random_bytes.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,7 +5,7 @@
   it "generates a random binary string of specified length" do
     (1..64).each do |idx|
       bytes = OpenSSL::Random.pseudo_bytes(idx)
-      bytes.class.should == String
+      bytes.should be_kind_of(String)
       bytes.length.should == idx
     end
   end

Modified: MacRuby/trunk/spec/frozen/library/pathname/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/pathname/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/pathname/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Pathname.new" do
   it "returns a new Pathname Object with 1 argument" do
-    Pathname.new('').class.should == Pathname
+    Pathname.new('').should be_kind_of(Pathname)
   end
 
   it "raises an ArgumentError when called with \0" do

Modified: MacRuby/trunk/spec/frozen/library/prime/each_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/prime/each_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/prime/each_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -67,7 +67,7 @@
 
   it "returns an evaluated value of the given block" do
     expected = Object.new
-    Prime.new.each{ break expected }.should equal?(expected)
+    Prime.new.each{ break expected }.should equal(expected)
   end
 
   it "returns an enumerator (or a compatible object) if no block given" do

Modified: MacRuby/trunk/spec/frozen/library/prime/instance_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/prime/instance_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/prime/instance_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Prime.instance" do
   it "returns a object representing the set of prime numbers" do
-    Prime.instance.class.should == Prime
+    Prime.instance.should be_kind_of(Prime)
   end
 
   it "returns a object with no obsolete features" do

Modified: MacRuby/trunk/spec/frozen/library/prime/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/prime/new_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/prime/new_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Prime.new" do
   it "returns a new object representing the set of prime numbers" do
-    Prime.new.class.should == Prime
+    Prime.new.should be_kind_of(Prime)
   end
 
   it "returns a object with obsolete featrues" do

Modified: MacRuby/trunk/spec/frozen/library/readline/basic_quote_characters_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/basic_quote_characters_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/basic_quote_characters_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,11 +5,16 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.basic_quote_characters" do
-      it "needs to be reviewed for spec completeness"
+      it "returns not nil" do
+        Readline.basic_quote_characters.should_not be_nil
+      end
     end
 
     describe "Readline.basic_quote_characters=" do
-      it "needs to be reviewed for spec completeness"
+      it "returns the passed string" do
+        Readline.basic_quote_characters = "test"
+        Readline.basic_quote_characters.should == "test"
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/basic_word_break_characters_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/basic_word_break_characters_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/basic_word_break_characters_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,11 +5,16 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.basic_word_break_characters" do
-      it "needs to be reviewed for spec completeness"
+      it "returns not nil" do
+        Readline.basic_word_break_characters.should_not be_nil
+      end
     end
 
     describe "Readline.basic_word_break_characters=" do
-      it "needs to be reviewed for spec completeness"
+      it "returns the passed string" do
+        Readline.basic_word_break_characters = "test"
+        Readline.basic_word_break_characters.should == "test"
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/completer_quote_characters_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/completer_quote_characters_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/completer_quote_characters_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,11 +5,16 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.completer_quote_characters" do
-      it "needs to be reviewed for spec completeness"
+      it "returns nil" do
+        Readline.completer_quote_characters.should be_nil
+      end
     end
 
     describe "Readline.completer_quote_characters=" do
-      it "needs to be reviewed for spec completeness"
+      it "returns the passed string" do
+        Readline.completer_quote_characters = "test"
+        Readline.completer_quote_characters.should == "test"
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/completer_word_break_characters_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/completer_word_break_characters_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/completer_word_break_characters_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,11 +5,16 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.completer_word_break_characters" do
-      it "needs to be reviewed for spec completeness"
+      it "returns nil" do
+        Readline.completer_word_break_characters.should be_nil
+      end
     end
 
     describe "Readline.completer_word_break_characters=" do
-      it "needs to be reviewed for spec completeness"
+      it "returns the passed string" do
+        Readline.completer_word_break_characters = "test"
+        Readline.completer_word_break_characters.should == "test"
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/completion_append_character_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/completion_append_character_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/completion_append_character_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,11 +5,16 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.completion_append_character" do
-      it "needs to be reviewed for spec completeness"
+      it "returns not nil" do
+        Readline.completion_append_character.should_not be_nil
+      end
     end
 
     describe "Readline.completion_append_character=" do
-      it "needs to be reviewed for spec completeness"
+      it "returns the first character of the passed string" do
+        Readline.completion_append_character = "test"
+        Readline.completion_append_character.should == "t"
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/completion_case_fold_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/completion_case_fold_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/completion_case_fold_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,11 +5,18 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.completion_case_fold" do
-      it "needs to be reviewed for spec completeness"
+      it "returns nil" do
+        Readline.completion_case_fold.should be_nil
+      end
     end
 
     describe "Readline.completion_case_fold=" do
-      it "needs to be reviewed for spec completeness"
+      it "returns the passed boolean" do
+        Readline.completion_case_fold = true
+        Readline.completion_case_fold.should == true
+        Readline.completion_case_fold = false
+        Readline.completion_case_fold.should == false
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/completion_proc_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/completion_proc_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/completion_proc_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,11 +5,22 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.completion_proc" do
-      it "needs to be reviewed for spec completeness"
+      it "returns nil" do
+        Readline.completion_proc.should be_nil
+      end
     end
 
     describe "Readline.completion_proc=" do
-      it "needs to be reviewed for spec completeness"
+      it "returns the passed Proc" do
+        proc = Proc.new do |e|
+        end
+        Readline.completion_proc = proc
+        Readline.completion_proc.should == proc
+      end
+
+      it "returns an ArgumentError if not given an Proc or #call" do
+        lambda { Readline.completion_proc = "test" }.should raise_error(ArgumentError)
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/emacs_editing_mode_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/emacs_editing_mode_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/emacs_editing_mode_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,7 +5,9 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.emacs_editing_mode" do
-      it "needs to be reviewed for spec completeness"
+      it "returns nil" do
+        Readline.emacs_editing_mode.should be_nil
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/filename_quote_characters_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/filename_quote_characters_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/filename_quote_characters_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,11 +5,16 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.filename_quote_characters" do
-      it "needs to be reviewed for spec completeness"
+      it "returns nil" do
+        Readline.filename_quote_characters.should be_nil
+      end
     end
 
     describe "Readline.filename_quote_characters=" do
-      it "needs to be reviewed for spec completeness"
+      it "returns the passed string" do
+        Readline.filename_quote_characters = "test"
+        Readline.filename_quote_characters.should == "test"
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/readline_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/readline_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/readline_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,14 +2,34 @@
 
 process_is_foreground do
 
-  not_supported_on :ironruby do
+  not_supported_on :ironruby, :jruby do
     require 'readline'
-    describe "Readline#readline" do
-      it "needs to be reviewed for spec completeness"
-    end
 
     describe "Readline.readline" do
-      it "needs to be reviewed for spec completeness"
+      before :each do
+        @file = tmp('readline')
+        File.open(@file, 'w') do |file|
+          file.puts "test\n"
+        end
+        @stdin_back = STDIN.dup
+        @stdout_back = STDOUT.dup
+        STDIN.reopen(@file, 'r')
+        STDOUT.reopen("/dev/null")
+      end
+
+      after :each do
+        rm_r @file
+        STDIN.reopen(@stdin_back)
+        STDOUT.reopen(@stdout_back)
+      end
+
+      it "returns the input string" do
+        Readline.readline.should == "test"
+      end
+
+      it "taints the returned strings" do
+        Readline.readline.tainted?.should be_true
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/readline/vi_editing_mode_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/readline/vi_editing_mode_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/readline/vi_editing_mode_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,7 +5,9 @@
   not_supported_on :ironruby do
     require 'readline'
     describe "Readline.vi_editing_mode" do
-      it "needs to be reviewed for spec completeness"
+      it "returns nil" do
+        Readline.vi_editing_mode.should be_nil
+      end
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/resolv/get_address_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/resolv/get_address_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/resolv/get_address_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -13,7 +13,9 @@
     lambda {
       address = Resolv.getaddress(localhost)
     }.should_not raise_error(Resolv::ResolvError)
-
+  end
+  
+  it 'raises ResolvError given a bogus address' do
     lambda {
       address = Resolv.getaddress("should.raise.error.")
     }.should raise_error(Resolv::ResolvError)

Modified: MacRuby/trunk/spec/frozen/library/rexml/text/write_with_substitution_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/rexml/text/write_with_substitution_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/rexml/text/write_with_substitution_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,7 +10,7 @@
 
   after :each do
     @file.close
-    File.delete(@f) if File.exists?(@f)
+    rm_r @f
   end
 
   it "writes out the input to a String" do

Modified: MacRuby/trunk/spec/frozen/library/securerandom/base64_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/securerandom/base64_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/securerandom/base64_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,13 +7,13 @@
     it "generates a random base64 string out of specified number of random bytes" do
       (16..128).each do |idx|
         base64 = SecureRandom.base64(idx)
-        base64.class.should == String
+        base64.should be_kind_of(String)
         base64.length.should < 2 * idx
         base64.should =~ /^[A-Za-z0-9\+\/]+={0,2}$/
       end
       
       base64 = SecureRandom.base64(16.5)
-      base64.class.should == String
+      base64.should be_kind_of(String)
       base64.length.should < 2 * 16
     end
 
@@ -33,12 +33,12 @@
     end
 
     it "generates a random base64 string out of 32 random bytes" do
-      SecureRandom.base64.class.should == String
+      SecureRandom.base64.should be_kind_of(String)
       SecureRandom.base64.length.should < 32 * 2
     end
 
     it "treats nil agrument as default one and generates a random base64 string" do
-      SecureRandom.base64(nil).class.should == String
+      SecureRandom.base64(nil).should be_kind_of(String)
       SecureRandom.base64(nil).length.should < 32 * 2
     end
 

Modified: MacRuby/trunk/spec/frozen/library/securerandom/hex_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/securerandom/hex_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/securerandom/hex_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,12 +7,12 @@
     it "generates a random hex string of length twice the specified argement" do
       (1..64).each do |idx|
         hex = SecureRandom.hex(idx)
-        hex.class.should == String
+        hex.should be_kind_of(String)
         hex.length.should == 2 * idx
       end
       
       base64 = SecureRandom.hex(5.5)
-      base64.class.should == String
+      base64.should be_kind_of(String)
       base64.length.should eql(10)
     end
 
@@ -32,12 +32,12 @@
     end
 
     it "generates a random hex string of length 32 if no argument is provided" do
-      SecureRandom.hex.class.should == String
+      SecureRandom.hex.should be_kind_of(String)
       SecureRandom.hex.length.should == 32
     end
 
     it "treats nil agrument as default one and generates a random hex string of length 32" do
-      SecureRandom.hex(nil).class.should == String
+      SecureRandom.hex(nil).should be_kind_of(String)
       SecureRandom.hex(nil).length.should == 32
     end
 

Modified: MacRuby/trunk/spec/frozen/library/securerandom/random_bytes_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/securerandom/random_bytes_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/securerandom/random_bytes_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,20 +6,20 @@
   describe "SecureRandom.random_bytes" do
     it "generates a random binary string of length 16 if no argument is provided" do
       bytes = SecureRandom.random_bytes
-      bytes.class.should == String
+      bytes.should be_kind_of(String)
       bytes.length.should == 16
     end
 
     it "generates a random binary string of length 16 if argument is nil" do
       bytes = SecureRandom.random_bytes(nil)
-      bytes.class.should == String
+      bytes.should be_kind_of(String)
       bytes.length.should == 16
     end
 
     it "generates a random binary string of specified length" do
       (1..64).each do |idx|
         bytes = SecureRandom.random_bytes(idx)
-        bytes.class.should == String
+        bytes.should be_kind_of(String)
         bytes.length.should == idx
       end
 

Modified: MacRuby/trunk/spec/frozen/library/securerandom/random_number_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/securerandom/random_number_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/securerandom/random_number_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,7 +7,7 @@
     it "generates a random positive number smaller then the positive integer argument" do
       (1..64).each do |idx|
         num = SecureRandom.random_number(idx)
-        num.class.should == Fixnum
+        num.should be_kind_of(Fixnum)
         (0 <= num).should == true
         (num < idx).should == true
       end
@@ -16,7 +16,7 @@
     it "generates a random float number between 0.0 and 1.0 if no argument provided" do
       64.times do
         num = SecureRandom.random_number
-        num.class.should == Float
+        num.should be_kind_of(Float)
         (0.0 <= num).should == true
         (num < 1.0).should == true
       end
@@ -24,7 +24,7 @@
     
     it "generates a random float number between 0.0 and 1.0 if argument is negative" do
       num = SecureRandom.random_number(-10)
-      num.class.should == Float
+      num.should be_kind_of(Float)
       (0.0 <= num).should == true
       (num < 1.0).should == true
     end

Modified: MacRuby/trunk/spec/frozen/library/set/initialize_copy_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/set/initialize_copy_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/set/initialize_copy_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,7 +7,7 @@
   end
   
   it "is private" do
-    @set.private_methods.should include("initialize_copy")
+    Set.should have_private_instance_method(:initialize_copy)
   end
   
   it "replaces all elements of self with the elements of the passed Set" do

Modified: MacRuby/trunk/spec/frozen/library/set/initialize_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/set/initialize_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/set/initialize_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "Set#initialize" do
   it "is private" do
-    Set[].private_methods.should include("initialize")
+    Set.should have_private_instance_method(:initialize)
   end
   
   it "adds all elements of the passed Enumerable to self" do

Modified: MacRuby/trunk/spec/frozen/library/set/sortedset/add_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/set/sortedset/add_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/set/sortedset/add_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,12 +7,9 @@
 
   ruby_bug "redmine #118", "1.9.1" do
     it "takes only values which responds <=>" do
-      lambda { SortedSet[Object.new].add(Object.new) }.should raise_error(ArgumentError)
-
-      obj = mock('x')
-      lambda { SortedSet[obj].add(:aaa) }.should raise_error(ArgumentError)
-      def obj.<=>(o) 1 end
-      lambda { SortedSet[obj].add(:aaa) }.should_not raise_error(ArgumentError)
+      obj = mock('no_comparison_operator')
+      obj.should_receive(:respond_to?).with(:<=>).and_return(false)
+      lambda { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError)
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/set/sortedset/flatten_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/set/sortedset/flatten_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/set/sortedset/flatten_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,14 +1,26 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
 require 'set'
 
+# Note: Flatten make little sens on sorted sets, because SortedSets are not (by default)
+# comparable. For a SortedSet to be both valid and nested, we need to define a comparison operator:
+module SortedSet_FlattenSpecs
+  class ComparableSortedSet < SortedSet
+    def <=>(other)
+      return puts "#{other} vs #{self}" unless other.is_a?(ComparableSortedSet)
+      to_a <=> other.to_a
+    end
+  end
+end
+
 describe "SortedSet#flatten" do
   ruby_bug "http://redmine.ruby-lang.org/projects/ruby-18/issues/show?id=117", "1.8.7" do
     it "returns a copy of self with each included SortedSet flattened" do
-      set = SortedSet[1, 2, SortedSet[3, 4, SortedSet[5, 6, SortedSet[7, 8]]], 9, 10]
+      klass = SortedSet_FlattenSpecs::ComparableSortedSet
+      set = klass[klass[1,2], klass[3,4], klass[5,6,7], klass[8]]
       flattened_set = set.flatten
-    
+
       flattened_set.should_not equal(set)
-      flattened_set.should == SortedSet[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+      flattened_set.should == klass[1, 2, 3, 4, 5, 6, 7, 8]
     end
   end
 end
@@ -16,19 +28,21 @@
 describe "SortedSet#flatten!" do
   ruby_bug "http://redmine.ruby-lang.org/projects/ruby-18/issues/show?id=117", "1.8.7" do
     it "flattens self" do
-      set = SortedSet[1, 2, SortedSet[3, 4, SortedSet[5, 6, SortedSet[7, 8]]], 9, 10]
+      klass = SortedSet_FlattenSpecs::ComparableSortedSet
+      set = klass[klass[1,2], klass[3,4], klass[5,6,7], klass[8]]
       set.flatten!
-      set.should == SortedSet[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+      set.should == klass[1, 2, 3, 4, 5, 6, 7, 8]
     end
-  
+
     it "returns self when self was modified" do
-      set = SortedSet[1, 2, SortedSet[3, 4]]
+      klass = SortedSet_FlattenSpecs::ComparableSortedSet
+      set = klass[klass[1,2], klass[3,4]]
       set.flatten!.should equal(set)
     end
   end
-  
+
   it "returns nil when self was not modified" do
     set = SortedSet[1, 2, 3, 4]
     set.flatten!.should be_nil
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/library/set/sortedset/initialize_copy_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/set/sortedset/initialize_copy_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/set/sortedset/initialize_copy_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,7 +7,7 @@
   end
   
   it "is private" do
-    @set.private_methods.should include("initialize_copy")
+    Set.should have_private_instance_method(:initialize_copy)
   end
   
   it "replaces all elements of self with the elements of the passed SortedSet" do

Modified: MacRuby/trunk/spec/frozen/library/socket/basicsocket/getsockopt_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/basicsocket/getsockopt_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/socket/basicsocket/getsockopt_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,14 +10,32 @@
     @sock.closed?.should be_false
     @sock.close
   end
-  
-  it "gets a socket option" do
+
+  it "gets a socket option Socket::SO_TYPE" do
     n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_TYPE)
     n.should == [Socket::SOCK_STREAM].pack("i")
   end
 
+  it "gets a socket option Socket::SO_OOBINLINE" do
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [0].pack("i")
+  end
+
+  it "gets a socket option Socket::SO_LINGER" do
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER)
+    if (n.size == 8) # linger struct on some platforms, not just a value
+      n.should == [0, 0].pack("ii")
+    else
+      n.should == [0].pack("i")
+    end
+  end
+
+  it "gets a socket option Socket::SO_SNDBUF" do
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
+    n.unpack('i')[0].should > 0
+  end
+
   it "raises a SystemCallError with an invalid socket option" do
     lambda { @sock.getsockopt Socket::SOL_SOCKET, -1 }.should raise_error(Errno::ENOPROTOOPT)
   end
 end
-

Modified: MacRuby/trunk/spec/frozen/library/socket/basicsocket/recv_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/basicsocket/recv_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/socket/basicsocket/recv_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,13 +10,14 @@
   after :each do
     @server.closed?.should be_false
     @server.close
+    ScratchPad.clear
   end
 
   it "receives a specified number of bytes of a message from another socket"  do
-    data = ""
     t = Thread.new do
       client = @server.accept
-      data = client.recv(10)
+      ScratchPad.record client.recv(10)
+      client.recv(1) # this recv is important
       client.close
     end
     Thread.pass while t.status and t.status != "sleep"
@@ -27,22 +28,49 @@
     socket.close
 
     t.join
-    data.should == 'hello'
+    ScratchPad.recorded.should == 'hello'
   end
 
   it "accepts flags to specify unusual receiving behaviour" do
-    data = ""
     t = Thread.new do
       client = @server.accept
-      data = client.recv(10)    # in-band data (TCP), doesn't receive the flag.
+
+      # in-band data (TCP), doesn't receive the flag.
+      ScratchPad.record client.recv(10)
+
+      # this recv is important (TODO: explain)
+      client.recv(10)
       client.close
     end
     Thread.pass while t.status and t.status != "sleep"
     t.status.should_not be_nil
-    
+
     socket = TCPSocket.new('127.0.0.1', SocketSpecs.port)
     socket.send('helloU', Socket::MSG_OOB)
+    socket.shutdown(1)
     t.join
-    data.should == 'hello'
+    socket.close
+    ScratchPad.recorded.should == 'hello'
   end
+
+  it "gets lines delimited with a custom separator"  do
+    t = Thread.new do
+      client = @server.accept
+      ScratchPad.record client.gets("\377")
+
+      # this call is important (TODO: explain)
+      client.gets(nil)
+      client.close
+    end
+    Thread.pass while t.status and t.status != "sleep"
+    t.status.should_not be_nil
+
+    socket = TCPSocket.new('127.0.0.1', SocketSpecs.port)
+    socket.write("firstline\377secondline\377")
+    socket.close
+
+    t.join
+    ScratchPad.recorded.should == "firstline\377"
+  end
+
 end

Modified: MacRuby/trunk/spec/frozen/library/socket/basicsocket/send_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/basicsocket/send_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/socket/basicsocket/send_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -16,17 +16,22 @@
   end
 
    it "sends a message to another socket and returns the number of bytes sent" do
-     data = nil
+     data = ""
      t = Thread.new do
        client = @server.accept
-       data = client.recv(5)
+       loop do
+         got = client.recv(5)
+         break if got.empty?
+         data << got
+       end
        client.close
      end
      Thread.pass while t.status and t.status != "sleep"
      t.status.should_not be_nil
 
      @socket.send('hello', 0).should == 5
-     @socket.shutdown # indicate, that we are done sending
+     @socket.shutdown(1) # indicate, that we are done sending
+     @socket.recv(10)
 
      t.join
      data.should == 'hello'
@@ -39,6 +44,7 @@
        client = @server.accept
        peek_data = client.recv(6, Socket::MSG_PEEK)
        data = client.recv(6)
+       client.recv(10) # this recv is important
        client.close
      end
      Thread.pass while t.status and t.status != "sleep"
@@ -53,10 +59,14 @@
    end
 
   it "accepts a sockaddr as recipient address" do
-     data = nil
+     data = ""
      t = Thread.new do
        client = @server.accept
-       data = client.recv(5)
+       loop do
+         got = client.recv(5)
+         break if got.empty?
+         data << got
+       end
        client.close
      end
      Thread.pass while t.status and t.status != "sleep"

Modified: MacRuby/trunk/spec/frozen/library/socket/basicsocket/setsockopt_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/basicsocket/setsockopt_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/socket/basicsocket/setsockopt_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,9 +10,148 @@
   after :each do
     @sock.close unless @sock.closed?
   end
-  
+
   it "sets the socket linger to 0" do
     linger = [0, 0].pack("ii")
     @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, linger).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER)
+
+    if (n.size == 8) # linger struct on some platforms, not just a value
+      n.should == [0, 0].pack("ii")
+    else
+      n.should == [0].pack("i")
+    end
   end
+
+  it "sets the socket linger to some positive value" do
+    linger = [64, 64].pack("ii")
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, linger).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER)
+    if (n.size == 8) # linger struct on some platforms, not just a value
+      n.should == [1, 64].pack("ii")
+    else
+      n.should == [64].pack("i")
+    end
+  end
+
+  it "sets the socket option Socket::SO_OOBINLINE" do
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, true).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [1].pack("i")
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, false).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [0].pack("i")
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, 1).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [1].pack("i")
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, 0).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [0].pack("i")
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, 2).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [1].pack("i")
+
+    platform_is_not :os => :windows do
+      lambda {
+        @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "")
+      }.should raise_error(SystemCallError)
+    end
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "blah").should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [1].pack("i")
+
+    platform_is_not :os => :windows do
+      lambda {
+        @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "0")
+      }.should raise_error(SystemCallError)
+    end
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "\x00\x00\x00\x00").should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [0].pack("i")
+
+    platform_is_not :os => :windows do
+      lambda {
+        @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "1")
+      }.should raise_error(SystemCallError)
+    end
+
+    platform_is_not :os => :windows do
+      lambda {
+        @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "\x00\x00\x00")
+      }.should raise_error(SystemCallError)
+    end
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, [1].pack('i')).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [1].pack("i")
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, [0].pack('i')).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [0].pack("i")
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, [1000].pack('i')).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE)
+    n.should == [1].pack("i")
+  end
+
+  it "sets the socket option Socket::SO_SNDBUF" do
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, 4000).should == 0
+    sndbuf = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
+    # might not always be possible to set to exact size
+    sndbuf.unpack('i')[0].should >= 4000
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, true).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
+    n.unpack('i')[0].should >= 1
+
+    lambda {
+      @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, nil).should == 0
+    }.should raise_error(TypeError)
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, 1).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
+    n.unpack('i')[0].should >= 1
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, 2).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
+    n.unpack('i')[0].should >= 2
+
+    lambda {
+      @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "")
+    }.should raise_error(SystemCallError)
+
+    lambda {
+      @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "bla")
+    }.should raise_error(SystemCallError)
+
+    lambda {
+      @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "0")
+    }.should raise_error(SystemCallError)
+
+    lambda {
+      @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "1")
+    }.should raise_error(SystemCallError)
+
+    lambda {
+      @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "\x00\x00\x00")
+    }.should raise_error(SystemCallError)
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "\x00\x00\x01\x00").should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
+    n.unpack('i')[0].should >= "\x00\x00\x01\x00".unpack('i')[0]
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, [4000].pack('i')).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
+    n.unpack('i')[0].should >= 4000
+
+    @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, [1000].pack('i')).should == 0
+    n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
+    n.unpack('i')[0].should >= 1000
+  end
 end

Added: MacRuby/trunk/spec/frozen/library/socket/shared/partially_closable_sockets.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/shared/partially_closable_sockets.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/socket/shared/partially_closable_sockets.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,13 @@
+describe "partially closable sockets", :shared => true do
+  specify "if the write end is closed then the other side can read past EOF without blocking" do
+    @s1.write("foo")
+    @s1.close_write
+    @s2.read("foo".size + 1).should == "foo"
+  end
+  
+  specify "closing the write end ensures that the other side can read until EOF" do
+    @s1.write("hello world")
+    @s1.close_write
+    @s2.read.should == "hello world"
+  end
+end

Modified: MacRuby/trunk/spec/frozen/library/socket/socket/for_fd_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/socket/for_fd_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/socket/socket/for_fd_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,26 +2,31 @@
 require File.dirname(__FILE__) + '/../fixtures/classes'
 require 'socket'
 
-describe "Socket#for_fd given a file descriptor" do
+describe "Socket.for_fd given a file descriptor" do
   it "adopts that descriptor into a new Socket object" do
     begin
-      server = TCPServer.new("0.0.0.0", SocketSpecs.port)
-      client = TCPSocket.open("0.0.0.0", SocketSpecs.port)
+      server = TCPServer.new("127.0.0.1", SocketSpecs.port)
+      client = TCPSocket.open("127.0.0.1", SocketSpecs.port)
       new_sock = Socket.for_fd(client.fileno)
 
-      # TODO: RSpec uses #send internally when calling #should == something
-      # but as Socket#send does not do what RSpex expects it to do,
-      # it fails horriby. RSpec should be using #__send__
       new_sock.should_not be_nil
-      new_sock.class.should == Socket
+      new_sock.should be_kind_of(Socket)
       new_sock.fileno.should == client.fileno
 
-      new_sock.write("foo")
-      client.write("bar")
+      new_sock.send("foo", 0)
+      client.send("bar", 0)
+
+      # state explicitly that we are done sending
+      new_sock.shutdown
+      client.shutdown
+
       host = server.accept
       host.read(3).should == "foo"
       host.read(3).should == "bar"
     ensure
+      if (host && !host.closed?)
+        host.close
+      end
       if (server && !server.closed?)
         server.close
       end
@@ -36,9 +41,4 @@
       end
     end
   end
-
-  it "raises error for a bad descriptor" do
-    lambda { Socket.for_fd(9999999) }.should raise_error
-  end
 end
-

Added: MacRuby/trunk/spec/frozen/library/socket/tcpsocket/partially_closable_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/tcpsocket/partially_closable_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/socket/tcpsocket/partially_closable_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,21 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+require File.dirname(__FILE__) + '/../fixtures/classes'
+require File.dirname(__FILE__) + '/../shared/partially_closable_sockets'
+
+describe "TCPSocket partial closability" do
+  
+  before :each do
+    @server = TCPServer.new("127.0.0.1", SocketSpecs.port)
+    @s1 = TCPSocket.new("127.0.0.1", SocketSpecs.port)
+    @s2 = @server.accept
+  end
+
+  after :each do
+    @server.close
+    @s1.close
+    @s2.close
+  end
+  
+  it_should_behave_like "partially closable sockets"
+  
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/socket/tcpsocket/shared/new.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/tcpsocket/shared/new.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/socket/tcpsocket/shared/new.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,11 +6,11 @@
     @hostname = Socket.getaddrinfo("127.0.0.1", nil)[0][2]
   end
   it "requires a hostname and a port as arguments" do
-    lambda { TCPSocket.new }.should raise_error(ArgumentError)
+    lambda { TCPSocket.send(@method) }.should raise_error(ArgumentError)
   end
 
   it "refuses the connection when there is no server to connect to" do
-    lambda { TCPSocket.new('127.0.0.1', SocketSpecs.port) }.should raise_error(Errno::ECONNREFUSED)
+    lambda { TCPSocket.send(@method, '127.0.0.1', SocketSpecs.port) }.should raise_error(Errno::ECONNREFUSED)
   end
 
   it "connects to a listening server" do
@@ -24,7 +24,7 @@
     Thread.pass while thread.status and thread.status != 'sleep'
     thread.status.should_not be_nil
     lambda {
-      sock = TCPSocket.new(@hostname, SocketSpecs.port)
+      sock = TCPSocket.send(@method, @hostname, SocketSpecs.port)
       sock.close
     }.should_not raise_error(Errno::ECONNREFUSED)
     thread.join
@@ -40,7 +40,7 @@
     end
     Thread.pass while thread.status and thread.status != 'sleep'
     thread.status.should_not be_nil
-    sock = TCPSocket.new('127.0.0.1', SocketSpecs.port)
+    sock = TCPSocket.send(@method, '127.0.0.1', SocketSpecs.port)
     sock.addr[0].should == "AF_INET"
     sock.addr[1].should be_kind_of(Fixnum)
     # on some platforms (Mac), MRI

Modified: MacRuby/trunk/spec/frozen/library/socket/unixserver/shared/new.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/unixserver/shared/new.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/socket/unixserver/shared/new.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,7 +7,7 @@
     it "creates a new UNIXServer" do
       path = tmp("unixserver_spec")
       File.unlink(path) if File.exists?(path)
-      unix = UNIXServer.new(path)
+      unix = UNIXServer.send(@method, path)
       unix.path.should == path
       unix.addr.should == ["AF_UNIX", path]
       File.unlink(path)

Modified: MacRuby/trunk/spec/frozen/library/socket/unixsocket/pair_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/unixsocket/pair_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/socket/unixsocket/pair_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,9 +1,12 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
 require File.dirname(__FILE__) + '/../fixtures/classes'
+require File.dirname(__FILE__) + '/../shared/partially_closable_sockets'
 
 describe "UNIXSocket#pair" do
   platform_is_not :windows do
 
+    it_should_behave_like "partially closable sockets"
+
     before :each do
       @s1, @s2 = UNIXSocket.pair
     end

Added: MacRuby/trunk/spec/frozen/library/socket/unixsocket/partially_closable_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/unixsocket/partially_closable_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/socket/unixsocket/partially_closable_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,26 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+require File.dirname(__FILE__) + '/../fixtures/classes'
+require File.dirname(__FILE__) + '/../shared/partially_closable_sockets'
+
+platform_is_not :windows do
+  describe "UNIXSocket partial closability" do
+    
+    before :each do
+      @path = SocketSpecs.socket_path
+      File.unlink(@path) if File.exists?(@path)
+      @server = UNIXServer.open(@path)
+      @s1 = UNIXSocket.new(@path)
+      @s2 = @server.accept
+    end
+
+    after :each do
+      @server.close
+      @s1.close
+      @s2.close
+      File.unlink(@path) if File.exists?(@path)
+    end
+    
+    it_should_behave_like "partially closable sockets"
+    
+  end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/stringio/initialize_copy_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/stringio/initialize_copy_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/stringio/initialize_copy_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,19 +6,11 @@
     @io      = StringIO.new("StringIO example")
     @orig_io = StringIO.new("Original StringIO")
   end
-  
-  ruby_version_is "" ... "1.9" do
-    it "is private" do
-      @io.private_methods.should include('initialize_copy')
-    end
-  end  
-    
-  ruby_version_is "1.9" do
-    it "is private" do
-      @io.private_methods.should include(:initialize_copy)
-    end
+
+  it "is private" do
+    StringIO.should have_private_instance_method(:initialize_copy)
   end
-  
+
   it "returns self" do
     @io.send(:initialize_copy, @orig_io).should equal(@io)
   end
@@ -86,4 +78,19 @@
     @io.send(:initialize_copy, orig_io)
     @io.string.should == "not truncated"
   end
+
+  it "makes both StringIO objects to share position, eof status" do
+    @io.send(:initialize_copy, @orig_io)
+    @orig_io.pos.should == 0
+    @io.getc
+    @io.pos.should == 1
+    @orig_io.pos.should == 1
+    @orig_io.read(1).should == "r"
+    @io.read(1).should == "i"
+    @orig_io.pos.should == 3
+    @orig_io.pos.should == 3
+    @io.gets(nil)
+    @io.eof?.should == true
+    @orig_io.eof?.should == true
+  end
 end

Modified: MacRuby/trunk/spec/frozen/library/stringio/initialize_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/stringio/initialize_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/stringio/initialize_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -9,19 +9,19 @@
   it "uses the passed Object as the StringIO backend" do
     @io.send(:initialize, str = "example", "r")
     @io.string.should equal(str)
-  end   
+  end
 
   it "sets the mode based on the passed mode" do
     io = StringIO.allocate
     io.send(:initialize, "example", "r")
     io.closed_read?.should be_false
     io.closed_write?.should be_true
-      
+
     io = StringIO.allocate
     io.send(:initialize, "example", "rb")
     io.closed_read?.should be_false
     io.closed_write?.should be_true
-    
+
     io = StringIO.allocate
     io.send(:initialize, "example", "r+")
     io.closed_read?.should be_false
@@ -31,46 +31,46 @@
     io.send(:initialize, "example", "rb+")
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-    
+
     io = StringIO.allocate
     io.send(:initialize, "example", "w")
     io.closed_read?.should be_true
     io.closed_write?.should be_false
-    
+
     io = StringIO.allocate
     io.send(:initialize, "example", "wb")
     io.closed_read?.should be_true
     io.closed_write?.should be_false
-    
+
     io = StringIO.allocate
     io.send(:initialize, "example", "w+")
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-    
+
     io = StringIO.allocate
     io.send(:initialize, "example", "wb+")
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-    
+
     io = StringIO.allocate
     io.send(:initialize, "example", "a")
     io.closed_read?.should be_true
     io.closed_write?.should be_false
-    
+
     io = StringIO.allocate
     io.send(:initialize, "example", "ab")
     io.closed_read?.should be_true
     io.closed_write?.should be_false
-    
+
     io = StringIO.allocate
     io.send(:initialize, "example", "a+")
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-    
+
     io = StringIO.allocate
     io.send(:initialize, "example", "ab+")
     io.closed_read?.should be_false
-    io.closed_write?.should be_false        
+    io.closed_write?.should be_false
   end
 
   it "allows passing the mode as an Integer" do
@@ -108,8 +108,8 @@
     io.send(:initialize, "example", IO::RDWR | IO::APPEND)
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-  end    
-  
+  end
+
   ruby_version_is "" ... "1.9" do
      it "raises a TypeError when passed a frozen String in truncate mode as StringIO backend" do
       io = StringIO.allocate
@@ -122,7 +122,7 @@
       io = StringIO.allocate
       lambda { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(RuntimeError)
     end
-  end  
+  end
 
   it "tries to convert the passed mode to a String using #to_str" do
     obj = mock('to_str')
@@ -137,10 +137,10 @@
     (str = "example").freeze
     lambda { @io.send(:initialize, str, "r+") }.should raise_error(Errno::EACCES)
     lambda { @io.send(:initialize, str, "w") }.should raise_error(Errno::EACCES)
-    lambda { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES)  
-  end   
+    lambda { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES)
+  end
 end
-     
+
 describe "StringIO#initialize when passed [Object]" do
   before(:each) do
     @io = StringIO.allocate
@@ -171,22 +171,14 @@
     @io.closed_write?.should be_true
   end
 end
-      
+
 describe "StringIO#initialize when passed no arguments" do
   before(:each) do
     @io = StringIO.allocate
   end
 
-  ruby_version_is "" ... "1.9" do
-    it "is private" do
-      @io.private_methods.should include('initialize')
-    end
-  end 
-  
-  ruby_version_is "1.9" do
-    it "is private" do
-      @io.private_methods.should include(:initialize)
-    end
+  it "is private" do
+    StringIO.should have_private_instance_method(:initialize)
   end
 
   it "sets the mode to read-write" do
@@ -199,4 +191,4 @@
     @io.send(:initialize)
     @io.string.should == ""
   end
-end                
+end

Modified: MacRuby/trunk/spec/frozen/library/stringio/read_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/stringio/read_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/stringio/read_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -57,6 +57,6 @@
     result = @io.read(10, buf)
 
     buf.should == "abcdefghij"
-    result.should equal?(buf)
+    result.should equal(buf)
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/stringio/seek_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/stringio/seek_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/stringio/seek_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -36,6 +36,13 @@
     lambda { @io.seek(-5, IO::SEEK_SET) }.should raise_error(Errno::EINVAL)
   end
 
+  it "raises an Errno::EINVAL error on incorrect whence argument" do
+    lambda { @io.seek(0, 3) }.should raise_error(Errno::EINVAL)
+    lambda { @io.seek(0, -1) }.should raise_error(Errno::EINVAL)
+    lambda { @io.seek(0, 2**16) }.should raise_error(Errno::EINVAL)
+    lambda { @io.seek(0, -2**16) }.should raise_error(Errno::EINVAL)
+  end
+
   it "tries to convert the passed Object to a String using #to_int" do
     obj = mock("to_int")
     obj.should_receive(:to_int).and_return(2)

Modified: MacRuby/trunk/spec/frozen/library/stringscanner/initialize_copy_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/stringscanner/initialize_copy_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/stringscanner/initialize_copy_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,12 +8,7 @@
   end
 
   it "is a private method" do
-    ruby_version_is "" ... "1.9" do
-      @s.private_methods.should include('initialize')
-    end
-    ruby_version_is "1.9" do
-      @s.private_methods.should include(:initialize)
-    end
+    StringScanner.should have_private_instance_method(:initialize_copy)
   end
 
   it "copies the passed StringScanner's content to self" do

Modified: MacRuby/trunk/spec/frozen/library/stringscanner/initialize_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/stringscanner/initialize_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/stringscanner/initialize_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -7,12 +7,7 @@
   end
 
   it "is a private method" do
-    ruby_version_is "" ... "1.9" do
-     @s.private_methods.should include('initialize')
-    end
-    ruby_version_is "1.9" do
-      @s.private_methods.should include(:initialize)
-    end
+    StringScanner.should have_private_instance_method(:initialize)
   end
 
   it "returns an instance of StringScanner" do

Modified: MacRuby/trunk/spec/frozen/library/tempfile/close_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/tempfile/close_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/tempfile/close_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,6 +5,10 @@
   before(:each) do
     @tempfile = Tempfile.new("specs", tmp(""))
   end
+
+  after(:each) do
+    @tempfile.unlink if @tempfile.path
+  end
   
   it "closes self" do
     @tempfile.close
@@ -18,7 +22,7 @@
   end
   
   after(:each) do
-    @tempfile.unlink unless @tempfile.path.nil?
+    @tempfile.unlink if @tempfile.path
   end
   
   it "closes self" do
@@ -39,7 +43,7 @@
   end
   
   after(:each) do
-    @tempfile.unlink unless @tempfile.path.nil?
+    @tempfile.unlink if @tempfile.path
   end
   
   it "closes self" do

Modified: MacRuby/trunk/spec/frozen/library/tempfile/initialize_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/tempfile/initialize_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/tempfile/initialize_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,18 +8,30 @@
 
   after(:each) do
     @tempfile.close
+    @tempfile.unlink if @tempfile.path
   end
 
   it "opens a new tempfile with the passed name in the passed directory" do
     @tempfile.send(:initialize, "basename", tmp(""))
     File.exist?(@tempfile.path).should be_true
+
     tmpdir = tmp("")
-    @tempfile.path[0, tmpdir.length].should == tmpdir
-    @tempfile.path.should include("basename")
+    path = @tempfile.path
+
+    platform_is :windows do
+      # on Windows, both types of slashes are OK,
+      # but the tmp helper always uses '/'
+      path.gsub!('\\', '/')
+    end
+
+    path[0, tmpdir.length].should == tmpdir
+    path.should include("basename")
   end
 
-  it "sets the permisssions on the tempfile to 0600" do
-    @tempfile.send(:initialize, "basename", tmp(""))
-    File.stat(@tempfile.path).mode.should == 0100600
+  platform_is_not :windows do
+    it "sets the permisssions on the tempfile to 0600" do
+      @tempfile.send(:initialize, "basename", tmp(""))
+      File.stat(@tempfile.path).mode.should == 0100600
+    end
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/tempfile/path_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/tempfile/path_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/tempfile/path_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -2,10 +2,26 @@
 require 'tempfile'
 
 describe "Tempfile#path" do
+  before :each do
+    @tempfile = Tempfile.new("specs", tmp(""))
+  end
+
+  after :each do
+    @tempfile.close
+    @tempfile.unlink if @tempfile.path
+  end
+
   it "returns the path to the tempfile" do
-    @tempfile = Tempfile.new("specs", tmp(""))
     tmpdir = tmp("")
-    @tempfile.path[0, tmpdir.length].should == tmpdir
-    @tempfile.path.should include("specs")
+    path = @tempfile.path
+
+    platform_is :windows do
+      # on Windows, both types of slashes are OK,
+      # but the tmp helper always uses '/'
+      path.gsub!('\\', '/')
+    end
+
+    path[0, tmpdir.length].should == tmpdir
+    path.should include("specs")
   end
 end

Modified: MacRuby/trunk/spec/frozen/library/tempfile/shared/unlink.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/tempfile/shared/unlink.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/tempfile/shared/unlink.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,11 +4,12 @@
   end
 
   after(:each) do
-    @tempfile.close
+    @tempfile.close rescue nil
   end
 
   ruby_bug "", "1.8.6" do
     it "unlinks self" do
+      @tempfile.close
       path = @tempfile.path
       @tempfile.send(@method)
       File.exists?(path).should be_false

Modified: MacRuby/trunk/spec/frozen/library/tmpdir/dir/mktmpdir_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/tmpdir/dir/mktmpdir_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/tmpdir/dir/mktmpdir_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,18 +3,22 @@
 
 ruby_version_is "1.8.7" do
   describe "Dir.mktmpdir when passed no arguments" do
+    after :each do
+      Dir.rmdir @tmpdir if File.directory? @tmpdir
+    end
+
     it "returns the path to the created tmp-dir" do
       Dir.stub!(:mkdir)
       Dir.should_receive(:tmpdir).and_return("/tmp")
-      path = Dir.mktmpdir
-      path.should =~ /^\/tmp\//
+      @tmpdir = Dir.mktmpdir
+      @tmpdir.should =~ /^\/tmp\//
     end
   
     it "creates a new writable directory in the path provided by Dir.tmpdir" do
       Dir.should_receive(:tmpdir).and_return(tmp(""))
-      path = Dir.mktmpdir
-      File.directory?(path).should be_true
-      File.writable?(path).should be_true
+      @tmpdir = Dir.mktmpdir
+      File.directory?(@tmpdir).should be_true
+      File.writable?(@tmpdir).should be_true
     end
   end
 
@@ -24,10 +28,15 @@
       FileUtils.stub!(:remove_entry_secure)
     end
   
+    after :each do
+      Dir.rmdir @tmpdir if File.directory? @tmpdir
+    end
+
     it "yields the path to the passed block" do
       Dir.stub!(:mkdir)
       called = nil
       Dir.mktmpdir do |path|
+        @tmpdir = path
         called = true
         path.should =~ /^\/tmp\//
       end
@@ -37,6 +46,7 @@
     it "creates the tmp-dir before yielding" do
       Dir.should_receive(:tmpdir).and_return(tmp(""))
       Dir.mktmpdir do |path|
+        @tmpdir = path
         File.directory?(path).should be_true
         File.writable?(path).should be_true
       end
@@ -45,42 +55,55 @@
     it "removes the tmp-dir after executing the block" do
       Dir.stub!(:mkdir)
       Dir.mktmpdir do |path|
+        @tmpdir = path
         FileUtils.should_receive(:remove_entry_secure).with(path)
       end
     end
   
     it "returns the blocks return value" do
       Dir.stub!(:mkdir)
-      Dir.mktmpdir { :test }.should equal(:test)
+      result = Dir.mktmpdir do |path|
+        @tmpdir = path
+        :test
+      end
+      result.should equal(:test)
     end
   end
 
   describe "Dir.mktmpdir when passed [String]" do
-    before(:each) do
+    before :each do
       Dir.stub!(:mkdir)
       Dir.stub!(:tmpdir).and_return("/tmp")
     end
 
+    after :each do
+      Dir.rmdir @tmpdir if File.directory? @tmpdir
+    end
+
     it "uses the passed String as a prefix to the tmp-directory" do
       prefix = "before"
-      path = Dir.mktmpdir(prefix)
-      path.should =~ /^\/tmp\/#{prefix}/
+      @tmpdir = Dir.mktmpdir(prefix)
+      @tmpdir.should =~ /^\/tmp\/#{prefix}/
     end
   end
 
   describe "Dir.mktmpdir when passed [Array]" do
-    before(:each) do
+    before :each do
       Dir.stub!(:mkdir)
       Dir.stub!(:tmpdir).and_return("/tmp")
       FileUtils.stub!(:remove_entry_secure)
     end
 
+    after :each do
+      Dir.rmdir @tmpdir if File.directory? @tmpdir
+    end
+
     it "uses the first element of the passed Array as a prefix and the scond element as a suffix to the tmp-directory" do
       prefix = "before"
       suffix = "after"
     
-      path = Dir.mktmpdir([prefix, suffix])
-      path.should =~ /#{suffix}$/
+      @tmpdir = Dir.mktmpdir([prefix, suffix])
+      @tmpdir.should =~ /#{suffix}$/
     end
   end
 

Added: MacRuby/trunk/spec/frozen/library/uri/eql_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/uri/eql_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/uri/eql_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,12 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/normalization'
+require File.dirname(__FILE__) + '/shared/eql'
+require 'uri'
+
+describe "URI#eql?" do
+  it_behaves_like :uri_eql, :eql?
+
+  ruby_bug "redmine:2428", "1.8.7" do
+    it_behaves_like :uri_eql_against_other_types, :eql?
+  end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/uri/equality_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/uri/equality_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/uri/equality_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,24 +1,48 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/normalization'
+require File.dirname(__FILE__) + '/shared/eql'
 require 'uri'
 
 describe "URI#==" do
-  it "ignores capitalization of host names and scheme names" do
+  it "ignores capitalization of host names" do
     URI("http://exAMPLE.cOm").should == URI("http://example.com")
   end
+
+  ruby_bug "redmine:2525", "1.8.7" do
+    it "ignores capitalization of scheme" do
+      URI("hTTp://example.com").should == URI("http://example.com")
+    end
+  end
   
   it "treats a blank path and a path of '/' as the same" do
     URI("http://example.com").should == URI("http://example.com/")
   end
   
   it "is case sensitive in all components of the URI but the host and scheme" do
-    URI("hTTp://example.com").should_not == URI("http://example.com")    
     URI("http://example.com/paTH").should_not == URI("http://example.com/path")
     URI("http://uSer@example.com").should_not == URI("http://user@example.com")            
-    URI("http://example.com/path?quERy").should_not == URI("http://example.com/?query")
-    URI("http://example.com/#fragMENT").should_not == URI("http://example.com#fragment")            
+    URI("http://example.com/path?quERy").should_not == URI("http://example.com/path?query")
+    URI("http://example.com/#fragMENT").should_not == URI("http://example.com/#fragment")
   end
   
   it "differentiates based on port number" do
     URI("http://example.com:8080").should_not == URI("http://example.com")
   end
+
+  # Note: The previous tests will be included in following ones
+
+  it_behaves_like :uri_eql, :==
+
+  it_behaves_like :uri_eql_against_other_types, :==
+
+  quarantine! do # Quarantined until redmine:2542 is accepted
+    it "returns true only if the normalized forms are equivalent" do
+      URISpec::NORMALIZED_FORMS.each do |form|
+        normal_uri = URI(form[:normalized])
+        form[:equivalent].each do |same|
+          URI(same).should == normal_uri
+        end
+      end
+    end
+  end
 end
\ No newline at end of file

Added: MacRuby/trunk/spec/frozen/library/uri/fixtures/normalization.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/uri/fixtures/normalization.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/uri/fixtures/normalization.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,54 @@
+module URISpec
+  # Not an exhaustive list. Refer to rfc3986
+  NORMALIZED_FORMS = [
+    { :normalized =>     "http://example.com/",
+      :equivalent =>  %w{ hTTp://example.com/
+                          http://exaMple.com/
+                          http://exa%4dple.com/
+                          http://exa%4Dple.com/
+                          http://exa%6dple.com/
+                          http://exa%6Dple.com/
+                          http://@example.com/
+                          http://example.com:/
+                          http://example.com:80/
+                          http://example.com
+                        },
+      :different =>   %w{ http://example.com/#
+                          http://example.com/?
+                          http://example.com:8888/
+                          http:///example.com
+                          http:example.com
+                          https://example.com/
+                        },
+    },
+    { :normalized =>     "http://example.com/index.html",
+      :equivalent =>  %w{ http://example.com/index.ht%6dl
+                          http://example.com/index.ht%6Dl
+                        },
+     :different =>    %w{ http://example.com/index.hTMl
+                          http://example.com/index.ht%4dl
+                          http://example.com/index
+                          http://example.com/
+                          http://example.com/
+                        },
+    },
+    { :normalized =>     "http://example.com/x?y#z",
+      :equivalent =>  %w{ http://example.com/x?y#%7a
+                          http://example.com/x?y#%7A
+                          http://example.com/x?%79#z
+                        },
+     :different =>    %w{ http://example.com/x?Y#z
+                          http://example.com/x?y#Z
+                          http://example.com/x?y=#z
+                          http://example.com/x?y
+                          http://example.com/x#z
+                        },
+    },
+    { :normalized =>     "http://example.com/x?q=a%20b",
+      :equivalent =>  %w{
+                        },
+      :different =>   %w{ http://example.com/x?q=a+b
+                        },
+    },
+  ]
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/uri/normalize_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/uri/normalize_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/uri/normalize_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,4 +1,5 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/normalization'
 require 'uri'
 
 describe "URI#normalize" do
@@ -13,4 +14,22 @@
     uri.to_s.should_not == "http://example.com/"
     uri.normalize.to_s.should == "http://example.com/"
   end
+
+  # The previous tests are included by the one below
+
+  quarantine! do # Quarantined until redmine:2542 is accepted
+    it "respects RFC 3986" do
+      URISpec::NORMALIZED_FORMS.each do |form|
+        normal_uri = URI(form[:normalized])
+        normalized = normal_uri.normalize.to_s
+        normal_uri.to_s.should == normalized
+        form[:equivalent].each do |same|
+          URI(same).normalize.to_s.should == normalized
+        end
+        form[:different].each do |other|
+          URI(other).normalize.to_s.should_not == normalized
+        end
+      end
+    end
+  end
 end
\ No newline at end of file

Added: MacRuby/trunk/spec/frozen/library/uri/shared/eql.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/uri/shared/eql.rb	                        (rev 0)
+++ MacRuby/trunk/spec/frozen/library/uri/shared/eql.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -0,0 +1,17 @@
+describe :uri_eql, :shared => true do
+  it "returns false if the normalized forms are different" do
+    URISpec::NORMALIZED_FORMS.each do |form|
+      normal_uri = URI(form[:normalized])
+      form[:different].each do |other|
+        URI(other).send(@method, normal_uri).should be_false
+      end
+    end
+  end
+end
+
+describe :uri_eql_against_other_types, :shared => true do
+  it "returns false for when compared to non-uri objects" do
+    URI("http://example.com/").send(@method, "http://example.com/").should be_false
+    URI("http://example.com/").send(@method, nil).should be_false
+  end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/library/yaml/dump_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/yaml/dump_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/yaml/dump_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,9 +1,10 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.dirname(__FILE__) + '/fixtures/common'
 
+# TODO: WTF is this using a global?
 describe "YAML.dump" do
   after :each do
-    File.delete $test_file if File.exist? $test_file
+    rm_r $test_file
   end
   
   it "converts an object to YAML and write result to io when io provided" do

Modified: MacRuby/trunk/spec/frozen/library/yaml/load_file_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/yaml/load_file_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/yaml/load_file_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,7 +3,7 @@
 
 describe "YAML.load_file" do
   after :each do
-    File.delete $test_file if File.exist? $test_file
+    rm_r $test_file
   end
   
   it "returns a hash" do

Modified: MacRuby/trunk/spec/frozen/library/yaml/load_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/yaml/load_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/yaml/load_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 
 describe "YAML.load" do
   after :each do
-    File.delete $test_file if File.exist? $test_file
+    rm_r $test_file
   end
   
   it "returns a document from current io stream when io provided" do

Modified: MacRuby/trunk/spec/frozen/library/zlib/gzipreader/each_byte_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/zlib/gzipreader/each_byte_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/zlib/gzipreader/each_byte_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1 +1,33 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
+require 'stringio'
+require 'zlib'
+
+describe "GzipReader#each_byte" do
+
+  before :each do
+    @data = '12345abcde'
+    @zip = "\037\213\b\000,\334\321G\000\00334261MLJNI\005\000\235\005\000$\n\000\000\000"
+    @io = StringIO.new @zip
+    ScratchPad.clear
+  end
+
+  it "calls the given block for each byte in the stream, passing the byte as an argument" do
+    gz = Zlib::GzipReader.new @io
+
+    ScratchPad.record []
+    gz.each_byte { |b| ScratchPad << b }
+
+    ScratchPad.recorded.should == [49, 50, 51, 52, 53, 97, 98, 99, 100, 101]
+  end
+
+  it "increments position before calling the block" do
+    gz = Zlib::GzipReader.new @io
+
+    i = 1
+    gz.each_byte do |ignore|
+      gz.pos.should == i
+      i += 1
+    end
+  end
+
+end

Modified: MacRuby/trunk/spec/frozen/library/zlib/gzipreader/eof_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/zlib/gzipreader/eof_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/zlib/gzipreader/eof_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,22 +1,55 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
 require 'stringio'
 require 'zlib'
-
+ 
 describe "GzipReader#eof?" do
-
+ 
   before :each do
-    @data = '12345abcde'
-    @zip = "\037\213\b\000,\334\321G\000\00334261MLJNI\005\000\235\005\000$\n\000\000\000"
+    @data = '{"a":1234}'
+    @zip = "\037\213\b\000\000\000\000\000\000\003\253VJT\2622426\251\005\000\304\024v\325\n\000\000\000"
     @io = StringIO.new @zip
   end
-
+ 
   it "returns true when at EOF" do
     gz = Zlib::GzipReader.new @io
-
-    gz.eof?.should == false
+    gz.eof?.should be_false
     gz.read
-    gz.eof?.should == true
+    gz.eof?.should be_true
   end
+  
+  it "returns true when at EOF with the exact length of uncompressed data" do
+    gz = Zlib::GzipReader.new @io
+    gz.eof?.should be_false
+    gz.read(10)
+    gz.eof?.should be_true
+  end
+  
+  it "returns true when at EOF with a length greater than the size of uncompressed data" do
+    gz = Zlib::GzipReader.new @io
+    gz.eof?.should be_false
+    gz.read(11)
+    gz.eof?.should be_true
+  end
+  
+  it "returns false when at EOF when there's data left in the buffer to read" do
+    gz = Zlib::GzipReader.new @io
+    data = gz.read(9)
+    gz.eof?.should be_false
+    gz.read
+    gz.eof?.should be_true
+  end
 
+  # This is especially important for JRuby, since eof? there
+  # is more than just a simple accessor.
+  it "does not affect the reading data" do
+    gz = Zlib::GzipReader.new @io
+    0.upto(9) do |i|
+      gz.eof?.should be_false
+      gz.read(1).should == @data[i, 1]
+    end
+    gz.eof?.should be_true
+    gz.read().should == ""
+    gz.eof?.should be_true
+  end
+ 
 end
-

Modified: MacRuby/trunk/spec/frozen/library/zlib/gzipreader/getc_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/zlib/gzipreader/getc_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/zlib/gzipreader/getc_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1 +1,55 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
+require 'stringio'
+require 'zlib'
+
+describe "GzipReader#getc" do
+
+  before :each do
+    @data = '12345abcde'
+    @zip = "\037\213\b\000,\334\321G\000\00334261MLJNI\005\000\235\005\000$\n\000\000\000"
+    @io = StringIO.new @zip
+  end
+
+  ruby_version_is ''...'1.9' do
+    it "returns the next byte from the stream" do
+      gz = Zlib::GzipReader.new @io
+      gz.pos.should == 0
+
+      gz.getc.should == ?1
+      gz.getc.should == ?2
+      gz.getc.should == ?3
+      gz.getc.should == ?4
+      gz.getc.should == ?5
+    end
+  end
+
+  ruby_version_is '1.9' do
+    it "returns the next character from the stream" do
+      gz = Zlib::GzipReader.new @io
+      gz.pos.should == 0
+
+      gz.getc.should == '1'
+      gz.getc.should == '2'
+      gz.getc.should == '3'
+      gz.getc.should == '4'
+      gz.getc.should == '5'
+    end
+  end
+
+  it "increments position" do
+    gz = Zlib::GzipReader.new @io
+    (0.. at data.size).each do |i|
+      gz.pos.should == i
+      gz.getc
+    end
+  end
+
+  it "returns nil at the end of the stream" do
+    gz = Zlib::GzipReader.new @io
+    gz.read
+    pos = gz.pos
+    gz.getc.should be_nil
+    gz.pos.should == pos
+  end
+
+end

Modified: MacRuby/trunk/spec/frozen/library/zlib/gzipreader/read_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/zlib/gzipreader/read_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/zlib/gzipreader/read_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,19 +10,49 @@
     @io = StringIO.new @zip
   end
 
-  it "reads the contents of a gzip file" do
+  it "with no arguments reads the entire content of a gzip file" do
     gz = Zlib::GzipReader.new @io
-
     gz.read.should == @data
   end
 
+  it "with nil length argument reads the entire content of a gzip file" do
+    gz = Zlib::GzipReader.new @io
+    gz.read(nil).should == @data
+  end
+
   it "reads the contents up to a certain size" do
     gz = Zlib::GzipReader.new @io
-
     gz.read(5).should == @data[0...5]
-
     gz.read(5).should == @data[5...10]
   end
+  
+  it "does not accept a negative length to read" do
+    gz = Zlib::GzipReader.new @io
+    lambda {
+      gz.read(-1)
+    }.should raise_error(ArgumentError)
+  end
+  
+  it "returns an empty string if a 0 length is given" do
+    gz = Zlib::GzipReader.new @io
+    gz.read(0).should == ""
+  end
 
+  describe "at the end of data" do
+    it "returns empty string if length prameter is not specified or 0" do
+      gz = Zlib::GzipReader.new @io
+      gz.read # read till the end
+      gz.read(0).should == ""
+      gz.read().should == ""
+      gz.read(nil).should == ""
+    end
+
+    it "returns nil if length prameter is positive" do
+      gz = Zlib::GzipReader.new @io
+      gz.read # read till the end
+      gz.read(1).should be_nil
+      gz.read(2**16).should be_nil
+    end
+  end
+
 end
-

Modified: MacRuby/trunk/spec/frozen/library/zlib/gzipreader/rewind_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/zlib/gzipreader/rewind_spec.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/library/zlib/gzipreader/rewind_spec.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -8,25 +8,40 @@
     @data = '12345abcde'
     @zip = "\037\213\b\000,\334\321G\000\00334261MLJNI\005\000\235\005\000$\n\000\000\000"
     @io = StringIO.new @zip
+    ScratchPad.clear
   end
 
-  it "resets the position of the file pointer" do
+  it "resets the position of the stream pointer" do
     gz = Zlib::GzipReader.new @io
     gz.read
     gz.pos.should == @data.length
 
     gz.rewind
     gz.pos.should == 0
+    gz.lineno.should == 0
   end
 
+  it "resets the position of the stream pointer to data previously read" do
+    gz = Zlib::GzipReader.new @io
+    first_read = gz.read
+    gz.rewind
+    first_read.should == gz.read
+  end
+
   it "invokes seek method on the associated IO object" do
     # first, prepare the mock object:
     (obj = mock("io")).should_receive(:get_io).any_number_of_times.and_return(@io)
     def obj.read(args); get_io.read(args); end
-    obj.should_receive(:seek).and_return(0)
+    def obj.seek(pos, whence = 0)
+      ScratchPad.record :seek
+      get_io.seek(pos, whence)
+    end
 
     gz = Zlib::GzipReader.new(obj)
     gz.rewind()
+
+    ScratchPad.recorded.should == :seek
     gz.pos.should == 0
+    gz.read.should == "12345abcde"
   end
 end

Modified: MacRuby/trunk/spec/frozen/optional/ffi/fixtures/GNUmakefile
===================================================================
--- MacRuby/trunk/spec/frozen/optional/ffi/fixtures/GNUmakefile	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/optional/ffi/fixtures/GNUmakefile	2010-01-10 20:52:37 UTC (rev 3229)
@@ -46,7 +46,7 @@
   ifeq ($(CPU),i386)
     ARCHFLAGS += -arch i386 -arch x86_64
   endif
-  CFLAGS += $(ARCHFLAGS) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -DTARGET_RT_MAC_CFM=0
+  CFLAGS += $(ARCHFLAGS) -DTARGET_RT_MAC_CFM=0
   CFLAGS += -fno-common
   LDFLAGS = $(ARCHFLAGS) -dynamiclib -Wl,-syslibroot,$(SDKROOT) -mmacosx-version-min=10.4
   # link against the universal libraries on ppc machines

Modified: MacRuby/trunk/spec/frozen/shared/array/join.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/array/join.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/array/join.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,17 +4,31 @@
     a.send(@method, ':').should == ''
   end
 
-  it "returns a string formed by concatenating each element.to_s separated by separator without trailing separator" do
-    obj = mock('foo')
-    def obj.to_s() 'foo' end
-    @object.new(1, 2, 3, 4, obj).send(@method, ' | ').should == '1 | 2 | 3 | 4 | foo'
+  ruby_version_is ""..."1.9" do
+    it "returns a string formed by concatenating each element.to_s separated by separator without trailing separator" do
+      obj = mock('foo')
+      def obj.to_s() 'foo' end
+      @object.new(1, 2, 3, 4, obj).send(@method, ' | ').should == '1 | 2 | 3 | 4 | foo'
 
-    obj = mock('o')
-    class << obj; undef :to_s; end
-    obj.should_receive(:method_missing).with(:to_s).and_return("o")
-    @object.new(1, obj).send(@method, ":").should == "1:o"
+      obj = mock('o')
+      class << obj; undef :to_s; end
+      obj.should_receive(:method_missing).with(:to_s).and_return("o")
+      @object.new(1, obj).send(@method, ":").should == "1:o"
+    end
   end
 
+  ruby_version_is "1.9" do
+    it "returns a string formed by concatenating each element.to_str separated by separator without trailing separator" do
+      obj = mock('foo')
+      def obj.to_s() 'foo' end
+      @object.new(1, 2, 3, 4, obj).send(@method, ' | ').should == '1 | 2 | 3 | 4 | foo'
+
+      obj = mock('o')
+      obj.should_receive(:method_missing).with(:to_str).and_return("o")
+      @object.new(1, obj).send(@method, ":").should == "1:o"
+    end
+  end
+
   it "raises a NoMethodError if an element does not respond to #to_s" do
     obj = mock('o')
     class << obj; undef :to_s; end

Modified: MacRuby/trunk/spec/frozen/shared/file/executable.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/executable.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/executable.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,18 +3,14 @@
     @file1 = tmp('temp1.txt')
     @file2 = tmp('temp2.txt')
 
-    File.open(@file1, "w"){} # touch
-    File.open(@file2, "w"){} # touch
+    touch @file1
+    touch @file2
 
     File.chmod(0755, @file1)
   end
 
   after :each do
-    File.delete(@file1) if File.exist?(@file1)
-    File.delete(@file2) if File.exist?(@file2)
-
-    @file1 = nil
-    @file2 = nil
+    rm_r @file1, @file2
   end
 
   platform_is_not :windows do

Modified: MacRuby/trunk/spec/frozen/shared/file/executable_real.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/executable_real.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/executable_real.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -3,18 +3,14 @@
     @file1 = tmp('temp1.txt')
     @file2 = tmp('temp2.txt')
 
-    File.open(@file1, "w") {} # touch
-    File.open(@file2, "w") {}
+    touch @file1
+    touch @file2
 
     File.chmod(0755, @file1)
   end
 
   after :each do
-    File.delete(@file1) if File.exist?(@file1)
-    File.delete(@file2) if File.exist?(@file2)
-
-    @file1 = nil
-    @file2 = nil
+    rm_r @file1, @file2
   end
 
   platform_is_not :windows do

Modified: MacRuby/trunk/spec/frozen/shared/file/file.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/file.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/file.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -11,13 +11,11 @@
     end
 
     @file = tmp("test.txt")
-    File.open(@file, "w"){} # touch
+    touch @file
   end
 
   after :each do
-    File.delete(@file) rescue nil
-    @null = nil
-    @file = nil
+    rm_r @file
   end
 
   it "returns true if the named file exists and is a regular file." do

Modified: MacRuby/trunk/spec/frozen/shared/file/grpowned.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/grpowned.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/grpowned.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -6,7 +6,7 @@
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
 
   platform_is_not :windows do

Modified: MacRuby/trunk/spec/frozen/shared/file/identical.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/identical.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/identical.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,36 +1,36 @@
 describe :file_identical, :shared => true do
   before :each do
-    @file1 = tmp('test.txt')
-    @file2 = tmp('test2.txt')
-    @file3 = tmp('test.lnk')
-    File.delete(@file3) if File.exists?(@file3)
+    @file1 = tmp('file_identical.txt')
+    @file2 = tmp('file_identical2.txt')
+    @link  = tmp('file_identical.lnk')
 
-    File.open(@file1,"w+") { |f| f.puts "file1" }
-    File.open(@file2,"w+") { |f| f.puts "file2" }
-    File.link(@file1, @file3)
+
+    touch(@file1) { |f| f.puts "file1" }
+    touch(@file2) { |f| f.puts "file2" }
+
+    rm_r @link
+    File.link(@file1, @link)
   end
 
   after :each do
-    File.unlink(@file3)
-    File.delete(@file1) if File.exists?(@file1)
-    File.delete(@file2) if File.exists?(@file2)
+    rm_r @link, @file1, @file2
   end
 
   it "return true if they are identical" do
     @object.send(@method, @file1, @file1).should == true
     @object.send(@method, @file1, @file2).should == false
-    @object.send(@method, @file1, @file3).should == true
+    @object.send(@method, @file1, @link).should == true
   end
 
   ruby_version_is "1.9" do
     it "accepts an object that has a #to_path method" do
-      @object.send(@method, mock_to_path(@file1), mock_to_path(@file3)).should == true
+      @object.send(@method, mock_to_path(@file1), mock_to_path(@link)).should == true
     end
   end
 
 
   it "raises an ArgumentError if not passed two arguments" do
-    lambda { @object.send(@method, @file1, @file2, @file3) }.should raise_error(ArgumentError)
+    lambda { @object.send(@method, @file1, @file2, @link) }.should raise_error(ArgumentError)
     lambda { @object.send(@method, @file1) }.should raise_error(ArgumentError)
   end
 

Modified: MacRuby/trunk/spec/frozen/shared/file/readable.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/readable.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/readable.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -10,7 +10,7 @@
   end
 
   after :each do
-    File.delete(@file) if File.exists?(@file)
+    rm_r @file
   end
 
   it "returns true if named file is readable by the effective user id of the process, otherwise false" do

Modified: MacRuby/trunk/spec/frozen/shared/file/readable_real.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/readable_real.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/readable_real.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
   end
 
   after :each do
-    File.delete(@file) if File.exists?(@file)
+    rm_r @file
   end
 
   it "returns true if named file is readable by the real user id of the process, otherwise false" do

Modified: MacRuby/trunk/spec/frozen/shared/file/size.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/size.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/size.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -5,7 +5,7 @@
   end
 
   after :each do
-    File.delete @exists if File.exist? @exists
+    rm_r @exists
   end
 
   it "returns the size of the file if it exists and is not empty" do
@@ -28,8 +28,9 @@
 
 describe :file_size_raise_when_missing, :shared => true do
   before :each do
-    @missing = "i_dont_exist"
-    File.delete @missing if File.exists? @missing
+    # TODO: missing_file
+    @missing = tmp("i_dont_exist")
+    rm_r @missing
   end
 
   it "raises an error if file_name doesn't exist" do
@@ -39,8 +40,9 @@
 
 describe :file_size_nil_when_missing, :shared => true do
   before :each do
-    @missing = "i_dont_exist"
-    File.delete @missing if File.exists? @missing
+    # TODO: missing_file
+    @missing = tmp("i_dont_exist")
+    rm_r @missing
   end
 
   it "returns nil if file_name doesn't exist or has 0 size" do
@@ -50,13 +52,12 @@
 
 describe :file_size_0_when_empty, :shared => true do
   before :each do
-    @empty = "i_am_empty"
-    File.delete @empty if File.exist? @empty
-    File.open(@empty,'w') { }
+    @empty = tmp("i_am_empty")
+    touch @empty
   end
 
   after :each do
-    File.delete @empty if File.exist? @empty
+    rm_r @empty
   end
 
   it "returns 0 if the file is empty" do
@@ -66,13 +67,12 @@
 
 describe :file_size_nil_when_empty, :shared => true do
   before :each do
-    @empty = "i_am_empty"
-    File.delete @empty if File.exist? @empty
-    File.open(@empty,'w') { }
+    @empty = tmp("i_am_empt")
+    touch @empty
   end
 
   after :each do
-    File.delete @empty if File.exist? @empty
+    rm_r @empty
   end
 
   it "returns nil if file_name is empty" do
@@ -83,14 +83,16 @@
 describe :file_size_with_file_argument, :shared => true do
   before :each do
     @exists = tmp('i_exist')
-    File.open(@exists,'w') { |f| f.write 'rubinius' }
+    touch(@exists) { |f| f.write 'rubinius' }
   end
 
   after :each do
-    File.delete @exists if File.exist? @exists
+    rm_r @exists
   end
 
   it "accepts a File argument" do
-    @object.send(@method,File.open(@exists)).should == 8
+    File.open(@exists) do |f|
+      @object.send(@method, f).should == 8
+    end
   end
-end
\ No newline at end of file
+end

Modified: MacRuby/trunk/spec/frozen/shared/file/sticky.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/sticky.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/sticky.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,6 +1,32 @@
 describe :file_sticky, :shared => true do
+  before :each do
+    @dir = tmp('sticky_dir')
+    Dir.rmdir(@dir) if File.exists?(@dir)
+  end
+  
+  after :each do
+    Dir.rmdir(@dir) if File.exists?(@dir)
+  end
+  
+  platform_is_not :windows, :darwin do
+    it "returns true if the named file has the sticky bit, otherwise false" do
+      Dir.mkdir @dir, 1755
+      
+      @object.send(@method, @dir).should == true
+      @object.send(@method, '/').should == false
+    end
+  end
+    
   ruby_version_is "1.9" do
 # please add a 1.9 test that accepts a mock_to_path("/path") argument
 #    it "accepts an object that has a #to_path method"
   end
 end
+
+describe :file_sticky_missing, :shared => true do
+  platform_is_not :windows do
+    it "returns false if the file dies not exist" do
+      @object.send(@method, 'fake_file').should == false
+    end
+  end
+end

Modified: MacRuby/trunk/spec/frozen/shared/file/symlink.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/symlink.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/symlink.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,15 +1,14 @@
 describe :file_symlink, :shared => true do
   before :each do
-    @file = "test.txt"
-    @link = "test.lnk"
-    File.delete(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
-    File.open(@file,"w+")
+    @file = tmp("test.txt")
+    @link = tmp("test.lnk")
+
+    rm_r @link
+    touch @file
   end
 
   after :each do
-    File.delete(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
+    rm_r @link, @file
   end
 
   platform_is_not :windows do
@@ -29,16 +28,16 @@
 
 describe :file_symlink_nonexistent, :shared => true do
   before :each do
-    @file = "test.txt"
-    @link = "test.lnk"
-    File.delete(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
-    File.open(@file,"w+")
+    @file = tmp("test.txt")
+    @link = tmp("test.lnk")
+
+    rm_r @link
+    touch @file
   end
 
   after :each do
-    File.delete(@link) if File.exist?(@link)
-    File.delete(@file) if File.exist?(@file)
+    rm_r @link
+    rm_r @file
   end
 
   platform_is_not :windows do

Modified: MacRuby/trunk/spec/frozen/shared/file/world_readable.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/world_readable.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/world_readable.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 
   before(:each) do
     @file = tmp('world-readable')
-    File.open(@file,'w') {|f| f.puts }
+    touch @file
   end
 
   after(:each) do

Modified: MacRuby/trunk/spec/frozen/shared/file/world_writable.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/world_writable.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/world_writable.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
 
   before(:each) do
     @file = tmp('world-writable')
-    File.open(@file,'w') {|f| f.puts }
+    touch @file
   end
 
   after(:each) do

Modified: MacRuby/trunk/spec/frozen/shared/file/writable.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/writable.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/writable.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
   end
 
   after :each do
-    File.delete(@file) if File.exists?(@file)
+    rm_r @file
   end
 
   it "returns true if named file is writable by the effective user id of the process, otherwise false" do

Modified: MacRuby/trunk/spec/frozen/shared/file/writable_real.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/writable_real.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/writable_real.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -4,7 +4,7 @@
   end
 
   after :each do
-    File.delete(@file) if File.exist?(@file)
+    rm_r @file
   end
 
   it "returns true if named file is writable by the real user id of the process, otherwise false" do

Modified: MacRuby/trunk/spec/frozen/shared/file/zero.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/zero.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/file/zero.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,22 +1,16 @@
 describe :file_zero, :shared => true do
   before :each do
-    @zero_file    = 'test.txt'
-    @nonzero_file = 'test2.txt'
-    @dir = File.dirname(__FILE__)
+    @zero_file    = tmp("test.txt")
+    @nonzero_file = tmp("test2.txt")
 
-    File.open(@zero_file, "w") {|f| @zero_fh = f} # Touch
-    File.open(@nonzero_file, "w") { |f| f.puts "hello"; @nonzero_fh = f }
+    @dir = tmp("")
+
+    touch @zero_file
+    touch(@nonzero_file) { |f| f.puts "hello" }
   end
 
   after :each do
-    @zero_fh.close unless @zero_fh.closed?
-    @nonzero_fh.close unless @nonzero_fh.closed?
-    File.delete(@zero_file) if File.exists?(@zero_file)
-    File.delete(@nonzero_file) if File.exists?(@nonzero_file)
-    @zero_file    = nil
-    @zero_fh    = nil
-    @nonzero_file = nil
-    @nonzero_fh = nil
+    rm_r @zero_file, @nonzero_file
   end
 
   it "returns true if the file is empty" do
@@ -69,10 +63,9 @@
   end
 
   platform_is :windows do
-    ruby_bug("redmine #449", "1.8.6") do
-      it "returns false for a directory" do
-        @object.send(@method, @dir).should == false
-      end
+    # see http://redmine.ruby-lang.org/issues/show/449 for background
+    it "returns true for a directory" do
+      @object.send(@method, @dir).should == true
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/shared/process/times.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/process/times.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/process/times.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1,6 +1,6 @@
 describe :process_times, :shared => true do
   it "returns a Struct::Tms" do
-    @object.send(@method).class.should == Struct::Tms
+    @object.send(@method).should be_kind_of(Struct::Tms)
   end
 
   it "returns current cpu times" do

Modified: MacRuby/trunk/spec/frozen/shared/rational/exponent.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/rational/exponent.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/rational/exponent.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -103,12 +103,12 @@
 
   ruby_version_is "1.9" do
     it "returns a complex number if self is negative and the passed argument is not 0" do
-      (Rational(-3, 2) ** 1.5).should == Complex(
-        -3.374618290464398e-16, -1.8371173070873836)
-      (Rational(3, -2) ** 1.5).should == Complex(
-        -3.374618290464398e-16, -1.8371173070873836)
-      (Rational(3, -2) ** -1.5).should == Complex(
-        -9.998869008783402e-17, 0.5443310539518174)
+      (Rational(-3, 2) ** 1.5).should be_close(Complex(
+        -3.374618290464398e-16, -1.8371173070873836), TOLERANCE)
+      (Rational(3, -2) ** 1.5).should be_close(Complex(
+        -3.374618290464398e-16, -1.8371173070873836), TOLERANCE)
+      (Rational(3, -2) ** -1.5).should be_close(Complex(
+        -9.998869008783402e-17, 0.5443310539518174), TOLERANCE)
     end
 
     it "returns Complex(1.0) when the passed argument is 0.0" do

Modified: MacRuby/trunk/spec/frozen/shared/rational/modulo.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/rational/modulo.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/shared/rational/modulo.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -23,12 +23,17 @@
   end
 
   it "raises ZeroDivisionError on zero denominator" do
-    lambda { Rational(3, 5).send(@method, Rational(0, 1)) }.should 
-      raise_error(ZeroDivisionError)
-    lambda { Rational(0, 1).send(@method, Rational(0, 1)) }.should 
-      raise_error(ZeroDivisionError)
-    lambda { Rational(3, 5).send(@method, 0) }.should 
-      raise_error(ZeroDivisionError)
+    lambda {
+      Rational(3, 5).send(@method, Rational(0, 1))
+    }.should raise_error(ZeroDivisionError)
+
+    lambda {
+      Rational(0, 1).send(@method, Rational(0, 1))
+    }.should raise_error(ZeroDivisionError)
+
+    lambda {
+      Rational(3, 5).send(@method, 0)
+    }.should raise_error(ZeroDivisionError)
   end
 
   ruby_version_is ""..."1.9" do
@@ -39,8 +44,9 @@
 
   ruby_version_is "1.9" do
     it "raises a ZeroDivisionError when the argument is 0.0" do
-      lambda { Rational(3, 5).send(@method, 0.0) }.should 
-        raise_error(ZeroDivisionError)
+      lambda {
+        Rational(3, 5).send(@method, 0.0)
+      }.should raise_error(ZeroDivisionError)
     end
   end
 end

Modified: MacRuby/trunk/spec/frozen/spec_helper.rb
===================================================================
--- MacRuby/trunk/spec/frozen/spec_helper.rb	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/spec_helper.rb	2010-01-10 20:52:37 UTC (rev 3229)
@@ -48,7 +48,7 @@
   end
 end
 
-minimum_version = "1.5.12"
+minimum_version = "1.5.14"
 unless MSpec::VERSION >= minimum_version
   puts "Please install MSpec version >= #{minimum_version} to run the specs"
   exit 1

Modified: MacRuby/trunk/spec/frozen/upstream
===================================================================
--- MacRuby/trunk/spec/frozen/upstream	2010-01-10 20:46:51 UTC (rev 3228)
+++ MacRuby/trunk/spec/frozen/upstream	2010-01-10 20:52:37 UTC (rev 3229)
@@ -1 +1 @@
-bb54356acee1c73a63472b3ae57479da6cac48f1
\ No newline at end of file
+df1eedf81d8bf3c2274f36730fd6f3ffa4076a12
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100110/7594e77e/attachment-0001.html>


More information about the macruby-changes mailing list