rroonga 1.1.0 → 1.2.0
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 +18 -0
- data/NEWS.rdoc +18 -0
- data/bin/grndump +71 -0
- data/ext/groonga/rb-grn-accessor.c +64 -1
- data/ext/groonga/rb-grn-context.c +40 -1
- data/ext/groonga/rb-grn-database.c +47 -5
- data/ext/groonga/rb-grn-index-column.c +77 -7
- data/ext/groonga/rb-grn-object.c +8 -4
- data/ext/groonga/rb-grn-table-cursor.c +56 -1
- data/ext/groonga/rb-grn-table-key-support.c +2 -2
- data/ext/groonga/rb-grn-table.c +10 -38
- data/ext/groonga/rb-grn.h +11 -1
- data/html/index.html +6 -6
- data/html/ranguba.css +8 -1
- data/lib/groonga.rb +1 -0
- data/lib/groonga/dumper.rb +481 -0
- data/lib/groonga/schema.rb +54 -181
- data/rroonga-build.rb +1 -1
- data/test-unit-notify/Rakefile +47 -0
- data/test-unit-notify/lib/test/unit/notify.rb +104 -0
- data/test-unit/COPYING +56 -0
- data/test-unit/GPL +340 -0
- data/test-unit/PSFL +271 -0
- data/test-unit/Rakefile +18 -5
- data/test-unit/html/bar.svg +153 -0
- data/test-unit/html/developer.svg +469 -0
- data/test-unit/html/favicon.ico +0 -0
- data/test-unit/html/favicon.svg +82 -0
- data/test-unit/html/heading-mark.svg +393 -0
- data/test-unit/html/index.html +235 -13
- data/test-unit/html/index.html.ja +258 -15
- data/test-unit/html/install.svg +636 -0
- data/test-unit/html/logo.svg +483 -0
- data/test-unit/html/test-unit.css +339 -0
- data/test-unit/html/tutorial.svg +559 -0
- data/test-unit/lib/test/unit.rb +6 -1
- data/test-unit/lib/test/unit/assertions.rb +115 -11
- data/test-unit/lib/test/unit/autorunner.rb +5 -2
- data/test-unit/lib/test/unit/collector/load.rb +1 -1
- data/test-unit/lib/test/unit/color-scheme.rb +6 -2
- data/test-unit/lib/test/unit/diff.rb +17 -1
- data/test-unit/lib/test/unit/testcase.rb +7 -0
- data/test-unit/lib/test/unit/testresult.rb +34 -2
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +9 -45
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +2 -12
- data/test-unit/lib/test/unit/ui/testrunner.rb +25 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +1 -0
- data/test-unit/lib/test/unit/util/output.rb +31 -0
- data/test-unit/lib/test/unit/version.rb +1 -1
- data/test-unit/test/test-color-scheme.rb +4 -2
- data/test-unit/test/test_assertions.rb +51 -5
- data/test-unit/test/ui/test_tap.rb +33 -0
- data/test-unit/test/util/test-output.rb +11 -0
- data/test/groonga-test-utils.rb +1 -0
- data/test/test-accessor.rb +32 -0
- data/test/test-context.rb +7 -1
- data/test/test-database-dumper.rb +156 -0
- data/test/test-index-column.rb +67 -1
- data/test/test-schema-dumper.rb +181 -0
- data/test/test-schema.rb +53 -97
- data/test/test-table-dumper.rb +83 -0
- metadata +48 -11
- data/ext/groonga/mkmf.log +0 -99
- data/test-unit/html/classic.html +0 -15
data/test/test-index-column.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
# Copyright (C) 2009-2011 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -105,10 +105,76 @@ class IndexColumnTest < Test::Unit::TestCase
|
|
105
105
|
assert_search(["l", "ll", "hello"], content_index, "l")
|
106
106
|
end
|
107
107
|
|
108
|
+
def test_with_section?
|
109
|
+
define_index_column_with_flags
|
110
|
+
assert_equal({
|
111
|
+
:section => true,
|
112
|
+
:weight => false,
|
113
|
+
:position => false,
|
114
|
+
},
|
115
|
+
{
|
116
|
+
:section => context["Tags.section"].with_section?,
|
117
|
+
:weight => context["Tags.weight"].with_section?,
|
118
|
+
:position => context["Tags.position"].with_section?,
|
119
|
+
})
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_with_weight?
|
123
|
+
define_index_column_with_flags
|
124
|
+
assert_equal({
|
125
|
+
:section => false,
|
126
|
+
:weight => true,
|
127
|
+
:position => false,
|
128
|
+
},
|
129
|
+
{
|
130
|
+
:section => context["Tags.section"].with_weight?,
|
131
|
+
:weight => context["Tags.weight"].with_weight?,
|
132
|
+
:position => context["Tags.position"].with_weight?,
|
133
|
+
})
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_with_position?
|
137
|
+
define_index_column_with_flags
|
138
|
+
assert_equal({
|
139
|
+
:section => false,
|
140
|
+
:weight => false,
|
141
|
+
:position => true,
|
142
|
+
},
|
143
|
+
{
|
144
|
+
:section => context["Tags.section"].with_position?,
|
145
|
+
:weight => context["Tags.weight"].with_position?,
|
146
|
+
:position => context["Tags.position"].with_position?,
|
147
|
+
})
|
148
|
+
end
|
149
|
+
|
150
|
+
private
|
108
151
|
def assert_search(expected, content_index, keyword)
|
109
152
|
result = content_index.search(keyword).collect do |entry|
|
110
153
|
entry.key["content"]
|
111
154
|
end
|
112
155
|
assert_equal(expected, result)
|
113
156
|
end
|
157
|
+
|
158
|
+
def define_index_column_with_flags
|
159
|
+
Groonga::Schema.define do |schema|
|
160
|
+
schema.create_table("Articles") do |table|
|
161
|
+
table.text("tags", :type => :vector)
|
162
|
+
end
|
163
|
+
|
164
|
+
schema.create_table("Tags",
|
165
|
+
:type => :patricia_trie,
|
166
|
+
:key_type => "ShortText",
|
167
|
+
:default_tokenizer => "TokenDelimit") do |table|
|
168
|
+
table.index("Articles.tags",
|
169
|
+
:name => "section",
|
170
|
+
:with_section => true)
|
171
|
+
table.index("Articles.tags",
|
172
|
+
:name => "weight",
|
173
|
+
:with_weight => true)
|
174
|
+
table.index("Articles.tags",
|
175
|
+
:name => "position",
|
176
|
+
:with_position => true)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
114
180
|
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
# Copyright (C) 2009-2011 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
class SchemaDumperTest < Test::Unit::TestCase
|
17
|
+
include GroongaTestUtils
|
18
|
+
|
19
|
+
setup :setup_database
|
20
|
+
|
21
|
+
private
|
22
|
+
def define_simple_schema
|
23
|
+
Groonga::Schema.define do |schema|
|
24
|
+
schema.create_table("Posts") do |table|
|
25
|
+
table.short_text :title
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def define_reference_schema
|
31
|
+
Groonga::Schema.define do |schema|
|
32
|
+
schema.create_table("Items") do |table|
|
33
|
+
table.short_text("title")
|
34
|
+
end
|
35
|
+
|
36
|
+
schema.create_table("Users") do |table|
|
37
|
+
table.short_text("name")
|
38
|
+
end
|
39
|
+
|
40
|
+
schema.create_table("Comments") do |table|
|
41
|
+
table.reference("item", "Items")
|
42
|
+
table.reference("author", "Users")
|
43
|
+
table.text("content")
|
44
|
+
table.time("issued")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def define_index_schema
|
50
|
+
Groonga::Schema.define do |schema|
|
51
|
+
schema.create_table("Items",
|
52
|
+
:type => :patricia_trie,
|
53
|
+
:key_type => "ShortText") do |table|
|
54
|
+
table.short_text("title")
|
55
|
+
end
|
56
|
+
|
57
|
+
schema.create_table("Terms",
|
58
|
+
:type => :patricia_trie,
|
59
|
+
:key_type => "ShortText",
|
60
|
+
:key_normalize => true,
|
61
|
+
:default_tokenizer => "TokenBigram") do |table|
|
62
|
+
table.index("Items", "_key")
|
63
|
+
table.index("Items", "title")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class RubySyntaxSchemaDumperTest < SchemaDumperTest
|
69
|
+
def test_simple
|
70
|
+
define_simple_schema
|
71
|
+
assert_equal(<<-EOS, dump)
|
72
|
+
create_table("Posts",
|
73
|
+
:force => true) do |table|
|
74
|
+
table.short_text("title")
|
75
|
+
end
|
76
|
+
EOS
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_reference
|
80
|
+
define_reference_schema
|
81
|
+
assert_equal(<<-EOS, dump)
|
82
|
+
create_table("Comments",
|
83
|
+
:force => true) do |table|
|
84
|
+
table.text("content")
|
85
|
+
table.time("issued")
|
86
|
+
end
|
87
|
+
|
88
|
+
create_table("Items",
|
89
|
+
:force => true) do |table|
|
90
|
+
table.short_text("title")
|
91
|
+
end
|
92
|
+
|
93
|
+
create_table("Users",
|
94
|
+
:force => true) do |table|
|
95
|
+
table.short_text("name")
|
96
|
+
end
|
97
|
+
|
98
|
+
change_table("Comments") do |table|
|
99
|
+
table.reference("author", "Users")
|
100
|
+
table.reference("item", "Items")
|
101
|
+
end
|
102
|
+
EOS
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_index
|
106
|
+
define_index_schema
|
107
|
+
assert_equal(<<-EOS, dump)
|
108
|
+
create_table("Items",
|
109
|
+
:type => :patricia_trie,
|
110
|
+
:key_type => "ShortText",
|
111
|
+
:force => true) do |table|
|
112
|
+
table.short_text("title")
|
113
|
+
end
|
114
|
+
|
115
|
+
create_table("Terms",
|
116
|
+
:type => :patricia_trie,
|
117
|
+
:key_type => "ShortText",
|
118
|
+
:key_normalize => true,
|
119
|
+
:default_tokenizer => "TokenBigram",
|
120
|
+
:force => true) do |table|
|
121
|
+
end
|
122
|
+
|
123
|
+
change_table("Terms") do |table|
|
124
|
+
table.index("Items", "_key", :name => "Items__key")
|
125
|
+
table.index("Items", "title", :name => "Items_title")
|
126
|
+
end
|
127
|
+
EOS
|
128
|
+
end
|
129
|
+
|
130
|
+
private
|
131
|
+
def dump
|
132
|
+
Groonga::Schema.dump
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
class CommandSyntaxSchemaDumperTest < SchemaDumperTest
|
137
|
+
def test_simple
|
138
|
+
define_simple_schema
|
139
|
+
assert_equal(<<-EOS, dump)
|
140
|
+
table_create Posts TABLE_NO_KEY
|
141
|
+
column_create Posts title COLUMN_SCALAR ShortText
|
142
|
+
EOS
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_reference
|
146
|
+
define_reference_schema
|
147
|
+
assert_equal(<<-EOS, dump)
|
148
|
+
table_create Comments TABLE_NO_KEY
|
149
|
+
column_create Comments content COLUMN_SCALAR Text
|
150
|
+
column_create Comments issued COLUMN_SCALAR Time
|
151
|
+
|
152
|
+
table_create Items TABLE_NO_KEY
|
153
|
+
column_create Items title COLUMN_SCALAR ShortText
|
154
|
+
|
155
|
+
table_create Users TABLE_NO_KEY
|
156
|
+
column_create Users name COLUMN_SCALAR ShortText
|
157
|
+
|
158
|
+
column_create Comments author COLUMN_SCALAR Users
|
159
|
+
column_create Comments item COLUMN_SCALAR Items
|
160
|
+
EOS
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_index
|
164
|
+
define_index_schema
|
165
|
+
assert_equal(<<-EOS, dump)
|
166
|
+
table_create Items TABLE_PAT_KEY --key_type ShortText
|
167
|
+
column_create Items title COLUMN_SCALAR ShortText
|
168
|
+
|
169
|
+
table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_tokenizer TokenBigram
|
170
|
+
|
171
|
+
column_create Terms Items__key COLUMN_INDEX|WITH_POSITION Items _key
|
172
|
+
column_create Terms Items_title COLUMN_INDEX|WITH_POSITION Items title
|
173
|
+
EOS
|
174
|
+
end
|
175
|
+
|
176
|
+
private
|
177
|
+
def dump
|
178
|
+
Groonga::Schema.dump(:syntax => :command)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
data/test/test-schema.rb
CHANGED
@@ -25,6 +25,34 @@ class SchemaTest < Test::Unit::TestCase
|
|
25
25
|
assert_nil(context["Posts"])
|
26
26
|
end
|
27
27
|
|
28
|
+
def test_remove_not_existing_table
|
29
|
+
assert_raise(Groonga::Schema::TableNotExists) do
|
30
|
+
Groonga::Schema.remove_table("NotExistingTable")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_path_canonicalization
|
35
|
+
directory = @tmp_dir.to_s
|
36
|
+
table_filename = "hash.groonga"
|
37
|
+
|
38
|
+
canonical_path = directory + "/#{table_filename}"
|
39
|
+
uncanonical_path = directory + "/./#{table_filename}"
|
40
|
+
|
41
|
+
Groonga::Schema.create_table("Posts",
|
42
|
+
:type => :hash,
|
43
|
+
:key_type => "integer",
|
44
|
+
:path => canonical_path) do |table|
|
45
|
+
end
|
46
|
+
|
47
|
+
assert_nothing_raised do
|
48
|
+
Groonga::Schema.create_table("Posts",
|
49
|
+
:type => :hash,
|
50
|
+
:key_type => "integer",
|
51
|
+
:path => uncanonical_path) do |table|
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
28
56
|
def test_define_hash
|
29
57
|
Groonga::Schema.create_table("Posts", :type => :hash) do |table|
|
30
58
|
end
|
@@ -419,103 +447,6 @@ class SchemaTest < Test::Unit::TestCase
|
|
419
447
|
end
|
420
448
|
end
|
421
449
|
|
422
|
-
def test_dump
|
423
|
-
Groonga::Schema.define do |schema|
|
424
|
-
schema.create_table("Posts") do |table|
|
425
|
-
table.short_text :title
|
426
|
-
end
|
427
|
-
end
|
428
|
-
assert_equal(<<-EOS, Groonga::Schema.dump)
|
429
|
-
create_table("Posts",
|
430
|
-
:force => true) do |table|
|
431
|
-
table.short_text("title")
|
432
|
-
end
|
433
|
-
EOS
|
434
|
-
end
|
435
|
-
|
436
|
-
def test_dump_reference
|
437
|
-
Groonga::Schema.define do |schema|
|
438
|
-
schema.create_table("Items") do |table|
|
439
|
-
table.short_text("title")
|
440
|
-
end
|
441
|
-
|
442
|
-
schema.create_table("Users") do |table|
|
443
|
-
table.short_text("name")
|
444
|
-
end
|
445
|
-
|
446
|
-
schema.create_table("Comments") do |table|
|
447
|
-
table.reference("item", "Items")
|
448
|
-
table.reference("author", "Users")
|
449
|
-
table.text("content")
|
450
|
-
table.time("issued")
|
451
|
-
end
|
452
|
-
end
|
453
|
-
|
454
|
-
assert_equal(<<-EOS, Groonga::Schema.dump)
|
455
|
-
create_table("Comments",
|
456
|
-
:force => true) do |table|
|
457
|
-
table.text("content")
|
458
|
-
table.time("issued")
|
459
|
-
end
|
460
|
-
|
461
|
-
create_table("Items",
|
462
|
-
:force => true) do |table|
|
463
|
-
table.short_text("title")
|
464
|
-
end
|
465
|
-
|
466
|
-
create_table("Users",
|
467
|
-
:force => true) do |table|
|
468
|
-
table.short_text("name")
|
469
|
-
end
|
470
|
-
|
471
|
-
change_table("Comments") do |table|
|
472
|
-
table.reference("author", "Users")
|
473
|
-
table.reference("item", "Items")
|
474
|
-
end
|
475
|
-
EOS
|
476
|
-
end
|
477
|
-
|
478
|
-
def test_dump_index
|
479
|
-
Groonga::Schema.define do |schema|
|
480
|
-
schema.create_table("Items",
|
481
|
-
:type => :patricia_trie,
|
482
|
-
:key_type => "ShortText") do |table|
|
483
|
-
table.short_text("title")
|
484
|
-
end
|
485
|
-
|
486
|
-
schema.create_table("Terms",
|
487
|
-
:type => :patricia_trie,
|
488
|
-
:key_type => "ShortText",
|
489
|
-
:key_normalize => true,
|
490
|
-
:default_tokenizer => "TokenBigram") do |table|
|
491
|
-
table.index("Items", "_key")
|
492
|
-
table.index("Items", "title")
|
493
|
-
end
|
494
|
-
end
|
495
|
-
|
496
|
-
assert_equal(<<-EOS, Groonga::Schema.dump)
|
497
|
-
create_table("Items",
|
498
|
-
:type => :patricia_trie,
|
499
|
-
:key_type => "ShortText",
|
500
|
-
:force => true) do |table|
|
501
|
-
table.short_text("title")
|
502
|
-
end
|
503
|
-
|
504
|
-
create_table("Terms",
|
505
|
-
:type => :patricia_trie,
|
506
|
-
:key_type => "ShortText",
|
507
|
-
:key_normalize => true,
|
508
|
-
:default_tokenizer => "TokenBigram",
|
509
|
-
:force => true) do |table|
|
510
|
-
end
|
511
|
-
|
512
|
-
change_table("Terms") do |table|
|
513
|
-
table.index("Items", "_key", :name => "Items__key")
|
514
|
-
table.index("Items", "title", :name => "Items_title")
|
515
|
-
end
|
516
|
-
EOS
|
517
|
-
end
|
518
|
-
|
519
450
|
def test_explicit_context_create_table
|
520
451
|
context = Groonga::Context.default
|
521
452
|
Groonga::Context.default = nil
|
@@ -558,6 +489,31 @@ EOS
|
|
558
489
|
assert_directory_not_removed(dir)
|
559
490
|
end
|
560
491
|
|
492
|
+
def test_default_tokenizer_name_shortcut
|
493
|
+
Groonga::Schema.define do |schema|
|
494
|
+
schema.create_table("Terms",
|
495
|
+
:type => :patricia_trie,
|
496
|
+
:key_normalize => true,
|
497
|
+
:default_tokenizer => :bigram) do |table|
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
assert_equal(Groonga["TokenBigram"], Groonga["Terms"].default_tokenizer)
|
502
|
+
end
|
503
|
+
|
504
|
+
def test_duplicated_shortcut_name
|
505
|
+
short_text = Groonga::Type.new("short_text", :size => 1024)
|
506
|
+
Groonga::Schema.define do |schema|
|
507
|
+
schema.create_table("Users",
|
508
|
+
:type => :patricia_trie,
|
509
|
+
:key_normalize => true,
|
510
|
+
:key_type => :short_text) do |table|
|
511
|
+
end
|
512
|
+
end
|
513
|
+
|
514
|
+
assert_equal(short_text, Groonga["Users"].domain)
|
515
|
+
end
|
516
|
+
|
561
517
|
private
|
562
518
|
def columns_directory_path(table)
|
563
519
|
"#{table.path}.columns"
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
class TableDumperTest < Test::Unit::TestCase
|
17
|
+
include GroongaTestUtils
|
18
|
+
|
19
|
+
setup :setup_database, :before => :append
|
20
|
+
|
21
|
+
def setup
|
22
|
+
setup_tables
|
23
|
+
end
|
24
|
+
|
25
|
+
def setup_tables
|
26
|
+
Groonga::Schema.define do |schema|
|
27
|
+
schema.create_table("Users",
|
28
|
+
:type => :hash,
|
29
|
+
:key_type => "ShortText") do |table|
|
30
|
+
table.text("name")
|
31
|
+
end
|
32
|
+
|
33
|
+
schema.create_table("Posts") do |table|
|
34
|
+
table.text("title")
|
35
|
+
table.reference("author", "Users")
|
36
|
+
table.integer("rank")
|
37
|
+
table.unsigned_integer("n_goods")
|
38
|
+
table.text("tags", :type => :vector)
|
39
|
+
table.boolean("published")
|
40
|
+
table.time("created_at")
|
41
|
+
end
|
42
|
+
|
43
|
+
schema.change_table("Users") do |table|
|
44
|
+
table.index("Posts.author")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_empty
|
50
|
+
assert_equal(<<-EOS, dump("Posts"))
|
51
|
+
load --table Posts
|
52
|
+
[
|
53
|
+
["_id","author","created_at","n_goods","published","rank","tags","title"]
|
54
|
+
]
|
55
|
+
EOS
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_with_records
|
59
|
+
posts.add(:author => "mori",
|
60
|
+
:created_at => Time.parse("2010-03-08 16:52 JST"),
|
61
|
+
:n_goods => 4,
|
62
|
+
:published => true,
|
63
|
+
:rank => 10,
|
64
|
+
:tags => ["search", "mori"],
|
65
|
+
:title => "Why search engine find?")
|
66
|
+
assert_equal(<<-EOS, dump("Posts"))
|
67
|
+
load --table Posts
|
68
|
+
[
|
69
|
+
["_id","author","created_at","n_goods","published","rank","tags","title"],
|
70
|
+
[1,"mori",1268034720.0,4,true,10,["search","mori"],"Why search engine find?"]
|
71
|
+
]
|
72
|
+
EOS
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
def dump(table_name)
|
77
|
+
Groonga::TableDumper.new(context[table_name]).dump
|
78
|
+
end
|
79
|
+
|
80
|
+
def posts
|
81
|
+
context["Posts"]
|
82
|
+
end
|
83
|
+
end
|