groonga-command 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -3
- data/doc/text/news.md +7 -0
- data/groonga-command.gemspec +1 -3
- data/lib/groonga/command/version.rb +2 -2
- data/lib/groonga/command.rb +18 -2
- data/test/command/test-column-create.rb +107 -108
- data/test/command/test-column-remove.rb +9 -10
- data/test/command/test-column-rename.rb +9 -10
- data/test/command/test-delete.rb +9 -10
- data/test/command/test-dump.rb +7 -7
- data/test/command/test-get.rb +13 -16
- data/test/command/test-load.rb +17 -10
- data/test/command/test-register.rb +9 -10
- data/test/command/test-select.rb +83 -82
- data/test/command/test-suggest.rb +43 -35
- data/test/command/test-table-create.rb +101 -94
- data/test/command/test-table-remove.rb +9 -10
- data/test/command/test-table-rename.rb +9 -10
- data/test/command/test-truncate.rb +9 -10
- data/test/groonga-command-test-utils.rb +1 -81
- metadata +60 -95
- data/lib/groonga/command/parser.rb +0 -449
- data/test/test-parser.rb +0 -377
data/test/command/test-select.rb
CHANGED
@@ -17,87 +17,88 @@
|
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
class SelectCommandTest < Test::Unit::TestCase
|
20
|
-
|
20
|
+
private
|
21
|
+
def select_command(pair_arguments={}, ordered_arguments=[])
|
22
|
+
Groonga::Command::Select.new("select", pair_arguments, ordered_arguments)
|
23
|
+
end
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
[
|
44
|
-
table,
|
45
|
-
match_columns,
|
46
|
-
query,
|
47
|
-
filter,
|
48
|
-
scorer,
|
49
|
-
sortby,
|
50
|
-
output_columns,
|
51
|
-
offset,
|
52
|
-
limit,
|
53
|
-
drilldown,
|
54
|
-
drilldown_sortby,
|
55
|
-
drilldown_output_columns,
|
56
|
-
drilldown_offset,
|
57
|
-
drilldown_limit,
|
58
|
-
cache,
|
59
|
-
match_escalation_threshold,
|
60
|
-
query_expansion,
|
61
|
-
query_flags,
|
62
|
-
query_expander,
|
63
|
-
],
|
64
|
-
:output_type => false)
|
25
|
+
class ConstructorTest < self
|
26
|
+
def test_ordered_argument
|
27
|
+
table = "Users"
|
28
|
+
match_columns = "name * 10 || description"
|
29
|
+
query = "groonga"
|
30
|
+
filter = "age >= 18"
|
31
|
+
scorer = "_score = age"
|
32
|
+
sortby = "_score"
|
33
|
+
output_columns = "_key, name"
|
34
|
+
offset = "10"
|
35
|
+
limit = "20"
|
36
|
+
drilldown = "name"
|
37
|
+
drilldown_sortby = "_nsubrecs"
|
38
|
+
drilldown_output_columns = "name, _nsubrecs"
|
39
|
+
drilldown_offset = "5"
|
40
|
+
drilldown_limit = "10"
|
41
|
+
cache = "no"
|
42
|
+
match_escalation_threshold = "-1"
|
43
|
+
query_expansion = "deprecated"
|
44
|
+
query_flags = "ALLOW_LEADING_NOT"
|
45
|
+
query_expander = "Terms.synonym"
|
65
46
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
command.arguments)
|
89
|
-
end
|
47
|
+
ordered_arguments = [
|
48
|
+
table,
|
49
|
+
match_columns,
|
50
|
+
query,
|
51
|
+
filter,
|
52
|
+
scorer,
|
53
|
+
sortby,
|
54
|
+
output_columns,
|
55
|
+
offset,
|
56
|
+
limit,
|
57
|
+
drilldown,
|
58
|
+
drilldown_sortby,
|
59
|
+
drilldown_output_columns,
|
60
|
+
drilldown_offset,
|
61
|
+
drilldown_limit,
|
62
|
+
cache,
|
63
|
+
match_escalation_threshold,
|
64
|
+
query_expansion,
|
65
|
+
query_flags,
|
66
|
+
query_expander,
|
67
|
+
]
|
68
|
+
command = select_command({}, ordered_arguments)
|
90
69
|
|
91
|
-
|
92
|
-
|
93
|
-
:
|
94
|
-
:
|
95
|
-
|
70
|
+
assert_equal({
|
71
|
+
:table => table,
|
72
|
+
:match_columns => match_columns,
|
73
|
+
:query => query,
|
74
|
+
:filter => filter,
|
75
|
+
:scorer => scorer,
|
76
|
+
:sortby => sortby,
|
77
|
+
:output_columns => output_columns,
|
78
|
+
:offset => offset,
|
79
|
+
:limit => limit,
|
80
|
+
:drilldown => drilldown,
|
81
|
+
:drilldown_sortby => drilldown_sortby,
|
82
|
+
:drilldown_output_columns => drilldown_output_columns,
|
83
|
+
:drilldown_offset => drilldown_offset,
|
84
|
+
:drilldown_limit => drilldown_limit,
|
85
|
+
:cache => cache,
|
86
|
+
:match_escalation_threshold => match_escalation_threshold,
|
87
|
+
:query_expansion => query_expansion,
|
88
|
+
:query_flags => query_flags,
|
89
|
+
:query_expander => query_expander,
|
90
|
+
},
|
91
|
+
command.arguments)
|
92
|
+
end
|
96
93
|
end
|
97
94
|
|
98
|
-
|
99
|
-
|
100
|
-
|
95
|
+
class ScorerTest < self
|
96
|
+
def test_reader
|
97
|
+
command = select_command(:table => "Users",
|
98
|
+
:filter => "age<=30",
|
99
|
+
:scorer => "_score = random()")
|
100
|
+
assert_equal("_score = random()", command.scorer)
|
101
|
+
end
|
101
102
|
end
|
102
103
|
|
103
104
|
class FilterTest < self
|
@@ -106,8 +107,8 @@ class SelectCommandTest < Test::Unit::TestCase
|
|
106
107
|
'"35.73360x139.7394","62614x139.7714") && ' +
|
107
108
|
'((type == "たいやき" || type == "和菓子")) && ' +
|
108
109
|
'keyword @ "たいやき" &! keyword @ "白" &! keyword @ "養殖"'
|
109
|
-
|
110
|
-
|
110
|
+
command = select_command(:table => "Users",
|
111
|
+
:filter => filter)
|
111
112
|
assert_equal(['geo_in_rectangle(location,' +
|
112
113
|
'"35.73360x139.7394","62614x139.7714")',
|
113
114
|
'type == "たいやき"',
|
@@ -115,14 +116,14 @@ class SelectCommandTest < Test::Unit::TestCase
|
|
115
116
|
'keyword @ "たいやき"',
|
116
117
|
'keyword @ "白"',
|
117
118
|
'keyword @ "養殖"'],
|
118
|
-
|
119
|
+
command.conditions)
|
119
120
|
end
|
120
121
|
|
121
122
|
def test_omitted
|
122
|
-
|
123
|
-
|
123
|
+
command = select_command(:table => "Users",
|
124
|
+
:filter => nil)
|
124
125
|
assert_equal([],
|
125
|
-
|
126
|
+
command.conditions)
|
126
127
|
end
|
127
128
|
end
|
128
129
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
+
# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
|
3
4
|
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
|
4
5
|
#
|
5
6
|
# This library is free software; you can redistribute it and/or
|
@@ -17,52 +18,59 @@
|
|
17
18
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
19
|
|
19
20
|
class SuggestCommandTest < Test::Unit::TestCase
|
20
|
-
|
21
|
-
|
21
|
+
private
|
22
|
+
def suggest_command(pair_arguments={}, ordered_arguments=[])
|
23
|
+
Groonga::Command::Suggest.new("suggest",
|
24
|
+
pair_arguments,
|
25
|
+
ordered_arguments)
|
26
|
+
end
|
22
27
|
|
28
|
+
class ConstructorTest < self
|
23
29
|
def test_ordered_arguments
|
24
|
-
types
|
25
|
-
table
|
26
|
-
column
|
27
|
-
query
|
28
|
-
sortby
|
29
|
-
output_columns
|
30
|
-
offset
|
31
|
-
limit
|
32
|
-
frequency_threshold
|
30
|
+
types = "complete"
|
31
|
+
table = "Users"
|
32
|
+
column = "name"
|
33
|
+
query = "name:@ Ali"
|
34
|
+
sortby = "_score"
|
35
|
+
output_columns = "name"
|
36
|
+
offset = "0"
|
37
|
+
limit = "5"
|
38
|
+
frequency_threshold = "120"
|
33
39
|
conditional_probability_threshold = "0.3"
|
34
|
-
prefix_search
|
35
|
-
similar_search
|
40
|
+
prefix_search = "yes"
|
41
|
+
similar_search = "yes"
|
36
42
|
|
37
|
-
|
38
|
-
types,
|
39
|
-
|
43
|
+
ordered_arguments = [
|
44
|
+
types,
|
45
|
+
table,
|
46
|
+
column,
|
47
|
+
query,
|
48
|
+
sortby,
|
49
|
+
output_columns,
|
50
|
+
offset,
|
51
|
+
limit,
|
52
|
+
frequency_threshold,
|
40
53
|
conditional_probability_threshold,
|
41
|
-
prefix_search,
|
54
|
+
prefix_search,
|
55
|
+
similar_search
|
42
56
|
]
|
43
|
-
command =
|
44
|
-
assert_instance_of(Groonga::Command::Suggest, command)
|
57
|
+
command = suggest_command({}, ordered_arguments)
|
45
58
|
|
46
59
|
expected_arguments = {
|
47
|
-
:types
|
48
|
-
:table
|
49
|
-
:column
|
50
|
-
:query
|
51
|
-
:sortby
|
52
|
-
:output_columns
|
53
|
-
:offset
|
54
|
-
:limit
|
55
|
-
:frequency_threshold
|
60
|
+
:types => types,
|
61
|
+
:table => table,
|
62
|
+
:column => column,
|
63
|
+
:query => query,
|
64
|
+
:sortby => sortby,
|
65
|
+
:output_columns => output_columns,
|
66
|
+
:offset => offset,
|
67
|
+
:limit => limit,
|
68
|
+
:frequency_threshold => frequency_threshold,
|
56
69
|
:conditional_probability_threshold => conditional_probability_threshold,
|
57
|
-
:prefix_search
|
58
|
-
:similar_search
|
70
|
+
:prefix_search => prefix_search,
|
71
|
+
:similar_search => similar_search
|
59
72
|
}
|
60
73
|
assert_equal(expected_arguments, command.arguments)
|
61
74
|
end
|
62
|
-
|
63
|
-
private
|
64
|
-
def parse(*arguments)
|
65
|
-
super("suggest", arguments, :output_type => false)
|
66
|
-
end
|
67
75
|
end
|
68
76
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
# Copyright (C) 2012-2013 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
|
@@ -17,9 +17,14 @@
|
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
class TableCreateCommandTest < Test::Unit::TestCase
|
20
|
-
|
21
|
-
|
20
|
+
private
|
21
|
+
def table_create_command(pair_arguments={}, ordered_arguments=[])
|
22
|
+
Groonga::Command::TableCreate.new("table_create",
|
23
|
+
pair_arguments,
|
24
|
+
ordered_arguments)
|
25
|
+
end
|
22
26
|
|
27
|
+
class ConstructorTest < self
|
23
28
|
def test_ordered_arguments
|
24
29
|
name = "Users"
|
25
30
|
flags = "TABLE_PAT_KEY"
|
@@ -28,8 +33,15 @@ class TableCreateCommandTest < Test::Unit::TestCase
|
|
28
33
|
default_tokenizer = "TokenBigram"
|
29
34
|
normalizer = "NormalizerAuto"
|
30
35
|
|
31
|
-
|
32
|
-
|
36
|
+
ordered_arguments = [
|
37
|
+
name,
|
38
|
+
flags,
|
39
|
+
key_type,
|
40
|
+
value_type,
|
41
|
+
default_tokenizer,
|
42
|
+
normalizer,
|
43
|
+
]
|
44
|
+
command = table_create_command({}, ordered_arguments)
|
33
45
|
assert_equal({
|
34
46
|
:name => name,
|
35
47
|
:flags => flags,
|
@@ -40,105 +52,100 @@ class TableCreateCommandTest < Test::Unit::TestCase
|
|
40
52
|
},
|
41
53
|
command.arguments)
|
42
54
|
end
|
55
|
+
end
|
43
56
|
|
44
|
-
|
45
|
-
def
|
46
|
-
|
57
|
+
class FlagsTest < self
|
58
|
+
def test_multiple
|
59
|
+
command = table_create_command({"flags" => "TABLE_PAT_KEY|KEY_WITH_SIS"})
|
60
|
+
assert_equal(["TABLE_PAT_KEY", "KEY_WITH_SIS"],
|
61
|
+
command.flags)
|
47
62
|
end
|
48
63
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
64
|
+
def test_one
|
65
|
+
command = table_create_command({"flags" => "TABLE_NO_KEY"})
|
66
|
+
assert_equal(["TABLE_NO_KEY"],
|
67
|
+
command.flags)
|
68
|
+
end
|
55
69
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
70
|
+
def test_no_flags
|
71
|
+
command = table_create_command
|
72
|
+
assert_equal([], command.flags)
|
73
|
+
end
|
61
74
|
|
62
|
-
|
63
|
-
|
64
|
-
|
75
|
+
class PredicateTest < self
|
76
|
+
data({
|
77
|
+
"TABLE_NO_KEY" => {
|
78
|
+
:expected => true,
|
79
|
+
:flags => "TABLE_NO_KEY",
|
80
|
+
},
|
81
|
+
"other flag" => {
|
82
|
+
:expected => false,
|
83
|
+
:flags => "TABLE_HASH_KEY",
|
84
|
+
}
|
85
|
+
})
|
86
|
+
def test_table_no_key?(data)
|
87
|
+
command = table_create_command({"flags" => data[:flags]})
|
88
|
+
assert_equal(data[:expected], command.table_no_key?)
|
65
89
|
end
|
66
90
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
data({
|
84
|
-
"TABLE_HASH_KEY" => {
|
85
|
-
:expected => true,
|
86
|
-
:flags => "TABLE_HASH_KEY",
|
87
|
-
},
|
88
|
-
"other flag" => {
|
89
|
-
:expected => false,
|
90
|
-
:flags => "TABLE_PAT_KEY",
|
91
|
-
}
|
92
|
-
})
|
93
|
-
def test_table_hash_key?(data)
|
94
|
-
command = parse({"flags" => data[:flags]})
|
95
|
-
assert_equal(data[:expected], command.table_hash_key?)
|
96
|
-
end
|
91
|
+
data({
|
92
|
+
"TABLE_HASH_KEY" => {
|
93
|
+
:expected => true,
|
94
|
+
:flags => "TABLE_HASH_KEY",
|
95
|
+
},
|
96
|
+
"other flag" => {
|
97
|
+
:expected => false,
|
98
|
+
:flags => "TABLE_PAT_KEY",
|
99
|
+
}
|
100
|
+
})
|
101
|
+
def test_table_hash_key?(data)
|
102
|
+
command = table_create_command({"flags" => data[:flags]})
|
103
|
+
assert_equal(data[:expected], command.table_hash_key?)
|
104
|
+
end
|
97
105
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
106
|
+
data({
|
107
|
+
"TABLE_PAT_KEY" => {
|
108
|
+
:expected => true,
|
109
|
+
:flags => "TABLE_PAT_KEY",
|
110
|
+
},
|
111
|
+
"other flag" => {
|
112
|
+
:expected => false,
|
113
|
+
:flags => "TABLE_DAT_KEY",
|
114
|
+
}
|
115
|
+
})
|
116
|
+
def test_table_pat_key?(data)
|
117
|
+
command = table_create_command({"flags" => data[:flags]})
|
118
|
+
assert_equal(data[:expected], command.table_pat_key?)
|
119
|
+
end
|
112
120
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
121
|
+
data({
|
122
|
+
"TABLE_DAT_KEY" => {
|
123
|
+
:expected => true,
|
124
|
+
:flags => "TABLE_DAT_KEY",
|
125
|
+
},
|
126
|
+
"other flag" => {
|
127
|
+
:expected => false,
|
128
|
+
:flags => "TABLE_NO_KEY",
|
129
|
+
}
|
130
|
+
})
|
131
|
+
def test_table_dat_key?(data)
|
132
|
+
command = table_create_command({"flags" => data[:flags]})
|
133
|
+
assert_equal(data[:expected], command.table_dat_key?)
|
134
|
+
end
|
127
135
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
end
|
136
|
+
data({
|
137
|
+
"KEY_WITH_SIS" => {
|
138
|
+
:expected => true,
|
139
|
+
:flags => "KEY_WITH_SIS|TABLE_PAT_KEY",
|
140
|
+
},
|
141
|
+
"other flag" => {
|
142
|
+
:expected => false,
|
143
|
+
:flags => "TABLE_NO_KEY",
|
144
|
+
}
|
145
|
+
})
|
146
|
+
def test_key_with_sis?(data)
|
147
|
+
command = table_create_command({"flags" => data[:flags]})
|
148
|
+
assert_equal(data[:expected], command.key_with_sis?)
|
142
149
|
end
|
143
150
|
end
|
144
151
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
# Copyright (C) 2012-2013 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
|
@@ -17,23 +17,22 @@
|
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
class TableRemoveCommandTest < Test::Unit::TestCase
|
20
|
-
|
21
|
-
|
20
|
+
private
|
21
|
+
def table_remove_command(pair_arguments={}, ordered_arguments=[])
|
22
|
+
Groonga::Command::TableRemove.new("table_remove",
|
23
|
+
pair_arguments,
|
24
|
+
ordered_arguments)
|
25
|
+
end
|
22
26
|
|
27
|
+
class ConstructorTest < self
|
23
28
|
def test_ordered_arguments
|
24
29
|
name = "Users"
|
25
30
|
|
26
|
-
command =
|
27
|
-
assert_instance_of(Groonga::Command::TableRemove, command)
|
31
|
+
command = table_remove_command({}, [name])
|
28
32
|
assert_equal({
|
29
33
|
:name => name,
|
30
34
|
},
|
31
35
|
command.arguments)
|
32
36
|
end
|
33
|
-
|
34
|
-
private
|
35
|
-
def parse(*arguments)
|
36
|
-
super("table_remove", arguments, :output_type => false)
|
37
|
-
end
|
38
37
|
end
|
39
38
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
# Copyright (C) 2012-2013 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
|
@@ -17,25 +17,24 @@
|
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
class TableRenameCommandTest < Test::Unit::TestCase
|
20
|
-
|
21
|
-
|
20
|
+
private
|
21
|
+
def table_rename_command(pair_arguments={}, ordered_arguments=[])
|
22
|
+
Groonga::Command::TableRename.new("table_rename",
|
23
|
+
pair_arguments,
|
24
|
+
ordered_arguments)
|
25
|
+
end
|
22
26
|
|
27
|
+
class ConstructorTest < self
|
23
28
|
def test_ordered_arguments
|
24
29
|
name = "Users"
|
25
30
|
new_name = "People"
|
26
31
|
|
27
|
-
command =
|
28
|
-
assert_instance_of(Groonga::Command::TableRename, command)
|
32
|
+
command = table_rename_command({}, [name, new_name])
|
29
33
|
assert_equal({
|
30
34
|
:name => name,
|
31
35
|
:new_name => new_name,
|
32
36
|
},
|
33
37
|
command.arguments)
|
34
38
|
end
|
35
|
-
|
36
|
-
private
|
37
|
-
def parse(*arguments)
|
38
|
-
super("table_rename", arguments, :output_type => false)
|
39
|
-
end
|
40
39
|
end
|
41
40
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
# Copyright (C) 2012-2013 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
|
@@ -17,23 +17,22 @@
|
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
class TruncateCommandTest < Test::Unit::TestCase
|
20
|
-
|
21
|
-
|
20
|
+
private
|
21
|
+
def truncate_command(pair_arguments={}, ordered_arguments=[])
|
22
|
+
Groonga::Command::Truncate.new("truncate",
|
23
|
+
pair_arguments,
|
24
|
+
ordered_arguments)
|
25
|
+
end
|
22
26
|
|
27
|
+
class ConstructorTest < self
|
23
28
|
def test_ordered_arguments
|
24
29
|
table = "Users"
|
25
30
|
|
26
|
-
command =
|
27
|
-
assert_instance_of(Groonga::Command::Truncate, command)
|
31
|
+
command = truncate_command([], [table])
|
28
32
|
assert_equal({
|
29
33
|
:table => table,
|
30
34
|
},
|
31
35
|
command.arguments)
|
32
36
|
end
|
33
|
-
|
34
|
-
private
|
35
|
-
def parse(*arguments)
|
36
|
-
super("truncate", arguments, :output_type => false)
|
37
|
-
end
|
38
37
|
end
|
39
38
|
end
|