testability-driver 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/bin/tdriver-devtools +0 -0
  2. data/config/sut_setup.rb +32 -0
  3. data/config/sut_teardown.rb +32 -0
  4. data/ext/extconf.rb +3 -1
  5. data/lib/tdriver-devtools/behaviour/old/xml/update +0 -0
  6. data/lib/tdriver-devtools/behaviour/xml/generate.rb +0 -0
  7. data/lib/tdriver-devtools/doc/update +0 -0
  8. data/lib/tdriver-devtools/doc/xslt/update +0 -0
  9. data/lib/tdriver-devtools/tdriver-devtools.rb +0 -0
  10. data/lib/tdriver-devtools/tests/feature_tests/output/application_closable_0x3f.feature +10 -0
  11. data/lib/tdriver-devtools/tests/feature_tests/output/application_close.feature +15 -0
  12. data/lib/tdriver-devtools/tests/feature_tests/output/application_environment.feature +10 -0
  13. data/lib/tdriver-devtools/tests/feature_tests/output/application_executable_name.feature +10 -0
  14. data/lib/tdriver-devtools/tests/feature_tests/output/application_uid.feature +10 -0
  15. data/lib/tdriver-devtools/tests/feature_tests/output/created.rid +1 -0
  16. data/lib/tdriver-devtools/tests/feature_tests/output/find_find.feature +15 -0
  17. data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash.feature +10 -0
  18. data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash_images.feature +15 -0
  19. data/lib/tdriver-devtools/tests/feature_tests/output/sut_application.feature +15 -0
  20. data/lib/tdriver-devtools/tests/feature_tests/output/sut_capture_screen.feature +10 -0
  21. data/lib/tdriver-devtools/tests/feature_tests/output/sut_child.feature +10 -0
  22. data/lib/tdriver-devtools/tests/feature_tests/output/sut_clear_verify_blocks.feature +10 -0
  23. data/lib/tdriver-devtools/tests/feature_tests/output/sut_connect.feature +10 -0
  24. data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order.feature +10 -0
  25. data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order_0x3d.feature +10 -0
  26. data/lib/tdriver-devtools/tests/feature_tests/output/sut_current_application_id.feature +15 -0
  27. data/lib/tdriver-devtools/tests/feature_tests/output/sut_disconnect.feature +10 -0
  28. data/lib/tdriver-devtools/tests/feature_tests/output/sut_dump_count.feature +15 -0
  29. data/lib/tdriver-devtools/tests/feature_tests/output/sut_freeze.feature +10 -0
  30. data/lib/tdriver-devtools/tests/feature_tests/output/sut_frozen.feature +10 -0
  31. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_application_id.feature +10 -0
  32. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_object.feature +10 -0
  33. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_operator_data.feature +10 -0
  34. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_ui_dump.feature +15 -0
  35. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_user_information.feature +10 -0
  36. data/lib/tdriver-devtools/tests/feature_tests/output/sut_input.feature +15 -0
  37. data/lib/tdriver-devtools/tests/feature_tests/output/sut_parameter.feature +15 -0
  38. data/lib/tdriver-devtools/tests/feature_tests/output/sut_press_key.feature +10 -0
  39. data/lib/tdriver-devtools/tests/feature_tests/output/sut_received_data.feature +10 -0
  40. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh.feature +20 -0
  41. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_timeout.feature +15 -0
  42. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_tries.feature +15 -0
  43. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_ui_dump.feature +20 -0
  44. data/lib/tdriver-devtools/tests/feature_tests/output/sut_run.feature +10 -0
  45. data/lib/tdriver-devtools/tests/feature_tests/output/sut_sent_data.feature +10 -0
  46. data/lib/tdriver-devtools/tests/feature_tests/output/sut_state.feature +10 -0
  47. data/lib/tdriver-devtools/tests/feature_tests/output/sut_translate.feature +30 -0
  48. data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_type.feature +10 -0
  49. data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_version.feature +10 -0
  50. data/lib/tdriver-devtools/tests/feature_tests/output/sut_unfreeze.feature +10 -0
  51. data/lib/tdriver-devtools/tests/feature_tests/output/sut_update.feature +10 -0
  52. data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_always.feature +20 -0
  53. data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_blocks.feature +10 -0
  54. data/lib/tdriver-devtools/tests/feature_tests/output/sut_x_path.feature +10 -0
  55. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data.feature +10 -0
  56. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_0x3d.feature +10 -0
  57. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_crc.feature +10 -0
  58. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_down.feature +10 -0
  59. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_status.feature +10 -0
  60. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_up.feature +10 -0
  61. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_reset.feature +10 -0
  62. data/lib/tdriver-devtools/tests/feature_tests/output/verification_test_object_exists_0x3f.feature +15 -0
  63. data/lib/tdriver-devtools/tests/feature_tests/update +0 -0
  64. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +4 -4
  65. data/lib/tdriver/base/behaviour/factory.rb +8 -0
  66. data/lib/tdriver/base/sut/generic/behaviours/application.rb +24 -3
  67. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +465 -354
  68. data/lib/tdriver/base/test_object/adapter.rb +2 -2
  69. data/lib/tdriver/base/test_object/behaviours/test_object.rb +22 -5
  70. data/lib/tdriver/base/test_object/cache.rb +1 -1
  71. data/lib/tdriver/base/test_object/factory.rb +23 -3
  72. data/lib/tdriver/env.rb +0 -0
  73. data/lib/tdriver/loader.rb +0 -0
  74. data/lib/tdriver/matti.rb +0 -0
  75. data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +22 -24
  76. data/lib/tdriver/report/report.rb +8 -1
  77. data/lib/tdriver/report/report_api.rb +18 -0
  78. data/lib/tdriver/report/report_combine.rb +1 -1
  79. data/lib/tdriver/report/report_creator.rb +5 -1
  80. data/lib/tdriver/report/report_execution_statistics.rb +105 -78
  81. data/lib/tdriver/report/report_test_case_run.rb +2 -1
  82. data/lib/tdriver/report/report_test_run.rb +187 -116
  83. data/lib/tdriver/report/report_writer.rb +49 -29
  84. data/lib/tdriver/tdriver.rb +14 -3
  85. data/lib/tdriver/util/common/exception.rb +53 -0
  86. data/lib/tdriver/util/common/hash.rb +79 -23
  87. data/lib/tdriver/util/common/numeric.rb +26 -5
  88. data/lib/tdriver/util/common/object.rb +44 -15
  89. data/lib/tdriver/util/common/string.rb +4 -1
  90. data/lib/tdriver/util/filters/dynamic_attributes.rb +2 -1
  91. data/lib/tdriver/util/keymap/keymap.rb +81 -0
  92. data/lib/tdriver/util/loader.rb +4 -1
  93. data/lib/tdriver/util/logger/logger.rb +17 -9
  94. data/lib/tdriver/util/other/config.rb +0 -0
  95. data/lib/tdriver/util/parameter/error.rb +3 -0
  96. data/lib/tdriver/util/parameter/loader.rb +6 -1
  97. data/lib/tdriver/util/parameter/parameter.rb +87 -14
  98. data/lib/tdriver/util/parameter/parameter_new.rb +869 -0
  99. data/lib/tdriver/util/parameter/parameter_template.rb +2 -2
  100. data/lib/tdriver/util/parameter/parameter_user_api.rb +27 -3
  101. data/lib/tdriver/util/parameter/parameter_xml.rb +36 -38
  102. data/lib/tdriver/version.rb +1 -1
  103. data/xml/templates/generic.xml +4 -10
  104. metadata +196 -138
@@ -57,7 +57,7 @@ module TDriver
57
57
  # ArgumentError:: SUT type not defined
58
58
  # ArgumentError:: SUT type '%s' not supported
59
59
  # ArgumentError:: Sut id not given
60
- # MobyUtil::ParameterFileNotFoundError:: if paramter file 'tdriver_home'/tdriver_parameters.xml is not found
60
+ # MobyUtil::ParameterFileNotFoundError:: if paramter file (tdriver_parameters.xml in TDriver home directory) is not found
61
61
  # === returns
62
62
  # Object:: Object that SutFactory returns
63
63
  # === example
@@ -115,10 +115,18 @@ module TDriver
115
115
  end
116
116
 
117
117
  # Wrapper for MobyUtil::ParameterUserAPI class with methods e.g. [] and []=, files and load_xml etc.
118
- def self.parameter
118
+ def self.parameter( *arguments )
119
119
 
120
- $parameters_api
120
+ if arguments.count == 0
121
121
 
122
+ $parameters_api
123
+
124
+ else
125
+
126
+ $parameters_api[ *arguments ]
127
+
128
+ end
129
+
122
130
  end
123
131
 
124
132
  # Wrapper for MobyUtil::Logger class
@@ -133,6 +141,9 @@ module TDriver
133
141
 
134
142
  end # TDriver
135
143
 
144
+ # initialize parameters
145
+ $parameters.init
146
+
136
147
  # enable logging engine
137
148
  $logger.enable_logging
138
149
 
@@ -0,0 +1,53 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of Testability Driver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ class Exception
21
+
22
+ # TODO: document me
23
+ def nested_backtrace
24
+
25
+ if backtrace
26
+
27
+ _backtrace = backtrace.dup
28
+
29
+ begin
30
+
31
+ _backtrace[ 0 ] = "#{ _backtrace.first.to_s } raised #{ self.class.name }: #{ message.to_s }"
32
+
33
+ _backtrace.unshift( caller.first )
34
+
35
+ rescue
36
+
37
+ # exception raised, do not alter backtrace
38
+
39
+ end
40
+
41
+ else
42
+
43
+ # no backtrace available
44
+ _backtrace = []
45
+
46
+ end
47
+
48
+ # return backtrace array
49
+ _backtrace
50
+
51
+ end
52
+
53
+ end # Exception
@@ -22,7 +22,9 @@ class Hash
22
22
 
23
23
  def not_empty( message = "Hash must not be empty", exception = ArgumentError )
24
24
 
25
- raise exception.new( message ) if self.empty?
25
+ raise exception, message if empty?
26
+
27
+ self
26
28
 
27
29
  end
28
30
 
@@ -30,27 +32,30 @@ class Hash
30
32
  def require_key( keys, message = "None of key(s) $1 found from hash" )
31
33
 
32
34
  # create array of types
33
- keys_array = keys.kind_of?( Array ) ? keys : [ keys ]
35
+ keys_array = Array( keys )
34
36
 
35
37
  found = false
36
38
 
37
39
  verbose_keys_list = keys_array.each_with_index.collect{ | key, index |
38
40
 
39
- found = true if self.has_key?( key )
41
+ if has_key?( key )
42
+ found = true
43
+ break
44
+ end
40
45
 
41
46
  # result string, separate types if multiple types given
42
47
  "#{ ( ( index > 0 ) ? ( index + 1 < keys_array.count ? ", " : " or " ) : "" ) }#{ key.inspect }"
43
48
 
44
- }.join
49
+ }
45
50
 
46
51
  # raise exception if type did not match
47
52
  unless found
48
53
 
49
54
  # convert macros
50
- [ verbose_keys_list ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
55
+ [ verbose_keys_list.join ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
51
56
 
52
57
  # raise the exception
53
- raise ArgumentError.new( message )
58
+ raise ArgumentError, message
54
59
 
55
60
  end
56
61
 
@@ -62,27 +67,27 @@ class Hash
62
67
  def require_keys( keys, message = "Required key(s) $1 not found from hash" )
63
68
 
64
69
  # create array of types
65
- keys_array = keys.kind_of?( Array ) ? keys : [ keys ]
70
+ keys_array = Array( keys )
66
71
 
67
72
  found = true
68
73
 
69
74
  verbose_keys_list = keys_array.each_with_index.collect{ | key, index |
70
75
 
71
- found = false unless self.has_key?( key )
76
+ found = false unless has_key?( key )
72
77
 
73
78
  # result string, separate types if multiple types given
74
79
  "#{ ( ( index > 0 ) ? ( index + 1 < keys_array.count ? ", " : " and " ) : "" ) }#{ key.inspect }"
75
80
 
76
- }.join
81
+ }
77
82
 
78
83
  # raise exception if type did not match
79
84
  unless found
80
85
 
81
86
  # convert macros
82
- [ verbose_keys_list ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
87
+ [ verbose_keys_list.join ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
83
88
 
84
89
  # raise the exception
85
- raise ArgumentError.new( message )
90
+ raise ArgumentError, message
86
91
 
87
92
  end
88
93
 
@@ -93,16 +98,20 @@ class Hash
93
98
  # collect given keypairs from hash
94
99
  def collect_keys( *keys )
95
100
 
96
- Hash[ self.select{ | key, value | true if keys.include?( key ) } ]
101
+ #Hash[ self.select{ | key, value | true if keys.include?( key ) } ]
97
102
 
103
+ # optimized version, approx 47.9% faster
104
+ keys.inject( {} ){ | hash, key | hash[ key ] = self[ key ] if has_key?( key ); hash }
105
+
98
106
  end
99
107
 
100
108
  # remove keys from hash, return hash of deleted keys as result
101
109
  def delete_keys!( *keys )
102
110
 
103
- deleted_keys = []
111
+ #Hash[ keys.flatten.collect{ | key | [ key, delete( key ) ] if has_key?( key ) }.compact ]
104
112
 
105
- Hash[ keys.flatten.collect{ | key | [ key, delete( key ) ] if has_key?( key ) }.compact ]
113
+ # optimized version, approx 23.4% faster
114
+ keys.inject( {} ){ | hash, key | hash[ key ] = delete( key ) if has_key?( key ); hash }
106
115
 
107
116
  end
108
117
 
@@ -110,22 +119,17 @@ class Hash
110
119
  def delete_keys( *keys )
111
120
 
112
121
  # create a duplicate of current hash
113
- result = dup
122
+ result = dup; keys.flatten.each{ | key | result.delete( key ) }; result
114
123
 
115
- keys.flatten.each{ | key | result.delete( key ) }
116
-
117
- result
124
+ # optimized version, approx 5% faster
125
+ #keys.inject( dup ){ | hash, key | hash.delete( key ); hash }
118
126
 
119
127
  end
120
128
 
121
129
  # store keys and values to hash if not already defined
122
130
  def default_values( hash )
123
131
 
124
- hash.each_pair{ | key, value |
125
-
126
- self[ key ] = value unless has_key?( key )
127
-
128
- }
132
+ hash.each_pair{ | key, value | self[ key ] = value unless has_key?( key ) }
129
133
 
130
134
  self
131
135
 
@@ -142,6 +146,7 @@ class Hash
142
146
 
143
147
  def strip_dynamic_attributes!
144
148
 
149
+ =begin
145
150
  # remove dynamic attributes from hash and return as result
146
151
  Hash[
147
152
 
@@ -167,7 +172,58 @@ class Hash
167
172
  }
168
173
 
169
174
  ]
175
+ =end
176
+
177
+ # optimized version, approx 3.2% faster
178
+ prefix = '__'
179
+
180
+ keys.inject( {} ){ | hash, key |
181
+
182
+ hash[ key ] = delete( key ) if key.to_s[0..1] == prefix
183
+
184
+ hash
185
+
186
+ }
170
187
 
171
188
  end # strip_dynamic_attributes!
172
189
 
190
+ # TODO: document me
191
+ def recursive_merge( other )
192
+
193
+ self.merge( other ){ | key, old_value, new_value |
194
+
195
+ new_value
196
+
197
+ if old_value.kind_of?( Hash ) && new_value.kind_of?( Hash )
198
+
199
+ # merge hashes, call self recursively
200
+ old_value.recursive_merge( new_value )
201
+
202
+ elsif old_value.kind_of?( Array ) && new_value.kind_of?( Array )
203
+
204
+ # concatenate arrays
205
+ old_value.clone.concat( new_value ).uniq
206
+
207
+ else
208
+
209
+ # return new value as is
210
+ new_value
211
+
212
+ end
213
+
214
+ }
215
+
216
+ end # recursive_merge
217
+
218
+ # TODO: document me
219
+ def recursive_merge!( other )
220
+
221
+ self.replace(
222
+
223
+ recursive_merge( other )
224
+
225
+ )
226
+
227
+ end # recursive_merge!
228
+
173
229
  end
@@ -49,11 +49,32 @@ class Numeric
49
49
  end
50
50
 
51
51
  # TODO: document me
52
- def limit( minimum_value, maximum_value )
52
+ def check_range( range, message = "value $1 is out of range ($2)" )
53
+
54
+ # check that given argument is type of Range
55
+ raise TypeError, 'wrong argument type #{ range.class } for range (expected Range)' unless range.kind_of?( Range )
56
+
57
+ # check that given argument is type of Range
58
+ raise TypeError, 'wrong argument type #{ message.class } for exception message (expected String)' unless message.kind_of?( String )
59
+
60
+ # replace macros
61
+ message.gsub!( '$1', self.inspect )
62
+
63
+ message.gsub!( '$2', range.inspect )
53
64
 
54
- value = self
65
+ # raise exception if number is out of range
66
+ raise RangeError, message unless range.include?( self )
67
+
68
+ # return self
69
+ self
70
+
71
+ end
72
+
73
+ # TODO: document me
74
+ def limit( minimum_value, maximum_value )
55
75
 
56
- value.min( minimum_value ).max( maximum_value )
76
+ # limit current value
77
+ self.min( minimum_value ).max( maximum_value )
57
78
 
58
79
  end
59
80
 
@@ -66,7 +87,7 @@ class Numeric
66
87
 
67
88
  else
68
89
 
69
- raise TypeError, 'wrong type %2 for value (expected Numeric)'
90
+ raise TypeError, "wrong type #{ value.class } for value (expected Numeric)"
70
91
 
71
92
  end
72
93
 
@@ -81,7 +102,7 @@ class Numeric
81
102
 
82
103
  else
83
104
 
84
- raise TypeError, 'wrong type %2 for value (expected Numeric)'
105
+ raise TypeError, "wrong type #{ value.class } for value (expected Numeric)"
85
106
 
86
107
  end
87
108
 
@@ -20,8 +20,23 @@
20
20
  # extend Ruby Object class functionality
21
21
  class Object
22
22
 
23
+ # TODO: document me
24
+ def blank?
25
+
26
+ respond_to?( :empty? ) ? empty? : !self
27
+
28
+ end
29
+
30
+ def not_blank( message = "Object must not be blank", exception = ArgumentError )
31
+
32
+ raise exception, message if blank?
33
+
34
+ self
35
+
36
+ end
37
+
23
38
  # define method to class instance
24
- def meta_def method_name, &block
39
+ def meta_def( method_name, &block )
25
40
 
26
41
  ( class << self; self; end ).instance_eval{ define_method method_name, &block }
27
42
 
@@ -31,10 +46,10 @@ class Object
31
46
  def check_type( types, message = "wrong argument type $1 (expected $2)" )
32
47
 
33
48
  # raise exception if message is not type of String
34
- raise TypeError.new( "wrong argument type %s for message (expected String)" % [ message.class ] ) unless message.kind_of?( String )
49
+ raise TypeError, "wrong argument type #{ message.class } for message (expected String)" unless message.kind_of?( String )
35
50
 
36
51
  # create array of types
37
- type_array = types.kind_of?( Array ) ? types : [ types ]
52
+ type_array = Array( types )
38
53
 
39
54
  # default result value
40
55
  found = false
@@ -42,23 +57,29 @@ class Object
42
57
  # collect verbose type list
43
58
  verbose_type_list = type_array.each_with_index.collect{ | type, index |
44
59
 
45
- raise TypeError.new( "invalid argument type #{ type } for check_type. Did you mean #{ type.class }?" ) unless type.kind_of?( Class )
60
+ raise TypeError, "invalid argument type #{ type } for check_type. Did you mean #{ type.class }?" unless type.kind_of?( Class )
61
+
62
+ if self.kind_of?( type )
63
+
64
+ found = true
65
+
66
+ break
46
67
 
47
- found = true if self.kind_of?( type )
68
+ end
48
69
 
49
70
  # result string, separate types if multiple types given
50
71
  "#{ ( ( index > 0 ) ? ( index + 1 < type_array.count ? ", " : " or " ) : "" ) }#{ type.to_s }"
51
72
 
52
- }.join
73
+ }
53
74
 
54
75
  # raise exception if type did not match
55
76
  unless found
56
77
 
57
78
  # convert macros
58
- [ self.class, verbose_type_list, self.inspect ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
79
+ [ self.class, verbose_type_list.join, self.inspect ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
59
80
 
60
81
  # raise the exception
61
- raise TypeError.new( message )
82
+ raise TypeError, message
62
83
 
63
84
  end
64
85
 
@@ -69,17 +90,19 @@ class Object
69
90
 
70
91
  def not_nil( message = "Value must not be nil", exception = ArgumentError )
71
92
 
72
- raise exception.new( message ) if self.nil?
93
+ raise exception, message unless self
94
+
95
+ self
73
96
 
74
97
  end
75
98
 
76
99
  def validate( values, message = "Unexpected value $3 for $1 (expected $2)" )
77
100
 
78
101
  # raise exception if message is not type of String
79
- raise TypeError.new( "wrong argument type %s for message (expected String)" % [ message.class ] ) unless message.kind_of?( String )
102
+ raise TypeError, "wrong argument type #{ message.class } for message (expected String)" unless message.kind_of?( String )
80
103
 
81
104
  # create array of values
82
- values_array = values.kind_of?( Array ) ? values : [ values ]
105
+ values_array = Array( values )
83
106
 
84
107
  # default result value
85
108
  found = false
@@ -89,21 +112,27 @@ class Object
89
112
 
90
113
  raise TypeError.new( "Invalid argument type #{ value.class } for value (expected #{ self.class })" ) unless value.kind_of?( self.class )
91
114
 
92
- found = true if self == value
115
+ if self == value
116
+
117
+ found = true
118
+
119
+ break
120
+
121
+ end
93
122
 
94
123
  # result string, separate types if multiple types given
95
124
  "#{ ( ( index > 0 ) ? ( index + 1 < values_array.count ? ", " : " or " ) : "" ) }#{ value.inspect }"
96
125
 
97
- }.join
126
+ }
98
127
 
99
128
  # raise exception if value was not found
100
129
  unless found
101
130
 
102
131
  # convert macros
103
- [ self.class, verbose_values_list, self.inspect ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
132
+ [ self.class, verbose_values_list.join, self.inspect ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
104
133
 
105
134
  # raise the exception
106
- raise ArgumentError.new( message )
135
+ raise ArgumentError, message
107
136
 
108
137
  end
109
138