facets 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -3
- data/ProjectInfo +5 -2
- data/conf/facets/noauto +11 -11
- data/lib/facet/aspects.rb +1 -0
- data/lib/facet/float/round_off.rb +1 -0
- data/lib/facet/kernel/instance.rb +1 -0
- data/lib/facet/kernel/pp_exception.rb +1 -0
- data/lib/facet/module/cattr.rb +1 -0
- data/lib/facet/module/on_included.rb +1 -0
- data/lib/facet/nilclass/blank.rb +1 -0
- data/lib/facet/numeric/approx.rb +1 -0
- data/lib/facet/ostruct/instance.rb +1 -0
- data/lib/facets.rb +0 -1
- data/lib/facets/core/enumerable/every.rb +1 -5
- data/lib/facets/core/float.rb +1 -0
- data/lib/facets/core/float/approx.rb +2 -42
- data/lib/facets/core/float/round_at.rb +2 -1
- data/lib/facets/core/float/round_off.rb +8 -0
- data/lib/facets/core/float/round_to.rb +2 -1
- data/lib/facets/core/gem.rb +0 -3
- data/lib/facets/core/hash/inverse.rb +3 -1
- data/lib/facets/core/inflect.rb +3 -0
- data/lib/facets/core/kernel.rb +2 -2
- data/lib/facets/core/kernel/{__meta__.rb → instance.rb} +10 -9
- data/lib/facets/core/kernel/pp_exception.rb +17 -0
- data/lib/facets/core/module.rb +2 -0
- data/lib/facets/core/module/attr.rb +4 -1
- data/lib/facets/core/module/basename.rb +12 -1
- data/lib/facets/core/module/cattr.rb +180 -0
- data/lib/facets/core/module/cattr_accessor.rb +2 -141
- data/lib/facets/core/module/cattr_reader.rb +1 -1
- data/lib/facets/core/module/cattr_writer.rb +1 -1
- data/lib/facets/core/module/on_included.rb +48 -0
- data/lib/facets/core/module/wrap_method.rb +7 -2
- data/lib/facets/core/nilclass.rb +1 -1
- data/lib/facets/core/nilclass/{to_f.rb → blank.rb} +6 -6
- data/lib/facets/core/nilclass/op_cmp.rb +11 -0
- data/lib/facets/core/nilclass/succ.rb +5 -0
- data/lib/facets/core/numeric.rb +1 -0
- data/lib/facets/core/numeric/approx.rb +34 -0
- data/lib/facets/core/ostruct/__update__.rb +2 -2
- data/lib/facets/core/ostruct/instance.rb +37 -0
- data/lib/facets/core/string/modulize.rb +1 -1
- data/lib/facets/more/consoleapp.rb +27 -16
- data/lib/facets/more/crypt.rb +8 -4
- data/lib/facets/more/elementor.rb +104 -0
- data/lib/facets/more/expirable.rb +5 -0
- data/lib/facets/more/nilcomparable.rb +88 -31
- data/lib/facets/more/overload.rb +1 -1
- data/lib/facets/more/typecast.rb +12 -3
- data/test/FIXTURE/filelist/testfile.txt +0 -0
- data/test/FIXTURE/filelist/testfile2.txt +0 -0
- data/test/lib/{facet → facets/core}/array/test_at_rand.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_delete_unless.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_delete_values.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_delete_values_at.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_first.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_head.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_last_index.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_merge.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_mid.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_middle.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_op_store.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_pick.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_pos.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_pull.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_rand_index.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_rand_subset.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_range.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_rotate.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_select.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_shuffle.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_slap.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_thru.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_to_b.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_to_h.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_to_hash.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/self/test_of_caller.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test___LINE__.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_call_stack.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_called.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_caller.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_defined.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_eval.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_local_variables.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_op_store.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_self.rb +3 -3
- data/test/lib/{facet → facets/core}/class/test_descendents.rb +3 -3
- data/test/lib/{facet → facets/core}/class/test_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/class/test_remove_descendents.rb +3 -3
- data/test/lib/{facet → facets/core}/class/test_unix_path.rb +3 -3
- data/test/lib/{facet → facets/core}/comparable/test_at_least.rb +3 -3
- data/test/lib/{facet → facets/core}/comparable/test_clip.rb +3 -3
- data/test/lib/{facet → facets/core}/comparable/test_cmp.rb +3 -3
- data/test/lib/{facet → facets/core}/continuation/self/test_create.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_days_in_month.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_days_of_month.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_stamp.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_to_date.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_to_s.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_to_time.rb +3 -3
- data/test/lib/{facet → facets/core}/dir/self/test_ancestor.rb +3 -3
- data/test/lib/{facet → facets/core}/dir/self/test_ascend.rb +3 -3
- data/test/lib/{facet → facets/core}/dir/self/test_ls_r.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/self/test_combinations.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/self/test_cross.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_collect_with_index.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_commonality.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_compact_collect.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_cross.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_each_combination.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_each_pair.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_each_slice.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_each_unique_pair.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_entropy.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_every.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_ew.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_filter_collect.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_find_collisions.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_frequency.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_graph.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_ideal_entropy.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_none.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_occur.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_one.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_op_pow.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_partition_by.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_permute.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_probability.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_to_h.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_uniq_by.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_create.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_open_as_string.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_read_list.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_sanitize.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_split_all.rb +3 -3
- data/test/lib/{facet → facets/core}/fileutils/test_wc.rb +3 -3
- data/test/lib/{facet → facets/core}/fileutils/test_which.rb +3 -3
- data/test/lib/{facet → facets/core}/float/test_approx.rb +3 -3
- data/test/lib/{facet → facets/core}/float/test_round_at.rb +3 -3
- data/test/lib/{facet → facets/core}/float/test_round_to.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/self/test_zipnew.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_alias.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_assert_has_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_assert_has_only_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_at.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_collate.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_each.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_each_with_index.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_each_with_key.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_graph.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_has_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_has_only_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_inverse.rb +6 -4
- data/test/lib/{facet → facets/core}/hash/test_keys_to_s.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_keys_to_sym.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_op_lshift.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_rand_key.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_rand_pair.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_rand_value.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_replace_each.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_shuffle.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_slice.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_swap.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_swapkey.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_to_h.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_to_ostruct.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_to_ostruct_recurse.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_traverse.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_update_each.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_update_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_update_values.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_weave.rb +3 -3
- data/test/lib/{facet → facets/core}/integer/test_factorial.rb +3 -3
- data/test/lib/{facet → facets/core}/integer/test_multiple.rb +3 -3
- data/test/lib/{facet → facets/core}/integer/test_ordinal.rb +3 -3
- data/test/lib/{facet → facets/core}/integer/test_times_collect.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test___class__.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_as.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_assign_from.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_assign_with.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_bool.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_bug.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_call_stack.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_called.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_constant.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_copy.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_deep_copy.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_demo.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_fn.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_generate_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_get_by_id.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_here.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_in.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_maybe.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_metaclass.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_method.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_methods.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_new.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_object_class.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_object_hexid.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_require_all.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_require_esc.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_require_facet.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_resc.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_returning.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_send_as.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_set_from.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_set_with.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_silently.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_singleton.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_superior.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_supermethod.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_this.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_to_b.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_to_bool.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_uri.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_val.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_with_accessor.rb +3 -3
- data/test/lib/{facet → facets/core}/matchdata/test_match.rb +3 -3
- data/test/lib/{facet → facets/core}/matchdata/test_matchtree.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_abstract.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_alias_module_function.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_ancestor.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_basename.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_by_name.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_cattr_accessor.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_clone_using.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_dirname.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_equate_on.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_generate_instance_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_include_as.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_initializer.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_instance_methods.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_integrate.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_memoize.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_modspace.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_namespace.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_nesting.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_redef.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_redefine_method.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_redirect.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_redirect_method.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_remove.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_rename.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_rename_method.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_revisal.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_shadow_method.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_sort_on.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_undef.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_wrap.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_wrap_method.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_empty.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_include.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_size.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_to_f.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_to_h.rb +3 -3
- data/test/lib/{facet → facets/core}/numeric/test_ceil_multiple.rb +3 -3
- data/test/lib/{facet → facets/core}/numeric/test_succ.rb +3 -3
- data/test/lib/{facet → facets/core}/numeric/test_to_b.rb +3 -3
- data/test/lib/{facet → facets/core}/ostruct/test___merge__.rb +3 -3
- data/test/lib/{facet → facets/core}/ostruct/test___update__.rb +3 -3
- data/test/lib/{facet → facets/core}/ostruct/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/ostruct/test_op_store.rb +3 -3
- data/test/lib/{facet → facets/core}/proc/test_compose.rb +3 -3
- data/test/lib/{facet → facets/core}/proc/test_to_method.rb +3 -3
- data/test/lib/{facet → facets/core}/range/test_to_r.rb +3 -3
- data/test/lib/{facet → facets/core}/range/test_to_range.rb +3 -3
- data/test/lib/{facet → facets/core}/range/test_umbrella.rb +3 -3
- data/test/lib/{facet → facets/core}/range/test_within.rb +3 -3
- data/test/lib/{facet → facets/core}/regexp/test_arity.rb +3 -3
- data/test/lib/{facet → facets/core}/regexp/test_to_re.rb +3 -3
- data/test/lib/{facet → facets/core}/regexp/test_to_regexp.rb +3 -3
- data/test/lib/{facet → facets/core}/string/self/test_interpolate.rb +3 -3
- data/test/lib/{facet → facets/core}/string/self/test_patterns.rb +3 -3
- data/test/lib/{facet → facets/core}/string/self/test_rand_letter.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_align_center.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_at_rand.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_basename.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_blank.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_bracket.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_camelcase.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_camelize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_capitalized.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_chars.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_cmp.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_demodulize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_downcase.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_dresner.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_each_char.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_each_word.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_first.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_fold.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_frequency.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_humanize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_indent.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_index_all.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_last.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_line_wrap.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_lines.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_lowercase.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_margin.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_methodize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_modulize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_mscan.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_natcmp.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_nchar.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_pathize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_pop.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_probability.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_push.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_quote.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_rand_byte.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_rand_index.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_range.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_range_all.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_range_of_line.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_regesc.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_shatter.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_shift.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_shuffle.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_similarity.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_singular.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_slap.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_soundex.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_succ.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_a.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_arr.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_b.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_const.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_date.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_proc.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_re.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_time.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_unix_crypt.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_unpack.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_unshift.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_upcase.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_whitespace.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_word_filter.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_word_wrap.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_words.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_camelcase.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_camelize.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_capitalize.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_capitalized.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_downcase.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_not.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_pad.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_succ.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_to_const.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_to_proc.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_to_str.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_underscore.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_upcase.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_change.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_elapse.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_stamp.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_to_date.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_to_s.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_to_time.rb +3 -3
- data/test/lib/facets/more/test_annotation.rb +217 -0
- data/test/lib/facets/more/test_ansicode.rb +36 -0
- data/test/lib/facets/more/test_association.rb +46 -0
- data/test/lib/facets/more/test_bbcode.rb +34 -0
- data/test/lib/facets/more/test_bitmask.rb +47 -0
- data/test/lib/facets/more/test_bytes.rb +84 -0
- data/test/lib/facets/more/test_classinherit.rb +65 -0
- data/test/lib/facets/more/test_classmethods.rb +65 -0
- data/test/lib/facets/more/test_coroutine.rb +60 -0
- data/test/lib/facets/more/test_crypt.rb +46 -0
- data/test/lib/facets/more/test_dictionary.rb +97 -0
- data/test/lib/facets/more/test_enumerablepass.rb +86 -0
- data/test/lib/facets/more/test_floatstring.rb +36 -0
- data/test/lib/facets/more/test_functor.rb +39 -0
- data/test/lib/facets/more/test_inheritor.rb +155 -0
- data/test/lib/facets/more/test_interval.rb +119 -0
- data/test/lib/facets/more/test_lisp.rb +47 -0
- data/test/lib/facets/more/test_lisp_format.rb +37 -0
- data/test/lib/facets/more/test_lrucache.rb +25 -0
- data/test/lib/facets/more/test_mathconstants.rb +18 -0
- data/test/lib/facets/more/test_methodprobe.rb +53 -0
- data/test/lib/facets/more/test_multipliers.rb +114 -0
- data/test/lib/facets/more/test_multiton.rb +200 -0
- data/test/lib/facets/more/test_nackclass.rb +45 -0
- data/test/lib/facets/more/test_nilcomparable.rb +43 -0
- data/test/lib/facets/more/test_openobject.rb +66 -0
- data/test/lib/facets/more/test_overload.rb +54 -0
- data/test/lib/facets/more/test_paramix.rb +100 -0
- data/test/lib/facets/more/test_preinitialize.rb +49 -0
- data/test/lib/facets/more/test_promoteself.rb +45 -0
- data/test/lib/facets/more/test_snapshot.rb +34 -0
- data/test/lib/facets/more/test_statichash.rb +31 -0
- data/test/lib/facets/more/test_syncarray.rb +28 -0
- data/test/lib/facets/more/test_synchash.rb +28 -0
- data/test/lib/facets/more/test_tagiterator.rb +93 -0
- data/test/lib/facets/more/test_timer.rb +66 -0
- data/test/lib/facets/more/test_times.rb +73 -0
- data/test/lib/facets/more/test_tuple.rb +32 -0
- data/test/lib/facets/more/test_typecast.rb +65 -0
- data/test/lib/facets/more/test_uninheritable.rb +42 -0
- data/test/lib/facets/more/test_units.rb +104 -0
- data/test/lib/facets/more/test_yamlstruct.rb +37 -0
- metadata +416 -357
- data/lib/facet/kernel/__meta__.rb +0 -1
- data/lib/facet/kernel/meta.rb +0 -1
- data/lib/facet/nilclass/to_f.rb +0 -1
- data/lib/facets/core/kernel/meta.rb +0 -2
- data/test/lib/facet/fileutils/test_slice.rb +0 -96
@@ -0,0 +1,28 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/syncarray.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Mar 24 23:42:51 UTC 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/syncarray.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
# TODO
|
19
|
+
|
20
|
+
class TC_SyncArray < Test::Unit::TestCase
|
21
|
+
|
22
|
+
def test_01
|
23
|
+
assert_nothing_raised{ @s = SyncArray.new }
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/synchash.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Mar 24 23:42:50 UTC 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/synchash.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
# TODO
|
19
|
+
|
20
|
+
class TC_SyncHash < Test::Unit::TestCase
|
21
|
+
|
22
|
+
def test_01
|
23
|
+
assert_nothing_raised{ @h = SyncHash.new }
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/tagiterator.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Mar 24 23:42:51 UTC 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/tagiterator.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
class TC_TagIterator < Test::Unit::TestCase
|
19
|
+
|
20
|
+
STEXT = <<-EOS
|
21
|
+
<body> This is a test...
|
22
|
+
<sub> S1 </sub> <sub> S2 </sub>
|
23
|
+
<DL>
|
24
|
+
<DT> A1
|
25
|
+
<DT> A2
|
26
|
+
<DT> A3
|
27
|
+
</DL>
|
28
|
+
<DL>
|
29
|
+
<DT> B1
|
30
|
+
<DT> B2
|
31
|
+
<DT> B3
|
32
|
+
</DL>
|
33
|
+
<NEST>
|
34
|
+
<P ALIGN="R">TOP</P>
|
35
|
+
<NEST>
|
36
|
+
<P>SECOND</P>
|
37
|
+
<OL>
|
38
|
+
<LI>C1
|
39
|
+
<LI>C2
|
40
|
+
<LI>C3
|
41
|
+
<LI>C4
|
42
|
+
</OL>
|
43
|
+
</NEST>
|
44
|
+
<OL>
|
45
|
+
<LI>D1
|
46
|
+
<LI>D2
|
47
|
+
<LI>D3
|
48
|
+
<LI>D4
|
49
|
+
</OL>
|
50
|
+
</NEST>
|
51
|
+
</body>
|
52
|
+
EOS
|
53
|
+
|
54
|
+
def test_all
|
55
|
+
assert_nothing_raised{ @a = TagIterator.new( STEXT ) }
|
56
|
+
@f = []
|
57
|
+
assert_nothing_raised {
|
58
|
+
@a.first("body") do |y|
|
59
|
+
y.nth("dl",2) do |dl|
|
60
|
+
dl.enumtag("dt") do |t|
|
61
|
+
@f << t.text.strip
|
62
|
+
end
|
63
|
+
end
|
64
|
+
y.first("nest") do |n|
|
65
|
+
n.first("p") do |c|
|
66
|
+
@f << c.text
|
67
|
+
@f.concat c.attributes.collect{ |k,v| "#{k}=#{v}" }
|
68
|
+
end.next("nest") do |m|
|
69
|
+
m.first("p") do |c|
|
70
|
+
@f << c.text
|
71
|
+
end.next("ol") do |o|
|
72
|
+
o.enumtag("li") do |i| @f << i.text.strip end
|
73
|
+
end
|
74
|
+
end.next("ol") do |o|
|
75
|
+
o.enumtag("li") do |i| @f << i.text.strip end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
@a.each_block("sub") do |y|
|
80
|
+
@f << y.text.strip
|
81
|
+
end
|
82
|
+
}
|
83
|
+
o = [ "B1", "B2", "B3",
|
84
|
+
"TOP", "align=R", "SECOND",
|
85
|
+
"C1", "C2", "C3", "C4",
|
86
|
+
"D1", "D2", "D3", "D4",
|
87
|
+
"S1", "S2" ]
|
88
|
+
assert_equal( o, @f )
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/timer.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Mar 24 23:42:51 UTC 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/timer.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
class TC_Timer < Test::Unit::TestCase
|
19
|
+
|
20
|
+
def test_timed
|
21
|
+
timed { |timer|
|
22
|
+
assert_equal 0, timer.total_time.round
|
23
|
+
sleep 1
|
24
|
+
assert_equal 1, timer.total_time.round
|
25
|
+
timer.stop
|
26
|
+
assert_equal 1, timer.total_time.round
|
27
|
+
sleep 1
|
28
|
+
assert_equal 1, timer.total_time.round
|
29
|
+
timer.start
|
30
|
+
assert_equal 1, timer.total_time.round
|
31
|
+
sleep 1
|
32
|
+
assert_equal 2, timer.total_time.round
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_outoftime
|
37
|
+
t = Timer.new(1)
|
38
|
+
assert_raises( TimeoutError ) {
|
39
|
+
t.start
|
40
|
+
sleep 2
|
41
|
+
t.stop
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# This has been removed becuase it is too close to call.
|
46
|
+
# Sometimes and error is returned sometimes it is not.
|
47
|
+
#def test_nickoftime
|
48
|
+
# assert_raises( TimeoutError ) {
|
49
|
+
# @t.start
|
50
|
+
# sleep 2
|
51
|
+
# @t.stop
|
52
|
+
# }
|
53
|
+
#end
|
54
|
+
|
55
|
+
def test_intime
|
56
|
+
t = Timer.new(2)
|
57
|
+
assert_nothing_raised {
|
58
|
+
t.start
|
59
|
+
sleep 1
|
60
|
+
t.stop
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/times.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Mar 24 23:42:51 UTC 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/times.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
#require 'mega/multiplier'
|
18
|
+
|
19
|
+
class TC_Numeric < Test::Unit::TestCase
|
20
|
+
|
21
|
+
#def test_micro_seconds
|
22
|
+
# assert_equal( 0.000001, 1.microsecond )
|
23
|
+
#end
|
24
|
+
|
25
|
+
#def test_milli_seconds
|
26
|
+
# assert_equal( 0.001, 1.millisecond )
|
27
|
+
#end
|
28
|
+
|
29
|
+
def test_seconds
|
30
|
+
assert_equal( 60**0, 1.seconds )
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_minutes
|
34
|
+
assert_equal( 60**1, 1.minutes )
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_hours
|
38
|
+
assert_equal( 60**2, 1.hours )
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_days
|
42
|
+
assert_equal( 24*(60**2), 1.days )
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_weeks
|
46
|
+
assert_equal( 7*24*(60**2), 1.weeks )
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_fortnights
|
50
|
+
assert_equal( 14*24*(60**2), 1.fortnights )
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_months
|
54
|
+
assert_equal( 30*24*(60**2), 1.months )
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_years
|
58
|
+
assert_equal( 365*24*(60**2), 1.years )
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_before
|
62
|
+
t = Time.now
|
63
|
+
assert_equal( t - 1.day, 1.day.before(t) )
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_after
|
67
|
+
t = Time.now
|
68
|
+
assert_equal( t + 1.day, 1.day.after(t) )
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/tuple.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Mar 24 23:42:51 UTC 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/tuple.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
class TC_Tuple < Test::Unit::TestCase
|
19
|
+
|
20
|
+
def setup
|
21
|
+
@t1 = Tuple[1,2,3]
|
22
|
+
@t2 = Tuple[2,4,5]
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_compare
|
26
|
+
assert( @t1 < @t2 )
|
27
|
+
assert( @t2 > @t1 )
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/typecast.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Mar 24 23:42:51 UTC 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/typecast.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
class TestClass
|
19
|
+
attr_accessor :my_var
|
20
|
+
def initialize(my_var); @my_var = my_var; end
|
21
|
+
|
22
|
+
def cast_to_string(options={})
|
23
|
+
@my_var
|
24
|
+
end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
def cast_from_string(string, options={})
|
28
|
+
self.new( string )
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class TC_TypeCast < Test::Unit::TestCase
|
34
|
+
|
35
|
+
def setup
|
36
|
+
@test_string = "this is a test"
|
37
|
+
@test_class = TestClass.new(@test_string)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_to_string
|
41
|
+
assert_equal( '1234', 1234.cast_to(String) )
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_custom_to_string
|
45
|
+
assert_equal( @test_string, @test_class.cast_to(String) )
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_custom_from_string
|
49
|
+
assert_equal( @test_class.my_var, @test_string.cast_to(TestClass).my_var )
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_string_to_class
|
53
|
+
assert_equal( Test::Unit::TestCase, "Test::Unit::TestCase".cast_to(Class) )
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_string_to_time
|
57
|
+
assert_equal( "Mon Oct 10 00:00:00 CEST 2005", "10-10-2005".cast_to(Time).to_s )
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_no_converter
|
61
|
+
assert_equal( nil, "sdfjljsldfjslk".cast_to( ::Regexp ))
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/uninheritable.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Mar 24 23:42:51 UTC 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/uninheritable.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
class TC_Uninheritable < Test::Unit::TestCase
|
19
|
+
|
20
|
+
class Cannot
|
21
|
+
extend Uninheritable
|
22
|
+
end
|
23
|
+
|
24
|
+
class Can
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_module
|
28
|
+
assert_nothing_raised {
|
29
|
+
self.instance_eval <<-EOS
|
30
|
+
class A < Can; end
|
31
|
+
EOS
|
32
|
+
}
|
33
|
+
assert_raises(TypeError, "Class Cannot cannot be subclassed.") do
|
34
|
+
self.instance_eval <<-EOS
|
35
|
+
class B < Cannot; end
|
36
|
+
EOS
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/units.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Mar 24 23:42:51 UTC 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/units.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
include Units
|
19
|
+
|
20
|
+
class TC01 < Test::Unit::TestCase
|
21
|
+
|
22
|
+
def test_01_001
|
23
|
+
assert_equal( "65.0 bit/s", (1.bit/s + 8.bytes/s).to_s )
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_01_002
|
27
|
+
assert_equal( "0.125 byte/s", ((1.bit/s).to(byte/s)).to_s )
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_01_003
|
31
|
+
assert_equal( "5280.0 feet", (1.mile.to(feet)).to_s )
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_01_004
|
35
|
+
assert_equal( "4840.0 yd**2", (1.acre.to(yd**2)).to_s )
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_01_005
|
39
|
+
assert_equal( "4840.0 sq_yd", (1.acre.to(sq_yd)).to_s )
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_01_006
|
43
|
+
assert_equal( "3.785411784 L", (1.gallon.to(self.L)).to_s )
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_01_007
|
47
|
+
assert_equal( "0.45359237 kg", (1.lb.to(kg)).to_s )
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_01_008
|
51
|
+
assert_equal( "1 s m", (1.m.s.to(m.s)).to_s )
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_01_009
|
55
|
+
assert_equal( "2.589988110336 km**2", (1.sq_mi.to(km**2)).to_s )
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_01_010
|
59
|
+
assert_equal( "1.609344 km", (1.mile.to(km)).to_s )
|
60
|
+
end
|
61
|
+
|
62
|
+
# currency rates change frequently, temp commented
|
63
|
+
#def test_01_011
|
64
|
+
# assert_equal( "33.2750003803837 twd", (1.usd.to(twd)).to_s )
|
65
|
+
#end
|
66
|
+
|
67
|
+
def test_01_012
|
68
|
+
with_unit_converter(:uk) {
|
69
|
+
assert_equal( "112.0 lb", 1.cwt.to(lb).to_s )
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_01_013
|
74
|
+
with_unit_converter(:us) {
|
75
|
+
assert_equal( "100.0 lb", 1.cwt.to(lb).to_s )
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_01_014
|
80
|
+
assert_equal( "112.0 lb", (1.cwt(:uk).to(lb(:uk))).to_s )
|
81
|
+
assert_equal( "100.0 lb", (1.cwt(:us).to(lb(:us))).to_s )
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_01_015
|
85
|
+
assert_equal( "lb", (Converter.current.lb).to_s )
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_01_016
|
89
|
+
assert_equal( [:us, :cex, :default, :uk], Converter.registered_converters )
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_01_017
|
93
|
+
assert_raises(TypeError) {
|
94
|
+
1.try.to(usd)
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_01_016
|
99
|
+
assert_equal( "33.2190007563597 twd", (1.usd(:cex).to(twd(:cex))).to_s )
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
|