groonga 0.0.5 → 0.0.6
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/NEWS.ja.rdoc +13 -0
- data/NEWS.rdoc +13 -0
- data/README.ja.rdoc +2 -1
- data/README.rdoc +2 -1
- data/Rakefile +0 -1
- data/TUTORIAL.ja.rdoc +49 -4
- data/benchmark/read-write-many-small-items.rb +5 -4
- data/benchmark/write-many-small-items.rb +5 -4
- data/example/bookmark.rb +30 -1
- data/example/index-html.rb +79 -0
- data/example/search/config.ru +182 -0
- data/example/search/public/css/groonga.css +122 -0
- data/ext/rb-grn-array.c +12 -9
- data/ext/rb-grn-column.c +13 -8
- data/ext/rb-grn-context.c +34 -16
- data/ext/rb-grn-database.c +3 -2
- data/ext/rb-grn-expression-builder.c +8 -2
- data/ext/rb-grn-expression.c +3 -3
- data/ext/rb-grn-hash.c +13 -10
- data/ext/rb-grn-object.c +127 -19
- data/ext/rb-grn-patricia-trie.c +8 -7
- data/ext/rb-grn-table-cursor.c +2 -40
- data/ext/rb-grn-table.c +154 -42
- data/ext/rb-grn-type.c +18 -10
- data/ext/rb-grn-utils.c +22 -20
- data/ext/rb-grn.h +9 -12
- data/extconf.rb +1 -1
- data/html/developer.html +1 -1
- data/html/index.html +2 -2
- data/lib/groonga/expression-builder.rb +133 -63
- data/lib/groonga/schema.rb +229 -37
- data/test/groonga-test-utils.rb +1 -1
- data/test/test-array.rb +1 -0
- data/test/test-context.rb +7 -1
- data/test/test-database.rb +11 -3
- data/test/test-expression-builder.rb +26 -2
- data/test/test-fix-size-column.rb +2 -1
- data/test/test-hash.rb +6 -1
- data/test/test-record.rb +2 -1
- data/test/test-schema.rb +85 -10
- data/test/test-table.rb +99 -3
- data/test/test-type.rb +3 -2
- data/test/test-variable-size-column.rb +2 -1
- data/test-unit/Rakefile +6 -1
- data/test-unit/lib/test/unit/autorunner.rb +26 -3
- data/test-unit/lib/test/unit/priority.rb +21 -1
- data/test-unit/lib/test/unit/testcase.rb +101 -36
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +7 -4
- data/test-unit/test/{test_testcase.rb → test-testcase.rb} +30 -1
- data/test-unit/test/test_assertions.rb +1 -1
- metadata +9 -6
@@ -1,7 +1,9 @@
|
|
1
1
|
#--
|
2
2
|
#
|
3
3
|
# Author:: Nathaniel Talbott.
|
4
|
-
# Copyright::
|
4
|
+
# Copyright::
|
5
|
+
# * Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
6
|
+
# * Copyright (c) 2008-2009 Kouhei Sutou <tt><kou@clear-code.com></tt>
|
5
7
|
# License:: Ruby license.
|
6
8
|
|
7
9
|
require 'test/unit/attribute'
|
@@ -60,14 +62,14 @@ module Test
|
|
60
62
|
# end
|
61
63
|
#
|
62
64
|
# Here is a call order:
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
65
|
+
# * startup
|
66
|
+
# * setup
|
67
|
+
# * test_my_method1
|
68
|
+
# * teardown
|
69
|
+
# * setup
|
70
|
+
# * test_my_method2
|
71
|
+
# * teardown
|
72
|
+
# * shutdown
|
71
73
|
class TestCase
|
72
74
|
include Attribute
|
73
75
|
include Fixture
|
@@ -81,24 +83,29 @@ module Test
|
|
81
83
|
include Assertions
|
82
84
|
include Util::BacktraceFilter
|
83
85
|
|
84
|
-
STARTED = name + "::STARTED"
|
85
|
-
FINISHED = name + "::FINISHED"
|
86
|
+
STARTED = name + "::STARTED" # :nodoc:
|
87
|
+
FINISHED = name + "::FINISHED" # :nodoc:
|
86
88
|
|
87
|
-
DESCENDANTS = []
|
89
|
+
DESCENDANTS = [] # :nodoc:
|
90
|
+
AVAILABLE_ORDERS = [:alphabetic, :random, :defined] # :nodoc:
|
88
91
|
|
89
92
|
class << self
|
90
|
-
def inherited(sub_class)
|
93
|
+
def inherited(sub_class) # :nodoc:
|
91
94
|
DESCENDANTS << sub_class
|
92
95
|
end
|
93
96
|
|
97
|
+
@@added_methods = []
|
98
|
+
def method_added(name) # :nodoc:
|
99
|
+
super
|
100
|
+
@@added_methods << name.to_s
|
101
|
+
end
|
102
|
+
|
94
103
|
# Rolls up all of the test* methods in the fixture into
|
95
104
|
# one suite, creating a new instance of the fixture for
|
96
105
|
# each method.
|
97
106
|
def suite
|
98
|
-
method_names = public_instance_methods(true).collect {|name| name.to_s}
|
99
|
-
tests = method_names.delete_if {|method_name| method_name !~ /^test./}
|
100
107
|
suite = TestSuite.new(name, self)
|
101
|
-
|
108
|
+
collect_test_names.each do |test|
|
102
109
|
catch(:invalid_test) do
|
103
110
|
suite << new(test)
|
104
111
|
end
|
@@ -137,11 +144,11 @@ module Test
|
|
137
144
|
# end
|
138
145
|
#
|
139
146
|
# Here is a call order:
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
#
|
147
|
+
# * startup
|
148
|
+
# * setup
|
149
|
+
# * test_my_class1 (or test_my_class2)
|
150
|
+
# * setup
|
151
|
+
# * test_my_class2 (or test_my_class1)
|
145
152
|
#
|
146
153
|
# Note that you should not assume test order. Tests
|
147
154
|
# should be worked in any order.
|
@@ -173,16 +180,74 @@ module Test
|
|
173
180
|
# end
|
174
181
|
#
|
175
182
|
# Here is a call order:
|
176
|
-
#
|
177
|
-
#
|
178
|
-
#
|
179
|
-
#
|
180
|
-
#
|
183
|
+
# * test_my_class1 (or test_my_class2)
|
184
|
+
# * teardown
|
185
|
+
# * test_my_class2 (or test_my_class1)
|
186
|
+
# * teardown
|
187
|
+
# * shutdown
|
181
188
|
#
|
182
189
|
# Note that you should not assume test order. Tests
|
183
190
|
# should be worked in any order.
|
184
191
|
def shutdown
|
185
192
|
end
|
193
|
+
|
194
|
+
@@test_order = AVAILABLE_ORDERS.first
|
195
|
+
|
196
|
+
# Returns the current test order. This returns
|
197
|
+
# +:alphabetic+ by default.
|
198
|
+
def test_order
|
199
|
+
@@test_order
|
200
|
+
end
|
201
|
+
|
202
|
+
# Sets the current test order.
|
203
|
+
#
|
204
|
+
# Here are the available _order_:
|
205
|
+
# [:alphabetic]
|
206
|
+
# Default. Tests are sorted in alphabetic order.
|
207
|
+
# [:random]
|
208
|
+
# Tests are sorted in random order.
|
209
|
+
# [:defined]
|
210
|
+
# Tests are sorted in defined order.
|
211
|
+
def test_order=(order)
|
212
|
+
@@test_order = order
|
213
|
+
end
|
214
|
+
|
215
|
+
# :stopdoc:
|
216
|
+
private
|
217
|
+
def collect_test_names
|
218
|
+
method_names = public_instance_methods(true).collect do |name|
|
219
|
+
name.to_s
|
220
|
+
end
|
221
|
+
test_names = method_names.find_all do |method_name|
|
222
|
+
method_name =~ /^test./
|
223
|
+
end
|
224
|
+
send("sort_test_names_in_#{test_order}_order", test_names)
|
225
|
+
end
|
226
|
+
|
227
|
+
def sort_test_names_in_alphabetic_order(test_names)
|
228
|
+
test_names.sort
|
229
|
+
end
|
230
|
+
|
231
|
+
def sort_test_names_in_random_order(test_names)
|
232
|
+
test_names.sort_by {rand(test_names.size)}
|
233
|
+
end
|
234
|
+
|
235
|
+
def sort_test_names_in_defined_order(test_names)
|
236
|
+
test_names.sort do |test1, test2|
|
237
|
+
test1_defined_order = @@added_methods.index(test1)
|
238
|
+
test2_defined_order = @@added_methods.index(test2)
|
239
|
+
if test1_defined_order and test2_defined_order
|
240
|
+
test1_defined_order <=> test2_defined_order
|
241
|
+
elsif test1_defined_order
|
242
|
+
1
|
243
|
+
elsif test2_defined_order
|
244
|
+
-1
|
245
|
+
else
|
246
|
+
test1 <=> test2
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
# :startdoc:
|
186
251
|
end
|
187
252
|
|
188
253
|
attr_reader :method_name
|
@@ -225,7 +290,7 @@ module Test
|
|
225
290
|
result.add_run
|
226
291
|
yield(FINISHED, name)
|
227
292
|
ensure
|
228
|
-
@_result = nil
|
293
|
+
# @_result = nil # For test-spec's after_all :<
|
229
294
|
end
|
230
295
|
end
|
231
296
|
|
@@ -255,10 +320,10 @@ module Test
|
|
255
320
|
# end
|
256
321
|
#
|
257
322
|
# Here is a call order:
|
258
|
-
#
|
259
|
-
#
|
260
|
-
#
|
261
|
-
#
|
323
|
+
# * setup
|
324
|
+
# * my_setup1
|
325
|
+
# * my_setup2
|
326
|
+
# * test_my_class
|
262
327
|
def setup
|
263
328
|
end
|
264
329
|
|
@@ -288,13 +353,13 @@ module Test
|
|
288
353
|
# end
|
289
354
|
#
|
290
355
|
# Here is a call order:
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
294
|
-
#
|
356
|
+
# * test_my_class
|
357
|
+
# * my_teardown2
|
358
|
+
# * my_teardown1
|
359
|
+
# * teardown
|
295
360
|
def teardown
|
296
361
|
end
|
297
|
-
|
362
|
+
|
298
363
|
def default_test
|
299
364
|
flunk("No tests were specified")
|
300
365
|
end
|
@@ -185,10 +185,13 @@ module Test
|
|
185
185
|
|
186
186
|
def guess_color_availability
|
187
187
|
return false unless @output.tty?
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
188
|
+
case ENV["TERM"]
|
189
|
+
when /term(?:-color)?\z/, "screen"
|
190
|
+
true
|
191
|
+
else
|
192
|
+
return true if ENV["EMACS"] == "t"
|
193
|
+
false
|
194
|
+
end
|
192
195
|
end
|
193
196
|
|
194
197
|
def guess_progress_row_max
|
@@ -6,7 +6,7 @@ require 'test/unit'
|
|
6
6
|
|
7
7
|
module Test
|
8
8
|
module Unit
|
9
|
-
class
|
9
|
+
class TestTestCase < TestCase
|
10
10
|
def test_creation
|
11
11
|
tc = Class.new(TestCase) do
|
12
12
|
def test_with_arguments(arg1, arg2)
|
@@ -468,11 +468,40 @@ module Test
|
|
468
468
|
end
|
469
469
|
end
|
470
470
|
|
471
|
+
def test_defined_order
|
472
|
+
keep_test_order do
|
473
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
474
|
+
def test_z
|
475
|
+
end
|
476
|
+
|
477
|
+
def test_1
|
478
|
+
end
|
479
|
+
|
480
|
+
def test_a
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
assert_equal(["test_1", "test_a", "test_z"],
|
485
|
+
test_case.suite.tests.collect {|test| test.method_name})
|
486
|
+
|
487
|
+
test_case.test_order = :defined
|
488
|
+
assert_equal(["test_z", "test_1", "test_a"],
|
489
|
+
test_case.suite.tests.collect {|test| test.method_name})
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
471
493
|
private
|
472
494
|
def check(message, passed)
|
473
495
|
add_assertion
|
474
496
|
raise AssertionFailedError.new(message) unless passed
|
475
497
|
end
|
498
|
+
|
499
|
+
def keep_test_order
|
500
|
+
order = TestCase.test_order
|
501
|
+
yield
|
502
|
+
ensure
|
503
|
+
TestCase.test_order = order
|
504
|
+
end
|
476
505
|
end
|
477
506
|
end
|
478
507
|
end
|
@@ -428,7 +428,7 @@ EOM
|
|
428
428
|
|
429
429
|
different_error_class = Class.new(StandardError)
|
430
430
|
message = <<-EOM
|
431
|
-
<\#<Class:
|
431
|
+
<\#<Class:[xa-f\\d]+>\\("Error"\\)> exception expected but was
|
432
432
|
Class: <RuntimeError>
|
433
433
|
Message: <"Error">
|
434
434
|
EOM
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-01 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -26,11 +26,11 @@ executables: []
|
|
26
26
|
extensions:
|
27
27
|
- extconf.rb
|
28
28
|
extra_rdoc_files:
|
29
|
+
- README.ja.rdoc
|
30
|
+
- README.rdoc
|
29
31
|
- TUTORIAL.ja.rdoc
|
30
|
-
- NEWS.ja.rdoc
|
31
32
|
- NEWS.rdoc
|
32
|
-
-
|
33
|
-
- README.ja.rdoc
|
33
|
+
- NEWS.ja.rdoc
|
34
34
|
files:
|
35
35
|
- AUTHORS
|
36
36
|
- NEWS.ja.rdoc
|
@@ -43,6 +43,9 @@ files:
|
|
43
43
|
- benchmark/read-write-many-small-items.rb
|
44
44
|
- benchmark/write-many-small-items.rb
|
45
45
|
- example/bookmark.rb
|
46
|
+
- example/index-html.rb
|
47
|
+
- example/search/config.ru
|
48
|
+
- example/search/public/css/groonga.css
|
46
49
|
- ext/.gitignore
|
47
50
|
- ext/rb-grn-accessor.c
|
48
51
|
- ext/rb-grn-array-cursor.c
|
@@ -165,10 +168,10 @@ files:
|
|
165
168
|
- test-unit/test/test-omission.rb
|
166
169
|
- test-unit/test/test-pending.rb
|
167
170
|
- test-unit/test/test-priority.rb
|
171
|
+
- test-unit/test/test-testcase.rb
|
168
172
|
- test-unit/test/test_assertions.rb
|
169
173
|
- test-unit/test/test_error.rb
|
170
174
|
- test-unit/test/test_failure.rb
|
171
|
-
- test-unit/test/test_testcase.rb
|
172
175
|
- test-unit/test/test_testresult.rb
|
173
176
|
- test-unit/test/test_testsuite.rb
|
174
177
|
- test-unit/test/testunit-test-util.rb
|