rroonga 2.0.4 → 2.0.5
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/Rakefile +21 -2
- data/bin/grndump +3 -2
- data/ext/groonga/extconf.rb +1 -6
- data/ext/groonga/rb-grn-array.c +58 -31
- data/ext/groonga/rb-grn-column.c +220 -148
- data/ext/groonga/rb-grn-context.c +46 -32
- data/ext/groonga/rb-grn-database.c +102 -90
- data/ext/groonga/rb-grn-double-array-trie.c +205 -163
- data/ext/groonga/rb-grn-encoding-support.c +2 -3
- data/ext/groonga/rb-grn-encoding.c +13 -8
- data/ext/groonga/rb-grn-exception.c +1 -1
- data/ext/groonga/rb-grn-expression.c +110 -133
- data/ext/groonga/rb-grn-fix-size-column.c +5 -4
- data/ext/groonga/rb-grn-geo-point.c +55 -0
- data/ext/groonga/rb-grn-hash.c +120 -82
- data/ext/groonga/rb-grn-index-column.c +66 -70
- data/ext/groonga/rb-grn-index-cursor.c +3 -0
- data/ext/groonga/rb-grn-logger.c +33 -51
- data/ext/groonga/rb-grn-object.c +2 -0
- data/ext/groonga/rb-grn-operator.c +1 -1
- data/ext/groonga/rb-grn-patricia-trie.c +287 -232
- data/ext/groonga/rb-grn-plugin.c +11 -14
- data/ext/groonga/rb-grn-snippet.c +37 -54
- data/ext/groonga/rb-grn-table-cursor-key-support.c +3 -3
- data/ext/groonga/rb-grn-table-cursor.c +8 -6
- data/ext/groonga/rb-grn-table-key-support.c +22 -29
- data/ext/groonga/rb-grn-table.c +355 -279
- data/ext/groonga/rb-grn-type.c +18 -25
- data/ext/groonga/rb-grn-utils.c +77 -7
- data/ext/groonga/rb-grn-variable-size-column.c +12 -20
- data/ext/groonga/rb-grn-view.c +56 -51
- data/ext/groonga/rb-grn.h +28 -1
- data/ext/groonga/rb-groonga.c +1 -0
- data/lib/groonga.rb +2 -0
- data/lib/groonga/command.rb +3 -1
- data/lib/groonga/database.rb +27 -0
- data/lib/groonga/dumper.rb +96 -17
- data/lib/groonga/geo-point.rb +216 -0
- data/lib/groonga/schema.rb +29 -46
- data/rroonga-build.rb +1 -1
- data/rroonga.gemspec +90 -0
- data/test/groonga-test-utils.rb +168 -0
- data/test/run-test.rb +60 -0
- data/test/test-accessor.rb +36 -0
- data/test/test-array.rb +146 -0
- data/test/test-column.rb +350 -0
- data/test/test-command-select.rb +181 -0
- data/test/test-context.rb +130 -0
- data/test/test-database-dumper.rb +259 -0
- data/test/test-database.rb +173 -0
- data/test/test-double-array-trie.rb +189 -0
- data/test/test-encoding.rb +33 -0
- data/test/test-exception.rb +230 -0
- data/test/test-expression-builder.rb +602 -0
- data/test/test-expression.rb +134 -0
- data/test/test-fix-size-column.rb +77 -0
- data/test/test-geo-point.rb +190 -0
- data/test/test-gqtp.rb +70 -0
- data/test/test-hash.rb +367 -0
- data/test/test-index-column.rb +180 -0
- data/test/test-index-cursor.rb +123 -0
- data/test/test-logger.rb +37 -0
- data/test/test-pagination.rb +249 -0
- data/test/test-patricia-trie.rb +440 -0
- data/test/test-plugin.rb +35 -0
- data/test/test-procedure.rb +37 -0
- data/test/test-query-log.rb +258 -0
- data/test/test-record.rb +577 -0
- data/test/test-remote.rb +63 -0
- data/test/test-schema-create-table.rb +267 -0
- data/test/test-schema-dumper.rb +235 -0
- data/test/test-schema-type.rb +208 -0
- data/test/test-schema-view.rb +90 -0
- data/test/test-schema.rb +886 -0
- data/test/test-snippet.rb +130 -0
- data/test/test-table-dumper.rb +353 -0
- data/test/test-table-offset-and-limit.rb +100 -0
- data/test/test-table-select-mecab.rb +80 -0
- data/test/test-table-select-normalize.rb +57 -0
- data/test/test-table-select-weight.rb +123 -0
- data/test/test-table-select.rb +191 -0
- data/test/test-table-traverse.rb +304 -0
- data/test/test-table.rb +711 -0
- data/test/test-type.rb +79 -0
- data/test/test-variable-size-column.rb +147 -0
- data/test/test-variable.rb +28 -0
- data/test/test-vector-column.rb +76 -0
- data/test/test-version.rb +61 -0
- data/test/test-view.rb +72 -0
- metadata +330 -202
data/lib/groonga/schema.rb
CHANGED
@@ -533,6 +533,7 @@ module Groonga
|
|
533
533
|
end
|
534
534
|
end
|
535
535
|
|
536
|
+
# @private
|
536
537
|
NORMALIZE_TYPE_TABLE = {
|
537
538
|
"short_text" => "ShortText",
|
538
539
|
"string" => "ShortText",
|
@@ -1118,37 +1119,32 @@ module Groonga
|
|
1118
1119
|
#
|
1119
1120
|
# table.index("Users.name")
|
1120
1121
|
#
|
1121
|
-
# @param
|
1122
|
-
#
|
1123
|
-
#
|
1124
|
-
#
|
1125
|
-
#
|
1126
|
-
#
|
1127
|
-
#
|
1128
|
-
#
|
1129
|
-
#
|
1130
|
-
#
|
1131
|
-
#
|
1132
|
-
#
|
1133
|
-
#
|
1134
|
-
#
|
1135
|
-
#
|
1136
|
-
#
|
1137
|
-
#
|
1138
|
-
#
|
1139
|
-
#
|
1140
|
-
#
|
1141
|
-
#
|
1142
|
-
#
|
1143
|
-
#
|
1144
|
-
#
|
1145
|
-
#
|
1146
|
-
#
|
1147
|
-
#
|
1148
|
-
# +true+ を指定すると転置索引に出現位置情報を合わせて
|
1149
|
-
# 格納する。未指定または +nil+ を指定した場合、テーブル
|
1150
|
-
# がN-gram系のトークナイザーを利用している場合は
|
1151
|
-
# 自動的に有効になる。
|
1122
|
+
# @param [Array] args
|
1123
|
+
# インデックスカラム作成時に指定できるオプション。
|
1124
|
+
# ハッシュを使って次の要素を指定することができる。
|
1125
|
+
#
|
1126
|
+
# - :name :=
|
1127
|
+
# インデックスカラムのカラム名を任意に指定する。 =:
|
1128
|
+
# - :force :=
|
1129
|
+
# +true+ を指定すると既存の同名のカラムが
|
1130
|
+
# 存在していても、強制的に新しいカラムを作成する。 =:
|
1131
|
+
# - :path :=
|
1132
|
+
# カラムを保存するパス。 =:
|
1133
|
+
# - :persistent :=
|
1134
|
+
# +true+ を指定すると永続カラムとなる。
|
1135
|
+
# +:path+ を省略した場合は自動的にパスが付加される。 =:
|
1136
|
+
# - :with_section :=
|
1137
|
+
# +true+ を指定すると転置索引にsection(段落情報)を
|
1138
|
+
# 合わせて格納する。未指定または +nil+ を指定した場合、
|
1139
|
+
# 複数のカラムを指定すると自動的に有効になる。 =:
|
1140
|
+
# - :with_weight :=
|
1141
|
+
# +true+ を指定すると転置索引にweight情報を合わせて
|
1142
|
+
# 格納する。 =:
|
1143
|
+
# - :with_position :=
|
1144
|
+
# +true+ を指定すると転置索引に出現位置情報を合わせて
|
1145
|
+
# 格納する。未指定または +nil+ を指定した場合、テーブル
|
1146
|
+
# がN-gram系のトークナイザーを利用している場合は
|
1147
|
+
# 自動的に有効になる。 =:
|
1152
1148
|
def index(target_table_or_target_column_full_name, *args)
|
1153
1149
|
key, target_table, target_columns, options =
|
1154
1150
|
parse_index_argument(target_table_or_target_column_full_name, *args)
|
@@ -1175,10 +1171,8 @@ module Groonga
|
|
1175
1171
|
#
|
1176
1172
|
# table.remove_index("Users.name")
|
1177
1173
|
#
|
1178
|
-
# @param
|
1179
|
-
#
|
1180
|
-
# @option options :name The name
|
1181
|
-
# インデックスカラムのカラム名を任意に指定する。
|
1174
|
+
# @param [::Hash] args { :name => target_column }と指定す
|
1175
|
+
# ることでインデックスカラムの任意のカラム名を指定することができる。
|
1182
1176
|
def remove_index(target_table_or_target_column_full_name, *args)
|
1183
1177
|
key, target_table, target_columns, options =
|
1184
1178
|
parse_index_argument(target_table_or_target_column_full_name, *args)
|
@@ -1356,17 +1350,6 @@ module Groonga
|
|
1356
1350
|
end
|
1357
1351
|
alias_method :bool, :boolean
|
1358
1352
|
|
1359
|
-
# Defines a 8 bit signed integer column named @name@.
|
1360
|
-
#
|
1361
|
-
# @param [String or Symbol] name the column name
|
1362
|
-
# @param [Hash] options ({}) the options
|
1363
|
-
# @see Groonga::Schema::TableDefinition#column for
|
1364
|
-
# available @options@.
|
1365
|
-
def integer8(name, options={})
|
1366
|
-
column(name, "Int8", options)
|
1367
|
-
end
|
1368
|
-
alias_method :int8, :integer8
|
1369
|
-
|
1370
1353
|
# Defines a geo point in Tokyo geodetic system column
|
1371
1354
|
# named @name@.
|
1372
1355
|
#
|
data/rroonga-build.rb
CHANGED
data/rroonga.gemspec
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License version 2.1 as published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
17
|
+
|
18
|
+
base_dir = File.dirname(__FILE__)
|
19
|
+
ext_dir = File.join(base_dir, "ext", "groonga")
|
20
|
+
|
21
|
+
guess_version = lambda do |ext_dir|
|
22
|
+
version = {}
|
23
|
+
File.open(File.join(ext_dir, "rb-grn.h")) do |rb_grn_h|
|
24
|
+
rb_grn_h.each_line do |line|
|
25
|
+
case line
|
26
|
+
when /\A#define RB_GRN_([A-Z]+)_VERSION (\d+)/
|
27
|
+
version[$1.downcase] = $2
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
[version["major"], version["minor"], version["micro"]].join(".")
|
32
|
+
end
|
33
|
+
|
34
|
+
clean_white_space = lambda do |entry|
|
35
|
+
entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
|
36
|
+
end
|
37
|
+
|
38
|
+
Gem::Specification.new do |s|
|
39
|
+
s.name = "rroonga"
|
40
|
+
s.version = guess_version.call(ext_dir)
|
41
|
+
|
42
|
+
authors_path = File.join(base_dir, "AUTHORS")
|
43
|
+
authors, emails = File.readlines(authors_path).collect do |line|
|
44
|
+
if /\s*<([^<>]*)>$/ =~ line
|
45
|
+
[$PREMATCH, $1]
|
46
|
+
else
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
end.compact
|
50
|
+
s.authors = authors
|
51
|
+
s.email = emails
|
52
|
+
|
53
|
+
readme_path = File.join(base_dir, "README.textile")
|
54
|
+
entries = File.read(readme_path).split(/^h2\.\s(.*)$/)
|
55
|
+
description = clean_white_space.call(entries[entries.index("Description") + 1])
|
56
|
+
s.summary, s.description, = description.split(/\n\n+/, 3)
|
57
|
+
|
58
|
+
s.files = ["README.textile", "AUTHORS", "Rakefile", "Gemfile"]
|
59
|
+
s.files += ["#{s.name}.gemspec"]
|
60
|
+
s.files += ["rroonga-build.rb", "extconf.rb"]
|
61
|
+
Dir.chdir(base_dir) do
|
62
|
+
s.files += Dir.glob("{lib,benchmark,misc,example}/**/*.rb")
|
63
|
+
s.files += Dir.glob("ext/**/*.{c,h,rb,def}")
|
64
|
+
s.extensions = ["ext/groonga/extconf.rb"]
|
65
|
+
s.extra_rdoc_files = ["README.textile"]
|
66
|
+
s.test_files = Dir.glob("test/**/*.rb")
|
67
|
+
Dir.chdir("bin") do
|
68
|
+
s.executables = Dir.glob("*")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
s.homepage = "http://groonga.rubyforge.org/#about-rroonga"
|
73
|
+
s.licenses = ["LGPLv2"]
|
74
|
+
s.require_paths = ["lib"]
|
75
|
+
s.rubyforge_project = "groonga"
|
76
|
+
|
77
|
+
s.add_runtime_dependency("pkg-config")
|
78
|
+
s.add_runtime_dependency("json")
|
79
|
+
s.add_runtime_dependency("archive-zip")
|
80
|
+
s.add_development_dependency("test-unit", [">= 2.4.6"])
|
81
|
+
s.add_development_dependency("test-unit-notify")
|
82
|
+
s.add_development_dependency("rake")
|
83
|
+
s.add_development_dependency("rake-compiler")
|
84
|
+
s.add_development_dependency("bundler")
|
85
|
+
s.add_development_dependency("yard")
|
86
|
+
# Use packnga 0.9.4 to release 2.0.5 only.
|
87
|
+
s.add_development_dependency("packnga", ["= 0.9.4"])
|
88
|
+
s.add_development_dependency("RedCloth")
|
89
|
+
end
|
90
|
+
|
@@ -0,0 +1,168 @@
|
|
1
|
+
# Copyright (C) 2009 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
|
+
require 'fileutils'
|
17
|
+
require 'pathname'
|
18
|
+
require 'time'
|
19
|
+
require 'erb'
|
20
|
+
require 'stringio'
|
21
|
+
require 'json'
|
22
|
+
require 'pkg-config'
|
23
|
+
|
24
|
+
require 'groonga'
|
25
|
+
|
26
|
+
module GroongaTestUtils
|
27
|
+
class << self
|
28
|
+
def included(base)
|
29
|
+
base.setup :setup_sandbox, :before => :prepend
|
30
|
+
base.teardown :teardown_sandbox, :after => :append
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def setup_sandbox
|
35
|
+
setup_tmp_directory
|
36
|
+
setup_log_path
|
37
|
+
|
38
|
+
setup_tables_directory
|
39
|
+
setup_columns_directory
|
40
|
+
|
41
|
+
setup_encoding
|
42
|
+
setup_context
|
43
|
+
end
|
44
|
+
|
45
|
+
def setup_tmp_directory
|
46
|
+
@base_tmp_dir = Pathname(File.dirname(__FILE__)) + "tmp"
|
47
|
+
memory_file_system = "/dev/shm"
|
48
|
+
if File.exist?(memory_file_system)
|
49
|
+
FileUtils.mkdir_p(@base_tmp_dir.parent.to_s)
|
50
|
+
FileUtils.rm_f(@base_tmp_dir.to_s)
|
51
|
+
FileUtils.ln_s(memory_file_system, @base_tmp_dir.to_s)
|
52
|
+
else
|
53
|
+
FileUtils.mkdir_p(@base_tmp_dir.to_s)
|
54
|
+
end
|
55
|
+
|
56
|
+
@tmp_dir = @base_tmp_dir + "rroonga"
|
57
|
+
FileUtils.rm_rf(@tmp_dir.to_s)
|
58
|
+
FileUtils.mkdir_p(@tmp_dir.to_s)
|
59
|
+
end
|
60
|
+
|
61
|
+
def setup_log_path
|
62
|
+
@dump_log = false
|
63
|
+
Groonga::Logger.log_path = (@tmp_dir + "groonga.log").to_s
|
64
|
+
Groonga::Logger.query_log_path = (@tmp_dir + "groonga-query.log").to_s
|
65
|
+
end
|
66
|
+
|
67
|
+
def setup_tables_directory
|
68
|
+
@tables_dir = @tmp_dir + "tables"
|
69
|
+
FileUtils.mkdir_p(@tables_dir.to_s)
|
70
|
+
end
|
71
|
+
|
72
|
+
def setup_columns_directory
|
73
|
+
@columns_dir = @tmp_dir + "columns"
|
74
|
+
FileUtils.mkdir_p(@columns_dir.to_s)
|
75
|
+
end
|
76
|
+
|
77
|
+
def setup_encoding
|
78
|
+
Groonga::Encoding.default = nil
|
79
|
+
end
|
80
|
+
|
81
|
+
def setup_context
|
82
|
+
Groonga::Context.default = nil
|
83
|
+
Groonga::Context.default_options = nil
|
84
|
+
end
|
85
|
+
|
86
|
+
def context
|
87
|
+
Groonga::Context.default
|
88
|
+
end
|
89
|
+
|
90
|
+
def encoding
|
91
|
+
Groonga::Encoding.default
|
92
|
+
end
|
93
|
+
|
94
|
+
def setup_logger
|
95
|
+
Groonga::Logger.register(:level => :dump) do |level, time, title, message, location|
|
96
|
+
p [level, time, title, message, location]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def setup_database
|
101
|
+
@database_path = @tmp_dir + "database"
|
102
|
+
@database = Groonga::Database.create(:path => @database_path.to_s)
|
103
|
+
end
|
104
|
+
|
105
|
+
def teardown_sandbox
|
106
|
+
@database = nil
|
107
|
+
Groonga::Context.default.close
|
108
|
+
Groonga::Context.default = nil
|
109
|
+
GC.start
|
110
|
+
teardown_log_path
|
111
|
+
teardown_tmp_directory
|
112
|
+
end
|
113
|
+
|
114
|
+
def teardown_log_path
|
115
|
+
return unless @dump_log
|
116
|
+
log_path = Groonga::Logger.log_path
|
117
|
+
query_log_path = Groonga::Logger.query_log_path
|
118
|
+
if File.exist?(log_path)
|
119
|
+
header = "--- log: #{log_path} ---"
|
120
|
+
puts(header)
|
121
|
+
puts(File.read(log_path))
|
122
|
+
puts("-" * header.length)
|
123
|
+
end
|
124
|
+
if File.exist?(query_log_path)
|
125
|
+
header = "--- query log: #{query_log_path} ---"
|
126
|
+
puts(header)
|
127
|
+
puts(File.read(query_log_path))
|
128
|
+
puts("-" * header.length)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def teardown_tmp_directory
|
133
|
+
FileUtils.rm_rf(@tmp_dir.to_s)
|
134
|
+
FileUtils.rm_rf(@base_tmp_dir.to_s)
|
135
|
+
end
|
136
|
+
|
137
|
+
private
|
138
|
+
def assert_equal_select_result(expected, actual, &normalizer)
|
139
|
+
normalizer ||= Proc.new {|record| record.key}
|
140
|
+
assert_equal(expected,
|
141
|
+
actual.collect(&normalizer),
|
142
|
+
actual.expression.inspect)
|
143
|
+
end
|
144
|
+
|
145
|
+
def ruby19?
|
146
|
+
RUBY_VERSION >= "1.9"
|
147
|
+
end
|
148
|
+
|
149
|
+
def only_ruby19
|
150
|
+
omit("Ruby 1.9 is needed.") unless ruby19?
|
151
|
+
end
|
152
|
+
|
153
|
+
def support_self_recursive_equal?
|
154
|
+
self_recursive_hash1 = {}
|
155
|
+
self_recursive_hash1["next"] = self_recursive_hash1
|
156
|
+
self_recursive_hash2 = {}
|
157
|
+
self_recursive_hash2["next"] = self_recursive_hash2
|
158
|
+
self_recursive_hash1 == self_recursive_hash2
|
159
|
+
end
|
160
|
+
|
161
|
+
def need_self_recursive_equal
|
162
|
+
omit("self recursive equal is needed.") unless support_self_recursive_equal?
|
163
|
+
end
|
164
|
+
|
165
|
+
def need_encoding
|
166
|
+
omit("Encoding is needed.") unless defined?(::Encoding)
|
167
|
+
end
|
168
|
+
end
|
data/test/run-test.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2009-2010 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License version 2.1 as published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
17
|
+
|
18
|
+
$VERBOSE = true
|
19
|
+
|
20
|
+
$KCODE = "u" if RUBY_VERSION < "1.9"
|
21
|
+
|
22
|
+
base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
23
|
+
ext_dir = File.join(base_dir, "ext", "groonga")
|
24
|
+
lib_dir = File.join(base_dir, "lib")
|
25
|
+
test_dir = File.join(base_dir, "test")
|
26
|
+
|
27
|
+
make = nil
|
28
|
+
if ENV["NO_MAKE"] != "yes"
|
29
|
+
if system("which gmake > /dev/null")
|
30
|
+
make = "gmake"
|
31
|
+
elsif system("which make > /dev/null")
|
32
|
+
make = "make"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
if make
|
36
|
+
system("cd #{base_dir.dump} && #{make} > /dev/null") or exit(false)
|
37
|
+
end
|
38
|
+
|
39
|
+
require "test-unit"
|
40
|
+
require "test/unit/notify"
|
41
|
+
|
42
|
+
Test::Unit::Priority.enable
|
43
|
+
|
44
|
+
$LOAD_PATH.unshift(ext_dir)
|
45
|
+
$LOAD_PATH.unshift(lib_dir)
|
46
|
+
$LOAD_PATH.unshift(base_dir)
|
47
|
+
|
48
|
+
$LOAD_PATH.unshift(test_dir)
|
49
|
+
require 'groonga-test-utils'
|
50
|
+
|
51
|
+
pkg_config = File.join(base_dir, "vendor", "local", "lib", "pkgconfig")
|
52
|
+
PKGConfig.add_path(pkg_config)
|
53
|
+
|
54
|
+
Dir.glob("#{base_dir}/test/**/test{_,-}*.rb") do |file|
|
55
|
+
require file.sub(/\.rb$/, '')
|
56
|
+
end
|
57
|
+
|
58
|
+
ENV["TEST_UNIT_MAX_DIFF_TARGET_STRING_SIZE"] ||= "5000"
|
59
|
+
|
60
|
+
exit Test::Unit::AutoRunner.run
|
@@ -0,0 +1,36 @@
|
|
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 AccessorTest < Test::Unit::TestCase
|
17
|
+
include GroongaTestUtils
|
18
|
+
|
19
|
+
def setup
|
20
|
+
setup_database
|
21
|
+
@posts = Groonga::Hash.create(:name => "Posts", :key_type => "ShortText")
|
22
|
+
@id = @posts.column("_id")
|
23
|
+
end
|
24
|
+
|
25
|
+
def teardown
|
26
|
+
@id = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_name
|
30
|
+
assert_nil(@id.name)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_local_name
|
34
|
+
assert_equal("_id", @id.local_name)
|
35
|
+
end
|
36
|
+
end
|