opal 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,6 @@
1
+ opal_filter "block" do
2
+ fails "A block arguments with _ assigns the first variable named"
3
+ fails "A block arguments with _ extracts arguments with _"
4
+ fails "A block taking |*a| arguments does not call #to_ary to convert a single yielded object to an Array"
5
+ fails "A block taking |*| arguments does not call #to_ary to convert a single yielded object to an Array"
6
+ end
@@ -0,0 +1,3 @@
1
+ opal_filter "break" do
2
+ fails "Break inside a while loop with a splat wraps a non-Array in an Array"
3
+ end
@@ -6,4 +6,7 @@ opal_filter "class" do
6
6
  fails "A class definition extending an object (sclass) raises a TypeError when trying to extend numbers"
7
7
  fails "A class definition extending an object (sclass) allows accessing the block of the original scope"
8
8
  fails "A class definition extending an object (sclass) can use return to cause the enclosing method to return"
9
+ fails "An outer class definition contains the inner classes"
10
+ fails "An outer class definition contains the inner classes"
11
+ fails "A class definition stores instance variables defined in the class body in the class object"
9
12
  end
@@ -0,0 +1,27 @@
1
+ opal_filter "def" do
2
+ fails "The def keyword within a closure looks outside the closure for the visibility"
3
+ fails "a method definition that sets more than one default parameter all to the same value treats the argument after the multi-parameter normally"
4
+ fails "a method definition that sets more than one default parameter all to the same value only allows overriding the default value of the first such parameter in each set"
5
+ fails "A method definition in an eval creates a singleton method"
6
+ fails "A method definition in an eval creates a class method"
7
+ fails "A method definition in an eval creates an instance method"
8
+ fails "A method definition inside an instance_eval creates a class method when the receiver is a class"
9
+ fails "A method definition inside a metaclass scope raises RuntimeError if frozen"
10
+ fails "A singleton method defined with extreme default arguments may use a lambda as a default"
11
+ fails "A singleton method defined with extreme default arguments may use preceding arguments as defaults"
12
+ fails "A singleton method defined with extreme default arguments evaluates the defaults in the singleton scope"
13
+ fails "A singleton method defined with extreme default arguments may use an fcall as a default"
14
+ fails "A singleton method defined with extreme default arguments may use a method definition as a default"
15
+ fails "A method defined with extreme default arguments may use an fcall as a default"
16
+ fails "A method defined with extreme default arguments can redefine itself when the default is evaluated"
17
+ fails "Redefining a singleton method does not inherit a previously set visibility"
18
+ fails "Redefining a singleton method does not inherit a previously set visibility"
19
+ fails "A singleton method definition raises RuntimeError if frozen"
20
+ fails "A singleton method definition can be declared for a class variable"
21
+ fails "A singleton method definition can be declared for a global variable"
22
+ fails "A singleton method definition can be declared for an instance variable"
23
+ fails "A singleton method definition can be declared for a local variable"
24
+ fails "Defining an 'initialize' method sets the method's visibility to private"
25
+ fails "Defining an 'initialize_copy' method sets the method's visibility to private"
26
+
27
+ end
@@ -0,0 +1,3 @@
1
+ opal_filter "defined?" do
2
+ fails "The defined? keyword when called with a method name having a module as a receiver returns nil if the method is private"
3
+ end
@@ -0,0 +1,4 @@
1
+ opal_filter "ensure" do
2
+ fails "An ensure block inside a begin block is executed even when a symbol is thrown in it's corresponding begin block"
3
+ fails "An ensure block inside a method is executed even when a symbol is thrown in the method"
4
+ end
@@ -0,0 +1,4 @@
1
+ opal_filter "execution" do
2
+ fails "`` returns the output of the executed sub-process"
3
+ fails "%x is the same as ``"
4
+ end
@@ -0,0 +1,18 @@
1
+ opal_filter "for" do
2
+ fails "The for expression repeats current iteration with 'redo'"
3
+ fails "The for expression starts the next iteration with 'next'"
4
+ fails "The for expression allows 'break' to have an argument which becomes the value of the for expression"
5
+ fails "The for expression breaks out of a loop upon 'break', returning nil"
6
+ fails "The for expression returns expr"
7
+ fails "The for expression executes code in containing variable scope with 'do'"
8
+ fails "The for expression executes code in containing variable scope"
9
+ fails "The for expression allows body begin on the same line if do is used"
10
+ fails "The for expression optionally takes a 'do' after the expression"
11
+ fails "The for expression yields only as many values as there are arguments"
12
+ fails "The for expression allows a constant as an iterator name"
13
+ fails "The for expression allows a class variable as an iterator name"
14
+ fails "The for expression allows an instance variable as an iterator name"
15
+ fails "The for expression iterates over any object responding to 'each'"
16
+ fails "The for expression iterates over an Hash passing each key-value pair to the block"
17
+ fails "The for expression iterates over an Enumerable passing each element to the block"
18
+ end
@@ -0,0 +1,13 @@
1
+ opal_filter "if" do
2
+ fails "The if expression with a boolean range ('flip-flop' operator) keeps flip-flops from interfering"
3
+ fails "The if expression with a boolean range ('flip-flop' operator) scopes state by flip-flop"
4
+ fails "The if expression with a boolean range ('flip-flop' operator) evaluates the second conditions lazily with exclusive-end range"
5
+ fails "The if expression with a boolean range ('flip-flop' operator) evaluates the second conditions lazily with inclusive-end range"
6
+ fails "The if expression with a boolean range ('flip-flop' operator) evaluates the first conditions lazily with exclusive-end range"
7
+ fails "The if expression with a boolean range ('flip-flop' operator) evaluates the first conditions lazily with inclusive-end range"
8
+ fails "The if expression with a boolean range ('flip-flop' operator) allows combining two flip-flops"
9
+ fails "The if expression with a boolean range ('flip-flop' operator) mimics a sed conditional with a many-element exclusive-end range"
10
+ fails "The if expression with a boolean range ('flip-flop' operator) mimics a sed conditional with a zero-element exclusive-end range"
11
+ fails "The if expression with a boolean range ('flip-flop' operator) mimics an awk conditional with a many-element inclusive-end range"
12
+ fails "The if expression with a boolean range ('flip-flop' operator) mimics an awk conditional with a single-element inclusive-end range"
13
+ end
@@ -0,0 +1,4 @@
1
+ opal_filter "loop" do
2
+ fails "The loop expression restarts the current iteration with redo"
3
+ fails "The loop expression uses a spaghetti nightmare of redo, next and break"
4
+ end
@@ -0,0 +1,14 @@
1
+ opal_filter "metaclass" do
2
+ fails "calling methods on the metaclass calls a method defined on the metaclass of the metaclass"
3
+ fails "calling methods on the metaclass calls a method in deeper chains of metaclasses"
4
+ fails "A constant on a metaclass is preserved when the object is cloned"
5
+ fails "A constant on a metaclass is not preserved when the object is duped"
6
+ fails "A constant on a metaclass does not appear in the object's class constant list"
7
+ fails "A constant on a metaclass appears in the metaclass constant list"
8
+ fails "A constant on a metaclass raises a NameError for anonymous_module::CONST"
9
+ fails "A constant on a metaclass cannot be accessed via object::CONST"
10
+ fails "A constant on a metaclass is not defined in the metaclass opener's scope"
11
+ fails "A constant on a metaclass is not defined on the object's class"
12
+ fails "self in a metaclass body (class << obj) raises a TypeError for symbols"
13
+ fails "self in a metaclass body (class << obj) raises a TypeError for numbers"
14
+ end
@@ -0,0 +1,6 @@
1
+ opal_filter "module" do
2
+ fails "The module keyword raises a TypeError if the constant in nil"
3
+ fails "The module keyword creates a new module with a variable qualified constant name"
4
+ fails "The module keyword creates a new module with a qualified constant name"
5
+ fails "The module keyword creates a new module with a non-qualified constant name"
6
+ end
@@ -0,0 +1,3 @@
1
+ opal_filter "next" do
2
+ fails "Assignment via next assigns splatted objects"
3
+ end
@@ -0,0 +1,3 @@
1
+ opal_filter "or" do
2
+ fails "The or operator has a lower precedence than 'next' in 'next true or false'"
3
+ end
@@ -0,0 +1,4 @@
1
+ opal_filter "order" do
2
+ fails "A method call evaluates block pass after arguments"
3
+ fails "A method call evaluates arguments after receiver"
4
+ end
@@ -0,0 +1,10 @@
1
+ opal_filter "precedence" do
2
+ fails "Operators or/and have higher precedence than if unless while until modifiers"
3
+ fails "Operators = %= /= -= += |= &= >>= <<= *= &&= ||= **= have higher precedence than defined? operator"
4
+ fails "Operators = %= /= -= += |= &= >>= <<= *= &&= ||= **= are right-associative"
5
+ fails "Operators rescue has higher precedence than ="
6
+ fails "Operators ? : has higher precedence than rescue"
7
+ fails "Operators + - have higher precedence than >> <<"
8
+ fails "Operators + - are left-associative"
9
+ fails "Operators * / % are left-associative"
10
+ end
@@ -0,0 +1,24 @@
1
+ opal_filter "proc" do
2
+ fails "A Proc taking |(a, b)| arguments raises an TypeError if #to_ary does not return an Array"
3
+ fails "A Proc taking |(a, b)| arguments calls #to_ary to convert a single passed object to an Array"
4
+ fails "A Proc taking |(a, b)| arguments destructures a single Array value yielded"
5
+ fails "A Proc taking |(a, b)| arguments raises an ArgumentError when passed no values"
6
+ fails "A Proc taking |a, | arguments does not call #to_ary to convert a single passed object to an Array"
7
+ fails "A Proc taking |a, | arguments does not destructure when passed a single Array"
8
+ fails "A Proc taking |a, | arguments assigns the argument the value passed"
9
+ fails "A Proc taking |a, | arguments raises an ArgumentError when passed more than one value"
10
+ fails "A Proc taking |a, | arguments raises an ArgumentError when passed no values"
11
+ fails "A Proc taking |*a| arguments does not call #to_ary to convert a single passed object to an Array"
12
+ fails "A Proc taking |*| arguments does not call #to_ary to convert a single passed object to an Array"
13
+ fails "A Proc taking |*| arguments does not raise an exception when passed multiple values"
14
+ fails "A Proc taking |*| arguments does not raise an exception when passed no values"
15
+ fails "A Proc taking |a, *b| arguments does not call #to_ary to convert a single passed object to an Array"
16
+ fails "A Proc taking |a, *b| arguments raises an ArgumentError if passed no values"
17
+ fails "A Proc taking |a, b| arguments does not call #to_ary to convert a single passed object to an Array"
18
+ fails "A Proc taking |a, b| arguments raises an ArgumentError if passed one value"
19
+ fails "A Proc taking |a, b| arguments raises an ArgumentError if passed no values"
20
+ fails "A Proc taking |a| arguments raises an ArgumentError if no value is passed"
21
+ fails "A Proc taking |a| arguments does not call #to_ary to convert a single passed object to an Array"
22
+ fails "A Proc taking || arguments raises an ArgumentError if a value is passed"
23
+ fails "A Proc taking zero arguments raises an ArgumentErro if a value is passed"
24
+ end
@@ -0,0 +1,5 @@
1
+ opal_filter "redo" do
2
+ fails "The redo statement re-executes the last step in enumeration"
3
+ fails "The redo statement re-executes the closest loop"
4
+ fails "The redo statement restarts block execution if used within block"
5
+ end
@@ -0,0 +1,9 @@
1
+ opal_filter "rescue" do
2
+ fails "The rescue keyword parses 'a += b rescue c' as 'a += (b rescue c)'"
3
+ fails "The rescue keyword will not rescue errors raised in an else block in the rescue block above it"
4
+ fails "The rescue keyword will not execute an else block if an exception was raised"
5
+ fails "The rescue keyword will execute an else block only if no exceptions were raised"
6
+ fails "The rescue keyword will only rescue the specified exceptions when doing a splat rescue"
7
+ fails "The rescue keyword can rescue a splatted list of exceptions"
8
+ fails "The rescue keyword can rescue multiple raised exceptions with a single rescue block"
9
+ end
@@ -0,0 +1,5 @@
1
+ opal_filter "retry" do
2
+ fails "The retry statement re-executes the closest block"
3
+ fails "The retry statement raises a SyntaxError when used outside of a begin statement"
4
+ fails "The retry keyword inside a begin block's rescue block causes the begin block to be executed again"
5
+ end
@@ -0,0 +1,10 @@
1
+ opal_filter "send" do
2
+ fails "Invoking a private getter method does not permit self as a receiver"
3
+ fails "Invoking a method with manditory and optional arguments raises an ArgumentError if too many values are passed"
4
+ fails "Invoking a method with optional arguments raises ArgumentError if extra arguments are passed"
5
+ fails "Invoking a method passes a literal hash without curly braces or parens"
6
+ fails "Invoking a method passes literal hashes without curly braces as the last parameter"
7
+ fails "Invoking a method raises a SyntaxError with both a literal block and an object as block"
8
+ fails "Invoking a method with an object as a block uses 'to_proc' for coercion"
9
+ fails "Invoking a method with a block makes it available to yield"
10
+ end
@@ -0,0 +1,9 @@
1
+ opal_filter "super" do
2
+ fails "The super keyword passes along modified rest args when they were originally empty"
3
+ fails "The super keyword passes along modified rest args when they weren't originally empty"
4
+ fails "The super keyword sees the included version of a module a method is alias from"
5
+ fails "The super keyword can't be used with implicit arguments from a method defined with define_method"
6
+ fails "The super keyword raises an error error when super method does not exist"
7
+ fails "The super keyword calls the correct method when the method visibility is modified"
8
+ fails "The super keyword searches class methods including modules"
9
+ end
@@ -0,0 +1,8 @@
1
+ opal_filter "until" do
2
+ fails "The until modifier with begin .. end block restart the current iteration without reevaluting condition with redo"
3
+ fails "The until modifier with begin .. end block skips to end of body with next"
4
+ fails "The until modifier with begin .. end block evaluates condition after block execution"
5
+ fails "The until modifier with begin .. end block runs block at least once (even if the expression is true)"
6
+ fails "The until modifier restarts the current iteration without reevaluating condition with redo"
7
+ fails "The until expression restarts the current iteration without reevaluating condition with redo"
8
+ end
@@ -0,0 +1,37 @@
1
+ opal_filter "variables" do
2
+ fails "Multiple assignment, array-style returns an array of all rhs values"
3
+ fails "Multiple assignment has the proper return value"
4
+ fails "Multiple assignments with grouping supports multiple levels of nested groupings"
5
+ fails "Multiple assignments with grouping A group on the lhs is considered one position and treats its corresponding rhs position like an Array"
6
+ fails "Operator assignment 'obj[idx] op= expr' returns result of rhs not result of []="
7
+ fails "Operator assignment 'obj[idx] op= expr' handles splat index (idx) arguments with normal arguments"
8
+ fails "Operator assignment 'obj[idx] op= expr' handles multiple splat index (idx) arguments"
9
+ fails "Operator assignment 'obj[idx] op= expr' handles single splat index (idx) arguments"
10
+ fails "Operator assignment 'obj[idx] op= expr' handles empty splat index (idx) arguments"
11
+ fails "Operator assignment 'obj[idx] op= expr' handles complex index (idx) arguments"
12
+ fails "Operator assignment 'obj[idx] op= expr' handles empty index (idx) arguments"
13
+ fails "Conditional operator assignment 'obj[idx] op= expr' uses short-circuit arg evaluation"
14
+ fails "Conditional operator assignment 'obj[idx] op= expr' may not assign at all, depending on the truthiness of lhs"
15
+ fails "Conditional operator assignment 'obj[idx] op= expr' is equivalent to 'obj[idx] op obj[idx] = expr'"
16
+ fails "Unconditional operator assignment 'obj[idx] op= expr' is equivalent to 'obj[idx] = obj[idx] op expr'"
17
+ fails "Conditional operator assignment 'obj.meth op= expr' uses short-circuit arg evaluation"
18
+ fails "Conditional operator assignment 'obj.meth op= expr' may not assign at all, depending on the truthiness of lhs"
19
+ fails "Conditional operator assignment 'var op= expr' uses short-circuit arg evaluation"
20
+ fails "Conditional operator assignment 'var op= expr' may not assign at all, depending on the truthiness of lhs"
21
+ fails "Assigning multiple values allows complex parallel assignment"
22
+ fails "Assigning multiple values calls #to_ary on RHS arg if the corresponding LHS var is a splat"
23
+ fails "Assigning multiple values returns the rhs values used for assignment as an array"
24
+ fails "Basic multiple assignment with a splatted single RHS value does not call #to_ary on an object"
25
+ fails "Basic multiple assignment with a splatted single RHS value calls #to_a on an object if #to_ary is not defined"
26
+ fails "Basic multiple assignment with a splatted single RHS value does not call #to_a on an Array subclass instance"
27
+ fails "Basic multiple assignment with a splatted single RHS value does not call #to_ary on an Array subclass instance"
28
+ fails "Basic multiple assignment with a splatted single RHS value does not call #to_a on an Array instance"
29
+ fails "Basic multiple assignment with a splatted single RHS value does not call #to_ary on an Array instance"
30
+ fails "Basic multiple assignment with a single RHS value does not call #to_a on an object if #to_ary is not defined"
31
+ fails "Basic multiple assignment with a single RHS value calls #to_ary on an object"
32
+ fails "Basic multiple assignment with a single RHS value does not call #to_a on an Array subclass instance"
33
+ fails "Basic multiple assignment with a single RHS value does not call #to_ary on an Array subclass instance"
34
+ fails "Basic multiple assignment with a single RHS value does not call #to_a on an Array instance"
35
+ fails "Basic multiple assignment with a single RHS value does not call #to_ary on an Array instance"
36
+ fails "Basic assignment allows the assignment of the rhs to the lhs using the rhs splat operator"
37
+ end
@@ -0,0 +1,6 @@
1
+ opal_filter "while" do
2
+ fails "The while modifier with begin .. end block runs block at least once (even if the expression is false)"
3
+ fails "The while modifier with begin .. end block evaluates condition after block execution"
4
+ fails "The while modifier with begin .. end block skips to end of body with next"
5
+ fails "The while modifier with begin .. end block restarts the current iteration without reevaluting condition with redo"
6
+ end
@@ -0,0 +1,5 @@
1
+ opal_filter "yield" do
2
+ fails "The yield call taking no arguments ignores assignment to the explicit block argument and calls the passed block"
3
+ fails "The yield call taking a single splatted argument passes no values when give nil as an argument"
4
+ fails "The yield call taking multiple arguments with a splat does not pass an argument value if the splatted argument is nil"
5
+ end
@@ -0,0 +1,6 @@
1
+ opal_filter "Module#method_defined?" do
2
+ fails "Module#method_defined? converts the given name to a string using to_str"
3
+ fails "Module#method_defined? raises a TypeError when the given object is not a string/symbol/fixnum"
4
+ fails "Module#method_defined? does not search Object or Kernel when called on a module"
5
+ fails "Module#method_defined? returns true if a public or private method with the given name is defined in self, self's ancestors or one of self's included modules"
6
+ end
@@ -0,0 +1,10 @@
1
+ opal_filter "Opal::Parser" do
2
+ fails "Singleton classes returns an empty s(:scope) when given an empty body"
3
+ fails "Singleton classes should accept any expressions for singleton part"
4
+ fails "Strings from %Q construction should match '{' and '}' pairs used to start string before ending match"
5
+ fails "Strings from %Q construction should match '(' and ')' pairs used to start string before ending match"
6
+ fails "Strings from %Q construction should match '[' and ']' pairs used to start string before ending match"
7
+ fails "x-strings created using %x notation should match '{' and '}' pairs used to start string before ending match"
8
+ fails "x-strings created using %x notation should match '(' and ')' pairs used to start string before ending match"
9
+ fails "x-strings created using %x notation should match '[' and ']' pairs used to start string before ending match"
10
+ end
@@ -1,3 +1,4 @@
1
1
  opal_filter "Module#public_methods" do
2
2
  fails "The alias keyword adds the new method to the list of public methods"
3
+ fails "The alias keyword adds the new method to the list of methods"
3
4
  end
@@ -0,0 +1,7 @@
1
+ opal_filter "return" do
2
+ fails "The return keyword within a begin returns last value returned in nested ensures"
3
+ fails "The return keyword within a begin executes nested ensures before returning"
4
+ fails "The return keyword when passed a splat calls 'to_a' on the splatted value first"
5
+ fails "The return keyword when passed a splat returns an array when used as a splat"
6
+ fails "The return keyword in a Thread raises a LocalJumpError if used to exit a thread"
7
+ end
@@ -0,0 +1,4 @@
1
+ opal_filter "Singleton#instance" do
2
+ fails "Singleton.instance returns an instance of the singleton's clone"
3
+ fails "Singleton.instance returns the same instance for multiple class to instance on clones"
4
+ end
@@ -0,0 +1,3 @@
1
+ opal_filter "Opal::SourceMap" do
2
+ fails "Opal::SourceMap does not blow while generating the map"
3
+ end
@@ -0,0 +1,4 @@
1
+ opal_filter "String#center" do
2
+ fails "String#center with length, padding pads with whitespace if no padstr is given"
3
+ fails "String#center with length, padding returns a new string of specified length with self centered and padded with padstr"
4
+ end
@@ -0,0 +1,3 @@
1
+ opal_filter "String#lines" do
2
+ fails "String#lines should split on the default record separator and return enumerator if not block is given"
3
+ end
File without changes
@@ -1,4 +1,5 @@
1
1
  opal_filter "Array subclasses" do
2
2
  fails "Array.[] returns a new array populated with the given elements"
3
3
  fails "Array[] is a synonym for .[]"
4
+ fails "Array.new returns an instance of a subclass"
4
5
  end
@@ -0,0 +1,32 @@
1
+ opal_filter "Object#frozen" do
2
+ fails "Array#frozen? returns true if array is frozen"
3
+ fails "Array#frozen? returns false for an array being sorted by #sort"
4
+ fails "Array#unshift raises a RuntimeError on a frozen array when the array is modified"
5
+ fails "Array#unshift raises a RuntimeError on a frozen array when the array would not be modified"
6
+ fails "Array#uniq! doesn't yield to the block on a frozen array"
7
+ fails "Array#uniq! raises a RuntimeError on a frozen array when the array would not be modified"
8
+ fails "Array#uniq! raises a RuntimeError on a frozen array when the array is modified"
9
+ fails "Array#sort! raises a RuntimeError on a frozen array"
10
+ fails "Array#slice! raises a RuntimeError on a frozen array"
11
+ fails "Array#shuffle! raises a RuntimeError on a frozen array"
12
+ fails "Array#shift raises a RuntimeError on an empty frozen array"
13
+ fails "Array#shift raises a RuntimeError on a frozen array"
14
+ fails "Array#reverse! raises a RuntimeError on a frozen array"
15
+ fails "Array#reject! raises a RuntimeError on an empty frozen array"
16
+ fails "Array#reject! raises a RuntimeError on a frozen array"
17
+ fails "Array#push raises a RuntimeError on a frozen array"
18
+ fails "Array#pop passed a number n as an argument raises a RuntimeError on a frozen array"
19
+ fails "Array#pop raises a RuntimeError on an empty frozen array"
20
+ fails "Array#pop raises a RuntimeError on a frozen array"
21
+ fails "Array#insert raises a RuntimeError on frozen arrays when the array would not be modified"
22
+ fails "Array#insert raises a RuntimeError on frozen arrays when the array is modified"
23
+ fails "Array#flatten! raises a RuntimeError on frozen arrays when the array would not be modified"
24
+ fails "Array#flatten! raises a RuntimeError on frozen arrays when the array is modified"
25
+ fails "Array#delete raises a RuntimeError on a frozen array"
26
+ fails "Array#delete_if raises a RuntimeError on an empty frozen array"
27
+ fails "Array#delete_if raises a RuntimeError on a frozen array"
28
+ fails "Array#delete_at raises a RuntimeError on a frozen array"
29
+ fails "Array#compact! raises a RuntimeError on a frozen array"
30
+ fails "Array#clear raises a RuntimeError on a frozen array"
31
+ fails "Array#<< raises a RuntimeError on a frozen array"
32
+ end
@@ -0,0 +1,3 @@
1
+ opal_filter "immutable strings" do
2
+ fails "Hash literal freezes string keys on initialization"
3
+ end
@@ -0,0 +1,17 @@
1
+ opal_filter 'tainted' do
2
+ fails "Array#clear keeps tainted status"
3
+ fails "Array#compact! keeps tainted status even if all elements are removed"
4
+ fails "Array#delete_at keeps tainted status"
5
+ fails "Array#delete_if keeps tainted status"
6
+ fails "Array#delete keeps tainted status"
7
+ fails "Array#shift passed a number n as an argument keeps taint status"
8
+ fails "Array#shift passed a number n as an argument returns an untainted array even if the array is tainted"
9
+ fails "Array#pop passed a number n as an argument keeps taint status"
10
+ fails "Array#pop passed a number n as an argument returns an untainted array even if the array is tainted"
11
+ fails "Array#pop keeps taint status"
12
+ fails "Array#+ does not get infected even if an original array is tainted"
13
+ fails "Array#* with an integer copies the taint status of the original array if the passed count is not 0"
14
+ fails "Array#* with an integer copies the taint status of the original array even if the array is empty"
15
+ fails "Array#* with an integer copies the taint status of the original array even if the passed count is 0"
16
+ fails "Array#compact does not keep tainted status even if all elements are removed"
17
+ end
@@ -0,0 +1,15 @@
1
+ opal_filter "Object#trusted/untrusted" do
2
+ fails "Array#pop passed a number n as an argument keeps untrusted status"
3
+ fails "Array#pop passed a number n as an argument returns a trusted array even if the array is untrusted"
4
+ fails "Array#pop keeps untrusted status"
5
+ fails "Array#+ does not infected even if an original array is untrusted"
6
+ fails "Array#* with an integer copies the untrusted status of the original array if the passed count is not 0"
7
+ fails "Array#* with an integer copies the untrusted status of the original array even if the array is empty"
8
+ fails "Array#* with an integer copies the untrusted status of the original array even if the passed count is 0"
9
+ fails "Array#delete keeps untrusted status"
10
+ fails "Array#delete_if keeps untrusted status"
11
+ fails "Array#delete_at keeps untrusted status"
12
+ fails "Array#compact! keeps untrusted status even if all elements are removed"
13
+ fails "Array#compact does not keep untrusted status even if all elements are removed"
14
+ fails "Array#clear keeps untrusted status"
15
+ end