facets 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ProjectInfo +32 -25
- data/data/facets/index.yml +30 -6
- data/data/facets/units/binary/base.yaml +12 -0
- data/data/facets/units/binary/extra.yaml +8 -0
- data/data/facets/units/cex.yaml +7 -0
- data/data/facets/units/currency/base.yaml +268 -0
- data/data/facets/units/default.yaml +22 -0
- data/data/facets/units/dump_yaml.rb +309 -0
- data/data/facets/units/si/base.yaml +36 -0
- data/data/facets/units/si/derived.yaml +133 -0
- data/data/facets/units/si/extra.yaml +107 -0
- data/data/facets/units/standard.yaml +5 -0
- data/data/facets/units/uk.yaml +16 -0
- data/data/facets/units/uk/base.yaml +107 -0
- data/data/facets/units/us.yaml +16 -0
- data/data/facets/units/us/base.yaml +112 -0
- data/data/facets/units/xmethods/cached.yaml +83 -0
- data/data/facets/units/xmethods/mapping.yaml +85 -0
- data/lib/facet/array/join_sentence.rb +1 -0
- data/lib/facet/class/cattr.rb +1 -0
- data/lib/facet/class/cattr_accessor.rb +1 -0
- data/lib/facet/class/cattr_reader.rb +1 -0
- data/lib/facet/class/cattr_writer.rb +1 -0
- data/lib/facet/elementor.rb +1 -0
- data/lib/facet/enumerable/accumulate.rb +1 -0
- data/lib/facet/enumerable/collect_if.rb +1 -0
- data/lib/facet/enumerable/map_if.rb +1 -0
- data/lib/facet/file/self/append.rb +1 -0
- data/lib/facet/file/self/read_binary.rb +1 -0
- data/lib/facet/file/self/write.rb +1 -0
- data/lib/facet/json.rb +1 -0
- data/lib/facet/kernel/__self__.rb +1 -0
- data/lib/facet/kernel/methodname.rb +1 -0
- data/lib/facet/module/attr_query.rb +1 -0
- data/lib/facet/module/attr_validator.rb +1 -0
- data/lib/facet/module/inherit.rb +1 -0
- data/lib/facet/module/let.rb +1 -0
- data/lib/facet/module/mattr.rb +1 -0
- data/lib/facet/module/mattr_accessor.rb +1 -0
- data/lib/facet/module/mattr_reader.rb +1 -0
- data/lib/facet/module/mattr_writer.rb +1 -0
- data/lib/facet/module/singleton_to_module.rb +1 -0
- data/lib/facet/nilclass/op_cmp.rb +1 -0
- data/lib/facet/nilclass/succ.rb +1 -0
- data/lib/facet/recorder.rb +1 -0
- data/lib/facet/xoxo.rb +1 -0
- data/lib/facets/core/array.rb +1 -0
- data/lib/facets/core/array/join_sentence.rb +12 -0
- data/lib/facets/core/class.rb +4 -0
- data/lib/facets/core/{module → class}/cattr.rb +7 -9
- data/lib/facets/core/class/cattr_accessor.rb +2 -0
- data/lib/facets/core/class/cattr_reader.rb +3 -0
- data/lib/facets/core/class/cattr_writer.rb +2 -0
- data/lib/facets/core/dir/self/ls_r.rb +4 -9
- data/lib/facets/core/enumerable.rb +3 -0
- data/lib/facets/core/enumerable/accumulate.rb +25 -0
- data/lib/facets/core/enumerable/collect_if.rb +15 -0
- data/lib/facets/core/enumerable/ew.rb +1 -5
- data/lib/facets/core/enumerable/map_if.rb +3 -0
- data/lib/facets/core/file.rb +3 -0
- data/lib/facets/core/file/self/append.rb +8 -0
- data/lib/facets/core/file/self/create.rb +14 -8
- data/lib/facets/core/file/self/open_as_string.rb +31 -13
- data/lib/facets/core/file/self/read_binary.rb +8 -0
- data/lib/facets/core/file/self/read_list.rb +11 -7
- data/lib/facets/core/file/self/write.rb +8 -0
- data/lib/facets/core/fileutils/wc.rb +4 -9
- data/lib/facets/core/fileutils/which.rb +4 -9
- data/lib/facets/core/kernel.rb +2 -1
- data/lib/facets/core/kernel/__self__.rb +32 -0
- data/lib/facets/core/kernel/as.rb +1 -1
- data/lib/facets/core/kernel/assign_from.rb +3 -3
- data/lib/facets/core/kernel/assign_with.rb +2 -0
- data/lib/facets/core/kernel/me.rb +3 -2
- data/lib/facets/core/kernel/method_name.rb +2 -49
- data/lib/facets/core/kernel/methodname.rb +49 -0
- data/lib/facets/core/module.rb +9 -4
- data/lib/facets/core/module/attr_query.rb +56 -0
- data/lib/facets/core/module/attr_validator.rb +18 -0
- data/lib/facets/core/module/inherit.rb +70 -0
- data/lib/facets/core/module/integrate.rb +1 -1
- data/lib/facets/core/module/let.rb +55 -0
- data/lib/facets/core/module/mattr.rb +180 -0
- data/lib/facets/core/module/{cattr_accessor.rb → mattr_accessor.rb} +0 -0
- data/lib/facets/core/module/{cattr_reader.rb → mattr_reader.rb} +0 -0
- data/lib/facets/core/module/{cattr_writer.rb → mattr_writer.rb} +0 -0
- data/lib/facets/core/module/on_included.rb +3 -1
- data/lib/facets/core/module/singleton_to_module.rb +23 -0
- data/lib/facets/core/nilclass.rb +2 -0
- data/lib/facets/core/string/methodize.rb +4 -3
- data/lib/facets/core/string/modulize.rb +3 -3
- data/lib/facets/more/ansicode.rb +1 -1
- data/lib/facets/more/aspects.rb +1 -1
- data/lib/facets/more/basicobject.rb +67 -22
- data/lib/facets/more/classinherit.rb +2 -2
- data/lib/facets/more/cloneable.rb +1 -1
- data/lib/facets/more/consoleapp.rb +31 -20
- data/lib/facets/more/dictionary.rb +1 -1
- data/lib/facets/more/filelist.rb +2 -10
- data/lib/facets/more/functor.rb +6 -6
- data/lib/facets/more/json.rb +891 -0
- data/lib/facets/more/methodprobe.rb +1 -1
- data/lib/facets/more/multiton.rb +16 -8
- data/lib/facets/more/nilcomparable.rb +31 -49
- data/lib/facets/more/openobject.rb +50 -10
- data/lib/facets/more/recorder.rb +125 -0
- data/lib/facets/more/rtals.rb +199 -4
- data/lib/facets/more/typecast.rb +12 -12
- data/lib/facets/more/units.rb +20 -14
- data/lib/facets/more/xoxo.rb +519 -0
- data/setup.rb +283 -271
- data/test/lib/facets/core/array/test_at_rand.rb +1 -1
- data/test/lib/facets/core/array/test_delete_unless.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values_at.rb +1 -1
- data/test/lib/facets/core/array/test_first.rb +1 -1
- data/test/lib/facets/core/array/test_head.rb +1 -1
- data/test/lib/facets/core/array/test_last_index.rb +1 -1
- data/test/lib/facets/core/array/test_merge.rb +1 -1
- data/test/lib/facets/core/array/test_mid.rb +1 -1
- data/test/lib/facets/core/array/test_middle.rb +1 -1
- data/test/lib/facets/core/array/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/array/test_op_store.rb +1 -1
- data/test/lib/facets/core/array/test_pick.rb +1 -1
- data/test/lib/facets/core/array/test_pos.rb +1 -1
- data/test/lib/facets/core/array/test_pull.rb +1 -1
- data/test/lib/facets/core/array/test_rand_index.rb +1 -1
- data/test/lib/facets/core/array/test_rand_subset.rb +1 -1
- data/test/lib/facets/core/array/test_range.rb +1 -1
- data/test/lib/facets/core/array/test_rotate.rb +1 -1
- data/test/lib/facets/core/array/test_select.rb +1 -1
- data/test/lib/facets/core/array/test_shuffle.rb +1 -1
- data/test/lib/facets/core/array/test_slap.rb +1 -1
- data/test/lib/facets/core/array/test_thru.rb +1 -1
- data/test/lib/facets/core/array/test_to_b.rb +1 -1
- data/test/lib/facets/core/array/test_to_h.rb +1 -1
- data/test/lib/facets/core/array/test_to_hash.rb +1 -1
- data/test/lib/facets/core/binding/self/test_of_caller.rb +1 -1
- data/test/lib/facets/core/binding/test___LINE__.rb +1 -1
- data/test/lib/facets/core/binding/test_call_stack.rb +1 -1
- data/test/lib/facets/core/binding/test_called.rb +1 -1
- data/test/lib/facets/core/binding/test_caller.rb +1 -1
- data/test/lib/facets/core/binding/test_defined.rb +1 -1
- data/test/lib/facets/core/binding/test_eval.rb +1 -1
- data/test/lib/facets/core/binding/test_local_variables.rb +1 -1
- data/test/lib/facets/core/binding/test_method_name.rb +1 -1
- data/test/lib/facets/core/binding/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/binding/test_op_store.rb +1 -1
- data/test/lib/facets/core/binding/test_self.rb +1 -1
- data/test/lib/facets/core/{module/test_cattr_accessor.rb → class/test_cattr.rb} +11 -3
- data/test/lib/facets/core/class/test_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_method_name.rb +1 -1
- data/test/lib/facets/core/class/test_remove_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_unix_path.rb +1 -1
- data/test/lib/facets/core/comparable/test_at_least.rb +1 -1
- data/test/lib/facets/core/comparable/test_clip.rb +1 -1
- data/test/lib/facets/core/comparable/test_cmp.rb +1 -1
- data/test/lib/facets/core/continuation/self/test_create.rb +1 -1
- data/test/lib/facets/core/date/test_days_in_month.rb +1 -1
- data/test/lib/facets/core/date/test_days_of_month.rb +1 -1
- data/test/lib/facets/core/date/test_stamp.rb +1 -1
- data/test/lib/facets/core/date/test_to_date.rb +1 -1
- data/test/lib/facets/core/date/test_to_s.rb +1 -1
- data/test/lib/facets/core/date/test_to_time.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ancestor.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ascend.rb +1 -1
- data/test/lib/facets/core/enumerable/self/test_combinations.rb +1 -1
- data/test/lib/facets/core/enumerable/self/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_collect_with_index.rb +1 -1
- data/test/lib/facets/core/enumerable/test_commonality.rb +1 -1
- data/test/lib/facets/core/enumerable/test_compact_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_combination.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_slice.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_unique_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_every.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ew.rb +1 -1
- data/test/lib/facets/core/enumerable/test_filter_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_find_collisions.rb +1 -1
- data/test/lib/facets/core/enumerable/test_frequency.rb +1 -1
- data/test/lib/facets/core/enumerable/test_graph.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ideal_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_none.rb +1 -1
- data/test/lib/facets/core/enumerable/test_occur.rb +1 -1
- data/test/lib/facets/core/enumerable/test_one.rb +1 -1
- data/test/lib/facets/core/enumerable/test_op_pow.rb +1 -1
- data/test/lib/facets/core/enumerable/test_partition_by.rb +1 -1
- data/test/lib/facets/core/enumerable/test_permute.rb +1 -1
- data/test/lib/facets/core/enumerable/test_probability.rb +1 -1
- data/test/lib/facets/core/enumerable/test_to_h.rb +1 -1
- data/test/lib/facets/core/enumerable/test_uniq_by.rb +1 -1
- data/test/lib/facets/core/file/self/test_create.rb +14 -9
- data/test/lib/facets/core/file/self/test_open_as_string.rb +21 -11
- data/test/lib/facets/core/file/self/test_read_list.rb +11 -8
- data/test/lib/facets/core/file/self/test_sanitize.rb +1 -1
- data/test/lib/facets/core/file/self/test_split_all.rb +1 -1
- data/test/lib/facets/core/float/test_round_at.rb +1 -1
- data/test/lib/facets/core/float/test_round_to.rb +1 -1
- data/test/lib/facets/core/hash/self/test_zipnew.rb +1 -1
- data/test/lib/facets/core/hash/test_alias.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_at.rb +1 -1
- data/test/lib/facets/core/hash/test_collate.rb +1 -1
- data/test/lib/facets/core/hash/test_each.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_index.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_key.rb +1 -1
- data/test/lib/facets/core/hash/test_graph.rb +1 -1
- data/test/lib/facets/core/hash/test_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_inverse.rb +1 -1
- data/test/lib/facets/core/hash/test_keys_to_s.rb +1 -1
- data/test/lib/facets/core/hash/test_keys_to_sym.rb +1 -1
- data/test/lib/facets/core/hash/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/hash/test_op_lshift.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_key.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_pair.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_value.rb +1 -1
- data/test/lib/facets/core/hash/test_replace_each.rb +1 -1
- data/test/lib/facets/core/hash/test_shuffle.rb +1 -1
- data/test/lib/facets/core/hash/test_slice.rb +1 -1
- data/test/lib/facets/core/hash/test_swap.rb +1 -1
- data/test/lib/facets/core/hash/test_swapkey.rb +1 -1
- data/test/lib/facets/core/hash/test_to_h.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct_recurse.rb +1 -1
- data/test/lib/facets/core/hash/test_traverse.rb +1 -1
- data/test/lib/facets/core/hash/test_update_each.rb +1 -1
- data/test/lib/facets/core/hash/test_update_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_update_values.rb +1 -1
- data/test/lib/facets/core/hash/test_weave.rb +1 -1
- data/test/lib/facets/core/integer/test_factorial.rb +1 -1
- data/test/lib/facets/core/integer/test_multiple.rb +1 -1
- data/test/lib/facets/core/integer/test_ordinal.rb +1 -1
- data/test/lib/facets/core/integer/test_times_collect.rb +1 -1
- data/test/lib/facets/core/kernel/test___class__.rb +1 -1
- data/test/lib/facets/core/kernel/test_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_bug.rb +1 -1
- data/test/lib/facets/core/kernel/test_call_stack.rb +1 -1
- data/test/lib/facets/core/kernel/test_called.rb +1 -1
- data/test/lib/facets/core/kernel/test_constant.rb +1 -1
- data/test/lib/facets/core/kernel/test_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_deep_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_demo.rb +1 -1
- data/test/lib/facets/core/kernel/test_fn.rb +1 -1
- data/test/lib/facets/core/kernel/test_generate_method_name.rb +1 -1
- data/test/lib/facets/core/kernel/test_get_by_id.rb +1 -1
- data/test/lib/facets/core/kernel/test_here.rb +1 -1
- data/test/lib/facets/core/kernel/test_in.rb +1 -1
- data/test/lib/facets/core/kernel/test_maybe.rb +1 -1
- data/test/lib/facets/core/kernel/test_metaclass.rb +1 -1
- data/test/lib/facets/core/kernel/test_method.rb +1 -1
- data/test/lib/facets/core/kernel/{test_method_name.rb → test_methodname.rb} +3 -3
- data/test/lib/facets/core/kernel/test_methods.rb +1 -1
- data/test/lib/facets/core/kernel/test_new.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_class.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_hexid.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_all.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_esc.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_facet.rb +1 -1
- data/test/lib/facets/core/kernel/test_resc.rb +1 -1
- data/test/lib/facets/core/kernel/test_returning.rb +1 -1
- data/test/lib/facets/core/kernel/test_send_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_silently.rb +1 -1
- data/test/lib/facets/core/kernel/test_singleton.rb +1 -1
- data/test/lib/facets/core/kernel/test_superior.rb +1 -1
- data/test/lib/facets/core/kernel/test_supermethod.rb +1 -1
- data/test/lib/facets/core/kernel/test_this.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_b.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_uri.rb +1 -1
- data/test/lib/facets/core/kernel/test_val.rb +1 -1
- data/test/lib/facets/core/kernel/test_with_accessor.rb +1 -1
- data/test/lib/facets/core/matchdata/test_match.rb +1 -1
- data/test/lib/facets/core/matchdata/test_matchtree.rb +1 -1
- data/test/lib/facets/core/module/test_abstract.rb +1 -1
- data/test/lib/facets/core/module/test_alias_module_function.rb +1 -1
- data/test/lib/facets/core/module/test_ancestor.rb +1 -1
- data/test/lib/facets/core/module/test_basename.rb +1 -1
- data/test/lib/facets/core/module/test_by_name.rb +1 -1
- data/test/lib/facets/core/module/test_clone_using.rb +1 -1
- data/test/lib/facets/core/module/test_dirname.rb +1 -1
- data/test/lib/facets/core/module/test_equate_on.rb +1 -1
- data/test/lib/facets/core/module/test_generate_instance_method_name.rb +1 -1
- data/test/lib/facets/core/module/test_include_as.rb +1 -1
- data/test/lib/facets/core/module/test_inherit.rb +58 -0
- data/test/lib/facets/core/module/test_initializer.rb +1 -1
- data/test/lib/facets/core/module/test_instance_methods.rb +1 -1
- data/test/lib/facets/core/module/test_integrate.rb +1 -1
- data/test/lib/facets/core/module/test_let.rb +31 -0
- data/test/lib/facets/core/module/test_mattr.rb +71 -0
- data/test/lib/facets/core/module/test_memoize.rb +1 -1
- data/test/lib/facets/core/module/test_modspace.rb +1 -1
- data/test/lib/facets/core/module/test_namespace.rb +1 -1
- data/test/lib/facets/core/module/test_nesting.rb +1 -1
- data/test/lib/facets/core/module/test_on_included.rb +36 -0
- data/test/lib/facets/core/module/test_redef.rb +1 -1
- data/test/lib/facets/core/module/test_redefine_method.rb +1 -1
- data/test/lib/facets/core/module/test_redirect.rb +1 -1
- data/test/lib/facets/core/module/test_redirect_method.rb +1 -1
- data/test/lib/facets/core/module/test_remove.rb +1 -1
- data/test/lib/facets/core/module/test_rename.rb +1 -1
- data/test/lib/facets/core/module/test_rename_method.rb +1 -1
- data/test/lib/facets/core/module/test_revisal.rb +1 -1
- data/test/lib/facets/core/module/test_shadow_method.rb +1 -1
- data/test/lib/facets/core/module/test_sort_on.rb +1 -1
- data/test/lib/facets/core/module/test_undef.rb +1 -1
- data/test/lib/facets/core/module/test_wrap.rb +1 -1
- data/test/lib/facets/core/module/test_wrap_method.rb +1 -1
- data/test/lib/facets/core/nilclass/{test_to_f.rb → test_blank.rb} +5 -5
- data/test/lib/facets/core/nilclass/test_empty.rb +1 -1
- data/test/lib/facets/core/nilclass/test_include.rb +1 -1
- data/test/lib/facets/core/nilclass/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/nilclass/test_size.rb +1 -1
- data/test/lib/facets/core/nilclass/test_to_h.rb +1 -1
- data/test/lib/facets/core/{float → numeric}/test_approx.rb +4 -3
- data/test/lib/facets/core/numeric/test_ceil_multiple.rb +1 -1
- data/test/lib/facets/core/numeric/test_succ.rb +1 -1
- data/test/lib/facets/core/numeric/test_to_b.rb +1 -1
- data/test/lib/facets/core/ostruct/test___merge__.rb +1 -1
- data/test/lib/facets/core/ostruct/test___update__.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_store.rb +1 -1
- data/test/lib/facets/core/proc/test_compose.rb +1 -1
- data/test/lib/facets/core/proc/test_to_method.rb +1 -1
- data/test/lib/facets/core/range/test_to_r.rb +1 -1
- data/test/lib/facets/core/range/test_to_range.rb +1 -1
- data/test/lib/facets/core/range/test_umbrella.rb +1 -1
- data/test/lib/facets/core/range/test_within.rb +1 -1
- data/test/lib/facets/core/regexp/test_arity.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_re.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_regexp.rb +1 -1
- data/test/lib/facets/core/string/self/test_interpolate.rb +1 -1
- data/test/lib/facets/core/string/self/test_patterns.rb +1 -1
- data/test/lib/facets/core/string/self/test_rand_letter.rb +1 -1
- data/test/lib/facets/core/string/test_align_center.rb +1 -1
- data/test/lib/facets/core/string/test_at_rand.rb +1 -1
- data/test/lib/facets/core/string/test_basename.rb +1 -1
- data/test/lib/facets/core/string/test_blank.rb +1 -1
- data/test/lib/facets/core/string/test_bracket.rb +1 -1
- data/test/lib/facets/core/string/test_camelcase.rb +1 -1
- data/test/lib/facets/core/string/test_camelize.rb +1 -1
- data/test/lib/facets/core/string/test_capitalized.rb +1 -1
- data/test/lib/facets/core/string/test_chars.rb +1 -1
- data/test/lib/facets/core/string/test_cmp.rb +1 -1
- data/test/lib/facets/core/string/test_demodulize.rb +1 -1
- data/test/lib/facets/core/string/test_downcase.rb +1 -1
- data/test/lib/facets/core/string/test_dresner.rb +1 -1
- data/test/lib/facets/core/string/test_each_char.rb +1 -1
- data/test/lib/facets/core/string/test_each_word.rb +1 -1
- data/test/lib/facets/core/string/test_first.rb +1 -1
- data/test/lib/facets/core/string/test_fold.rb +1 -1
- data/test/lib/facets/core/string/test_frequency.rb +1 -1
- data/test/lib/facets/core/string/test_humanize.rb +1 -1
- data/test/lib/facets/core/string/test_indent.rb +1 -1
- data/test/lib/facets/core/string/test_index_all.rb +1 -1
- data/test/lib/facets/core/string/test_last.rb +1 -1
- data/test/lib/facets/core/string/test_line_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_lines.rb +1 -1
- data/test/lib/facets/core/string/test_lowercase.rb +1 -1
- data/test/lib/facets/core/string/test_margin.rb +1 -1
- data/test/lib/facets/core/string/test_methodize.rb +1 -1
- data/test/lib/facets/core/string/test_modulize.rb +1 -1
- data/test/lib/facets/core/string/test_mscan.rb +1 -1
- data/test/lib/facets/core/string/test_natcmp.rb +1 -1
- data/test/lib/facets/core/string/test_nchar.rb +1 -1
- data/test/lib/facets/core/string/test_pathize.rb +1 -1
- data/test/lib/facets/core/string/test_pop.rb +1 -1
- data/test/lib/facets/core/string/test_probability.rb +1 -1
- data/test/lib/facets/core/string/test_push.rb +1 -1
- data/test/lib/facets/core/string/test_quote.rb +1 -1
- data/test/lib/facets/core/string/test_rand_byte.rb +1 -1
- data/test/lib/facets/core/string/test_rand_index.rb +1 -1
- data/test/lib/facets/core/string/test_range.rb +1 -1
- data/test/lib/facets/core/string/test_range_all.rb +1 -1
- data/test/lib/facets/core/string/test_range_of_line.rb +1 -1
- data/test/lib/facets/core/string/test_regesc.rb +1 -1
- data/test/lib/facets/core/string/test_shatter.rb +1 -1
- data/test/lib/facets/core/string/test_shift.rb +1 -1
- data/test/lib/facets/core/string/test_shuffle.rb +1 -1
- data/test/lib/facets/core/string/test_similarity.rb +1 -1
- data/test/lib/facets/core/string/test_singular.rb +1 -1
- data/test/lib/facets/core/string/test_slap.rb +1 -1
- data/test/lib/facets/core/string/test_soundex.rb +1 -1
- data/test/lib/facets/core/string/test_succ.rb +1 -1
- data/test/lib/facets/core/string/test_to_a.rb +1 -1
- data/test/lib/facets/core/string/test_to_arr.rb +1 -1
- data/test/lib/facets/core/string/test_to_b.rb +1 -1
- data/test/lib/facets/core/string/test_to_const.rb +1 -1
- data/test/lib/facets/core/string/test_to_date.rb +1 -1
- data/test/lib/facets/core/string/test_to_proc.rb +1 -1
- data/test/lib/facets/core/string/test_to_re.rb +1 -1
- data/test/lib/facets/core/string/test_to_time.rb +1 -1
- data/test/lib/facets/core/string/test_unix_crypt.rb +1 -1
- data/test/lib/facets/core/string/test_unpack.rb +1 -1
- data/test/lib/facets/core/string/test_unshift.rb +1 -1
- data/test/lib/facets/core/string/test_upcase.rb +1 -1
- data/test/lib/facets/core/string/test_whitespace.rb +1 -1
- data/test/lib/facets/core/string/test_word_filter.rb +1 -1
- data/test/lib/facets/core/string/test_word_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_words.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalized.rb +1 -1
- data/test/lib/facets/core/symbol/test_downcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_not.rb +1 -1
- data/test/lib/facets/core/symbol/test_pad.rb +1 -1
- data/test/lib/facets/core/symbol/test_succ.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_const.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_proc.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_str.rb +1 -1
- data/test/lib/facets/core/symbol/test_underscore.rb +1 -1
- data/test/lib/facets/core/symbol/test_upcase.rb +1 -1
- data/test/lib/facets/core/time/test_change.rb +1 -1
- data/test/lib/facets/core/time/test_elapse.rb +1 -1
- data/test/lib/facets/core/time/test_stamp.rb +1 -1
- data/test/lib/facets/core/time/test_to_date.rb +1 -1
- data/test/lib/facets/core/time/test_to_s.rb +1 -1
- data/test/lib/facets/core/time/test_to_time.rb +1 -1
- data/test/lib/facets/more/test_annotation.rb +1 -1
- data/test/lib/facets/more/test_ansicode.rb +1 -1
- data/test/lib/facets/more/test_association.rb +1 -1
- data/test/lib/facets/more/test_basicobject.rb +58 -0
- data/test/lib/facets/more/test_bbcode.rb +1 -1
- data/test/lib/facets/more/test_bitmask.rb +1 -1
- data/test/lib/facets/more/test_bytes.rb +1 -1
- data/test/lib/facets/more/test_classinherit.rb +1 -1
- data/test/lib/facets/more/test_classmethods.rb +1 -1
- data/test/lib/facets/more/test_coroutine.rb +1 -1
- data/test/lib/facets/more/test_crypt.rb +1 -1
- data/test/lib/facets/more/test_dictionary.rb +1 -1
- data/test/lib/facets/more/test_elementor.rb +48 -0
- data/test/lib/facets/more/test_enumerablepass.rb +1 -1
- data/test/lib/facets/more/test_floatstring.rb +1 -1
- data/test/lib/facets/more/test_functor.rb +1 -1
- data/test/lib/facets/more/test_inheritor.rb +1 -1
- data/test/lib/facets/more/test_interval.rb +1 -1
- data/test/lib/facets/more/test_json.rb +232 -0
- data/test/lib/facets/more/test_lisp.rb +1 -1
- data/test/lib/facets/more/test_lisp_format.rb +1 -1
- data/test/lib/facets/more/test_lrucache.rb +1 -1
- data/test/lib/facets/more/test_mathconstants.rb +1 -1
- data/test/lib/facets/more/test_methodprobe.rb +1 -1
- data/test/lib/facets/more/test_multipliers.rb +1 -1
- data/test/lib/facets/more/test_multiton.rb +1 -1
- data/test/lib/facets/more/test_nackclass.rb +1 -1
- data/test/lib/facets/more/test_nilcomparable.rb +6 -2
- data/test/lib/facets/more/test_openobject.rb +1 -1
- data/test/lib/facets/more/test_overload.rb +1 -1
- data/test/lib/facets/more/test_paramix.rb +1 -1
- data/test/lib/facets/more/test_preinitialize.rb +1 -1
- data/test/lib/facets/more/test_promoteself.rb +1 -1
- data/test/lib/facets/more/test_recorder.rb +44 -0
- data/test/lib/facets/more/test_snapshot.rb +1 -1
- data/test/lib/facets/more/test_statichash.rb +1 -1
- data/test/lib/facets/more/test_syncarray.rb +1 -1
- data/test/lib/facets/more/test_synchash.rb +1 -1
- data/test/lib/facets/more/test_tagiterator.rb +1 -1
- data/test/lib/facets/more/test_timer.rb +1 -1
- data/test/lib/facets/more/test_times.rb +1 -1
- data/test/lib/facets/more/test_tuple.rb +1 -1
- data/test/lib/facets/more/test_typecast.rb +2 -2
- data/test/lib/facets/more/test_uninheritable.rb +1 -1
- data/test/lib/facets/more/test_units.rb +16 -10
- data/test/lib/facets/more/test_xoxo.rb +288 -0
- data/test/lib/facets/more/test_yamlstruct.rb +1 -1
- metadata +92 -25
- data/lib/facet/kernel/instance.rb +0 -1
- data/lib/facet/module/cattr.rb +0 -1
- data/lib/facet/module/cattr_accessor.rb +0 -1
- data/lib/facet/module/cattr_reader.rb +0 -1
- data/lib/facet/module/cattr_writer.rb +0 -1
- data/lib/facets/core/kernel/instance.rb +0 -29
- data/test/FIXTURE/create_file +0 -1
- data/test/FIXTURE/open_as_string_file +0 -1
- data/test/FIXTURE/read_list_file +0 -6
- data/test/lib/facets/core/dir/self/test_ls_r.rb +0 -52
- data/test/lib/facets/core/fileutils/test_wc.rb +0 -68
- data/test/lib/facets/core/fileutils/test_which.rb +0 -61
- data/test/testdir.rb +0 -8
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# for lib/facets/more/nilcomparable.rb
|
8
8
|
#
|
9
|
-
# Extracted Fri
|
9
|
+
# Extracted Fri Apr 14 10:02:13 EDT 2006
|
10
10
|
# Unit Tools Reap Test Extractor
|
11
11
|
#
|
12
12
|
|
@@ -16,7 +16,11 @@ require 'facets/more/nilcomparable.rb'
|
|
16
16
|
require 'test/unit'
|
17
17
|
|
18
18
|
class Mock < String
|
19
|
-
|
19
|
+
alias_method :compare_without_nil, :<=>
|
20
|
+
def <=>( other )
|
21
|
+
return 1 if other.nil?
|
22
|
+
compare_without_nil( other )
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
class TC_NilClass_Comparable < Test::Unit::TestCase
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/recorder.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Apr 14 10:02:13 EDT 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/recorder.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
#class Object
|
19
|
+
# def &(o)
|
20
|
+
# self && o
|
21
|
+
# end
|
22
|
+
#end
|
23
|
+
|
24
|
+
class TCRecorder < Test::Unit::TestCase
|
25
|
+
|
26
|
+
class Z
|
27
|
+
def name ; 'George' ; end
|
28
|
+
def age ; 12 ; end
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup
|
32
|
+
@z = Z.new
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_001
|
36
|
+
r = Recorder.new
|
37
|
+
q = proc { |x| (x.name == 'George') & (x.age > 10) }
|
38
|
+
x = q[r]
|
39
|
+
assert( x.__call__(@z) )
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# for lib/facets/more/typecast.rb
|
8
8
|
#
|
9
|
-
# Extracted Fri
|
9
|
+
# Extracted Fri Apr 14 10:02:13 EDT 2006
|
10
10
|
# Unit Tools Reap Test Extractor
|
11
11
|
#
|
12
12
|
|
@@ -54,7 +54,7 @@ require 'facets/more/typecast.rb'
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_string_to_time
|
57
|
-
assert_equal( "Mon Oct 10 00:00:00
|
57
|
+
assert_equal( "Mon Oct 10 00:00:00 2005", "2005-10-10".cast_to(Time).strftime("%a %b %d %H:%M:%S %Y") )
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_no_converter
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# for lib/facets/more/units.rb
|
8
8
|
#
|
9
|
-
# Extracted Fri
|
9
|
+
# Extracted Fri Apr 14 10:02:13 EDT 2006
|
10
10
|
# Unit Tools Reap Test Extractor
|
11
11
|
#
|
12
12
|
|
@@ -86,18 +86,24 @@ require 'facets/more/units.rb'
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def test_01_016
|
89
|
-
|
89
|
+
assert(
|
90
|
+
[:us, :cex, :default, :uk].all? { |c|
|
91
|
+
Converter.registered_converters.include?( c )
|
92
|
+
}
|
93
|
+
)
|
90
94
|
end
|
91
95
|
|
92
|
-
|
93
|
-
assert_raises(TypeError) {
|
94
|
-
1.try.to(usd)
|
95
|
-
}
|
96
|
-
end
|
96
|
+
# Money exchange is off line at the moment
|
97
97
|
|
98
|
-
def
|
99
|
-
|
100
|
-
|
98
|
+
#def test_01_017
|
99
|
+
# assert_raises(TypeError) {
|
100
|
+
# 1.try.to(usd)
|
101
|
+
# }
|
102
|
+
#end
|
103
|
+
|
104
|
+
#def test_01_016
|
105
|
+
# assert_equal( "33.2190007563597 twd", (1.usd(:cex).to(twd(:cex))).to_s )
|
106
|
+
#end
|
101
107
|
|
102
108
|
end
|
103
109
|
|
@@ -0,0 +1,288 @@
|
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |_
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# for lib/facets/more/xoxo.rb
|
8
|
+
#
|
9
|
+
# Extracted Fri Apr 14 10:02:13 EDT 2006
|
10
|
+
# Unit Tools Reap Test Extractor
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'facets/more/xoxo.rb'
|
14
|
+
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
class TCXOXO < Test::Unit::TestCase
|
19
|
+
|
20
|
+
def test_simple_list
|
21
|
+
l = ['1', '2', '3']
|
22
|
+
html = XOXO.dump(l)
|
23
|
+
assert_equal '<ol class="xoxo"><li>1</li><li>2</li><li>3</li></ol>', html
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_nested_list
|
27
|
+
l = ['1', ['2', '3']]
|
28
|
+
assert_equal '<ol class="xoxo"><li>1</li><li><ol><li>2</li><li>3</li></ol></li></ol>', XOXO.dump(l)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_hash
|
32
|
+
h = {'test' => '1', 'name' => 'Kevin'}
|
33
|
+
# Changed since Ruby sorts the hash differently.
|
34
|
+
assert_equal '<ol class="xoxo"><li><dl><dt>name</dt><dd>Kevin</dd><dt>test</dt><dd>1</dd></dl></li></ol>', XOXO.dump(h)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_single_item
|
38
|
+
l = 'test'
|
39
|
+
assert_equal '<ol class="xoxo"><li>test</li></ol>', XOXO.dump(l)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_wrap_differs
|
43
|
+
l = 'test'
|
44
|
+
html = XOXO.dump(l)
|
45
|
+
html_wrap = XOXO.dump(l, :html_wrap => true)
|
46
|
+
assert_not_equal html, html_wrap
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_wrap_single_item
|
50
|
+
l = 'test'
|
51
|
+
html = XOXO.dump(l, :html_wrap => true)
|
52
|
+
assert_equal <<EOF.strip, html
|
53
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN
|
54
|
+
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
55
|
+
<html xmlns="http://www.w3.org/1999/xhtml"><head profile=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><ol class="xoxo"><li>test</li></ol></body></html>
|
56
|
+
EOF
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_wrap_item_with_css
|
60
|
+
l = 'test'
|
61
|
+
html = XOXO.dump(l, :html_wrap => true, :css => 'reaptest.css')
|
62
|
+
assert_equal <<EOF.strip, html
|
63
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN
|
64
|
+
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
65
|
+
<html xmlns="http://www.w3.org/1999/xhtml"><head profile=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css" >@import "reaptest.css";</style></head><body><ol class="xoxo"><li>test</li></ol></body></html>
|
66
|
+
EOF
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_hash_roundtrip
|
70
|
+
h = {'test' => '1', 'name' => 'Kevin'}
|
71
|
+
assert_equal h, XOXO.load(XOXO.dump(h))
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_hash_with_url_roundtrip
|
75
|
+
h = {'url' => 'http://example.com', 'name' => 'Kevin'}
|
76
|
+
assert_equal h, XOXO.load(XOXO.dump(h))
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_nested_hash_roundtrip
|
80
|
+
h = {'test' => '1', 'inner' => {'name' => 'Kevin'}}
|
81
|
+
assert_equal h, XOXO.load(XOXO.dump(h))
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_nested_hash_with_url_roundtrip
|
85
|
+
h = {'url' => 'http://example.com', 'inner' => {
|
86
|
+
'url' => 'http://slashdot.org', 'name' => 'Kevin'}}
|
87
|
+
assert_equal h, XOXO.load(XOXO.dump(h))
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_list_round_trip
|
91
|
+
l = ['3', '2', '1']
|
92
|
+
assert_equal l, XOXO.load(XOXO.dump(l))
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_list_of_hashes_round_trip
|
96
|
+
l = ['3', {'a' => '2'}, {'b' => '1', 'c' => '4'}]
|
97
|
+
assert_equal l, XOXO.load(XOXO.dump(l))
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_list_of_lists_round_trip
|
101
|
+
l = ['3', ['a', '2'], ['b', ['1', ['c', '4']]]]
|
102
|
+
assert_equal l, XOXO.load(XOXO.dump(l))
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_hashes_of_lists_roundtrip
|
106
|
+
h = {
|
107
|
+
'test' => ['1', '2'],
|
108
|
+
'name' => 'Kevin',
|
109
|
+
'nestlist' => ['a', ['b', 'c']],
|
110
|
+
'nestdict' => {'e' => '6', 'f' => '7'}
|
111
|
+
}
|
112
|
+
assert_equal h, XOXO.load(XOXO.dump(h))
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_xoxo_junk_in_containers
|
116
|
+
h = XOXO.load '<ol>bad<li><dl>worse<dt>good</dt><dd>buy</dd> now</dl></li></ol>'
|
117
|
+
assert_equal({'good' => 'buy'}, h)
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_xoxo_junk_in_elements
|
121
|
+
l = XOXO.load '<ol><li>bad<dl><dt>good</dt><dd>buy</dd></dl>worse</li><li>bag<ol><li>OK</li></ol>fish</li></ol>'
|
122
|
+
assert_equal([{'good' => 'buy'}, ['OK']], l)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_xoxo_with_spaces_and_newlines
|
126
|
+
xoxo_sample = <<EOF.strip
|
127
|
+
<ol class='xoxo'>
|
128
|
+
<li>
|
129
|
+
<dl>
|
130
|
+
<dt>text</dt>
|
131
|
+
<dd>item 1</dd>
|
132
|
+
<dt>description</dt>
|
133
|
+
<dd> This item represents the main point we're trying to make.</dd>
|
134
|
+
<dt>url</dt>
|
135
|
+
<dd>http://example.com/more.xoxo</dd>
|
136
|
+
<dt>title</dt>
|
137
|
+
<dd>title of item 1</dd>
|
138
|
+
<dt>type</dt>
|
139
|
+
<dd>text/xml</dd>
|
140
|
+
<dt>rel</dt>
|
141
|
+
<dd>help</dd>
|
142
|
+
</dl>
|
143
|
+
</li>
|
144
|
+
</ol>
|
145
|
+
EOF
|
146
|
+
h = XOXO.load xoxo_sample
|
147
|
+
h2 = {
|
148
|
+
'text' => 'item 1',
|
149
|
+
'description' => " This item represents the main point we're trying to make.",
|
150
|
+
'url' => 'http://example.com/more.xoxo',
|
151
|
+
'title' => 'title of item 1',
|
152
|
+
'type' => 'text/xml',
|
153
|
+
'rel' => 'help'
|
154
|
+
}
|
155
|
+
assert_equal h2, XOXO.load(xoxo_sample)
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_special_attribute_decoding
|
159
|
+
xoxo_sample = <<EOF.strip
|
160
|
+
<ol class='xoxo'>
|
161
|
+
<li>
|
162
|
+
<dl>
|
163
|
+
<dt>text</dt>
|
164
|
+
<dd>item 1</dd>
|
165
|
+
<dt>url</dt>
|
166
|
+
<dd>http://example.com/more.xoxo</dd>
|
167
|
+
<dt>title</dt>
|
168
|
+
<dd>title of item 1</dd>
|
169
|
+
<dt>type</dt>
|
170
|
+
<dd>text/xml</dd>
|
171
|
+
<dt>rel</dt>
|
172
|
+
<dd>help</dd>
|
173
|
+
</dl>
|
174
|
+
</li>
|
175
|
+
</ol>
|
176
|
+
EOF
|
177
|
+
smart_xoxo_sample = <<EOF.strip
|
178
|
+
<ol class='xoxo'>
|
179
|
+
<li><a href="http://example.com/more.xoxo"
|
180
|
+
title="title of item 1"
|
181
|
+
type="text/xml"
|
182
|
+
rel="help">item 1</a>
|
183
|
+
<!-- note how the "text" property is simply the contents of the <a> element -->
|
184
|
+
</li>
|
185
|
+
</ol>
|
186
|
+
EOF
|
187
|
+
assert_equal XOXO.load(xoxo_sample), XOXO.load(smart_xoxo_sample)
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_special_attribute_and_dl_decoding
|
191
|
+
xoxo_sample = <<EOF.strip
|
192
|
+
<ol class="xoxo">
|
193
|
+
<li>
|
194
|
+
<dl>
|
195
|
+
<dt>text</dt>
|
196
|
+
<dd>item 1</dd>
|
197
|
+
<dt>description</dt>
|
198
|
+
<dd> This item represents the main point we're trying to make.</dd>
|
199
|
+
<dt>url</dt>
|
200
|
+
<dd>http://example.com/more.xoxo</dd>
|
201
|
+
<dt>title</dt>
|
202
|
+
<dd>title of item 1</dd>
|
203
|
+
<dt>type</dt>
|
204
|
+
<dd>text/xml</dd>
|
205
|
+
<dt>rel</dt>
|
206
|
+
<dd>help</dd>
|
207
|
+
</dl>
|
208
|
+
</li>
|
209
|
+
</ol>
|
210
|
+
EOF
|
211
|
+
smart_xoxo_sample = <<EOF.strip
|
212
|
+
<ol class="xoxo">
|
213
|
+
<li><a href="http://example.com/more.xoxo"
|
214
|
+
title="title of item 1"
|
215
|
+
type="text/xml"
|
216
|
+
rel="help">item 1</a>
|
217
|
+
<!-- note how the "text" property is simply the contents of the <a> element -->
|
218
|
+
<dl>
|
219
|
+
<dt>description</dt>
|
220
|
+
<dd> This item represents the main point we're trying to make.</dd>
|
221
|
+
</dl>
|
222
|
+
</li>
|
223
|
+
</ol>
|
224
|
+
EOF
|
225
|
+
assert_equal XOXO.load(xoxo_sample), XOXO.load(smart_xoxo_sample)
|
226
|
+
end
|
227
|
+
|
228
|
+
def test_special_attribute_encode
|
229
|
+
h = {
|
230
|
+
'url' => 'http://example.com/more.xoxo',
|
231
|
+
'title' => 'sample url',
|
232
|
+
'type' => "text/xml",
|
233
|
+
'rel' => 'help',
|
234
|
+
'text' => 'an example'
|
235
|
+
}
|
236
|
+
assert_equal '<ol class="xoxo"><li><a href="http://example.com/more.xoxo" title="sample url" rel="help" type="text/xml" >an example</a></li></ol>', XOXO.dump(h)
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_special_attribute_roundtrip_full
|
240
|
+
h = {
|
241
|
+
'url' => 'http://example.com/more.xoxo',
|
242
|
+
'title' => 'sample url',
|
243
|
+
'type' => "text/xml",
|
244
|
+
'rel' => 'help',
|
245
|
+
'text' => 'an example'
|
246
|
+
}
|
247
|
+
assert_equal h, XOXO.load(XOXO.dump(h))
|
248
|
+
end
|
249
|
+
|
250
|
+
def test_special_attribute_roundtrip_no_text
|
251
|
+
h = {
|
252
|
+
'url' => 'http://example.com/more.xoxo',
|
253
|
+
'title' => 'sample url',
|
254
|
+
'type' => "text/xml",
|
255
|
+
'rel' => 'help'
|
256
|
+
}
|
257
|
+
assert_equal h, XOXO.load(XOXO.dump(h))
|
258
|
+
end
|
259
|
+
|
260
|
+
def test_special_attribute_roundtrip_no_text_or_title
|
261
|
+
h = {'url' => 'http://example.com/more.xoxo'}
|
262
|
+
assert_equal h, XOXO.load(XOXO.dump(h))
|
263
|
+
end
|
264
|
+
|
265
|
+
def test_attention_roundtrip
|
266
|
+
kmattn = <<EOF.strip
|
267
|
+
<ol class="xoxo"><li><a href="http://www.boingboing.net/" title="Boing Boing Blog" >Boing Boing Blog</a><dl><dt>alturls</dt><dd><ol><li><a href="http://boingboing.net/rss.xml" >xmlurl</a></li></ol></dd><dt>description</dt><dd>Boing Boing Blog</dd></dl></li><li><a href="http://www.financialcryptography.com/" title="Financial Cryptography" >Financial Cryptography</a><dl><dt>alturls</dt><dd><ol><li><a href="http://www.financialcryptography.com/mt/index.rdf" >xmlurl</a></li></ol></dd><dt>description</dt><dd>Financial Cryptography</dd></dl></li><li><a href="http://hublog.hubmed.org/" title="HubLog" >HubLog</a><dl><dt>alturls</dt><dd><ol><li><a href="http://hublog.hubmed.org/index.xml" >xmlurl</a></li><li><a href="http://hublog.hubmed.org/foaf.rdf" >foafurl</a></li></ol></dd><dt>description</dt><dd>HubLog</dd></dl></li></ol>
|
268
|
+
EOF
|
269
|
+
assert_equal kmattn, XOXO.dump(XOXO.load(kmattn))
|
270
|
+
assert_equal XOXO.load(kmattn), XOXO.load(XOXO.dump(XOXO.load(kmattn)))
|
271
|
+
assert_equal XOXO.dump(XOXO.load(kmattn)),
|
272
|
+
XOXO.dump(XOXO.load(XOXO.dump(XOXO.load(kmattn))))
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_unicode_roundtrip
|
276
|
+
unicode = "Tantek \xc3\x87elik and a snowman \xe2\x98\x83"
|
277
|
+
assert_equal unicode, XOXO.load(XOXO.dump(unicode))
|
278
|
+
end
|
279
|
+
|
280
|
+
# TBD: Implement proper encodings.
|
281
|
+
#
|
282
|
+
# def test_utf8_roundtrip
|
283
|
+
# end
|
284
|
+
# def test_windows1252_roundtrip
|
285
|
+
# end
|
286
|
+
end
|
287
|
+
|
288
|
+
|