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
@@ -30,7 +30,7 @@ describe "The not keyword" do
30
30
  end
31
31
  end
32
32
 
33
- # language_version __FILE__, "not"
33
+ language_version __FILE__, "not"
34
34
 
35
35
  describe "The `!' keyword" do
36
36
  it "negates a `true' value" do
@@ -80,7 +80,7 @@ describe "The or operator" do
80
80
  lambda { eval "break true or false" }.should raise_error(SyntaxError, /void value expression/)
81
81
  end
82
82
 
83
- pending "has a lower precedence than 'next' in 'next true or false'" do
83
+ it "has a lower precedence than 'next' in 'next true or false'" do
84
84
  lambda { eval "next true or false" }.should raise_error(SyntaxError, /void value expression/)
85
85
  end
86
86
 
@@ -27,7 +27,7 @@ describe "A method call" do
27
27
  (obj = @obj).foo4(obj = nil, obj = nil, obj = nil, obj = nil).should == [nil, nil, nil, nil, nil]
28
28
  end
29
29
 
30
- pending "evaluates arguments after receiver" do
30
+ it "evaluates arguments after receiver" do
31
31
  a = 0
32
32
  # (a += 1; @obj).foo1(a).should == [1, nil]
33
33
  # (a += 1; @obj).foo2(a, a).should == [2, 2, nil]
@@ -45,9 +45,8 @@ describe "A method call" do
45
45
  a.should == 10
46
46
  end
47
47
 
48
- pending do
49
48
  ruby_bug "redmine #1034", "1.8" do
50
- pending "evaluates block pass after arguments" do
49
+ it "evaluates block pass after arguments" do
51
50
  a = 0
52
51
  p = proc {true}
53
52
  # @obj.foo1(a += 1, &(a += 1; p)).should == [1, true]
@@ -57,7 +56,7 @@ describe "A method call" do
57
56
  a.should == 14
58
57
  end
59
58
 
60
- pending "evaluates block pass after receiver" do
59
+ it "evaluates block pass after receiver" do
61
60
  p1 = proc {true}
62
61
  p2 = proc {false}
63
62
  p1.should_not == p2
@@ -75,5 +74,4 @@ describe "A method call" do
75
74
  p = p1
76
75
  end
77
76
  end
78
- end
79
77
  end
@@ -127,7 +127,7 @@ describe "Operators" do
127
127
  (--2).should == 2
128
128
  end
129
129
 
130
- pending "unary minus has higher precedence than * / %" do
130
+ it "unary minus has higher precedence than * / %" do
131
131
  class UnaryMinusTest; def -@; 50; end; end
132
132
  b = UnaryMinusTest.new
133
133
 
@@ -136,7 +136,7 @@ describe "Operators" do
136
136
  (-b % 7).should == 1
137
137
  end
138
138
 
139
- pending "* / % are left-associative" do
139
+ it "* / % are left-associative" do
140
140
  (2*1/2).should == (2*1)/2
141
141
  # Guard against the Mathn library
142
142
  # TODO: Make these specs not rely on specific behaviour / result values
@@ -165,7 +165,7 @@ describe "Operators" do
165
165
  (10-10%4).should == 8
166
166
  end
167
167
 
168
- pending "+ - are left-associative" do
168
+ it "+ - are left-associative" do
169
169
  (2-3-4).should == -5
170
170
  (4-3+2).should == 3
171
171
 
@@ -176,7 +176,7 @@ describe "Operators" do
176
176
  (s+s+s).should_not == s+(s+s)
177
177
  end
178
178
 
179
- pending "+ - have higher precedence than >> <<" do
179
+ it "+ - have higher precedence than >> <<" do
180
180
  (2<<1+2).should == 16
181
181
  (8>>1+2).should == 1
182
182
  (4<<1-3).should == 1
@@ -194,7 +194,7 @@ describe "Operators" do
194
194
  (2 & 4 >> 1).should == 2
195
195
  end
196
196
 
197
- pending "& is left-associative" do
197
+ it "& is left-associative" do
198
198
  class BitwiseAndTest; def &(a); a+1; end; end
199
199
  c = BitwiseAndTest.new
200
200
 
@@ -207,7 +207,7 @@ describe "Operators" do
207
207
  (8 | 16 & 16).should == 24
208
208
  end
209
209
 
210
- pending "^ | are left-associative" do
210
+ it "^ | are left-associative" do
211
211
  class OrAndXorTest; def ^(a); a+10; end; def |(a); a-10; end; end
212
212
  d = OrAndXorTest.new
213
213
 
@@ -229,7 +229,7 @@ describe "Operators" do
229
229
  (10 >= 7 | 7).should == true
230
230
  end
231
231
 
232
- pending "<= < > >= are left-associative" do
232
+ it "<= < > >= are left-associative" do
233
233
  class ComparisonTest
234
234
  def <=(a); 0; end;
235
235
  def <(a); 0; end;
@@ -295,7 +295,7 @@ describe "Operators" do
295
295
  lambda { eval("1 !~ 2 !~ 3") }.should raise_error(SyntaxError)
296
296
  end
297
297
 
298
- pending "<=> == === != =~ !~ have higher precedence than &&" do
298
+ it "<=> == === != =~ !~ have higher precedence than &&" do
299
299
  (false && 2 <=> 3).should == false
300
300
  (false && 3 == false).should == false
301
301
  (false && 3 === false).should == false
@@ -311,14 +311,14 @@ describe "Operators" do
311
311
 
312
312
  # XXX: figure out how to test it
313
313
  # (a && b) && c equals to a && (b && c) for all a,b,c values I can imagine so far
314
- pending "&& is left-associative"
314
+ it "&& is left-associative"
315
315
 
316
316
  it "&& has higher precedence than ||" do
317
317
  (true || false && false).should == true
318
318
  end
319
319
 
320
320
  # XXX: figure out how to test it
321
- pending "|| is left-associative"
321
+ it "|| is left-associative"
322
322
 
323
323
  it "|| has higher precedence than .. ..." do
324
324
  (1..false||10).should == (1..10)
@@ -346,22 +346,22 @@ describe "Operators" do
346
346
 
347
347
  def oops; raise end
348
348
 
349
- pending "? : has higher precedence than rescue" do
349
+ it "? : has higher precedence than rescue" do
350
350
 
351
351
  (true ? oops : 0 rescue 10).should == 10
352
352
  end
353
353
 
354
354
  # XXX: figure how to test it (problem similar to || associativity)
355
- pending "rescue is left-associative"
355
+ it "rescue is left-associative"
356
356
 
357
- pending "rescue has higher precedence than =" do
357
+ it "rescue has higher precedence than =" do
358
358
  # a = oops rescue 10
359
359
  a.should == 10
360
360
 
361
361
  # rescue doesn't have the same sense for %= /= and friends
362
362
  end
363
363
 
364
- pending "= %= /= -= += |= &= >>= <<= *= &&= ||= **= are right-associative" do
364
+ it "= %= /= -= += |= &= >>= <<= *= &&= ||= **= are right-associative" do
365
365
  # a = b = 10
366
366
  # a.should == 10
367
367
  # b.should == 10
@@ -427,7 +427,7 @@ describe "Operators" do
427
427
  # b.should == 9
428
428
  end
429
429
 
430
- pending "= %= /= -= += |= &= >>= <<= *= &&= ||= **= have higher precedence than defined? operator" do
430
+ it "= %= /= -= += |= &= >>= <<= *= &&= ||= **= have higher precedence than defined? operator" do
431
431
  # (defined? a = 10).should == "assignment"
432
432
  # (defined? a %= 10).should == "assignment"
433
433
  # (defined? a /= 10).should == "assignment"
@@ -444,7 +444,7 @@ describe "Operators" do
444
444
  end
445
445
 
446
446
  # XXX: figure out how to test it
447
- pending "defined? is non-associative"
447
+ it "defined? is non-associative"
448
448
 
449
449
  it "defined? has higher precedence than not" do
450
450
  # does it have sense?
@@ -462,9 +462,9 @@ describe "Operators" do
462
462
  end
463
463
 
464
464
  # XXX: figure out how to test it
465
- pending "or/and are left-associative"
465
+ it "or/and are left-associative"
466
466
 
467
- pending "or/and have higher precedence than if unless while until modifiers" do
467
+ it "or/and have higher precedence than if unless while until modifiers" do
468
468
  (1 if 2 and 3).should == 1
469
469
  (1 if 2 or 3).should == 1
470
470
 
@@ -479,5 +479,5 @@ describe "Operators" do
479
479
  end
480
480
 
481
481
  # XXX: it seems to me they are right-associative
482
- pending "if unless while until are non-associative"
482
+ it "if unless while until are non-associative"
483
483
  end
@@ -38,7 +38,7 @@ describe "A Proc" do
38
38
  end
39
39
 
40
40
  ruby_version_is "1.9" do
41
- pending "raises an ArgumentErro if a value is passed" do
41
+ it "raises an ArgumentErro if a value is passed" do
42
42
  lambda { @l.call(0) }.should raise_error(ArgumentError)
43
43
  end
44
44
  end
@@ -53,7 +53,7 @@ describe "A Proc" do
53
53
  @l.call.should == 1
54
54
  end
55
55
 
56
- pending "raises an ArgumentError if a value is passed" do
56
+ it "raises an ArgumentError if a value is passed" do
57
57
  lambda { @l.call(0) }.should raise_error(ArgumentError)
58
58
  end
59
59
  end
@@ -63,15 +63,15 @@ describe "A Proc" do
63
63
  @l = lambda { |a| a }
64
64
  end
65
65
 
66
- pending "assigns the value passed to the argument" do
66
+ it "assigns the value passed to the argument" do
67
67
  @l.call(2).should == 2
68
68
  end
69
69
 
70
- pending "does not destructure a single Array value" do
70
+ it "does not destructure a single Array value" do
71
71
  @l.call([1, 2]).should == [1, 2]
72
72
  end
73
73
 
74
- pending "does not call #to_ary to convert a single passed object to an Array" do
74
+ it "does not call #to_ary to convert a single passed object to an Array" do
75
75
  obj = mock("block yield to_ary")
76
76
  obj.should_not_receive(:to_ary)
77
77
 
@@ -89,7 +89,7 @@ describe "A Proc" do
89
89
  end
90
90
 
91
91
  ruby_version_is "1.9" do
92
- pending "raises an ArgumentError if no value is passed" do
92
+ it "raises an ArgumentError if no value is passed" do
93
93
  lambda { @l.call }.should raise_error(ArgumentError)
94
94
  end
95
95
  end
@@ -100,11 +100,11 @@ describe "A Proc" do
100
100
  @l = lambda { |a, b| [a, b] }
101
101
  end
102
102
 
103
- pending "raises an ArgumentError if passed no values" do
103
+ it "raises an ArgumentError if passed no values" do
104
104
  lambda { @l.call }.should raise_error(ArgumentError)
105
105
  end
106
106
 
107
- pending "raises an ArgumentError if passed one value" do
107
+ it "raises an ArgumentError if passed one value" do
108
108
  lambda { @l.call(0) }.should raise_error(ArgumentError)
109
109
  end
110
110
 
@@ -112,7 +112,7 @@ describe "A Proc" do
112
112
  @l.call(1, 2).should == [1, 2]
113
113
  end
114
114
 
115
- pending "does not call #to_ary to convert a single passed object to an Array" do
115
+ it "does not call #to_ary to convert a single passed object to an Array" do
116
116
  obj = mock("proc call to_ary")
117
117
  obj.should_not_receive(:to_ary)
118
118
 
@@ -125,19 +125,19 @@ describe "A Proc" do
125
125
  @l = lambda { |a, *b| [a, b] }
126
126
  end
127
127
 
128
- pending "raises an ArgumentError if passed no values" do
128
+ it "raises an ArgumentError if passed no values" do
129
129
  lambda { @l.call }.should raise_error(ArgumentError)
130
130
  end
131
131
 
132
- pending "does not destructure a single Array value yielded" do
132
+ it "does not destructure a single Array value yielded" do
133
133
  @l.call([1, 2, 3]).should == [[1, 2, 3], []]
134
134
  end
135
135
 
136
- pending "assigns all passed values after the first to the rest argument" do
136
+ it "assigns all passed values after the first to the rest argument" do
137
137
  @l.call(1, 2, 3).should == [1, [2, 3]]
138
138
  end
139
139
 
140
- pending "does not call #to_ary to convert a single passed object to an Array" do
140
+ it "does not call #to_ary to convert a single passed object to an Array" do
141
141
  obj = mock("block yield to_ary")
142
142
  obj.should_not_receive(:to_ary)
143
143
 
@@ -150,15 +150,15 @@ describe "A Proc" do
150
150
  # @l = lambda { |*| 1 }
151
151
  end
152
152
 
153
- pending "does not raise an exception when passed no values" do
153
+ it "does not raise an exception when passed no values" do
154
154
  @l.call.should == 1
155
155
  end
156
156
 
157
- pending "does not raise an exception when passed multiple values" do
157
+ it "does not raise an exception when passed multiple values" do
158
158
  @l.call(2, 3, 4).should == 1
159
159
  end
160
160
 
161
- pending "does not call #to_ary to convert a single passed object to an Array" do
161
+ it "does not call #to_ary to convert a single passed object to an Array" do
162
162
  obj = mock("block yield to_ary")
163
163
  obj.should_not_receive(:to_ary)
164
164
 
@@ -171,19 +171,19 @@ describe "A Proc" do
171
171
  @l = lambda { |*a| a }
172
172
  end
173
173
 
174
- pending "assigns [] to the argument when passed no values" do
174
+ it "assigns [] to the argument when passed no values" do
175
175
  @l.call.should == []
176
176
  end
177
177
 
178
- pending "assigns the argument an Array wrapping one passed value" do
178
+ it "assigns the argument an Array wrapping one passed value" do
179
179
  @l.call(1).should == [1]
180
180
  end
181
181
 
182
- pending "assigns the argument an Array wrapping all values passed" do
182
+ it "assigns the argument an Array wrapping all values passed" do
183
183
  @l.call(1, 2, 3).should == [1, 2, 3]
184
184
  end
185
185
 
186
- pending "does not call #to_ary to convert a single passed object to an Array" do
186
+ it "does not call #to_ary to convert a single passed object to an Array" do
187
187
  obj = mock("block yield to_ary")
188
188
  obj.should_not_receive(:to_ary)
189
189
 
@@ -196,23 +196,23 @@ describe "A Proc" do
196
196
  # @l = lambda { |a, | a }
197
197
  end
198
198
 
199
- pending "raises an ArgumentError when passed no values" do
199
+ it "raises an ArgumentError when passed no values" do
200
200
  lambda { @l.call }.should raise_error(ArgumentError)
201
201
  end
202
202
 
203
- pending "raises an ArgumentError when passed more than one value" do
203
+ it "raises an ArgumentError when passed more than one value" do
204
204
  lambda { @l.call(1, 2) }.should raise_error(ArgumentError)
205
205
  end
206
206
 
207
- pending "assigns the argument the value passed" do
207
+ it "assigns the argument the value passed" do
208
208
  @l.call(1).should == 1
209
209
  end
210
210
 
211
- pending "does not destructure when passed a single Array" do
211
+ it "does not destructure when passed a single Array" do
212
212
  @l.call([1,2]).should == [1, 2]
213
213
  end
214
214
 
215
- pending "does not call #to_ary to convert a single passed object to an Array" do
215
+ it "does not call #to_ary to convert a single passed object to an Array" do
216
216
  obj = mock("block yield to_ary")
217
217
  obj.should_not_receive(:to_ary)
218
218
 
@@ -225,7 +225,7 @@ describe "A Proc" do
225
225
  # @l = lambda { |(a, b)| [a, b] }
226
226
  end
227
227
 
228
- pending "raises an ArgumentError when passed no values" do
228
+ it "raises an ArgumentError when passed no values" do
229
229
  lambda { @l.call }.should raise_error(ArgumentError)
230
230
  end
231
231
 
@@ -243,18 +243,18 @@ describe "A Proc" do
243
243
  end
244
244
 
245
245
  ruby_version_is "1.9" do
246
- pending "destructures a single Array value yielded" do
246
+ it "destructures a single Array value yielded" do
247
247
  @l.call([1, 2]).should == [1, 2]
248
248
  end
249
249
 
250
- pending "calls #to_ary to convert a single passed object to an Array" do
250
+ it "calls #to_ary to convert a single passed object to an Array" do
251
251
  obj = mock("block yield to_ary")
252
252
  obj.should_receive(:to_ary).and_return([1, 2])
253
253
 
254
254
  @l.call(obj).should == [1, 2]
255
255
  end
256
256
 
257
- pending "raises an TypeError if #to_ary does not return an Array" do
257
+ it "raises an TypeError if #to_ary does not return an Array" do
258
258
  obj = mock("block yield to_ary invalid")
259
259
  obj.should_receive(:to_ary).and_return(1)
260
260
 
@@ -1,7 +1,7 @@
1
1
  require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe "The redo statement" do
4
- pending "restarts block execution if used within block" do
4
+ it "restarts block execution if used within block" do
5
5
  a = []
6
6
  lambda {
7
7
  a << 1
@@ -11,7 +11,7 @@ describe "The redo statement" do
11
11
  a.should == [1, 1, 2]
12
12
  end
13
13
 
14
- pending "re-executes the closest loop" do
14
+ it "re-executes the closest loop" do
15
15
  exist = [2,3]
16
16
  processed = []
17
17
  order = []
@@ -32,7 +32,7 @@ describe "The redo statement" do
32
32
  order.should == [1,2,2,3,3,4]
33
33
  end
34
34
 
35
- pending "re-executes the last step in enumeration" do
35
+ it "re-executes the last step in enumeration" do
36
36
  list = []
37
37
  [1,2,3].each do |x|
38
38
  list << x
@@ -44,7 +44,6 @@ describe "The redo statement" do
44
44
 
45
45
  # The #count method is on 1.9, but this causes SyntaxError,
46
46
  # Invalid redo in 1.9
47
- pending do
48
47
  quarantine! do
49
48
  it "triggers ensure block when re-executing a block" do
50
49
  list = []
@@ -61,7 +60,6 @@ describe "The redo statement" do
61
60
  list.should == [1,10,100,1,10,100,2,20,200,3,30,300]
62
61
  end
63
62
  end
64
- end
65
63
  end
66
64
 
67
65
  # language_version __FILE__, "redo"
@@ -29,7 +29,7 @@ describe "The rescue keyword" do
29
29
  end
30
30
  end
31
31
 
32
- pending "can rescue multiple raised exceptions with a single rescue block" do
32
+ it "can rescue multiple raised exceptions with a single rescue block" do
33
33
  lambda do
34
34
  [lambda{1/0}, lambda{raise SpecificExampleException}].each do |block|
35
35
  begin
@@ -40,7 +40,7 @@ describe "The rescue keyword" do
40
40
  end.should_not raise_error
41
41
  end
42
42
 
43
- pending "can rescue a splatted list of exceptions" do
43
+ it "can rescue a splatted list of exceptions" do
44
44
  caught_it = false
45
45
  begin
46
46
  raise SpecificExampleException, "not important"
@@ -64,7 +64,7 @@ describe "The rescue keyword" do
64
64
  end
65
65
  end
66
66
 
67
- pending "will only rescue the specified exceptions when doing a splat rescue" do
67
+ it "will only rescue the specified exceptions when doing a splat rescue" do
68
68
  lambda do
69
69
  begin
70
70
  raise OtherCustomException, "not rescued!"
@@ -73,7 +73,7 @@ describe "The rescue keyword" do
73
73
  end.should raise_error(OtherCustomException)
74
74
  end
75
75
 
76
- pending "will execute an else block only if no exceptions were raised" do
76
+ it "will execute an else block only if no exceptions were raised" do
77
77
  # begin
78
78
  # ScratchPad << :one
79
79
  # rescue
@@ -84,7 +84,7 @@ describe "The rescue keyword" do
84
84
  # ScratchPad.recorded.should == [:one, :two]
85
85
  end
86
86
 
87
- pending "will not execute an else block if an exception was raised" do
87
+ it "will not execute an else block if an exception was raised" do
88
88
  # begin
89
89
  # ScratchPad << :one
90
90
  # raise "an error occurred"
@@ -96,7 +96,7 @@ describe "The rescue keyword" do
96
96
  # ScratchPad.recorded.should == [:one, :two]
97
97
  end
98
98
 
99
- pending "will not rescue errors raised in an else block in the rescue block above it" do
99
+ it "will not rescue errors raised in an else block in the rescue block above it" do
100
100
  # lambda do
101
101
  # begin
102
102
  # ScratchPad << :one
@@ -111,7 +111,7 @@ describe "The rescue keyword" do
111
111
  end
112
112
 
113
113
  ruby_version_is "1.9" do
114
- pending "parses 'a += b rescue c' as 'a += (b rescue c)'" do
114
+ it "parses 'a += b rescue c' as 'a += (b rescue c)'" do
115
115
  a = 'a'
116
116
  c = 'c'
117
117
  # a += b rescue c