facets 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +1 -1
- data/CHANGES +28 -45
- data/MANIFEST +35 -4
- data/README +3 -14
- data/RELEASE +36 -70
- data/VERSION +1 -1
- data/doc/archive/RELEASE-2.5.0 +83 -0
- data/doc/log/basic_stats/index.html +4 -4
- data/doc/log/changelog.html +509 -2
- data/doc/log/changelog.txt +130 -1522
- data/doc/rdoc/core/classes/Array.html +366 -141
- data/doc/rdoc/core/classes/Binding.html +45 -45
- data/doc/rdoc/core/classes/Class.html +38 -38
- data/doc/rdoc/core/classes/Comparable.html +26 -26
- data/doc/rdoc/core/classes/Enumerable.html +174 -170
- data/doc/rdoc/core/classes/Enumerable/Enumerator.html +130 -0
- data/doc/rdoc/core/classes/Enumerator.html +132 -0
- data/doc/rdoc/core/classes/Exception.html +8 -8
- data/doc/rdoc/core/classes/File.html +58 -58
- data/doc/rdoc/core/classes/FileTest.html +4 -4
- data/doc/rdoc/core/classes/Float.html +8 -8
- data/doc/rdoc/core/classes/Functor.html +12 -12
- data/doc/rdoc/core/classes/Hash.html +447 -263
- data/doc/rdoc/core/classes/Indexable.html +110 -110
- data/doc/rdoc/core/classes/Integer.html +2 -2
- data/doc/rdoc/core/classes/Kernel.html +329 -329
- data/doc/rdoc/core/classes/Lazy/Promise.html +1 -1
- data/doc/rdoc/core/classes/MatchData.html +15 -15
- data/doc/rdoc/core/classes/Module.html +176 -157
- data/doc/rdoc/core/classes/NilClass.html +23 -23
- data/doc/rdoc/core/classes/Numeric.html +27 -27
- data/doc/rdoc/core/classes/Object.html +8 -8
- data/doc/rdoc/core/classes/ObjectSpace.html +5 -5
- data/doc/rdoc/core/classes/Proc.html +22 -22
- data/doc/rdoc/core/classes/Regexp.html +1 -1
- data/doc/rdoc/core/classes/Stackable.html +31 -31
- data/doc/rdoc/core/classes/String.html +332 -291
- data/doc/rdoc/core/classes/Symbol.html +1 -1
- data/doc/rdoc/core/classes/TrueClass.html +8 -8
- data/doc/rdoc/core/classes/UnboundMethod.html +18 -13
- data/doc/rdoc/core/created.rid +1 -1
- data/doc/rdoc/core/files/README.html +7 -29
- data/doc/rdoc/core/files/lib/core/facets/array/product_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/collect_rb.html +10 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/compact_map_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/enumerable/map_with_index_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/enumerable/split_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/collate_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/group_by_value_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/hash/new_with_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/module/conflict_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/extend_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/string/align_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/file_rb.html +96 -0
- data/doc/rdoc/core/files/lib/core/facets/string/xor_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/to_hash_rb.html +5 -1
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod/name_rb.html +1 -1
- data/doc/rdoc/core/fr_class_index.html +2 -0
- data/doc/rdoc/core/fr_file_index.html +6 -0
- data/doc/rdoc/core/fr_method_index.html +386 -373
- data/doc/rdoc/lore/classes/OpenStruct.html +6 -4
- data/doc/rdoc/lore/created.rid +1 -1
- data/doc/rdoc/lore/files/README.html +7 -29
- data/doc/rdoc/lore/files/lib/lore/facets/ostruct_rb.html +1 -1
- data/doc/rdoc/more/classes/ANSICode.html +66 -66
- data/doc/rdoc/more/classes/Advisable.html +37 -37
- data/doc/rdoc/more/classes/Advisable/Method.html +20 -20
- data/doc/rdoc/more/classes/Archive/Tar/Minitar.html +27 -27
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Input.html +28 -28
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Output.html +19 -19
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Reader.html +31 -31
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Writer.html +33 -33
- data/doc/rdoc/more/classes/Association.html +67 -53
- data/doc/rdoc/more/classes/Association/Kernel.html +11 -12
- data/doc/rdoc/more/classes/BBCode.html +36 -36
- data/doc/rdoc/more/classes/BaseX.html +16 -16
- data/doc/rdoc/more/classes/BiCrypt.html +67 -67
- data/doc/rdoc/more/classes/BinReadable.html +85 -85
- data/doc/rdoc/more/classes/BinReadable/ByteOrder.html +25 -25
- data/doc/rdoc/more/classes/Binding.html +8 -8
- data/doc/rdoc/more/classes/Buildable.html +4 -4
- data/doc/rdoc/more/classes/Cloneable.html +4 -4
- data/doc/rdoc/more/classes/ConsoleUtils.html +18 -18
- data/doc/rdoc/more/classes/Crypt.html +16 -16
- data/doc/rdoc/more/classes/CssTree.html +8 -8
- data/doc/rdoc/more/classes/Dictionary.html +52 -45
- data/doc/rdoc/more/classes/Enumerable.html +50 -50
- data/doc/rdoc/more/classes/Enumerable/Elementor.html +16 -16
- data/doc/rdoc/more/classes/Enumerable/Enumerator.html +4 -4
- data/doc/rdoc/more/classes/Enumerable/Filterable.html +30 -30
- data/doc/rdoc/more/classes/EnumerablePass.html +15 -15
- data/doc/rdoc/more/classes/Equatable.html +16 -16
- data/doc/rdoc/more/classes/Expirable.html +17 -17
- data/doc/rdoc/more/classes/Fileable.html +14 -14
- data/doc/rdoc/more/classes/Fileable/DSL.html +41 -41
- data/doc/rdoc/more/classes/Hash2Xml.html +4 -4
- data/doc/rdoc/more/classes/Hook.html +162 -0
- data/doc/rdoc/more/classes/HtmlFilter.html +9 -9
- data/doc/rdoc/more/classes/Instantiable.html +9 -9
- data/doc/rdoc/more/classes/Instantize.html +8 -8
- data/doc/rdoc/more/classes/Interval.html +187 -187
- data/doc/rdoc/more/classes/It.html +12 -12
- data/doc/rdoc/more/classes/Matcher.html +38 -38
- data/doc/rdoc/more/classes/Matcher/MatchData.html +4 -4
- data/doc/rdoc/more/classes/Memoizer.html +21 -21
- data/doc/rdoc/more/classes/Multiton.html +12 -12
- data/doc/rdoc/more/classes/Multiton/MetaMethods.html +28 -28
- data/doc/rdoc/more/classes/Net/SMTP.html +8 -8
- data/doc/rdoc/more/classes/OpEsc.html +5 -5
- data/doc/rdoc/more/classes/OpenCascade.html +4 -4
- data/doc/rdoc/more/classes/OpenHash.html +9 -9
- data/doc/rdoc/more/classes/OpenStructable.html +36 -36
- data/doc/rdoc/more/classes/PQueue.html +84 -84
- data/doc/rdoc/more/classes/Paramix.html +16 -16
- data/doc/rdoc/more/classes/Paramix/Delegator.html +16 -16
- data/doc/rdoc/more/classes/RWDelegator.html +16 -16
- data/doc/rdoc/more/classes/Random.html +5 -5
- data/doc/rdoc/more/classes/Random/Array.html +37 -37
- data/doc/rdoc/more/classes/Random/Hash.html +52 -52
- data/doc/rdoc/more/classes/Random/Object.html +4 -4
- data/doc/rdoc/more/classes/Random/String.html +34 -34
- data/doc/rdoc/more/classes/Random/String/Self.html +9 -9
- data/doc/rdoc/more/classes/Registerable.html +13 -13
- data/doc/rdoc/more/classes/Stash.html +28 -28
- data/doc/rdoc/more/classes/String/Mask.html +72 -72
- data/doc/rdoc/more/classes/String/Words.html +31 -31
- data/doc/rdoc/more/classes/System.html +253 -253
- data/doc/rdoc/more/classes/Timer.html +48 -48
- data/doc/rdoc/more/classes/Timer/Dummy.html +9 -9
- data/doc/rdoc/more/classes/Tuple.html +170 -170
- data/doc/rdoc/more/classes/TypeCast/Class.html +4 -4
- data/doc/rdoc/more/classes/TypeCast/Object.html +4 -4
- data/doc/rdoc/more/classes/Uninheritable.html +6 -6
- data/doc/rdoc/more/classes/X.html +117 -0
- data/doc/rdoc/more/classes/XOXO.html +11 -11
- data/doc/rdoc/more/classes/ZipUtils.html +88 -88
- data/doc/rdoc/more/classes/ZipUtils/DryRun.html +68 -68
- data/doc/rdoc/more/classes/ZipUtils/NoWrite.html +68 -68
- data/doc/rdoc/more/classes/ZipUtils/Verbose.html +60 -60
- data/doc/rdoc/more/created.rid +1 -1
- data/doc/rdoc/more/files/README.html +7 -29
- data/doc/rdoc/more/files/lib/more/facets/association_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/dictionary_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/hook_rb.html +96 -0
- data/doc/rdoc/more/files/lib/more/facets/paramix_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/xoxo_rb.html +2 -2
- data/doc/rdoc/more/fr_class_index.html +2 -0
- data/doc/rdoc/more/fr_file_index.html +1 -0
- data/doc/rdoc/more/fr_method_index.html +686 -681
- data/lib/core/facets/array/product.rb +6 -23
- data/lib/core/facets/enumerable/collect.rb +3 -53
- data/lib/core/facets/enumerable/compact_map.rb +35 -0
- data/lib/core/facets/enumerable/map_with_index.rb +23 -0
- data/lib/core/facets/enumerable/split.rb +3 -3
- data/lib/core/facets/hash/collate.rb +45 -14
- data/lib/core/facets/hash/group_by_value.rb +65 -0
- data/lib/core/facets/hash/new_with.rb +15 -0
- data/lib/core/facets/module/extend.rb +11 -0
- data/lib/core/facets/string/align.rb +19 -18
- data/lib/core/facets/string/file.rb +17 -0
- data/lib/core/facets/string/xor.rb +9 -3
- data/lib/core/facets/to_hash.rb +274 -17
- data/lib/core/facets/unboundmethod/name.rb +4 -2
- data/lib/lore/facets/ostruct.rb +3 -0
- data/lib/more/facets/association.rb +28 -12
- data/lib/more/facets/dictionary.rb +10 -4
- data/lib/more/facets/hook.rb +65 -0
- data/lib/more/facets/paramix.rb +5 -5
- data/meta/abstract +13 -0
- data/meta/authors +1 -0
- data/meta/contact +1 -0
- data/meta/contributors +48 -0
- data/meta/created +1 -0
- data/meta/homepage +1 -0
- data/meta/license +1 -0
- data/meta/loadpath +3 -0
- data/meta/releases +14 -0
- data/meta/slogan +1 -0
- data/meta/summary +1 -0
- data/task/test.rake +116 -18
- data/test/core/array/test_product.rb +0 -6
- data/test/core/binding/test_local_variables.rb +9 -3
- data/test/core/enumerable/test_split.rb +19 -0
- data/test/core/module/test_conflict.rb +8 -3
- data/test/core/test_to_hash.rb +152 -0
- data/test/core/unboundmethod/test_arguments.rb +1 -1
- data/test/core/unboundmethod/test_name.rb +2 -2
- metadata +39 -8
- data/doc/log/bstats/stats.html +0 -39
- data/doc/log/stats.html +0 -25
- data/test/more/test_to_hash.rb +0 -58
@@ -239,7 +239,6 @@ class Dictionary
|
|
239
239
|
end
|
240
240
|
|
241
241
|
#
|
242
|
-
|
243
242
|
def reorder
|
244
243
|
if @order_by
|
245
244
|
assoc = @order.collect{ |k| [k,@hash[k]] }.sort_by(&@order_by)
|
@@ -352,9 +351,16 @@ class Dictionary
|
|
352
351
|
self == hsh2 ? nil : hsh2
|
353
352
|
end
|
354
353
|
|
355
|
-
def replace(
|
356
|
-
|
357
|
-
|
354
|
+
def replace(hsh2)
|
355
|
+
case hsh2
|
356
|
+
when Hash
|
357
|
+
@order = hsh2.keys
|
358
|
+
@hash = hsh2
|
359
|
+
else
|
360
|
+
@order = hsh2.order
|
361
|
+
@hash = hsh2.hash
|
362
|
+
end
|
363
|
+
reorder
|
358
364
|
end
|
359
365
|
|
360
366
|
def shift
|
@@ -0,0 +1,65 @@
|
|
1
|
+
|
2
|
+
# TODO: hooks should be an inheritor
|
3
|
+
#
|
4
|
+
module Hook
|
5
|
+
|
6
|
+
def self.append_features(base)
|
7
|
+
base.extend self
|
8
|
+
end
|
9
|
+
|
10
|
+
def hooks
|
11
|
+
@hooks ||= Hash.new{ |h,k| h[k] = [] }
|
12
|
+
end
|
13
|
+
|
14
|
+
def hook(name)
|
15
|
+
name = name.to_sym
|
16
|
+
|
17
|
+
(class << self; self; end).class_eval %{
|
18
|
+
def #{name}(meth=nil, &blk)
|
19
|
+
hooks[:#{name}] << (meth || blk)
|
20
|
+
end
|
21
|
+
}
|
22
|
+
|
23
|
+
module_eval %{
|
24
|
+
def #{name}(*args)
|
25
|
+
self.class.hooks[:#{name}].each do |blk|
|
26
|
+
if Proc === blk
|
27
|
+
blk.call(:#{name}, *args)
|
28
|
+
else
|
29
|
+
__send__(blk, :#{name}, *args)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
#=begin demo
|
40
|
+
|
41
|
+
class X
|
42
|
+
include Hook
|
43
|
+
|
44
|
+
hook :signal
|
45
|
+
|
46
|
+
def boom(event, message)
|
47
|
+
puts "Kaboom!"
|
48
|
+
end
|
49
|
+
|
50
|
+
signal do |event, message|
|
51
|
+
puts "1", event, message
|
52
|
+
end
|
53
|
+
|
54
|
+
signal do |event, message|
|
55
|
+
puts "2", event, message
|
56
|
+
end
|
57
|
+
|
58
|
+
signal :boom
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
X.new.signal("hi")
|
63
|
+
|
64
|
+
#=end
|
65
|
+
|
data/lib/more/facets/paramix.rb
CHANGED
@@ -44,19 +44,19 @@ require 'facets/module/modspace'
|
|
44
44
|
# end
|
45
45
|
#
|
46
46
|
# class MyClass
|
47
|
-
# include
|
47
|
+
# include MyMixin[:name => 'Ruby']
|
48
48
|
# end
|
49
49
|
#
|
50
50
|
# m = MyClass.new
|
51
|
-
# m.hello
|
51
|
+
# m.hello #=> 'Hello from Ruby!'
|
52
52
|
#
|
53
53
|
# You can view the full set of parameters via the #mixin_parameters
|
54
54
|
# class method, which returns a hash keyed on the included modules.
|
55
55
|
#
|
56
|
-
# MyClass.mixin_parameters
|
56
|
+
# MyClass.mixin_parameters #=> {MyMixin=>{:name=>'Ruby'}}
|
57
57
|
# MyClass.mixin_parameters[MyMixin] #=> {:name=>'ruby'}
|
58
58
|
#
|
59
|
-
# The include
|
59
|
+
# The include Paramix is equivalent to:
|
60
60
|
#
|
61
61
|
# def [](parameters)
|
62
62
|
# Paramix.new(self, parameters)
|
@@ -65,7 +65,7 @@ require 'facets/module/modspace'
|
|
65
65
|
# Paramix.new can also take a block that injects code into the class
|
66
66
|
# or module including the parametric mixin. This is useful as an
|
67
67
|
# alternative to using the #included callback for creating dynamic
|
68
|
-
# mixins
|
68
|
+
# mixins. For example:
|
69
69
|
#
|
70
70
|
# def self.[](parameters)
|
71
71
|
# Paramix.new(self, parameters) do
|
data/meta/abstract
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Facets is the single largest collection of core extension methods
|
2
|
+
and standard class additions available for the Ruby programming
|
3
|
+
language.
|
4
|
+
|
5
|
+
Premium Core Extensions and Standard Additions.
|
6
|
+
Facets is a large collection of core extension methods
|
7
|
+
and standard additions for the Ruby programming language.
|
8
|
+
The core extensions are unique by virtue of thier atomicity.
|
9
|
+
Methods are stored in small, tightly related collections,
|
10
|
+
allowing for highly granular control of requirements.
|
11
|
+
The modules include a variety of useful classes, mixins
|
12
|
+
and microframeworks, from the Functor to a complete
|
13
|
+
Annotations system.
|
data/meta/authors
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Thomas Sawyer <transfire@gmail.com>
|
data/meta/contact
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
facets-universal@rubyforge.org
|
data/meta/contributors
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
Trans <transfire@gmail.com>
|
2
|
+
Matthew Harris
|
3
|
+
Noah Gibbs
|
4
|
+
Thibaut Barrère
|
5
|
+
Daniel J. Berger
|
6
|
+
Paul Brannan
|
7
|
+
Mikael Brockman
|
8
|
+
Jamis Buck
|
9
|
+
Renald Buter
|
10
|
+
Shashank Date
|
11
|
+
Robert Feldt
|
12
|
+
Mauricio Fernandez
|
13
|
+
Florian Frank
|
14
|
+
Hal Fulton
|
15
|
+
Noah Gibbs
|
16
|
+
Michael Granger
|
17
|
+
Florian Gross
|
18
|
+
Sean O'Halpin
|
19
|
+
Matthew Harris
|
20
|
+
David Heinemeier Hansson
|
21
|
+
Thomas-Ivo Heinen
|
22
|
+
Dave Hoover
|
23
|
+
Ara T. Howard
|
24
|
+
MenTaLguY
|
25
|
+
Mohammad Khan
|
26
|
+
Richard Laugesen
|
27
|
+
Derek Lewis
|
28
|
+
Jan Molic
|
29
|
+
George Moschovitis
|
30
|
+
Michael Neumann
|
31
|
+
Tim Pease
|
32
|
+
Jonas Pfenniger
|
33
|
+
Ryan Platte
|
34
|
+
Oliver Renaud
|
35
|
+
Tyler Rick
|
36
|
+
Christoph Rippel
|
37
|
+
Daniel Schierbeck
|
38
|
+
Louis J Scoras
|
39
|
+
Gavin Sinclair
|
40
|
+
Tilo Sloboda
|
41
|
+
Phil Tomson
|
42
|
+
Peter Vanbroekhoven
|
43
|
+
Jim Weirich
|
44
|
+
Jeff Wood
|
45
|
+
Erik Veenstra
|
46
|
+
Austin Ziegler
|
47
|
+
Why The Lucky Stiff
|
48
|
+
|
data/meta/created
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2004-12-16
|
data/meta/homepage
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
http://facets.rubyforge.org
|
data/meta/license
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Ruby
|
data/meta/loadpath
ADDED
data/meta/releases
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
facets 2.4.4 stable (2008-09-01)
|
2
|
+
facets 2.4.3 stable (2008-08-14)
|
3
|
+
facets 2.4.2 stable (2008-08-12)
|
4
|
+
facets 2.4.1 stable (2008-04-03)
|
5
|
+
facets 2.4.0 stable (2008-03-24)
|
6
|
+
facets 2.3.0 stable (2008-02-01)
|
7
|
+
facets 2.2.1 stable (2007-12-22)
|
8
|
+
facets 2.2.0 stable (2007-12-13)
|
9
|
+
facets 2.1.3 stable (2007-11-28)
|
10
|
+
facets 2.1.2 stable (2007-11-22)
|
11
|
+
facets 2.1.1 stable (2007-11-16)
|
12
|
+
facets 2.1.0 stable (2007-11-10)
|
13
|
+
facets 2.0.5 stable (2007-11-07)
|
14
|
+
|
data/meta/slogan
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ALL YOUR BASE ARE BELONG TO RUBY!
|
data/meta/summary
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Premium Core Extensions and Standard Additions
|
data/task/test.rake
CHANGED
@@ -1,40 +1,79 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
desc "run unit tests"
|
4
|
-
|
5
3
|
task 'test' do
|
6
|
-
|
4
|
+
prepare_tests_all
|
5
|
+
end
|
6
|
+
|
7
|
+
desc "run all unit tests"
|
8
|
+
task 'test:all' do
|
9
|
+
prepare_tests_all
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "run core unit tests"
|
13
|
+
task 'test:core' do
|
14
|
+
prepare_tests_core
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "run lore unit tests"
|
18
|
+
task 'test:lore' do
|
19
|
+
prepare_tests_lore
|
7
20
|
end
|
21
|
+
|
22
|
+
desc "run more unit tests"
|
23
|
+
task 'test:more' do
|
24
|
+
prepare_tests_more
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "run all unit tests with ActiveSupport loaded"
|
28
|
+
task 'test:all:activesupport' => [:include_activesupport, 'test:all']
|
8
29
|
|
9
|
-
desc "run unit tests with ActiveSupport loaded"
|
30
|
+
desc "run core unit tests with ActiveSupport loaded"
|
31
|
+
task 'test:core:activesupport' => [:include_activesupport, 'test:core']
|
10
32
|
|
11
|
-
|
33
|
+
desc "run lore unit tests with ActiveSupport loaded"
|
34
|
+
task 'test:lore:activesupport' => [:include_activesupport, 'test:lore']
|
35
|
+
|
36
|
+
desc "run more unit tests with ActiveSupport loaded"
|
37
|
+
task 'test:more:activesupport' => [:include_activesupport, 'test:more']
|
38
|
+
|
39
|
+
task 'include_activesupport' do
|
12
40
|
require 'activesupport'
|
13
|
-
run_tests
|
14
41
|
end
|
15
42
|
|
16
|
-
def run_tests
|
17
|
-
live = ENV['live']
|
18
43
|
|
44
|
+
def add_loadpath(*paths)
|
45
|
+
live = ENV['live']
|
46
|
+
|
19
47
|
unless live
|
20
|
-
$LOAD_PATH.unshift(File.expand_path('lib/core'))
|
21
|
-
$LOAD_PATH.unshift(File.expand_path('lib/lore'))
|
22
|
-
$LOAD_PATH.unshift(File.expand_path('lib/more'))
|
48
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/core'))
|
49
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/lore'))
|
50
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/more'))
|
51
|
+
paths.each do |path|
|
52
|
+
$LOAD_PATH.unshift(File.expand_path(path))
|
53
|
+
end
|
23
54
|
end
|
24
|
-
|
55
|
+
|
25
56
|
puts "RUBY VERSION: #{RUBY_VERSION}"
|
26
|
-
puts "LOAD PATH:\n" + $LOAD_PATH.join("\n")
|
27
|
-
|
57
|
+
puts "LOAD PATH:\n" + $LOAD_PATH.join("\n")
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_tests(which="{c,l,m}ore")
|
28
61
|
if find = ARGV[1..-1].select{|e| e !~ /(^[-]|[=])/ }[0]
|
29
62
|
unless FileTest.file?(find)
|
30
|
-
find = File.join(find, '**', 'test_*.rb')
|
63
|
+
#find = File.join(find, '**', 'test_*.rb')
|
64
|
+
find = ['test/test_*.rb']
|
65
|
+
find << File.join(find, which, '**', 'test_*.rb')
|
31
66
|
end
|
32
67
|
else
|
33
|
-
find = 'test/**/test_*.rb'
|
68
|
+
#find = 'test/**/test_*.rb'
|
69
|
+
find = ['test/test_*.rb']
|
70
|
+
find << "test/#{which}/**/test_*.rb"
|
34
71
|
end
|
72
|
+
|
73
|
+
Dir.glob(find)
|
74
|
+
end
|
35
75
|
|
36
|
-
|
37
|
-
|
76
|
+
def run_tests(files)
|
38
77
|
files.each do |file|
|
39
78
|
next if File.directory?(file)
|
40
79
|
begin
|
@@ -45,3 +84,62 @@ def run_tests
|
|
45
84
|
end
|
46
85
|
end
|
47
86
|
end
|
87
|
+
|
88
|
+
def prepare_tests_all
|
89
|
+
add_loadpath('lib/core','lib/lore','lib/more')
|
90
|
+
files = get_tests
|
91
|
+
run_tests(files)
|
92
|
+
end
|
93
|
+
|
94
|
+
def prepare_tests_core
|
95
|
+
add_loadpath('lib/core')
|
96
|
+
files = get_tests('core')
|
97
|
+
run_tests(files)
|
98
|
+
end
|
99
|
+
|
100
|
+
def prepare_tests_lore
|
101
|
+
add_loadpath('lib/lore')
|
102
|
+
files = get_tests('lore')
|
103
|
+
run_tests(files)
|
104
|
+
end
|
105
|
+
|
106
|
+
def prepare_tests_more
|
107
|
+
add_loadpath('lib/more')
|
108
|
+
files = get_tests('more')
|
109
|
+
run_tests(files)
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
#def run_tests
|
114
|
+
# live = ENV['live']
|
115
|
+
#
|
116
|
+
# unless live
|
117
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/core'))
|
118
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/lore'))
|
119
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/more'))
|
120
|
+
# end
|
121
|
+
#
|
122
|
+
# puts "RUBY VERSION: #{RUBY_VERSION}"
|
123
|
+
# puts "LOAD PATH:\n" + $LOAD_PATH.join("\n")
|
124
|
+
#
|
125
|
+
# if find = ARGV[1..-1].select{|e| e !~ /(^[-]|[=])/ }[0]
|
126
|
+
# unless FileTest.file?(find)
|
127
|
+
# find = File.join(find, '**', 'test_*.rb')
|
128
|
+
# end
|
129
|
+
# else
|
130
|
+
# find = 'test/**/test_*.rb'
|
131
|
+
# end
|
132
|
+
#
|
133
|
+
# files = Dir.glob(find)
|
134
|
+
#
|
135
|
+
# files.each do |file|
|
136
|
+
# next if File.directory?(file)
|
137
|
+
# begin
|
138
|
+
# puts "Loading: #{file}" if $DEBUG
|
139
|
+
# load(file)
|
140
|
+
# rescue LoadError
|
141
|
+
# puts "Error loading: #{file}"
|
142
|
+
# end
|
143
|
+
# end
|
144
|
+
#end
|
145
|
+
|
@@ -35,12 +35,6 @@ class TC_Array_Product < Test::Unit::TestCase
|
|
35
35
|
assert_equal( [[1, 4],[1, 5],[1, 6],[2, 4],[2, 5],[2, 6],[3, 4],[3, 5],[3, 6]], a )
|
36
36
|
end
|
37
37
|
|
38
|
-
def test_product_03
|
39
|
-
a = []
|
40
|
-
[1,2,3].product([4,5,6]) {|elem| a << elem }
|
41
|
-
assert_equal( [[1, 4],[1, 5],[1, 6],[2, 4],[2, 5],[2, 6],[3, 4],[3, 5],[3, 6]], a )
|
42
|
-
end
|
43
|
-
|
44
38
|
# def test_op_mod
|
45
39
|
# a = [:A,:B,:C]
|
46
40
|
# assert_equal( a[1], a/1 )
|
@@ -10,9 +10,15 @@ class TC_Binding_Local_Variables < Test::Unit::TestCase
|
|
10
10
|
@bind = binding
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
unless RUBY_VERSION > "1.9"
|
14
|
+
def test_local_variables
|
15
|
+
assert_equal( ["a","b","x"], @bind.local_variables )
|
16
|
+
end
|
17
|
+
else
|
18
|
+
def test_local_variables
|
19
|
+
assert_equal( [:a,:b,:x], @bind.local_variables )
|
20
|
+
end
|
21
|
+
end
|
16
22
|
|
17
23
|
end
|
18
24
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'facets/enumerable/split'
|
3
|
+
|
4
|
+
class Test_Enumerable_Split < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_empty
|
7
|
+
assert_equal( [], [].split('a') )
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_same
|
11
|
+
assert_equal( [], ['a'].split('a') )
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_split
|
15
|
+
assert_equal( [['a'], ['c']], ['a','b','c'].split('b') )
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
@@ -11,9 +11,14 @@ class Test_Module_Conflict < Test::Unit::TestCase
|
|
11
11
|
def q; "qy"; end
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
if RUBY_VERSION < '1.9'
|
15
|
+
def test_conflict?
|
16
|
+
assert_equal( ["q"], X.conflict?(Y) )
|
17
|
+
end
|
18
|
+
else
|
19
|
+
def test_conflict?
|
20
|
+
assert_equal( [:q], X.conflict?(Y) )
|
21
|
+
end
|
16
22
|
end
|
17
|
-
|
18
23
|
end
|
19
24
|
|