Class: Grntest::Tester
- Inherits:
-
Object
- Object
- Grntest::Tester
- Defined in:
- lib/grntest/tester.rb
Instance Attribute Summary collapse
-
#base_directory ⇒ Object
Returns the value of attribute base_directory.
-
#database_path ⇒ Object
Returns the value of attribute database_path.
-
#default_gdb ⇒ Object
Returns the value of attribute default_gdb.
-
#diff ⇒ Object
Returns the value of attribute diff.
-
#diff_options ⇒ Object
Returns the value of attribute diff_options.
-
#exclude_test_patterns ⇒ Object
readonly
Returns the value of attribute exclude_test_patterns.
-
#exclude_test_suite_patterns ⇒ Object
readonly
Returns the value of attribute exclude_test_suite_patterns.
-
#gdb ⇒ Object
Returns the value of attribute gdb.
-
#groonga ⇒ Object
Returns the value of attribute groonga.
-
#groonga_httpd ⇒ Object
Returns the value of attribute groonga_httpd.
-
#groonga_suggest_create_dataset ⇒ Object
Returns the value of attribute groonga_suggest_create_dataset.
-
#interface ⇒ Object
Returns the value of attribute interface.
-
#keep_database ⇒ Object
writeonly
Sets the attribute keep_database.
-
#n_workers ⇒ Object
Returns the value of attribute n_workers.
-
#output ⇒ Object
Returns the value of attribute output.
-
#output_type ⇒ Object
Returns the value of attribute output_type.
- #reporter ⇒ Object
-
#test_patterns ⇒ Object
readonly
Returns the value of attribute test_patterns.
-
#test_suite_patterns ⇒ Object
readonly
Returns the value of attribute test_suite_patterns.
-
#testee ⇒ Object
Returns the value of attribute testee.
-
#use_color ⇒ Object
writeonly
Sets the attribute use_color.
Class Method Summary collapse
Instance Method Summary collapse
- #excluded_test?(test_name) ⇒ Boolean
- #excluded_test_suite?(test_suite_name) ⇒ Boolean
-
#initialize ⇒ Tester
constructor
A new instance of Tester.
- #keep_database? ⇒ Boolean
- #run(*targets) ⇒ Object
- #selected_test?(test_name) ⇒ Boolean
- #selected_test_suite?(test_suite_name) ⇒ Boolean
- #target_test?(test_name) ⇒ Boolean
- #target_test_suite?(test_suite_name) ⇒ Boolean
- #use_color? ⇒ Boolean
Constructor Details
#initialize ⇒ Tester
Returns a new instance of Tester.
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/grntest/tester.rb', line 212 def initialize @groonga = "groonga" @groonga_httpd = "groonga-httpd" @groonga_suggest_create_dataset = "groonga-suggest-create-dataset" @interface = :stdio @output_type = "json" @testee = "groonga" @base_directory = Pathname(".") @database_path = nil @reporter = nil @n_workers = 1 @output = $stdout @keep_database = false @use_color = nil @test_patterns = [] @test_suite_patterns = [] @exclude_test_patterns = [] @exclude_test_suite_patterns = [] detect_suitable_diff initialize_debuggers end |
Instance Attribute Details
#base_directory ⇒ Object
Returns the value of attribute base_directory.
205 206 207 |
# File 'lib/grntest/tester.rb', line 205 def base_directory @base_directory end |
#database_path ⇒ Object
Returns the value of attribute database_path.
205 206 207 |
# File 'lib/grntest/tester.rb', line 205 def database_path @database_path end |
#default_gdb ⇒ Object
Returns the value of attribute default_gdb.
208 209 210 |
# File 'lib/grntest/tester.rb', line 208 def default_gdb @default_gdb end |
#diff ⇒ Object
Returns the value of attribute diff.
205 206 207 |
# File 'lib/grntest/tester.rb', line 205 def diff @diff end |
#diff_options ⇒ Object
Returns the value of attribute diff_options.
205 206 207 |
# File 'lib/grntest/tester.rb', line 205 def @diff_options end |
#exclude_test_patterns ⇒ Object (readonly)
Returns the value of attribute exclude_test_patterns.
211 212 213 |
# File 'lib/grntest/tester.rb', line 211 def exclude_test_patterns @exclude_test_patterns end |
#exclude_test_suite_patterns ⇒ Object (readonly)
Returns the value of attribute exclude_test_suite_patterns.
211 212 213 |
# File 'lib/grntest/tester.rb', line 211 def exclude_test_suite_patterns @exclude_test_suite_patterns end |
#gdb ⇒ Object
Returns the value of attribute gdb.
208 209 210 |
# File 'lib/grntest/tester.rb', line 208 def gdb @gdb end |
#groonga ⇒ Object
Returns the value of attribute groonga.
203 204 205 |
# File 'lib/grntest/tester.rb', line 203 def groonga @groonga end |
#groonga_httpd ⇒ Object
Returns the value of attribute groonga_httpd.
203 204 205 |
# File 'lib/grntest/tester.rb', line 203 def groonga_httpd @groonga_httpd end |
#groonga_suggest_create_dataset ⇒ Object
Returns the value of attribute groonga_suggest_create_dataset.
203 204 205 |
# File 'lib/grntest/tester.rb', line 203 def groonga_suggest_create_dataset @groonga_suggest_create_dataset end |
#interface ⇒ Object
Returns the value of attribute interface.
204 205 206 |
# File 'lib/grntest/tester.rb', line 204 def interface @interface end |
#keep_database=(value) ⇒ Object (writeonly)
Sets the attribute keep_database
209 210 211 |
# File 'lib/grntest/tester.rb', line 209 def keep_database=(value) @keep_database = value end |
#n_workers ⇒ Object
Returns the value of attribute n_workers.
206 207 208 |
# File 'lib/grntest/tester.rb', line 206 def n_workers @n_workers end |
#output ⇒ Object
Returns the value of attribute output.
207 208 209 |
# File 'lib/grntest/tester.rb', line 207 def output @output end |
#output_type ⇒ Object
Returns the value of attribute output_type.
204 205 206 |
# File 'lib/grntest/tester.rb', line 204 def output_type @output_type end |
#reporter ⇒ Object
242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/grntest/tester.rb', line 242 def reporter if @reporter.nil? if @n_workers == 1 :mark else :inplace end else @reporter end end |
#test_patterns ⇒ Object (readonly)
Returns the value of attribute test_patterns.
210 211 212 |
# File 'lib/grntest/tester.rb', line 210 def test_patterns @test_patterns end |
#test_suite_patterns ⇒ Object (readonly)
Returns the value of attribute test_suite_patterns.
210 211 212 |
# File 'lib/grntest/tester.rb', line 210 def test_suite_patterns @test_suite_patterns end |
#testee ⇒ Object
Returns the value of attribute testee.
204 205 206 |
# File 'lib/grntest/tester.rb', line 204 def testee @testee end |
#use_color=(value) ⇒ Object (writeonly)
Sets the attribute use_color
209 210 211 |
# File 'lib/grntest/tester.rb', line 209 def use_color=(value) @use_color = value end |
Class Method Details
.run(argv = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/grntest/tester.rb', line 27 def run(argv=nil) argv ||= ARGV.dup tester = new catch do |tag| parser = create_option_parser(tester, tag) targets = parser.parse!(argv) tester.run(*targets) end end |
Instance Method Details
#excluded_test?(test_name) ⇒ Boolean
276 277 278 279 280 |
# File 'lib/grntest/tester.rb', line 276 def excluded_test?(test_name) @exclude_test_patterns.any? do |pattern| pattern === test_name end end |
#excluded_test_suite?(test_suite_name) ⇒ Boolean
294 295 296 297 298 |
# File 'lib/grntest/tester.rb', line 294 def excluded_test_suite?(test_suite_name) @exclude_test_suite_patterns.any? do |pattern| pattern === test_suite_name end end |
#keep_database? ⇒ Boolean
254 255 256 |
# File 'lib/grntest/tester.rb', line 254 def keep_database? @keep_database end |
#run(*targets) ⇒ Object
234 235 236 237 238 239 240 |
# File 'lib/grntest/tester.rb', line 234 def run(*targets) succeeded = true return succeeded if targets.empty? test_suites = load_tests(*targets) run_test_suites(test_suites) end |
#selected_test?(test_name) ⇒ Boolean
269 270 271 272 273 274 |
# File 'lib/grntest/tester.rb', line 269 def selected_test?(test_name) return true if @test_patterns.empty? @test_patterns.any? do |pattern| pattern === test_name end end |
#selected_test_suite?(test_suite_name) ⇒ Boolean
287 288 289 290 291 292 |
# File 'lib/grntest/tester.rb', line 287 def selected_test_suite?(test_suite_name) return true if @test_suite_patterns.empty? @test_suite_patterns.any? do |pattern| pattern === test_suite_name end end |
#target_test?(test_name) ⇒ Boolean
265 266 267 |
# File 'lib/grntest/tester.rb', line 265 def target_test?(test_name) selected_test?(test_name) and not excluded_test?(test_name) end |
#target_test_suite?(test_suite_name) ⇒ Boolean
282 283 284 285 |
# File 'lib/grntest/tester.rb', line 282 def target_test_suite?(test_suite_name) selected_test_suite?(test_suite_name) and not excluded_test_suite?(test_suite_name) end |
#use_color? ⇒ Boolean
258 259 260 261 262 263 |
# File 'lib/grntest/tester.rb', line 258 def use_color? if @use_color.nil? @use_color = guess_color_availability end @use_color end |