opal 0.4.3 → 0.4.4

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.
Files changed (303) hide show
  1. data/.rspec +3 -0
  2. data/.travis.yml +0 -4
  3. data/README.md +6 -0
  4. data/Rakefile +30 -6
  5. data/bin/opal +6 -82
  6. data/corelib/{opal/array.rb → array.rb} +40 -56
  7. data/corelib/{opal/basic_object.rb → basic_object.rb} +2 -2
  8. data/corelib/{opal/boolean.rb → boolean.rb} +0 -8
  9. data/corelib/class.rb +47 -0
  10. data/corelib/{opal/comparable.rb → comparable.rb} +0 -0
  11. data/corelib/{opal/enumerable.rb → enumerable.rb} +208 -141
  12. data/corelib/{opal/enumerator.rb → enumerator.rb} +3 -3
  13. data/corelib/{opal/error.rb → error.rb} +1 -0
  14. data/corelib/{opal/hash.rb → hash.rb} +67 -56
  15. data/corelib/io.rb +39 -0
  16. data/corelib/{opal/kernel.rb → kernel.rb} +35 -31
  17. data/corelib/{opal/class.rb → module.rb} +29 -57
  18. data/corelib/native.rb +148 -0
  19. data/corelib/{opal/nil_class.rb → nil_class.rb} +2 -10
  20. data/corelib/{opal/numeric.rb → numeric.rb} +39 -14
  21. data/corelib/opal.rb +42 -25
  22. data/corelib/{opal/proc.rb → proc.rb} +3 -3
  23. data/corelib/{opal/range.rb → range.rb} +5 -1
  24. data/corelib/{opal/regexp.rb → regexp.rb} +0 -0
  25. data/corelib/{opal/runtime.js → runtime.js} +96 -188
  26. data/corelib/{opal/string.rb → string.rb} +20 -15
  27. data/corelib/struct.rb +139 -0
  28. data/corelib/{opal/time.rb → time.rb} +0 -0
  29. data/lib/opal.rb +4 -0
  30. data/lib/opal/cli.rb +79 -32
  31. data/lib/opal/cli_options.rb +91 -0
  32. data/lib/opal/erb.rb +41 -8
  33. data/lib/opal/grammar.rb +24 -10
  34. data/lib/opal/grammar.y +15 -4
  35. data/lib/opal/grammar_helpers.rb +4 -0
  36. data/lib/opal/lexer.rb +214 -143
  37. data/lib/opal/parser.rb +596 -562
  38. data/lib/opal/require_parser.rb +1 -1
  39. data/lib/opal/source_map.rb +15 -30
  40. data/lib/opal/target_scope.rb +24 -5
  41. data/lib/opal/version.rb +1 -1
  42. data/mri_spec/cli_spec.rb +18 -0
  43. data/mri_spec/fixtures/opal_file.rb +2 -0
  44. data/mri_spec/spec_helper.rb +17 -0
  45. data/opal.gemspec +5 -2
  46. data/spec/{rubyspec/filters → filters}/bugs/alias.rb +0 -0
  47. data/spec/{rubyspec/filters → filters}/bugs/ancestors.rb +0 -0
  48. data/spec/{rubyspec/filters → filters}/bugs/array.rb +0 -0
  49. data/spec/filters/bugs/array/combination.rb +11 -0
  50. data/spec/filters/bugs/array/count.rb +3 -0
  51. data/spec/filters/bugs/array/delete_if.rb +3 -0
  52. data/spec/filters/bugs/array/drop.rb +3 -0
  53. data/spec/filters/bugs/array/drop_while.rb +5 -0
  54. data/spec/filters/bugs/array/eql.rb +3 -0
  55. data/spec/filters/bugs/array/flatten.rb +9 -0
  56. data/spec/filters/bugs/array/minus.rb +5 -0
  57. data/spec/filters/bugs/array/multipliy.rb +9 -0
  58. data/spec/filters/bugs/array/new.rb +3 -0
  59. data/spec/filters/bugs/array/pop.rb +6 -0
  60. data/spec/filters/bugs/array/rassoc.rb +4 -0
  61. data/spec/filters/bugs/array/rindex.rb +6 -0
  62. data/spec/filters/bugs/array/select.rb +3 -0
  63. data/spec/filters/bugs/array/shift.rb +7 -0
  64. data/spec/filters/bugs/array/shuffle.rb +11 -0
  65. data/spec/filters/bugs/array/slice.rb +7 -0
  66. data/spec/filters/bugs/array/take.rb +3 -0
  67. data/spec/filters/bugs/array/to_a.rb +3 -0
  68. data/spec/filters/bugs/array/try_convert.rb +7 -0
  69. data/spec/filters/bugs/array/uniq.rb +10 -0
  70. data/spec/filters/bugs/array/zip.rb +4 -0
  71. data/spec/{rubyspec/filters → filters}/bugs/array_delete.rb +1 -0
  72. data/spec/{rubyspec/filters → filters}/bugs/array_fetch.rb +0 -0
  73. data/spec/{rubyspec/filters → filters}/bugs/array_first.rb +0 -0
  74. data/spec/{rubyspec/filters → filters}/bugs/array_flatten.rb +0 -0
  75. data/spec/{rubyspec/filters → filters}/bugs/array_intersection.rb +0 -0
  76. data/spec/{rubyspec/filters → filters}/bugs/array_join.rb +0 -0
  77. data/spec/{rubyspec/filters → filters}/bugs/break.rb +0 -0
  78. data/spec/filters/bugs/case.rb +4 -0
  79. data/spec/{rubyspec/filters → filters}/bugs/coerce_integer.rb +0 -0
  80. data/spec/filters/bugs/enumerable_sort_by.rb +3 -0
  81. data/spec/{rubyspec/filters → filters}/bugs/kernel/instance_variables.rb +0 -0
  82. data/spec/filters/bugs/kernel/rand.rb +4 -0
  83. data/spec/filters/bugs/language/array.rb +3 -0
  84. data/spec/filters/bugs/language/block.rb +6 -0
  85. data/spec/filters/bugs/language/break.rb +3 -0
  86. data/spec/{rubyspec/filters → filters}/bugs/language/class.rb +3 -0
  87. data/spec/{rubyspec/filters → filters}/bugs/language/class_variables.rb +0 -0
  88. data/spec/filters/bugs/language/def.rb +27 -0
  89. data/spec/filters/bugs/language/defined.rb +3 -0
  90. data/spec/filters/bugs/language/ensure.rb +4 -0
  91. data/spec/filters/bugs/language/execution.rb +4 -0
  92. data/spec/filters/bugs/language/for.rb +18 -0
  93. data/spec/filters/bugs/language/if.rb +13 -0
  94. data/spec/filters/bugs/language/loop.rb +4 -0
  95. data/spec/filters/bugs/language/metaclass.rb +14 -0
  96. data/spec/filters/bugs/language/module.rb +6 -0
  97. data/spec/filters/bugs/language/next.rb +3 -0
  98. data/spec/filters/bugs/language/or.rb +3 -0
  99. data/spec/filters/bugs/language/order.rb +4 -0
  100. data/spec/filters/bugs/language/precedence.rb +10 -0
  101. data/spec/filters/bugs/language/proc.rb +24 -0
  102. data/spec/filters/bugs/language/redo.rb +5 -0
  103. data/spec/filters/bugs/language/rescue.rb +9 -0
  104. data/spec/filters/bugs/language/retry.rb +5 -0
  105. data/spec/filters/bugs/language/send.rb +10 -0
  106. data/spec/filters/bugs/language/super.rb +9 -0
  107. data/spec/filters/bugs/language/until.rb +8 -0
  108. data/spec/filters/bugs/language/variables.rb +37 -0
  109. data/spec/filters/bugs/language/while.rb +6 -0
  110. data/spec/filters/bugs/language/yield.rb +5 -0
  111. data/spec/{rubyspec/filters → filters}/bugs/module/class_variables.rb +0 -0
  112. data/spec/filters/bugs/module/method_defined.rb +6 -0
  113. data/spec/filters/bugs/parser.rb +10 -0
  114. data/spec/{rubyspec/filters → filters}/bugs/public_methods.rb +1 -0
  115. data/spec/filters/bugs/return.rb +7 -0
  116. data/spec/filters/bugs/singleton/instance.rb +4 -0
  117. data/spec/filters/bugs/source_map.rb +3 -0
  118. data/spec/filters/bugs/string/center.rb +4 -0
  119. data/spec/filters/bugs/string/lines.rb +3 -0
  120. data/spec/{rubyspec/filters → filters}/mspec/mocks.rb +0 -0
  121. data/spec/{rubyspec/filters → filters}/mspec/ruby_exe.rb +0 -0
  122. data/spec/{rubyspec/filters → filters}/mspec/should_receive.rb +0 -0
  123. data/spec/{rubyspec/filters → filters}/parser/block_args.rb +0 -0
  124. data/spec/{rubyspec/filters → filters}/unsupported/array_subclasses.rb +1 -0
  125. data/spec/filters/unsupported/frozen.rb +32 -0
  126. data/spec/filters/unsupported/immutable_strings.rb +3 -0
  127. data/spec/filters/unsupported/tainted.rb +17 -0
  128. data/spec/filters/unsupported/trusted.rb +15 -0
  129. data/spec/opal/class/constants_spec.rb +7 -0
  130. data/spec/opal/erb/erb_spec.rb +7 -1
  131. data/spec/opal/erb/inline_block.opalerb +3 -0
  132. data/spec/opal/hash/allocate_spec.rb +16 -0
  133. data/spec/opal/hash/new_spec.rb +10 -0
  134. data/spec/opal/hash/to_s_spec.rb +9 -0
  135. data/spec/opal/kernel/instance_variable_defined_spec.rb +15 -0
  136. data/spec/opal/kernel/rand_spec.rb +5 -5
  137. data/spec/opal/kernel/respond_to_spec.rb +14 -1
  138. data/spec/opal/language/block_spec.rb +13 -0
  139. data/spec/opal/language/rescue_spec.rb +27 -0
  140. data/spec/opal/language/return_spec.rb +38 -0
  141. data/spec/opal/language/singleton_class_spec.rb +13 -0
  142. data/spec/opal/language/super_spec.rb +99 -0
  143. data/spec/opal/language/variables_spec.rb +20 -0
  144. data/spec/opal/module/attr_accessor_spec.rb +8 -0
  145. data/spec/opal/module/constants_spec.rb +2 -2
  146. data/spec/opal/native/alias_native_spec.rb +18 -0
  147. data/spec/opal/native/each_spec.rb +14 -0
  148. data/spec/opal/native/element_reference_spec.rb +14 -0
  149. data/spec/opal/native/method_missing_spec.rb +39 -0
  150. data/spec/opal/native/new_spec.rb +19 -0
  151. data/spec/opal/native/nil_spec.rb +14 -0
  152. data/spec/opal/runtime2/class_hierarchy_spec.rb +2 -2
  153. data/spec/opal/source_map_spec.rb +3 -7
  154. data/spec/ospec/main.rb.erb +2 -5
  155. data/spec/parser/alias_spec.rb +4 -4
  156. data/spec/parser/and_spec.rb +2 -2
  157. data/spec/parser/array_spec.rb +6 -6
  158. data/spec/parser/attrasgn_spec.rb +8 -8
  159. data/spec/parser/begin_spec.rb +11 -11
  160. data/spec/parser/block_spec.rb +3 -3
  161. data/spec/parser/break_spec.rb +4 -4
  162. data/spec/parser/call_spec.rb +50 -48
  163. data/spec/parser/class_spec.rb +2 -2
  164. data/spec/parser/const_spec.rb +1 -1
  165. data/spec/parser/cvar_spec.rb +1 -1
  166. data/spec/parser/def_spec.rb +5 -5
  167. data/spec/parser/gvar_spec.rb +2 -2
  168. data/spec/parser/hash_spec.rb +4 -4
  169. data/spec/parser/iasgn_spec.rb +3 -3
  170. data/spec/parser/if_spec.rb +6 -6
  171. data/spec/parser/iter_spec.rb +6 -6
  172. data/spec/parser/lambda_spec.rb +5 -5
  173. data/spec/parser/lasgn_spec.rb +2 -2
  174. data/spec/parser/line_spec.rb +2 -2
  175. data/spec/parser/lvar_spec.rb +5 -5
  176. data/spec/parser/masgn_spec.rb +1 -1
  177. data/spec/parser/module_spec.rb +2 -2
  178. data/spec/parser/not_spec.rb +4 -4
  179. data/spec/parser/op_asgn1_spec.rb +2 -2
  180. data/spec/parser/op_asgn2_spec.rb +2 -2
  181. data/spec/parser/or_spec.rb +2 -2
  182. data/spec/parser/parse_spec.rb +66 -0
  183. data/spec/parser/parser_spec.rb +32 -38
  184. data/spec/parser/regexp_spec.rb +4 -4
  185. data/spec/parser/return_spec.rb +4 -4
  186. data/spec/parser/sclass_spec.rb +4 -4
  187. data/spec/parser/str_spec.rb +3 -3
  188. data/spec/parser/super_spec.rb +6 -6
  189. data/spec/parser/undef_spec.rb +3 -3
  190. data/spec/parser/unless_spec.rb +4 -4
  191. data/spec/parser/while_spec.rb +3 -3
  192. data/spec/parser/xstr_spec.rb +3 -3
  193. data/spec/parser/yield_spec.rb +6 -6
  194. data/spec/rubyspec/core/array/drop_spec.rb +1 -1
  195. data/spec/rubyspec/core/array/keep_if_spec.rb +1 -3
  196. data/spec/rubyspec/core/array/length_spec.rb +1 -3
  197. data/spec/rubyspec/core/array/map_spec.rb +2 -6
  198. data/spec/rubyspec/core/array/minus_spec.rb +3 -3
  199. data/spec/rubyspec/core/array/multiply_spec.rb +14 -16
  200. data/spec/rubyspec/core/array/new_spec.rb +3 -5
  201. data/spec/rubyspec/core/array/plus_spec.rb +2 -2
  202. data/spec/rubyspec/core/array/pop_spec.rb +4 -4
  203. data/spec/rubyspec/core/array/rassoc_spec.rb +2 -2
  204. data/spec/rubyspec/core/array/reject_spec.rb +2 -6
  205. data/spec/rubyspec/core/array/replace_spec.rb +1 -3
  206. data/spec/rubyspec/core/array/reverse_each_spec.rb +1 -3
  207. data/spec/rubyspec/core/array/reverse_spec.rb +4 -4
  208. data/spec/rubyspec/core/array/rindex_spec.rb +1 -1
  209. data/spec/rubyspec/core/array/select_spec.rb +3 -7
  210. data/spec/rubyspec/core/array/shared/collect.rb +7 -0
  211. data/spec/rubyspec/core/array/shared/index.rb +1 -1
  212. data/spec/rubyspec/core/array/shared/keep_if.rb +3 -0
  213. data/spec/rubyspec/core/array/shared/length.rb +3 -0
  214. data/spec/rubyspec/core/array/shared/replace.rb +3 -0
  215. data/spec/rubyspec/core/array/shared/slice.rb +3 -0
  216. data/spec/rubyspec/core/array/shuffle_spec.rb +1 -1
  217. data/spec/rubyspec/core/array/size_spec.rb +1 -3
  218. data/spec/rubyspec/core/array/slice_spec.rb +4 -6
  219. data/spec/rubyspec/core/array/sort_spec.rb +2 -2
  220. data/spec/rubyspec/core/array/to_a_spec.rb +1 -1
  221. data/spec/rubyspec/core/array/try_convert_spec.rb +7 -7
  222. data/spec/rubyspec/core/array/uniq_spec.rb +7 -7
  223. data/spec/rubyspec/core/array/zip_spec.rb +1 -1
  224. data/spec/rubyspec/core/enumerable/collect_spec.rb +24 -0
  225. data/spec/rubyspec/core/enumerable/count_spec.rb +35 -19
  226. data/spec/rubyspec/core/enumerable/find_spec.rb +5 -0
  227. data/spec/rubyspec/core/hash/each_pair_spec.rb +7 -7
  228. data/spec/rubyspec/core/hash/each_spec.rb +13 -7
  229. data/spec/rubyspec/core/module/method_defined_spec.rb +4 -4
  230. data/spec/rubyspec/core/module/public_method_defined_spec.rb +19 -0
  231. data/spec/rubyspec/core/module/remove_const_spec.rb +23 -0
  232. data/spec/rubyspec/core/numeric/step_spec.rb +14 -0
  233. data/spec/rubyspec/core/string/center_spec.rb +43 -65
  234. data/spec/rubyspec/core/string/lines_spec.rb +1 -1
  235. data/spec/rubyspec/core/string/ljust_spec.rb +25 -9
  236. data/spec/rubyspec/core/string/rjust_spec.rb +26 -10
  237. data/spec/rubyspec/core/struct/fixtures/classes.rb +26 -0
  238. data/spec/rubyspec/core/struct/initialize_spec.rb +11 -0
  239. data/spec/rubyspec/core/struct/new_spec.rb +24 -0
  240. data/spec/rubyspec/fixtures/constants.rb +7 -0
  241. data/spec/rubyspec/language/break_spec.rb +1 -1
  242. data/spec/rubyspec/language/case_spec.rb +30 -30
  243. data/spec/rubyspec/language/def_spec.rb +34 -34
  244. data/spec/rubyspec/language/defined_spec.rb +2 -2
  245. data/spec/rubyspec/language/ensure_spec.rb +2 -2
  246. data/spec/rubyspec/language/execution_spec.rb +2 -2
  247. data/spec/rubyspec/language/for_spec.rb +17 -17
  248. data/spec/rubyspec/language/hash_spec.rb +3 -3
  249. data/spec/rubyspec/language/if_spec.rb +11 -11
  250. data/spec/rubyspec/language/loop_spec.rb +3 -3
  251. data/spec/rubyspec/language/metaclass_spec.rb +14 -14
  252. data/spec/rubyspec/language/module_spec.rb +6 -6
  253. data/spec/rubyspec/language/next_spec.rb +5 -5
  254. data/spec/rubyspec/language/not_spec.rb +1 -1
  255. data/spec/rubyspec/language/or_spec.rb +1 -1
  256. data/spec/rubyspec/language/order_spec.rb +3 -5
  257. data/spec/rubyspec/language/precedence_spec.rb +19 -19
  258. data/spec/rubyspec/language/proc_spec.rb +29 -29
  259. data/spec/rubyspec/language/redo_spec.rb +3 -5
  260. data/spec/rubyspec/language/rescue_spec.rb +7 -7
  261. data/spec/rubyspec/language/retry_spec.rb +2 -2
  262. data/spec/rubyspec/language/return_spec.rb +12 -12
  263. data/spec/rubyspec/language/send_spec.rb +9 -9
  264. data/spec/rubyspec/language/singleton_class_spec.rb +3 -4
  265. data/spec/rubyspec/language/super_spec.rb +7 -11
  266. data/spec/rubyspec/language/until_spec.rb +10 -10
  267. data/spec/rubyspec/language/variables_spec.rb +59 -67
  268. data/spec/rubyspec/language/versions/array_1.9.rb +1 -1
  269. data/spec/rubyspec/language/versions/block_1.9.rb +0 -0
  270. data/spec/rubyspec/language/versions/break_1.9.rb +0 -0
  271. data/spec/rubyspec/language/versions/literal_lambda_1.9.rb +12 -12
  272. data/spec/rubyspec/language/versions/send_1.9.rb +23 -23
  273. data/spec/rubyspec/language/versions/symbol_1.9.rb +2 -2
  274. data/spec/rubyspec/language/versions/variables_1.9.rb +1 -1
  275. data/spec/rubyspec/language/while_spec.rb +4 -4
  276. data/spec/rubyspec/language/yield_spec.rb +3 -3
  277. data/spec/rubyspec/library/erb/util/html_escape_spec.rb +10 -0
  278. data/spec/rubyspec/library/singleton/clone_spec.rb +8 -0
  279. data/spec/rubyspec/library/singleton/dup_spec.rb +8 -0
  280. data/spec/rubyspec/library/singleton/fixtures/classes.rb +18 -0
  281. data/spec/rubyspec/library/singleton/instance_spec.rb +30 -0
  282. data/spec/spec_helper.rb +214 -0
  283. data/stdlib/buffer.rb +40 -0
  284. data/stdlib/buffer/array.rb +66 -0
  285. data/stdlib/buffer/view.rb +70 -0
  286. data/stdlib/erb.rb +11 -20
  287. data/stdlib/forwardable.rb +71 -0
  288. data/stdlib/json.rb +78 -0
  289. data/stdlib/ostruct.rb +69 -0
  290. data/stdlib/rbconfig.rb +1 -0
  291. data/stdlib/singleton.rb +40 -0
  292. data/stdlib/stringio.rb +173 -0
  293. data/stdlib/template.rb +44 -0
  294. metadata +285 -79
  295. data/corelib/opal/native.rb +0 -31
  296. data/spec/opal/class/bridge_class_spec.rb +0 -39
  297. data/spec/opal/native_spec.rb +0 -209
  298. data/spec/ospec/runner.rb +0 -223
  299. data/spec/rubyspec/filters/bugs/block_args.rb +0 -3
  300. data/spec/rubyspec/filters/bugs/case.rb +0 -8
  301. data/spec/rubyspec/filters/bugs/language/module.rb +0 -3
  302. data/spec/rubyspec/filters/unsupported/frozen.rb +0 -4
  303. data/spec/rubyspec/filters/unsupported/tainted.rb +0 -7
@@ -1,7 +1,7 @@
1
1
  require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe "The retry statement" do
4
- pending "re-executes the closest block" do
4
+ it "re-executes the closest block" do
5
5
  retry_first = true
6
6
  retry_second = true
7
7
  results = []
@@ -39,7 +39,7 @@ describe "The retry statement" do
39
39
  end
40
40
 
41
41
  describe "The retry keyword inside a begin block's rescue block" do
42
- pending "causes the begin block to be executed again" do
42
+ it "causes the begin block to be executed again" do
43
43
  counter = 0
44
44
 
45
45
  begin
@@ -30,7 +30,7 @@ describe "The return keyword" do
30
30
  end
31
31
 
32
32
  ruby_version_is "1.9" do
33
- pending "raises a LocalJumpError if used to exit a thread" do
33
+ it "raises a LocalJumpError if used to exit a thread" do
34
34
  lambda { Thread.new { return }.join }.should raise_error(LocalJumpError)
35
35
  end
36
36
  end
@@ -45,7 +45,7 @@ describe "The return keyword" do
45
45
  end
46
46
 
47
47
  ruby_version_is "1.9" do
48
- pending "returns [] when the ary is empty" do
48
+ it "returns [] when the ary is empty" do
49
49
  def r; ary = []; return *ary; end
50
50
  r.should == []
51
51
  end
@@ -81,14 +81,14 @@ describe "The return keyword" do
81
81
  end
82
82
 
83
83
  ruby_version_is "1.9" do
84
- pending "returns an array when used as a splat" do
84
+ it "returns an array when used as a splat" do
85
85
  def r; value = 1; return *value; end
86
86
  r.should == [1]
87
87
  end
88
88
  end
89
89
 
90
90
 
91
- pending "calls 'to_a' on the splatted value first" do
91
+ it "calls 'to_a' on the splatted value first" do
92
92
  def r
93
93
  obj = Object.new
94
94
  def obj.to_a
@@ -154,7 +154,7 @@ describe "The return keyword" do
154
154
  ScratchPad.recorded.should == [:begin, :ensure]
155
155
  end
156
156
 
157
- pending "executes nested ensures before returning" do
157
+ it "executes nested ensures before returning" do
158
158
  # def f()
159
159
  # begin
160
160
  # begin
@@ -176,7 +176,7 @@ describe "The return keyword" do
176
176
  # ScratchPad.recorded.should == [:inner_begin, :inner_ensure, :outer_ensure]
177
177
  end
178
178
 
179
- pending "returns last value returned in nested ensures" do
179
+ it "returns last value returned in nested ensures" do
180
180
  # def f()
181
181
  # begin
182
182
  # begin
@@ -238,22 +238,22 @@ describe "The return keyword" do
238
238
  lambda { return 123; 456 }.call.should == 123
239
239
  end
240
240
 
241
- pending "causes the method that lexically encloses the block to return" do
241
+ it "causes the method that lexically encloses the block to return" do
242
242
  ReturnSpecs::Blocks.new.enclosing_method.should == :return_value
243
243
  ScratchPad.recorded.should == :before_return
244
244
  end
245
245
 
246
- pending "returns from the lexically enclosing method even in case of chained calls" do
246
+ it "returns from the lexically enclosing method even in case of chained calls" do
247
247
  ReturnSpecs::NestedCalls.new.enclosing_method.should == :return_value
248
248
  ScratchPad.recorded.should == :before_return
249
249
  end
250
250
 
251
- pending "returns from the lexically enclosing method even in case of chained calls(in yield)" do
251
+ it "returns from the lexically enclosing method even in case of chained calls(in yield)" do
252
252
  ReturnSpecs::NestedBlocks.new.enclosing_method.should == :return_value
253
253
  ScratchPad.recorded.should == :before_return
254
254
  end
255
255
 
256
- pending "causes the method to return even when the immediate parent has already returned" do
256
+ it "causes the method to return even when the immediate parent has already returned" do
257
257
  ReturnSpecs::SavedInnerBlock.new.start.should == :return_value
258
258
  ScratchPad.recorded.should == :before_return
259
259
  end
@@ -261,7 +261,7 @@ describe "The return keyword" do
261
261
  end
262
262
 
263
263
  describe "within two blocks" do
264
- pending "causes the method that lexically encloses the block to return" do
264
+ it "causes the method that lexically encloses the block to return" do
265
265
  def f
266
266
  1.times { 1.times {return true}; false}; false
267
267
  end
@@ -270,7 +270,7 @@ describe "The return keyword" do
270
270
  end
271
271
 
272
272
  describe "within define_method" do
273
- pending "goes through the method via a closure" do
273
+ it "goes through the method via a closure" do
274
274
  ReturnSpecs::ThroughDefineMethod.new.outer.should == :good
275
275
  end
276
276
 
@@ -51,7 +51,7 @@ describe "Invoking a method" do
51
51
  specs.fooM0O1(2).should == [2]
52
52
  end
53
53
 
54
- pending "raises ArgumentError if extra arguments are passed" do
54
+ it "raises ArgumentError if extra arguments are passed" do
55
55
  lambda {
56
56
  specs.fooM0O1(2,3)
57
57
  }.should raise_error(ArgumentError)
@@ -69,7 +69,7 @@ describe "Invoking a method" do
69
69
  }.should raise_error(ArgumentError)
70
70
  end
71
71
 
72
- pending "raises an ArgumentError if too many values are passed" do
72
+ it "raises an ArgumentError if too many values are passed" do
73
73
  lambda {
74
74
  specs.fooM1O1(1,2,3)
75
75
  }.should raise_error(ArgumentError)
@@ -88,7 +88,7 @@ describe "Invoking a method" do
88
88
  end
89
89
  end
90
90
 
91
- pending "with a block makes it available to yield" do
91
+ it "with a block makes it available to yield" do
92
92
  specs.oneb(10) { 200 }.should == [10,200]
93
93
  end
94
94
 
@@ -98,7 +98,7 @@ describe "Invoking a method" do
98
98
  prc.call.should == "hello"
99
99
  end
100
100
 
101
- pending "with an object as a block uses 'to_proc' for coercion" do
101
+ it "with an object as a block uses 'to_proc' for coercion" do
102
102
  o = LangSendSpecs::ToProc.new(:from_to_proc)
103
103
 
104
104
  specs.makeproc(&o).call.should == :from_to_proc
@@ -106,7 +106,7 @@ describe "Invoking a method" do
106
106
  specs.yield_now(&o).should == :from_to_proc
107
107
  end
108
108
 
109
- pending "raises a SyntaxError with both a literal block and an object as block" do
109
+ it "raises a SyntaxError with both a literal block and an object as block" do
110
110
  lambda {
111
111
  eval "specs.oneb(10, &l){ 42 }"
112
112
  }.should raise_error(SyntaxError)
@@ -168,13 +168,13 @@ describe "Invoking a method" do
168
168
  end
169
169
  end
170
170
 
171
- pending "passes literal hashes without curly braces as the last parameter" do
171
+ it "passes literal hashes without curly braces as the last parameter" do
172
172
  #specs.fooM3('abc', 456, 'rbx' => 'cool',
173
173
  # 'specs' => 'fail sometimes', 'oh' => 'weh').should == \
174
174
  # ['abc', 456, {'rbx' => 'cool', 'specs' => 'fail sometimes', 'oh' => 'weh'}]
175
175
  end
176
176
 
177
- pending "passes a literal hash without curly braces or parens" do
177
+ it "passes a literal hash without curly braces or parens" do
178
178
  #(specs.fooM3 'abc', 456, 'rbx' => 'cool',
179
179
  # 'specs' => 'fail sometimes', 'oh' => 'weh').should == \
180
180
  # ['abc', 456, { 'rbx' => 'cool', 'specs' => 'fail sometimes', 'oh' => 'weh'}]
@@ -207,7 +207,7 @@ describe "Invoking a private setter method" do
207
207
  receiver.foo.should == 42
208
208
  end
209
209
 
210
- pending "for multiple assignment" do
210
+ it "for multiple assignment" do
211
211
  receiver = LangSendSpecs::PrivateSetter.new
212
212
  receiver.call_self_foo_equals_masgn(42)
213
213
  receiver.foo.should == 42
@@ -216,7 +216,7 @@ describe "Invoking a private setter method" do
216
216
  end
217
217
 
218
218
  describe "Invoking a private getter method" do
219
- pending "does not permit self as a receiver" do
219
+ it "does not permit self as a receiver" do
220
220
  receiver = LangSendSpecs::PrivateGetter.new
221
221
  lambda { receiver.call_self_foo }.should raise_error(NoMethodError)
222
222
  lambda { receiver.call_self_foo_or_equals(6) }.should raise_error(NoMethodError)
@@ -1,7 +1,5 @@
1
-
2
- module ClassSpecs
3
- class A; end
4
- end
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+ require File.expand_path('../../fixtures/class', __FILE__)
5
3
 
6
4
  describe "A singleton class" do
7
5
  it "is NilClass for nil" do
@@ -12,6 +10,7 @@ describe "A singleton class" do
12
10
  o = mock('x')
13
11
  o.singleton_class.should be_kind_of(Class)
14
12
  o.singleton_class.should_not equal(Object)
13
+ o.should_not be_kind_of(o.singleton_class)
15
14
  end
16
15
 
17
16
  it "is a Class for classes" do
@@ -39,7 +39,7 @@ describe "The super keyword" do
39
39
  Super::MS2::C.new.foo([]).should == ["ModB#foo","C#baz","A#baz"]
40
40
  end
41
41
 
42
- pending "searches class methods including modules" do
42
+ it "searches class methods including modules" do
43
43
  Super::MS3::A.new.foo([]).should == ["A#foo"]
44
44
  Super::MS3::A.foo([]).should == ["ModA#foo"]
45
45
  Super::MS3::A.bar([]).should == ["ModA#bar","ModA#foo"]
@@ -48,7 +48,7 @@ describe "The super keyword" do
48
48
  Super::MS3::B.bar([]).should == ["B::bar","ModA#bar","B::foo","ModA#foo"]
49
49
  end
50
50
 
51
- pending "calls the correct method when the method visibility is modified" do
51
+ it "calls the correct method when the method visibility is modified" do
52
52
  Super::MS4::A.new.example.should == 5
53
53
  end
54
54
 
@@ -57,7 +57,6 @@ describe "The super keyword" do
57
57
  Super::S4::B.new.foo([],"test").should == ["B#foo(a,test)", "A#foo"]
58
58
  end
59
59
 
60
- pending do
61
60
  ruby_bug "#1151 [ruby-core:22040]", "1.8.7.174" do
62
61
  it "raises an error error when super method does not exist" do
63
62
  sup = Class.new
@@ -76,7 +75,6 @@ describe "The super keyword" do
76
75
  lambda {sub_zsuper.new.foo}.should raise_error(NoMethodError, /super/)
77
76
  end
78
77
  end
79
- end
80
78
 
81
79
  it "calls the superclass method when in a block" do
82
80
  Super::S6.new.here.should == :good
@@ -230,7 +228,6 @@ describe "The super keyword" do
230
228
  end
231
229
  end
232
230
 
233
- pending do
234
231
  ruby_bug "#6907", "2.0" do
235
232
  it "can be used with implicit arguments from a method defined with define_method" do
236
233
  super_class = Class.new do
@@ -248,29 +245,28 @@ describe "The super keyword" do
248
245
  klass.new.a(:a_called).should == :a_called
249
246
  end
250
247
  end
251
- end
252
248
 
253
249
  # Rubinius ticket github#157
254
- pending "calls method_missing when a superclass method is not found" do
250
+ it "calls method_missing when a superclass method is not found" do
255
251
  lambda {
256
252
  Super::MM_B.new.is_a?(Hash).should == false
257
253
  }.should_not raise_error(NoMethodError)
258
254
  end
259
255
 
260
256
  # Rubinius ticket github#180
261
- pending "respects the original module a method is aliased from" do
257
+ it "respects the original module a method is aliased from" do
262
258
  lambda {
263
259
  Super::Alias3.new.name3.should == [:alias2, :alias1]
264
260
  }.should_not raise_error(RuntimeError)
265
261
  end
266
262
 
267
- pending "sees the included version of a module a method is alias from" do
263
+ it "sees the included version of a module a method is alias from" do
268
264
  lambda {
269
265
  Super::AliasWithSuper::Trigger.foo.should == [:b, :a]
270
266
  }.should_not raise_error(NoMethodError)
271
267
  end
272
268
 
273
- pending "passes along modified rest args when they weren't originally empty" do
269
+ it "passes along modified rest args when they weren't originally empty" do
274
270
  Super::RestArgsWithSuper::B.new.a("bar").should == ["bar", "foo"]
275
271
  end
276
272
 
@@ -281,7 +277,7 @@ describe "The super keyword" do
281
277
  end
282
278
 
283
279
  ruby_version_is "1.9" do
284
- pending "passes along modified rest args when they were originally empty" do
280
+ it "passes along modified rest args when they were originally empty" do
285
281
  Super::RestArgsWithSuper::B.new.a.should == ["foo"]
286
282
  end
287
283
  end
@@ -103,7 +103,7 @@ describe "The until expression" do
103
103
  a.should == [1, 2, 4]
104
104
  end
105
105
 
106
- pending "restarts the current iteration without reevaluating condition with redo" do
106
+ it "restarts the current iteration without reevaluating condition with redo" do
107
107
  a = []
108
108
  i = 0
109
109
  j = 0
@@ -156,7 +156,7 @@ describe "The until modifier" do
156
156
  j.should == 63
157
157
  end
158
158
 
159
- pending "restarts the current iteration without reevaluating condition with redo" do
159
+ it "restarts the current iteration without reevaluating condition with redo" do
160
160
  i = 0
161
161
  j = 0
162
162
  (i+=1) == 4 ? redo : j+=i until (i+=1) > 10
@@ -165,7 +165,7 @@ describe "The until modifier" do
165
165
  end
166
166
 
167
167
  describe "The until modifier with begin .. end block" do
168
- pending "runs block while the expression is false" do
168
+ it "runs block while the expression is false" do
169
169
  i = 0
170
170
  begin
171
171
  i += 1
@@ -174,7 +174,7 @@ describe "The until modifier with begin .. end block" do
174
174
  i.should == 10
175
175
  end
176
176
 
177
- pending "stops running block if interrupted by break" do
177
+ it "stops running block if interrupted by break" do
178
178
  i = 0
179
179
  begin
180
180
  i += 1
@@ -184,15 +184,15 @@ describe "The until modifier with begin .. end block" do
184
184
  i.should == 6
185
185
  end
186
186
 
187
- pending "returns value passed to break if interrupted by break" do
187
+ it "returns value passed to break if interrupted by break" do
188
188
  (begin; break 123; end until false).should == 123
189
189
  end
190
190
 
191
- pending "returns nil if interrupted by break with no arguments" do
191
+ it "returns nil if interrupted by break with no arguments" do
192
192
  (begin; break; end until false).should == nil
193
193
  end
194
194
 
195
- pending "runs block at least once (even if the expression is true)" do
195
+ it "runs block at least once (even if the expression is true)" do
196
196
  i = 0
197
197
  begin
198
198
  i += 1
@@ -201,7 +201,7 @@ describe "The until modifier with begin .. end block" do
201
201
  i.should == 1
202
202
  end
203
203
 
204
- pending "evaluates condition after block execution" do
204
+ it "evaluates condition after block execution" do
205
205
  a = []
206
206
  i = 0
207
207
  begin
@@ -210,7 +210,7 @@ describe "The until modifier with begin .. end block" do
210
210
  a.should == [0, 1, 2, 3, 4]
211
211
  end
212
212
 
213
- pending "skips to end of body with next" do
213
+ it "skips to end of body with next" do
214
214
  a = []
215
215
  i = 0
216
216
  begin
@@ -220,7 +220,7 @@ describe "The until modifier with begin .. end block" do
220
220
  a.should == [0, 1, 2, 4]
221
221
  end
222
222
 
223
- pending "restart the current iteration without reevaluting condition with redo" do
223
+ it "restart the current iteration without reevaluting condition with redo" do
224
224
  a = []
225
225
  i = 0
226
226
  j = 0
@@ -64,7 +64,7 @@ describe "Basic assignment" do
64
64
  end
65
65
 
66
66
  ruby_version_is "1.9" do
67
- pending "allows the assignment of the rhs to the lhs using the lhs splat operator" do
67
+ it "allows the assignment of the rhs to the lhs using the lhs splat operator" do
68
68
  # * = 1,2 # Valid syntax, but pretty useless! Nothing to test
69
69
  *a = nil; a.should == [nil]
70
70
  *a = 1; a.should == [1]
@@ -86,7 +86,7 @@ describe "Basic assignment" do
86
86
  end
87
87
 
88
88
  ruby_version_is "1.9" do
89
- pending "allows the assignment of rhs to the lhs using the lhs and rhs splat operators simultaneously" do
89
+ it "allows the assignment of rhs to the lhs using the lhs and rhs splat operators simultaneously" do
90
90
  *a = *nil; a.should == []
91
91
  *a = *1; a.should == [1]
92
92
  *a = *[]; a.should == []
@@ -192,7 +192,7 @@ end
192
192
 
193
193
  describe "Basic multiple assignment" do
194
194
  describe "with a single RHS value" do
195
- pending "does not call #to_ary on an Array instance" do
195
+ it "does not call #to_ary on an Array instance" do
196
196
  x = [1, 2]
197
197
  x.should_not_receive(:to_ary)
198
198
 
@@ -201,7 +201,7 @@ describe "Basic multiple assignment" do
201
201
  b.should == 2
202
202
  end
203
203
 
204
- pending "does not call #to_a on an Array instance" do
204
+ it "does not call #to_a on an Array instance" do
205
205
  x = [1, 2]
206
206
  x.should_not_receive(:to_a)
207
207
 
@@ -210,7 +210,7 @@ describe "Basic multiple assignment" do
210
210
  b.should == 2
211
211
  end
212
212
 
213
- pending "does not call #to_ary on an Array subclass instance" do
213
+ it "does not call #to_ary on an Array subclass instance" do
214
214
  x = VariablesSpecs::ArraySubclass.new [1, 2]
215
215
  x.should_not_receive(:to_ary)
216
216
 
@@ -219,7 +219,7 @@ describe "Basic multiple assignment" do
219
219
  b.should == 2
220
220
  end
221
221
 
222
- pending "does not call #to_a on an Array subclass instance" do
222
+ it "does not call #to_a on an Array subclass instance" do
223
223
  x = VariablesSpecs::ArraySubclass.new [1, 2]
224
224
  x.should_not_receive(:to_a)
225
225
 
@@ -228,7 +228,7 @@ describe "Basic multiple assignment" do
228
228
  b.should == 2
229
229
  end
230
230
 
231
- pending "calls #to_ary on an object" do
231
+ it "calls #to_ary on an object" do
232
232
  x = mock("single rhs value for masgn")
233
233
  x.should_receive(:to_ary).and_return([1, 2])
234
234
 
@@ -237,7 +237,7 @@ describe "Basic multiple assignment" do
237
237
  b.should == 2
238
238
  end
239
239
 
240
- pending "does not call #to_a on an object if #to_ary is not defined" do
240
+ it "does not call #to_a on an object if #to_ary is not defined" do
241
241
  x = mock("single rhs value for masgn")
242
242
  x.should_not_receive(:to_a)
243
243
 
@@ -256,7 +256,7 @@ describe "Basic multiple assignment" do
256
256
  end
257
257
 
258
258
  describe "with a splatted single RHS value" do
259
- pending "does not call #to_ary on an Array instance" do
259
+ it "does not call #to_ary on an Array instance" do
260
260
  x = [1, 2]
261
261
  x.should_not_receive(:to_ary)
262
262
 
@@ -265,7 +265,7 @@ describe "Basic multiple assignment" do
265
265
  b.should == 2
266
266
  end
267
267
 
268
- pending "does not call #to_a on an Array instance" do
268
+ it "does not call #to_a on an Array instance" do
269
269
  x = [1, 2]
270
270
  x.should_not_receive(:to_a)
271
271
 
@@ -274,7 +274,7 @@ describe "Basic multiple assignment" do
274
274
  b.should == 2
275
275
  end
276
276
 
277
- pending "does not call #to_ary on an Array subclass instance" do
277
+ it "does not call #to_ary on an Array subclass instance" do
278
278
  x = VariablesSpecs::ArraySubclass.new [1, 2]
279
279
  x.should_not_receive(:to_ary)
280
280
 
@@ -283,7 +283,7 @@ describe "Basic multiple assignment" do
283
283
  b.should == 2
284
284
  end
285
285
 
286
- pending "does not call #to_a on an Array subclass instance" do
286
+ it "does not call #to_a on an Array subclass instance" do
287
287
  x = VariablesSpecs::ArraySubclass.new [1, 2]
288
288
  x.should_not_receive(:to_a)
289
289
 
@@ -292,7 +292,7 @@ describe "Basic multiple assignment" do
292
292
  b.should == 2
293
293
  end
294
294
 
295
- pending "calls #to_a on an object if #to_ary is not defined" do
295
+ it "calls #to_a on an object if #to_ary is not defined" do
296
296
  x = mock("single splatted rhs value for masgn")
297
297
  x.should_receive(:to_a).and_return([1, 2])
298
298
 
@@ -321,7 +321,7 @@ describe "Basic multiple assignment" do
321
321
  end
322
322
 
323
323
  ruby_version_is "1.9" do
324
- pending "does not call #to_ary on an object" do
324
+ it "does not call #to_ary on an object" do
325
325
  x = mock("single splatted rhs value for masgn")
326
326
  x.should_not_receive(:to_ary)
327
327
 
@@ -330,7 +330,7 @@ describe "Basic multiple assignment" do
330
330
  b.should be_nil
331
331
  end
332
332
 
333
- pending "does not call #to_a on a String" do
333
+ it "does not call #to_a on a String" do
334
334
  x = "one\ntwo"
335
335
 
336
336
  a, b = *x
@@ -358,14 +358,12 @@ describe "Assigning multiple values" do
358
358
  b.should == 1
359
359
  end
360
360
 
361
- pending do
362
361
  not_compliant_on :rubinius do
363
- pending "returns the rhs values used for assignment as an array" do
362
+ it "returns the rhs values used for assignment as an array" do
364
363
  # x = begin; a, b, c = 1, 2, 3; end
365
364
  x.should == [1,2,3]
366
365
  end
367
366
  end
368
- end
369
367
 
370
368
  ruby_version_is "" ... "1.9" do
371
369
  it "wraps a single value in an Array" do
@@ -397,7 +395,7 @@ describe "Assigning multiple values" do
397
395
  f.should == 3
398
396
  end
399
397
 
400
- pending "supports parallel assignment to lhs args via object.method=" do
398
+ it "supports parallel assignment to lhs args via object.method=" do
401
399
  a = VariablesSpecs::ParAsgn.new
402
400
  a.x, b = 1, 2
403
401
 
@@ -411,7 +409,7 @@ describe "Assigning multiple values" do
411
409
  a.x.should == 2
412
410
  end
413
411
 
414
- pending "supports parallel assignment to lhs args using []=" do
412
+ it "supports parallel assignment to lhs args using []=" do
415
413
  a = [1,2,3]
416
414
  a[3], b = 4,5
417
415
 
@@ -491,7 +489,7 @@ describe "Assigning multiple values" do
491
489
  end
492
490
 
493
491
  ruby_version_is "1.9" do
494
- pending "calls #to_ary on RHS arg if the corresponding LHS var is a splat" do
492
+ it "calls #to_ary on RHS arg if the corresponding LHS var is a splat" do
495
493
  x = VariablesSpecs::ParAsgn.new
496
494
 
497
495
  # a,(*b),c = 5,x
@@ -512,7 +510,7 @@ describe "Assigning multiple values" do
512
510
  end
513
511
  end
514
512
 
515
- pending "allows complex parallel assignment" do
513
+ it "allows complex parallel assignment" do
516
514
  # a, (b, c), d = 1, [2, 3], 4
517
515
  a.should == 1
518
516
  b.should == 2
@@ -546,7 +544,7 @@ describe "Assigning multiple values" do
546
544
  g.should == [7,8]
547
545
  end
548
546
 
549
- pending "allows a lhs arg to be used in another lhs args parallel assignment" do
547
+ it "allows a lhs arg to be used in another lhs args parallel assignment" do
550
548
  c = [4,5,6]
551
549
  a,b,c[a] = 1,2,3
552
550
  a.should == 1
@@ -675,7 +673,7 @@ describe "Conditional operator assignment 'var op= expr'" do
675
673
  x.should == false
676
674
  end
677
675
 
678
- pending "may not assign at all, depending on the truthiness of lhs" do
676
+ it "may not assign at all, depending on the truthiness of lhs" do
679
677
  Object.new.instance_eval do
680
678
  @falsey = false
681
679
  @truthy = true
@@ -685,7 +683,7 @@ describe "Conditional operator assignment 'var op= expr'" do
685
683
  end
686
684
  end
687
685
 
688
- pending "uses short-circuit arg evaluation" do
686
+ it "uses short-circuit arg evaluation" do
689
687
  x = 8
690
688
  y = VariablesSpecs::OpAsgn.new
691
689
  (x ||= y.do_side_effect).should == 8
@@ -780,7 +778,7 @@ describe "Conditional operator assignment 'obj.meth op= expr'" do
780
778
  @x.a.should == false
781
779
  end
782
780
 
783
- pending "may not assign at all, depending on the truthiness of lhs" do
781
+ it "may not assign at all, depending on the truthiness of lhs" do
784
782
  m = mock("object")
785
783
  m.should_receive(:foo).and_return(:truthy)
786
784
  m.should_not_receive(:foo=)
@@ -791,7 +789,7 @@ describe "Conditional operator assignment 'obj.meth op= expr'" do
791
789
  # m.bar &&= 42
792
790
  end
793
791
 
794
- pending "uses short-circuit arg evaluation" do
792
+ it "uses short-circuit arg evaluation" do
795
793
  x = 8
796
794
  y = VariablesSpecs::OpAsgn.new
797
795
  (x ||= y.do_side_effect).should == 8
@@ -808,7 +806,7 @@ describe "Conditional operator assignment 'obj.meth op= expr'" do
808
806
  end
809
807
 
810
808
  describe "Operator assignment 'obj.meth op= expr'" do
811
- pending "evaluates lhs one time" do
809
+ it "evaluates lhs one time" do
812
810
  x = VariablesSpecs::OpAsgn.new
813
811
  x.a = 5
814
812
  (x.do_more_side_effects.a += 5).should == 15
@@ -857,31 +855,31 @@ describe "Operator assignment 'obj.meth op= expr'" do
857
855
 
858
856
  x.a = nil
859
857
  x.b = 0
860
- # (x.do_bool_side_effects.a ||= 17).should == 17
861
- # x.a.should == 17
862
- # x.b.should == 1
858
+ (x.do_bool_side_effects.a ||= 17).should == 17
859
+ x.a.should == 17
860
+ x.b.should == 1
863
861
 
864
862
  x.a = false
865
863
  x.b = 0
866
- # # (x.do_bool_side_effects.a &&= true).should == false
867
- # x.a.should == false
868
- # x.b.should == 1
869
- # (x.do_bool_side_effects.a &&= false).should == false
870
- # x.a.should == false
871
- # x.b.should == 2
872
- # x.a = true
873
- # x.b = 0
874
- # (x.do_bool_side_effects.a &&= true).should == true
875
- # x.a.should == true
876
- # x.b.should == 1
877
- # (x.do_bool_side_effects.a &&= false).should == false
878
- # x.a.should == false
879
- # x.b.should == 2
864
+ (x.do_bool_side_effects.a &&= true).should == false
865
+ x.a.should == false
866
+ x.b.should == 1
867
+ (x.do_bool_side_effects.a &&= false).should == false
868
+ x.a.should == false
869
+ x.b.should == 2
870
+ x.a = true
871
+ x.b = 0
872
+ (x.do_bool_side_effects.a &&= true).should == true
873
+ x.a.should == true
874
+ x.b.should == 1
875
+ (x.do_bool_side_effects.a &&= false).should == false
876
+ x.a.should == false
877
+ x.b.should == 2
880
878
  end
881
879
  end
882
880
 
883
881
  describe "Unconditional operator assignment 'obj[idx] op= expr'" do
884
- pending "is equivalent to 'obj[idx] = obj[idx] op expr'" do
882
+ it "is equivalent to 'obj[idx] = obj[idx] op expr'" do
885
883
  # x = [2,13,7]
886
884
  # (x[1] += 5).should == 18
887
885
  # x.should == [2,18,7]
@@ -938,7 +936,7 @@ describe "Unconditional operator assignment 'obj[idx] op= expr'" do
938
936
  end
939
937
 
940
938
  describe "Conditional operator assignment 'obj[idx] op= expr'" do
941
- pending "is equivalent to 'obj[idx] op obj[idx] = expr'" do
939
+ it "is equivalent to 'obj[idx] op obj[idx] = expr'" do
942
940
  # x = [1,nil,12]
943
941
  # (x[1] ||= 17).should == 17
944
942
  # x.should == [1,17,12]
@@ -956,7 +954,7 @@ describe "Conditional operator assignment 'obj[idx] op= expr'" do
956
954
  # x.should == [false, false, false]
957
955
  end
958
956
 
959
- pending "may not assign at all, depending on the truthiness of lhs" do
957
+ it "may not assign at all, depending on the truthiness of lhs" do
960
958
  # m = mock("object")
961
959
  # m.should_receive(:[]).and_return(:truthy)
962
960
  # m.should_not_receive(:[]=)
@@ -968,7 +966,7 @@ describe "Conditional operator assignment 'obj[idx] op= expr'" do
968
966
  # m[:bar] &&= 42
969
967
  end
970
968
 
971
- pending "uses short-circuit arg evaluation" do
969
+ it "uses short-circuit arg evaluation" do
972
970
  # x = 8
973
971
  # y = VariablesSpecs::OpAsgn.new
974
972
  # (x ||= y.do_side_effect).should == 8
@@ -1003,13 +1001,13 @@ describe "Operator assignment 'obj[idx] op= expr'" do
1003
1001
  end
1004
1002
  end
1005
1003
 
1006
- pending "handles empty index (idx) arguments" do
1004
+ it "handles empty index (idx) arguments" do
1007
1005
  # array = ArrayWithDefaultIndex.new
1008
1006
  # array << 1
1009
1007
  # (array[] += 5).should == 6
1010
1008
  end
1011
1009
 
1012
- pending "handles complex index (idx) arguments" do
1010
+ it "handles complex index (idx) arguments" do
1013
1011
  # x = [1,2,3,4]
1014
1012
  # (x[0,2] += [5]).should == [1,2,5]
1015
1013
  # x.should == [1,2,5,3,4]
@@ -1030,7 +1028,7 @@ describe "Operator assignment 'obj[idx] op= expr'" do
1030
1028
  # h.should == {'key1' => 3, 'key2' => 'value'}
1031
1029
  end
1032
1030
 
1033
- pending "handles empty splat index (idx) arguments" do
1031
+ it "handles empty splat index (idx) arguments" do
1034
1032
  # array = ArrayWithDefaultIndex.new
1035
1033
  # array << 5
1036
1034
  # splat_index = []
@@ -1039,7 +1037,7 @@ describe "Operator assignment 'obj[idx] op= expr'" do
1039
1037
  # array.should== [10]
1040
1038
  end
1041
1039
 
1042
- pending "handles single splat index (idx) arguments" do
1040
+ it "handles single splat index (idx) arguments" do
1043
1041
  # array = [1,2,3,4]
1044
1042
  # splat_index = [0]
1045
1043
 
@@ -1047,7 +1045,7 @@ describe "Operator assignment 'obj[idx] op= expr'" do
1047
1045
  # array.should == [6,2,3,4]
1048
1046
  end
1049
1047
 
1050
- pending "handles multiple splat index (idx) arguments" do
1048
+ it "handles multiple splat index (idx) arguments" do
1051
1049
  # array = [1,2,3,4]
1052
1050
  # splat_index = [0,2]
1053
1051
 
@@ -1055,7 +1053,7 @@ describe "Operator assignment 'obj[idx] op= expr'" do
1055
1053
  # array.should == [1,2,5,3,4]
1056
1054
  end
1057
1055
 
1058
- pending "handles splat index (idx) arguments with normal arguments" do
1056
+ it "handles splat index (idx) arguments with normal arguments" do
1059
1057
  # array = [1,2,3,4]
1060
1058
  # splat_index = [2]
1061
1059
 
@@ -1064,7 +1062,7 @@ describe "Operator assignment 'obj[idx] op= expr'" do
1064
1062
  end
1065
1063
 
1066
1064
  # This example fails on 1.9 because of bug #2050
1067
- pending "returns result of rhs not result of []=" do
1065
+ it "returns result of rhs not result of []=" do
1068
1066
  # a = VariablesSpecs::Hashalike.new
1069
1067
 
1070
1068
  # (a[123] = 2).should == 2
@@ -1190,7 +1188,7 @@ describe "Multiple assignments with splats" do
1190
1188
  end
1191
1189
 
1192
1190
  describe "Multiple assignments with grouping" do
1193
- pending "A group on the lhs is considered one position and treats its corresponding rhs position like an Array" do
1191
+ it "A group on the lhs is considered one position and treats its corresponding rhs position like an Array" do
1194
1192
  # a, (b, c), d = 1, 2, 3, 4
1195
1193
  # e, (f, g), h = 1, [2, 3, 4], 5
1196
1194
  # i, (j, k), l = 1, 2, 3
@@ -1208,7 +1206,7 @@ describe "Multiple assignments with grouping" do
1208
1206
  l.should == 3
1209
1207
  end
1210
1208
 
1211
- pending "supports multiple levels of nested groupings" do
1209
+ it "supports multiple levels of nested groupings" do
1212
1210
  # a,(b,(c,d)) = 1,[2,[3,4]]
1213
1211
  a.should == 1
1214
1212
  b.should == 2
@@ -1229,7 +1227,7 @@ describe "Multiple assignments with grouping" do
1229
1227
  d.should == 4
1230
1228
  end
1231
1229
 
1232
- pending "rhs cannot use parameter grouping, it is a syntax error" do
1230
+ it "rhs cannot use parameter grouping, it is a syntax error" do
1233
1231
  lambda { eval '(a, b) = (1, 2)' }.should raise_error(SyntaxError)
1234
1232
  end
1235
1233
  end
@@ -1237,7 +1235,6 @@ end
1237
1235
  # TODO: merge the following two describe blocks and partition the specs
1238
1236
  # into distinct cases.
1239
1237
  describe "Multiple assignment" do
1240
- pending do
1241
1238
  not_compliant_on :rubinius do
1242
1239
  it "has the proper return value" do
1243
1240
  # (a,b,*c = *[5,6,7,8,9,10]).should == [5,6,7,8,9,10]
@@ -1259,7 +1256,6 @@ describe "Multiple assignment" do
1259
1256
  l.should == [6,7]
1260
1257
  end
1261
1258
  end
1262
- end
1263
1259
 
1264
1260
  # TODO: write Rubinius versions
1265
1261
  end
@@ -1269,7 +1265,6 @@ end
1269
1265
  # containing all the elements on the rhs. As this result is never used, the cost
1270
1266
  # of creating and then discarding this array is avoided
1271
1267
  describe "Multiple assignment, array-style" do
1272
- pending do
1273
1268
  not_compliant_on :rubinius do
1274
1269
  it "returns an array of all rhs values" do
1275
1270
  (a,b = 5,6,7).should == [5,6,7]
@@ -1305,11 +1300,10 @@ describe "Multiple assignment, array-style" do
1305
1300
  h.should == nil
1306
1301
  end
1307
1302
  end
1308
- end
1309
1303
  end
1310
1304
 
1311
1305
  describe "Scope of variables" do
1312
- pending "instance variables not overwritten by local variable in each block" do
1306
+ it "instance variables not overwritten by local variable in each block" do
1313
1307
 
1314
1308
  class ScopeVariables
1315
1309
  attr_accessor :v
@@ -1346,7 +1340,6 @@ describe "Scope of variables" do
1346
1340
  end
1347
1341
 
1348
1342
  describe "A local variable in a #define_method scope" do
1349
- pending do
1350
1343
  ruby_bug '#1322', '1.8.7.228' do
1351
1344
  it "shares the lexical scope containing the call to #define_method" do
1352
1345
  # We need a new scope to reproduce this bug.
@@ -1369,7 +1362,6 @@ describe "A local variable in a #define_method scope" do
1369
1362
  handle.produce_bug.should == 2
1370
1363
  end
1371
1364
  end
1372
- end
1373
1365
  end
1374
1366
 
1375
- # # language_version __FILE__, "variables"
1367
+ # language_version __FILE__, "variables"