opal 1.7.4 → 1.8.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +1 -0
  3. data/.github/workflows/build.yml +9 -9
  4. data/.rubocop/todo.yml +2 -2
  5. data/.rubocop.yml +17 -10
  6. data/.rubocop_todo.yml +311 -0
  7. data/CHANGELOG.md +1 -15
  8. data/README.md +7 -7
  9. data/UNRELEASED.md +92 -1
  10. data/benchmark-ips/bm_block_vs_yield.rb +3 -0
  11. data/benchmark-ips/bm_slice_or_not.rb +53 -0
  12. data/docs/bridging.md +112 -0
  13. data/docs/compiled_ruby.md +10 -10
  14. data/docs/getting_started.md +18 -22
  15. data/docs/releasing.md +8 -16
  16. data/lib/opal/cli_runners/chrome_cdp_interface.rb +1 -0
  17. data/lib/opal/cli_runners/firefox_cdp_interface.rb +1 -0
  18. data/lib/opal/compiler.rb +33 -1
  19. data/lib/opal/nodes/args/extract_kwoptarg.rb +2 -1
  20. data/lib/opal/nodes/call.rb +1 -1
  21. data/lib/opal/nodes/call_special.rb +71 -47
  22. data/lib/opal/nodes/closure.rb +15 -7
  23. data/lib/opal/nodes/defined.rb +1 -1
  24. data/lib/opal/nodes/hash.rb +14 -30
  25. data/lib/opal/nodes/if.rb +37 -29
  26. data/lib/opal/nodes/literal.rb +15 -7
  27. data/lib/opal/nodes/rescue.rb +1 -1
  28. data/lib/opal/nodes/x_string.rb +13 -0
  29. data/lib/opal/parser/patch.rb +1 -0
  30. data/lib/opal/rewriters/for_rewriter.rb +36 -24
  31. data/lib/opal/source_map/file.rb +1 -1
  32. data/lib/opal/version.rb +1 -1
  33. data/opal/corelib/array/pack.rb +1 -0
  34. data/opal/corelib/array.rb +110 -64
  35. data/opal/corelib/basic_object.rb +1 -0
  36. data/opal/corelib/binding.rb +2 -0
  37. data/opal/corelib/boolean.rb +1 -0
  38. data/opal/corelib/class.rb +28 -8
  39. data/opal/corelib/comparable.rb +1 -0
  40. data/opal/corelib/complex.rb +3 -1
  41. data/opal/corelib/constants.rb +2 -2
  42. data/opal/corelib/dir.rb +2 -0
  43. data/opal/corelib/enumerable.rb +3 -2
  44. data/opal/corelib/enumerator/arithmetic_sequence.rb +3 -1
  45. data/opal/corelib/enumerator/chain.rb +1 -0
  46. data/opal/corelib/enumerator/generator.rb +1 -0
  47. data/opal/corelib/enumerator/lazy.rb +1 -0
  48. data/opal/corelib/enumerator/yielder.rb +2 -0
  49. data/opal/corelib/enumerator.rb +1 -0
  50. data/opal/corelib/error/errno.rb +2 -0
  51. data/opal/corelib/error.rb +22 -0
  52. data/opal/corelib/file.rb +1 -0
  53. data/opal/corelib/hash.rb +224 -519
  54. data/opal/corelib/helpers.rb +1 -0
  55. data/opal/corelib/io.rb +2 -0
  56. data/opal/corelib/irb.rb +2 -0
  57. data/opal/corelib/kernel/format.rb +1 -0
  58. data/opal/corelib/kernel.rb +70 -15
  59. data/opal/corelib/main.rb +2 -0
  60. data/opal/corelib/marshal/read_buffer.rb +2 -0
  61. data/opal/corelib/marshal/write_buffer.rb +2 -0
  62. data/opal/corelib/math/polyfills.rb +2 -0
  63. data/opal/corelib/math.rb +1 -0
  64. data/opal/corelib/method.rb +2 -0
  65. data/opal/corelib/module.rb +45 -5
  66. data/opal/corelib/nil.rb +3 -1
  67. data/opal/corelib/number.rb +30 -1
  68. data/opal/corelib/numeric.rb +2 -0
  69. data/opal/corelib/object_space.rb +1 -0
  70. data/opal/corelib/pack_unpack/format_string_parser.rb +2 -0
  71. data/opal/corelib/proc.rb +30 -28
  72. data/opal/corelib/process.rb +2 -0
  73. data/opal/corelib/random/formatter.rb +2 -0
  74. data/opal/corelib/random/math_random.js.rb +2 -0
  75. data/opal/corelib/random/mersenne_twister.rb +2 -0
  76. data/opal/corelib/random/seedrandom.js.rb +2 -0
  77. data/opal/corelib/random.rb +1 -0
  78. data/opal/corelib/range.rb +35 -13
  79. data/opal/corelib/rational.rb +3 -1
  80. data/opal/corelib/regexp.rb +1 -0
  81. data/opal/corelib/runtime.js +297 -259
  82. data/opal/corelib/set.rb +2 -0
  83. data/opal/corelib/string/encoding.rb +3 -0
  84. data/opal/corelib/string/unpack.rb +2 -0
  85. data/opal/corelib/string.rb +56 -20
  86. data/opal/corelib/struct.rb +4 -2
  87. data/opal/corelib/time.rb +2 -1
  88. data/opal/corelib/trace_point.rb +2 -0
  89. data/opal/corelib/unsupported.rb +2 -0
  90. data/opal/corelib/variables.rb +2 -0
  91. data/opal.gemspec +2 -2
  92. data/spec/filters/bugs/array.rb +58 -2
  93. data/spec/filters/bugs/basicobject.rb +7 -0
  94. data/spec/filters/bugs/bigdecimal.rb +1 -2
  95. data/spec/filters/bugs/binding.rb +1 -0
  96. data/spec/filters/bugs/class.rb +2 -3
  97. data/spec/filters/bugs/complex.rb +3 -0
  98. data/spec/filters/bugs/date.rb +5 -2
  99. data/spec/filters/bugs/datetime.rb +1 -0
  100. data/spec/filters/bugs/delegate.rb +1 -2
  101. data/spec/filters/bugs/encoding.rb +1 -1
  102. data/spec/filters/bugs/enumerable.rb +11 -3
  103. data/spec/filters/bugs/enumerator.rb +15 -2
  104. data/spec/filters/bugs/exception.rb +9 -4
  105. data/spec/filters/bugs/file.rb +2 -0
  106. data/spec/filters/bugs/float.rb +1 -0
  107. data/spec/filters/bugs/freeze.rb +5 -49
  108. data/spec/filters/bugs/hash.rb +1 -13
  109. data/spec/filters/bugs/integer.rb +5 -6
  110. data/spec/filters/bugs/kernel.rb +12 -43
  111. data/spec/filters/bugs/language.rb +33 -15
  112. data/spec/filters/bugs/marshal.rb +63 -4
  113. data/spec/filters/bugs/method.rb +2 -10
  114. data/spec/filters/bugs/module.rb +18 -7
  115. data/spec/filters/bugs/objectspace.rb +2 -0
  116. data/spec/filters/bugs/pathname.rb +1 -0
  117. data/spec/filters/bugs/proc.rb +4 -2
  118. data/spec/filters/bugs/random.rb +0 -3
  119. data/spec/filters/bugs/range.rb +1 -2
  120. data/spec/filters/bugs/rational.rb +2 -0
  121. data/spec/filters/bugs/refinement.rb +19 -0
  122. data/spec/filters/bugs/regexp.rb +27 -5
  123. data/spec/filters/bugs/ruby-32.rb +0 -6
  124. data/spec/filters/bugs/set.rb +10 -2
  125. data/spec/filters/bugs/singleton.rb +0 -2
  126. data/spec/filters/bugs/string.rb +140 -2
  127. data/spec/filters/bugs/struct.rb +16 -10
  128. data/spec/filters/bugs/time.rb +56 -2
  129. data/spec/filters/bugs/trace_point.rb +1 -0
  130. data/spec/filters/bugs/unboundmethod.rb +4 -9
  131. data/spec/filters/bugs/warnings.rb +0 -1
  132. data/spec/filters/platform/firefox/exception.rb +3 -3
  133. data/spec/filters/platform/firefox/kernel.rb +1 -0
  134. data/spec/filters/platform/safari/exception.rb +2 -2
  135. data/spec/filters/platform/safari/float.rb +1 -0
  136. data/spec/filters/platform/safari/kernel.rb +1 -0
  137. data/spec/filters/platform/safari/literal_regexp.rb +2 -2
  138. data/spec/filters/unsupported/hash.rb +1 -0
  139. data/spec/lib/compiler_spec.rb +28 -17
  140. data/spec/mspec-opal/formatters.rb +2 -0
  141. data/spec/mspec-opal/runner.rb +2 -0
  142. data/spec/opal/core/array/dup_spec.rb +2 -0
  143. data/spec/opal/core/class/clone_spec.rb +36 -0
  144. data/spec/opal/core/exception_spec.rb +2 -0
  145. data/spec/opal/core/hash/internals_spec.rb +154 -206
  146. data/spec/opal/core/hash_spec.rb +2 -0
  147. data/spec/opal/core/iterable_props_spec.rb +2 -0
  148. data/spec/opal/core/kernel/at_exit_spec.rb +2 -0
  149. data/spec/opal/core/kernel/respond_to_spec.rb +2 -0
  150. data/spec/opal/core/language/arguments/mlhs_arg_spec.rb +2 -0
  151. data/spec/opal/core/language/safe_navigator_spec.rb +2 -0
  152. data/spec/opal/core/language/xstring_send_spec.rb +15 -0
  153. data/spec/opal/core/language/xstring_spec.rb +2 -0
  154. data/spec/opal/core/language_spec.rb +2 -0
  155. data/spec/opal/core/module_spec.rb +44 -0
  156. data/spec/opal/core/number/to_i_spec.rb +2 -0
  157. data/spec/opal/core/object_id_spec.rb +2 -6
  158. data/spec/opal/core/regexp/match_spec.rb +2 -0
  159. data/spec/opal/core/runtime/bridged_classes_spec.rb +38 -0
  160. data/spec/opal/core/runtime/constants_spec.rb +2 -0
  161. data/spec/opal/core/runtime/eval_spec.rb +2 -0
  162. data/spec/opal/core/runtime/exit_spec.rb +2 -0
  163. data/spec/opal/core/runtime/is_a_spec.rb +2 -0
  164. data/spec/opal/core/runtime/loaded_spec.rb +2 -0
  165. data/spec/opal/core/runtime/method_missing_spec.rb +2 -0
  166. data/spec/opal/core/runtime/rescue_spec.rb +2 -0
  167. data/spec/opal/core/runtime/string_spec.rb +2 -0
  168. data/spec/opal/core/runtime/truthy_spec.rb +2 -0
  169. data/spec/opal/core/runtime_spec.rb +2 -6
  170. data/spec/opal/core/string/to_sym_spec.rb +2 -0
  171. data/spec/opal/language/predefined_spec.rb +20 -0
  172. data/spec/opal/language/yield_spec.rb +43 -0
  173. data/spec/opal/stdlib/js_spec.rb +2 -0
  174. data/spec/opal/stdlib/native/alias_native_spec.rb +2 -0
  175. data/spec/opal/stdlib/native/array_spec.rb +2 -0
  176. data/spec/opal/stdlib/native/date_spec.rb +2 -0
  177. data/spec/opal/stdlib/native/each_spec.rb +2 -0
  178. data/spec/opal/stdlib/native/element_reference_spec.rb +2 -0
  179. data/spec/opal/stdlib/native/exposure_spec.rb +2 -0
  180. data/spec/opal/stdlib/native/ext_spec.rb +2 -0
  181. data/spec/opal/stdlib/native/hash_spec.rb +30 -2
  182. data/spec/opal/stdlib/native/initialize_spec.rb +2 -0
  183. data/spec/opal/stdlib/native/method_missing_spec.rb +2 -0
  184. data/spec/opal/stdlib/native/native_alias_spec.rb +2 -0
  185. data/spec/opal/stdlib/native/native_class_spec.rb +2 -0
  186. data/spec/opal/stdlib/native/native_module_spec.rb +2 -0
  187. data/spec/opal/stdlib/native/native_reader_spec.rb +2 -0
  188. data/spec/opal/stdlib/native/native_writer_spec.rb +2 -0
  189. data/spec/opal/stdlib/native/new_spec.rb +2 -0
  190. data/spec/opal/stdlib/native/struct_spec.rb +2 -0
  191. data/spec/ruby_specs +0 -2
  192. data/spec/spec_helper.rb +2 -0
  193. data/stdlib/await.rb +1 -0
  194. data/stdlib/base64.rb +2 -0
  195. data/stdlib/bigdecimal/bignumber.js.rb +2 -0
  196. data/stdlib/bigdecimal/util.rb +1 -0
  197. data/stdlib/bigdecimal.rb +4 -0
  198. data/stdlib/buffer/array.rb +2 -0
  199. data/stdlib/buffer/view.rb +2 -0
  200. data/stdlib/buffer.rb +2 -0
  201. data/stdlib/cgi.rb +14 -0
  202. data/stdlib/console.rb +2 -0
  203. data/stdlib/date/date_time.rb +2 -0
  204. data/stdlib/date.rb +2 -0
  205. data/stdlib/delegate.rb +5 -4
  206. data/stdlib/deno/base.rb +2 -0
  207. data/stdlib/deno/file.rb +2 -0
  208. data/stdlib/erb.rb +2 -0
  209. data/stdlib/gjs/io.rb +2 -0
  210. data/stdlib/gjs/kernel.rb +2 -0
  211. data/stdlib/headless_browser/base.rb +2 -0
  212. data/stdlib/headless_browser/file.rb +1 -0
  213. data/stdlib/headless_browser.rb +1 -0
  214. data/stdlib/js.rb +2 -0
  215. data/stdlib/json.rb +9 -15
  216. data/stdlib/logger.rb +2 -0
  217. data/stdlib/nashorn/file.rb +2 -0
  218. data/stdlib/nashorn/io.rb +2 -0
  219. data/stdlib/native.rb +48 -48
  220. data/stdlib/nodejs/base.rb +2 -0
  221. data/stdlib/nodejs/dir.rb +2 -0
  222. data/stdlib/nodejs/env.rb +2 -0
  223. data/stdlib/nodejs/file.rb +2 -0
  224. data/stdlib/nodejs/fileutils.rb +2 -0
  225. data/stdlib/nodejs/io.rb +2 -0
  226. data/stdlib/nodejs/js-yaml-3-6-1.js +1 -1
  227. data/stdlib/nodejs/kernel.rb +2 -0
  228. data/stdlib/nodejs/open-uri.rb +2 -0
  229. data/stdlib/nodejs/pathname.rb +2 -0
  230. data/stdlib/nodejs/require.rb +2 -0
  231. data/stdlib/nodejs/yaml.rb +9 -3
  232. data/stdlib/opal/miniracer.rb +2 -0
  233. data/stdlib/opal-parser.rb +8 -1
  234. data/stdlib/opal-platform.rb +2 -0
  235. data/stdlib/opal-replutils.rb +2 -0
  236. data/stdlib/open-uri.rb +4 -1
  237. data/stdlib/ostruct.rb +4 -2
  238. data/stdlib/pathname.rb +3 -1
  239. data/stdlib/pp.rb +1 -0
  240. data/stdlib/promise/v2.rb +24 -7
  241. data/stdlib/quickjs/io.rb +2 -0
  242. data/stdlib/quickjs/kernel.rb +2 -0
  243. data/stdlib/quickjs.rb +2 -0
  244. data/stdlib/securerandom.rb +2 -0
  245. data/stdlib/stringio.rb +2 -0
  246. data/stdlib/strscan.rb +2 -0
  247. data/stdlib/time.rb +2 -0
  248. data/stdlib/uri.rb +1 -0
  249. data/tasks/performance/optimization_status.rb +2 -0
  250. data/tasks/testing.rake +16 -11
  251. data/test/nodejs/test_await.rb +1 -0
  252. data/test/nodejs/test_dir.rb +2 -0
  253. data/test/nodejs/test_error.rb +2 -0
  254. data/test/nodejs/test_file.rb +2 -0
  255. data/test/nodejs/test_string.rb +2 -0
  256. data/test/nodejs/test_yaml.rb +20 -0
  257. data/test/opal/promisev2/test_always.rb +14 -0
  258. data/test/opal/unsupported_and_bugs.rb +0 -8
  259. metadata +26 -13
  260. data/spec/filters/bugs/openstruct.rb +0 -8
@@ -1,7 +1,10 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Enumerable" do
3
+ fails "Enumerable#all? when given a pattern argument ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
4
+ fails "Enumerable#any? when given a pattern argument ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
3
5
  fails "Enumerable#chain returns a chain of self and provided enumerables" # NoMethodError: undefined method `chain' for #<EnumerableSpecs::Numerous:0x2eb8 @list=[1]>
4
6
  fails "Enumerable#chain returns an Enumerator::Chain if given a block" # NoMethodError: undefined method `chain' for #<EnumerableSpecs::Numerous:0x2eb2 @list=[2, 5, 3, 6, 1, 4]>
7
+ fails "Enumerable#chunk returns a partitioned Array of values" # NoMethodError: undefined method `last' for false
5
8
  fails "Enumerable#chunk_while on a single-element array ignores the block and returns an enumerator that yields [element]" # Expected [] == [[1]] to be truthy but was false
6
9
  fails "Enumerable#collect reports the same arity as the given block" # Exception: Cannot read properties of undefined (reading '$$is_array')
7
10
  fails "Enumerable#collect yields 2 arguments for a Hash when block arity is 2" # ArgumentError: [#register] wrong number of arguments (given 1, expected 2)
@@ -12,10 +15,16 @@ opal_filter "Enumerable" do
12
15
  fails "Enumerable#grep_v correctly handles non-string elements" # Expected nil == "match" to be truthy but was false
13
16
  fails "Enumerable#grep_v does not modify Regexp.last_match without block" # Expected "e" == "z" to be truthy but was false
14
17
  fails "Enumerable#grep_v does not set $~ when given no block" # Expected "e" == "z" to be truthy but was false
18
+ fails "Enumerable#inject ignores the block if two arguments" # Expected warning to match: /ruby\/core\/enumerable\/shared\/inject.rb:23: warning: given block not used/ but got: ""
15
19
  fails "Enumerable#inject raises an ArgumentError when no parameters or block is given" # Expected ArgumentError but got: Exception (Cannot read properties of undefined (reading '$inspect'))
20
+ fails "Enumerable#inject tolerates increasing a collection size during iterating Array" # Expected ["a", "b", "c"] == [0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 3, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 4, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 5, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 6, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 7, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 8, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 9, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, "a", "b", "c"] to be truthy but was false
16
21
  fails "Enumerable#map reports the same arity as the given block" # Exception: Cannot read properties of undefined (reading '$$is_array')
17
22
  fails "Enumerable#map yields 2 arguments for a Hash when block arity is 2" # ArgumentError: [#register] wrong number of arguments (given 1, expected 2)
23
+ fails "Enumerable#none? when given a pattern argument ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
24
+ fails "Enumerable#one? when given a pattern argument ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
25
+ fails "Enumerable#reduce ignores the block if two arguments" # Expected warning to match: /ruby\/core\/enumerable\/shared\/inject.rb:23: warning: given block not used/ but got: ""
18
26
  fails "Enumerable#reduce raises an ArgumentError when no parameters or block is given" # Expected ArgumentError but got: Exception (Cannot read properties of undefined (reading '$inspect'))
27
+ fails "Enumerable#reduce tolerates increasing a collection size during iterating Array" # Expected ["a", "b", "c"] == [0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 3, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 4, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 5, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 6, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 7, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 8, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 9, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, "a", "b", "c"] to be truthy but was false
19
28
  fails "Enumerable#reverse_each gathers whole arrays as elements when each yields multiple" # Expected [6, 3, 1] == [[6, 7, 8, 9], [3, 4, 5], [1, 2]] to be truthy but was false
20
29
  fails "Enumerable#slice_when when an iterator method yields more than one value processes all yielded values" # Expected [] == [[[1, 2]]] to be truthy but was false
21
30
  fails "Enumerable#slice_when when given a block doesn't yield an empty array on a small enumerable" # Expected [] == [[42]] to be truthy but was false
@@ -23,9 +32,8 @@ opal_filter "Enumerable" do
23
32
  fails "Enumerable#sort_by returns an array of elements when a block is supplied and #map returns an enumerable" # NoMethodError: undefined method `sort!' for #<EnumerableSpecs::MapReturnsEnumerable::EnumerableMapping:0x42a48 @items=#<EnumerableSpecs::MapReturnsEnumerable:0x42a46> @block=#<Proc:0x42a4a>>
24
33
  fails "Enumerable#take_while calls the block with initial args when yielded with multiple arguments" # Expected [1, [2], [3, 4], [5, 6, 7], [8, 9], nil, []] == [1, [2], 3, 5, [8, 9], nil, []] to be truthy but was false
25
34
  fails "Enumerable#tally counts values as gathered array when yielded with multiple arguments" # Expected {[]=>3, 0=>1, [0, 1]=>2, [0, 1, 2]=>3, nil=>1, "default_arg"=>1, [0]=>1} == {nil=>2, 0=>1, [0, 1]=>2, [0, 1, 2]=>3, "default_arg"=>1, []=>2, [0]=>1} to be truthy but was false
26
- fails "Enumerable#to_h with block does not coerce returned pair to Array with #to_a" # Expected TypeError (/wrong element type MockObject/) but got: TypeError (wrong element type NilClass at 0 (expected array))
27
- fails "Enumerable#to_h with block raises ArgumentError if block returns longer or shorter array" # Expected ArgumentError (/element has wrong array length/) but got: ArgumentError (wrong array length at 0 (expected 2, was 3))
28
- fails "Enumerable#to_h with block raises TypeError if block returns something other than Array" # Expected TypeError (/wrong element type String/) but got: TypeError (wrong element type NilClass at 0 (expected array))
35
+ fails "Enumerable#tally with a hash calls #to_hash to convert argument to Hash implicitly if passed not a Hash" # NoMethodError: undefined method `fetch' for #<Object:0x8def0>
29
36
  fails "Enumerable#uniq uses eql? semantics" # Expected [1] == [1, 1] to be truthy but was false
30
37
  fails "Enumerable#zip passes each element of the result array to a block and return nil if a block is given" # Expected [[1, 4, 7], [2, 5, 8], [3, 6, 9]] == nil to be truthy but was false
38
+ fails "Enumerable#zip raises TypeError when some argument isn't Array and doesn't respond to #to_ary and #to_enum" # Expected TypeError (wrong argument type Object (must respond to :each)) but got: NoMethodError (undefined method `each' for #<Object:0x2e1e6>)
31
39
  end
@@ -12,15 +12,28 @@ opal_filter "Enumerator" do
12
12
  fails "Enumerator#initialize sets size to the given size if the given size is Float::INFINITY" # Expected 4 to be identical to Infinity
13
13
  fails "Enumerator#initialize sets size to the given size if the given size is a Proc" # NoMethodError: undefined method `size' for nil
14
14
  fails "Enumerator#initialize sets size to the given size if the given size is an Integer" # Expected 4 == 100 to be truthy but was false
15
+ fails "Enumerator#inspect returns a not initialized representation if #initialized is not called yet" # NoMethodError: undefined method `any?' for nil
15
16
  fails "Enumerator.new no block given raises" # Expected ArgumentError but no exception was raised (#<Enumerator: 1:upto(3)> was returned)
16
17
  fails "Enumerator.new when passed a block yielded values handles yield arguments properly" # Expected 1 == [1, 2] to be truthy but was false
17
18
  fails "Enumerator.produce creates an infinite enumerator" # NoMethodError: undefined method `produce' for Enumerator
18
19
  fails "Enumerator.produce terminates iteration when block raises StopIteration exception" # NoMethodError: undefined method `produce' for Enumerator
19
20
  fails "Enumerator.produce when initial value skipped starts enumerable from result of first block call" # NoMethodError: undefined method `produce' for Enumerator
20
21
  fails "Enumerator.produce when initial value skipped uses nil instead" # NoMethodError: undefined method `produce' for Enumerator
21
- fails "Enumerator::ArithmeticSequence#hash is based on begin, end, step and exclude_end?" # Expected "A,3,21,3,0" (String) to be an instance of Integer
22
+ fails "Enumerator.product accepts a block" # NoMethodError: undefined method `product' for Enumerator
23
+ fails "Enumerator.product accepts a list of enumerators of any length" # NoMethodError: undefined method `product' for Enumerator
24
+ fails "Enumerator.product accepts infinite enumerators and returns infinite enumerator" # NoMethodError: undefined method `product' for Enumerator
25
+ fails "Enumerator.product calls #each_entry lazily" # NoMethodError: undefined method `product' for Enumerator
26
+ fails "Enumerator.product calls only #each_entry method on arguments" # NoMethodError: undefined method `product' for Enumerator
27
+ fails "Enumerator.product iterates through consuming enumerator elements only once" # NoMethodError: undefined method `product' for Enumerator
28
+ fails "Enumerator.product raises NoMethodError when argument doesn't respond to #each_entry" # Expected NoMethodError (/undefined method `each_entry' for/) but got: NoMethodError (undefined method `product' for Enumerator)
29
+ fails "Enumerator.product reject keyword arguments" # Expected ArgumentError (unknown keywords: :foo, :bar) but got: NoMethodError (undefined method `product' for Enumerator)
30
+ fails "Enumerator.product returns a Cartesian product of enumerators" # NoMethodError: undefined method `product' for Enumerator
31
+ fails "Enumerator.product returns an enumerator with an empty array when no arguments passed" # NoMethodError: undefined method `product' for Enumerator
32
+ fails "Enumerator.product returns an instance of Enumerator::Product" # NoMethodError: undefined method `product' for Enumerator
33
+ fails "Enumerator.product returns nil when a block passed" # NoMethodError: undefined method `product' for Enumerator
22
34
  fails "Enumerator::ArithmeticSequence.allocate is not defined" # Expected TypeError (allocator undefined for Enumerator::ArithmeticSequence) but no exception was raised (#<Enumerator::ArithmeticSequence>(#pretty_inspect raised #<NoMethodError: undefined method `begin' for nil>) was returned)
23
35
  fails "Enumerator::ArithmeticSequence.new is not defined" # Expected NoMethodError but got: ArgumentError ([ArithmeticSequence#initialize] wrong number of arguments (given 0, expected -2))
36
+ fails "Enumerator::Chain#inspect returns a not initialized representation if #initialized is not called yet" # Expected "#<Enumerator::Chain: nil>" == "#<Enumerator::Chain: uninitialized>" to be truthy but was false
24
37
  fails "Enumerator::Generator#each returns the block returned value" # Expected #<Enumerator::Generator:0x3f346 @block=#<Proc:0x3f40c>> to be identical to "block_returned"
25
38
  fails "Enumerator::Generator#initialize returns self when given a block" # Expected #<Proc:0x3ff5e> to be identical to #<Enumerator::Generator:0x3ff52 @block=#<Proc:0x3ff5e>>
26
39
  fails "Enumerator::Lazy defines lazy versions of a whitelist of Enumerator methods" # Expected ["initialize", "lazy", "collect", "collect_concat", "drop", "drop_while", "enum_for", "find_all", "grep", "reject", "take", "take_while", "inspect", "force", "filter", "flat_map", "map", "select", "to_enum"] to include "chunk"
@@ -41,6 +54,7 @@ opal_filter "Enumerator" do
41
54
  fails "Enumerator::Lazy#collect_concat when the returned lazy enumerator is evaluated by Enumerable#first stops after specified times" # TypeError: can't iterate from Float
42
55
  fails "Enumerator::Lazy#collect_concat works with an infinite enumerable" # TypeError: can't iterate from Float
43
56
  fails "Enumerator::Lazy#compact returns array without nil elements" # Expected [1, 3, false, 5] (Array) to be an instance of Enumerator::Lazy
57
+ fails "Enumerator::Lazy#compact sets #size to nil" # NoMethodError: undefined method `each' for #<Object:0x9caea>
44
58
  fails "Enumerator::Lazy#drop on a nested Lazy sets difference of given count with old size to new size" # Expected 20 == 30 to be truthy but was false
45
59
  fails "Enumerator::Lazy#drop on a nested Lazy when the returned lazy enumerator is evaluated by Enumerable#first stops after specified times" # TypeError: can't iterate from Float
46
60
  fails "Enumerator::Lazy#drop sets difference of given count with old size to new size" # Expected 20 == 80 to be truthy but was false
@@ -150,6 +164,5 @@ opal_filter "Enumerator" do
150
164
  fails "Enumerator::Lazy#zip when the returned lazy enumerator is evaluated by Enumerable#first stops after specified times" # TypeError: can't iterate from Float
151
165
  fails "Enumerator::Lazy#zip works with an infinite enumerable and an array" # TypeError: can't iterate from Float
152
166
  fails "Enumerator::Lazy#zip works with two infinite enumerables" # TypeError: can't iterate from Float
153
- fails "SimpleDelegator can be marshalled with its instance variables intact" # Exception: Cannot create property 'foo' on string 'hello'
154
167
  fails "SimpleDelegator can be marshalled" # Expected String == SimpleDelegator to be truthy but was false
155
168
  end
@@ -26,9 +26,17 @@ opal_filter "Exception" do
26
26
  fails "Exception#backtrace_locations returns nil if no backtrace was set" # Expected ["ruby/core/exception/backtrace_locations_spec.rb:10:14:in `instance_exec'", "<internal:corelib/basic_object.rb>:125:1:in `instance_exec'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `instance_exec'", "mspec/runner/mspec.rb:116:11:in `protect'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `protect'", "mspec/runner/context.rb:176:39:in `$$17'", "<internal:corelib/runtime.js>:1667:5:in `Opal.yieldX'", "<internal:corelib/enumerable.rb>:27:16:in `$$3'", "<internal:corelib/runtime.js>:1644:7:in `each'", "<internal:corelib/array.rb>:983:1:in `each'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `each'", "<internal:corelib/enumerable.rb>:26:7:in `Enumerable_all$ques$1'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `all?'", "mspec/runner/context.rb:176:18:in `protect'", "mspec/runner/context.rb:212:26:in `$$21'", "<internal:corelib/runtime.js>:1667:5:in `Opal.yieldX'", "mspec/runner/mspec.rb:284:7:in `repeat'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `repeat'", "mspec/runner/context.rb:204:16:in `$$20'", "<internal:corelib/runtime.js>:1644:7:in `each'", "<internal:corelib/array.rb>:983:1:in `each'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `each'", "mspec/runner/context.rb:203:18:in `process'", "mspec/runner/mspec.rb:55:10:in `describe'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `describe'", "mspec/runner/object.rb:11:10:in `describe'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `describe'", "ruby/core/exception/backtrace_locations_spec.rb:4:1:in `Opal.modules.ruby/core/exception/backtrace_locations_spec'", "<internal:corelib/runtime.js>:2692:7:in `Opal.load_normalized'", "<internal:corelib/runtime.js>:2721:5:in `load'", "<internal:corelib/kernel.rb>:535:6:in `load'", "mspec/runner/mspec.rb:99:42:in `instance_exec'", "<internal:corelib/basic_object.rb>:125:1:in `instance_exec'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `instance_exec'", "mspec/runner/mspec.rb:116:11:in `protect'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `protect'", "mspec/runner/mspec.rb:99:7:in `$$1'", "<internal:corelib/runtime.js>:1644:7:in `each'", "<internal:corelib/array.rb>:983:1:in `each'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `each'", "mspec/runner/mspec.rb:90:12:in `each_file'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `each_file'", "mspec/runner/mspec.rb:95:5:in `files'", "mspec/runner/mspec.rb:63:5:in `process'", "tmp/mspec_nodejs.rb:3880:6:in `undefined'", "<internal:corelib/runtime.js>:2805:7:in `<main>'", "tmp/mspec_nodejs.rb:1:1:in `null'", "node:internal/modules/cjs/loader:1105:14:in `Module._compile'", "node:internal/modules/cjs/loader:1159:10:in `Module._extensions..js'", "node:internal/modules/cjs/loader:981:32:in `Module.load'", "node:internal/modules/cjs/loader:822:12:in `Module._load'", "node:internal/modules/run_main:77:12:in `executeUserEntryPoint'", "node:internal/main/run_main_module:17:47:in `undefined'"] to be nil
27
27
  fails "Exception#cause is set for internal errors caused by user errors" # Expected ZeroDivisionError but no exception was raised (Infinity was returned)
28
28
  fails "Exception#cause is set for user errors caused by internal errors" # Expected RuntimeError but no exception was raised (Infinity was returned)
29
+ fails "Exception#detailed_message accepts highlight keyword argument and adds escape control sequences" # NoMethodError: undefined method `detailed_message' for #<RuntimeError: new error>
30
+ fails "Exception#detailed_message allows and ignores other keyword arguments" # NoMethodError: undefined method `detailed_message' for #<RuntimeError: new error>
31
+ fails "Exception#detailed_message returns 'unhandled exception' for an instance of RuntimeError with empty message" # NoMethodError: undefined method `detailed_message' for RuntimeError
32
+ fails "Exception#detailed_message returns a generated class name for an instance of RuntimeError anonymous subclass with empty message" # NoMethodError: undefined method `detailed_message' for #<Class:0x4b72c>
33
+ fails "Exception#detailed_message returns decorated message" # NoMethodError: undefined method `detailed_message' for #<RuntimeError: new error>
34
+ fails "Exception#detailed_message returns just a message if exception class is anonymous" # NoMethodError: undefined method `detailed_message' for #<#<Class:0x4b742>: message>
35
+ fails "Exception#detailed_message returns just class name for an instance of RuntimeError sublass with empty message" # NoMethodError: undefined method `detailed_message' for DetailedMessageSpec::C
29
36
  fails "Exception#exception captures an exception into $!" # Expected "<internal:corelib/kernel.rb>:609:37:in `raise'" =~ /exception_spec/ to be truthy but was nil
30
- fails "Exception#full_message contains all the chain of exceptions" # Expected "<internal:corelib/kernel.rb>:612:37:in `raise': \e[1mlast exception (\e[1;4mRuntimeError\e[m\e[1m)\e[m \tfrom ruby/core/exception/full_message_spec.rb:96:9:in `instance_exec' \tfrom <internal:corelib/basic_object.rb>:125:1:in `instance_exec' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `instance_exec' \tfrom mspec/runner/mspec.rb:116:11:in `protect' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `protect' \tfrom mspec/runner/context.rb:176:39:in `$$17' \tfrom <internal:corelib/runtime.js>:1667:5:in `Opal.yieldX' \tfrom <internal:corelib/enumerable.rb>:27:16:in `$$3' \tfrom <internal:corelib/runtime.js>:1644:7:in `each' \tfrom <internal:corelib/array.rb>:983:1:in `each' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `each' \tfrom <internal:corelib/enumerable.rb>:26:7:in `Enumerable_all$ques$1' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `all?' \tfrom mspec/runner/context.rb:176:18:in `protect' \tfrom mspec/runner/context.rb:212:26:in `$$21' \tfrom <internal:corelib/runtime.js>:1667:5:in `Opal.yieldX' \tfrom mspec/runner/mspec.rb:284:7:in `repeat' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `repeat' \tfrom mspec/runner/context.rb:204:16:in `$$20' \tfrom <internal:corelib/runtime.js>:1644:7:in `each' \tfrom <internal:corelib/array.rb>:983:1:in `each' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `each' \tfrom mspec/runner/context.rb:203:18:in `process' \tfrom mspec/runner/mspec.rb:55:10:in `describe' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `describe' \tfrom mspec/runner/object.rb:11:10:in `describe' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `describe' \tfrom ruby/core/exception/full_message_spec.rb:3:1:in `Opal.modules.ruby/core/exception/full_message_spec' \tfrom <internal:corelib/runtime.js>:2692:7:in `Opal.load_normalized' \tfrom <internal:corelib/runtime.js>:2721:5:in `load' \tfrom <internal:corelib/kernel.rb>:535:6:in `load' \tfrom mspec/runner/mspec.rb:99:42:in `instance_exec' \tfrom <internal:corelib/basic_object.rb>:125:1:in `instance_exec' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `instance_exec' \tfrom mspec/runner/mspec.rb:116:11:in `protect' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `protect' \tfrom mspec/runner/mspec.rb:99:7:in `$$1' \tfrom <internal:corelib/runtime.js>:1644:7:in `each' \tfrom <internal:corelib/array.rb>:983:1:in `each' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `each' \tfrom mspec/runner/mspec.rb:90:12:in `each_file' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `each_file' \tfrom mspec/runner/mspec.rb:95:5:in `files' \tfrom mspec/runner/mspec.rb:63:5:in `process' \tfrom tmp/mspec_nodejs.rb:3880:6:in `undefined' \tfrom <internal:corelib/runtime.js>:2805:7:in `<main>' \tfrom tmp/mspec_nodejs.rb:1:1:in `null' \tfrom node:internal/modules/cjs/loader:1105:14:in `Module._compile' \tfrom node:internal/modules/cjs/loader:1159:10:in `Module._extensions..js' \tfrom node:internal/modules/cjs/loader:981:32:in `Module.load' \tfrom node:internal/modules/cjs/loader:822:12:in `Module._load' \tfrom node:internal/modules/run_main:77:12:in `executeUserEntryPoint' \tfrom node:internal/main/run_main_module:17:47:in `undefined' <internal:corelib/kernel.rb>:612:37:in `raise': \e[1morigin exception (\e[1;4mRuntimeError\e[m\e[1m)\e[m \tfrom ruby/core/exception/full_message_spec.rb:91:11:in `instance_exec' \tfrom <internal:corelib/basic_object.rb>:125:1:in `instance_exec' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `instance_exec' \tfrom mspec/runner/mspec.rb:116:11:in `protect' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `protect' \tfrom mspec/runner/context.rb:176:39:in `$$17' \tfrom <internal:corelib/runtime.js>:1667:5:in `Opal.yieldX' \tfrom <internal:corelib/enumerable.rb>:27:16:in `$$3' \tfrom <internal:corelib/runtime.js>:1644:7:in `each' \tfrom <internal:corelib/array.rb>:983:1:in `each' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `each' \tfrom <internal:corelib/enumerable.rb>:26:7:in `Enumerable_all$ques$1' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `all?' \tfrom mspec/runner/context.rb:176:18:in `protect' \tfrom mspec/runner/context.rb:212:26:in `$$21' \tfrom <internal:corelib/runtime.js>:1667:5:in `Opal.yieldX' \tfrom mspec/runner/mspec.rb:284:7:in `repeat' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `repeat' \tfrom mspec/runner/context.rb:204:16:in `$$20' \tfrom <internal:corelib/runtime.js>:1644:7:in `each' \tfrom <internal:corelib/array.rb>:983:1:in `each' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `each' \tfrom mspec/runner/context.rb:203:18:in `process' \tfrom mspec/runner/mspec.rb:55:10:in `describe' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `describe' \tfrom mspec/runner/object.rb:11:10:in `describe' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `describe' \tfrom ruby/core/exception/full_message_spec.rb:3:1:in `Opal.modules.ruby/core/exception/full_message_spec' \tfrom <internal:corelib/runtime.js>:2692:7:in `Opal.load_normalized' \tfrom <internal:corelib/runtime.js>:2721:5:in `load' \tfrom <internal:corelib/kernel.rb>:535:6:in `load' \tfrom mspec/runner/mspec.rb:99:42:in `instance_exec' \tfrom <internal:corelib/basic_object.rb>:125:1:in `instance_exec' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `instance_exec' \tfrom mspec/runner/mspec.rb:116:11:in `protect' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `protect' \tfrom mspec/runner/mspec.rb:99:7:in `$$1' \tfrom <internal:corelib/runtime.js>:1644:7:in `each' \tfrom <internal:corelib/array.rb>:983:1:in `each' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `each' \tfrom mspec/runner/mspec.rb:90:12:in `each_file' \tfrom <internal:corelib/runtime.js>:1878:5:in `Opal.send2' \tfrom <internal:corelib/runtime.js>:1866:5:in `each_file' \tfrom mspec/runner/mspec.rb:95:5:in `files' \tfrom mspec/runner/mspec.rb:63:5:in `process' \tfrom tmp/mspec_nodejs.rb:3880:6:in `undefined' \tfrom <internal:corelib/runtime.js>:2805:7:in `<main>' \tfrom tmp/mspec_nodejs.rb:1:1:in `null' \tfrom node:internal/modules/cjs/loader:1105:14:in `Module._compile' \tfrom node:internal/modules/cjs/loader:1159:10:in `Module._extensions..js' \tfrom node:internal/modules/cjs/loader:981:32:in `Module.load' \tfrom node:internal/modules/cjs/loader:822:12:in `Module._load' \tfrom node:internal/modules/run_main:77:12:in `executeUserEntryPoint' \tfrom node:internal/main/run_main_module:17:47:in `undefined' " to include "intermediate exception"
31
37
  fails "Exception#full_message highlights the entire message when the message contains multiple lines" # Expected "<internal:corelib/kernel.rb>:612:37:in `raise': \e[1mfirst line ".start_with? "ruby/core/exception/full_message_spec.rb:62:in `" to be truthy but was false
38
+ fails "Exception#full_message passes all its own keyword arguments to #detailed_message" # NoMethodError: undefined method `to_tty?' for Exception
39
+ fails "Exception#full_message relies on #detailed_message" # Expected "ruby/core/exception/full_message_spec.rb:109:23:in `instance_exec': \e[1mnew error (\e[1;4mRuntimeError\e[m\e[1m)\e[m " =~ /DETAILED MESSAGE/ to be truthy but was nil
32
40
  fails "Exception#full_message shows the caller if the exception has no backtrace" # Expected ["ruby/core/exception/full_message_spec.rb:42:21:in `instance_exec'", "<internal:corelib/basic_object.rb>:125:1:in `instance_exec'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `instance_exec'", "mspec/runner/mspec.rb:116:11:in `protect'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `protect'", "mspec/runner/context.rb:176:39:in `$$17'", "<internal:corelib/runtime.js>:1667:5:in `Opal.yieldX'", "<internal:corelib/enumerable.rb>:27:16:in `$$3'", "<internal:corelib/runtime.js>:1644:7:in `each'", "<internal:corelib/array.rb>:983:1:in `each'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `each'", "<internal:corelib/enumerable.rb>:26:7:in `Enumerable_all$ques$1'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `all?'", "mspec/runner/context.rb:176:18:in `protect'", "mspec/runner/context.rb:212:26:in `$$21'", "<internal:corelib/runtime.js>:1667:5:in `Opal.yieldX'", "mspec/runner/mspec.rb:284:7:in `repeat'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `repeat'", "mspec/runner/context.rb:204:16:in `$$20'", "<internal:corelib/runtime.js>:1644:7:in `each'", "<internal:corelib/array.rb>:983:1:in `each'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `each'", "mspec/runner/context.rb:203:18:in `process'", "mspec/runner/mspec.rb:55:10:in `describe'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `describe'", "mspec/runner/object.rb:11:10:in `describe'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `describe'", "ruby/core/exception/full_message_spec.rb:3:1:in `Opal.modules.ruby/core/exception/full_message_spec'", "<internal:corelib/runtime.js>:2692:7:in `Opal.load_normalized'", "<internal:corelib/runtime.js>:2721:5:in `load'", "<internal:corelib/kernel.rb>:535:6:in `load'", "mspec/runner/mspec.rb:99:42:in `instance_exec'", "<internal:corelib/basic_object.rb>:125:1:in `instance_exec'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `instance_exec'", "mspec/runner/mspec.rb:116:11:in `protect'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `protect'", "mspec/runner/mspec.rb:99:7:in `$$1'", "<internal:corelib/runtime.js>:1644:7:in `each'", "<internal:corelib/array.rb>:983:1:in `each'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `each'", "mspec/runner/mspec.rb:90:12:in `each_file'", "<internal:corelib/runtime.js>:1878:5:in `Opal.send2'", "<internal:corelib/runtime.js>:1866:5:in `each_file'", "mspec/runner/mspec.rb:95:5:in `files'", "mspec/runner/mspec.rb:63:5:in `process'", "tmp/mspec_nodejs.rb:3880:6:in `undefined'", "<internal:corelib/runtime.js>:2805:7:in `<main>'", "tmp/mspec_nodejs.rb:1:1:in `null'", "node:internal/modules/cjs/loader:1105:14:in `Module._compile'", "node:internal/modules/cjs/loader:1159:10:in `Module._extensions..js'", "node:internal/modules/cjs/loader:981:32:in `Module.load'", "node:internal/modules/cjs/loader:822:12:in `Module._load'", "node:internal/modules/run_main:77:12:in `executeUserEntryPoint'", "node:internal/main/run_main_module:17:47:in `undefined'"] == nil to be truthy but was false
33
41
  fails "Exception#full_message shows the exception class at the end of the first line of the message when the message contains multiple lines" # Expected "<internal:corelib/kernel.rb>:612:37:in `raise': first line ".start_with? "ruby/core/exception/full_message_spec.rb:51:in `" to be truthy but was false
34
42
  fails "Exception#full_message supports :highlight option and adds escape sequences to highlight some strings" # Expected "ruby/core/exception/full_message_spec.rb:16:21:in `instance_exec': \e[1mSome runtime error (\e[1;4mRuntimeError\e[m\e[1m)\e[m".end_with? "\e[1mSome runtime error (\e[1;4mRuntimeError\e[m\e[1m)\e[m " to be truthy but was false
@@ -40,8 +48,6 @@ opal_filter "Exception" do
40
48
  fails "Interrupt.new returns an instance of interrupt with no message given" # NoMethodError: undefined method `signo' for #<Interrupt: Interrupt>
41
49
  fails "Interrupt.new takes an optional message argument" # NoMethodError: undefined method `signo' for #<Interrupt: message>
42
50
  fails "KeyError accepts :receiver and :key options" # ArgumentError: no receiver is available
43
- fails "LocalJumpError#exit_value returns the value given to return" # Expected LocalJumpError but got: Exception (unexpected return)
44
- fails "LocalJumpError#reason returns 'return' for a return" # Expected LocalJumpError but got: Exception (unexpected return)
45
51
  fails "NameError#dup copies the name and receiver" # NoMethodError: undefined method `receiver' for #<NoMethodError: undefined method `foo' for #<MSpecEnv:0x39754>>
46
52
  fails "NameError#name returns a class variable name as a symbol" # Expected nil == "@@doesnt_exist" to be truthy but was false
47
53
  fails "NameError#receiver returns a class when an undefined class variable is called in a subclass' namespace" # NoMethodError: undefined method `receiver' for #<NameError: uninitialized class variable @@doesnt_exist in NameErrorSpecs::ReceiverClass>
@@ -54,7 +60,6 @@ opal_filter "Exception" do
54
60
  fails "NameError#to_s raises its own message for an undefined variable" # Expected "undefined method `not_defined' for #<MSpecEnv:0xb0b34>" =~ /undefined local variable or method `not_defined'/ to be truthy but was nil
55
61
  fails "NameError.new accepts a :receiver keyword argument" # ArgumentError: [NameError#initialize] wrong number of arguments (given 3, expected -2)
56
62
  fails "NoMethodError#dup copies the name, arguments and receiver" # NoMethodError: undefined method `receiver' for #<NoMethodError: undefined method `foo' for #<Object:0x11274>>
57
- fails "NoMethodError#message uses #name to display the receiver if it is a class or a module" # Expected "undefined method `foo' for #<Class:0x11230>" == "undefined method `foo' for MyClass:Class" to be truthy but was false
58
63
  fails "NoMethodError.new accepts a :receiver keyword argument" # NoMethodError: undefined method `receiver' for #<NoMethodError: msg>
59
64
  fails "SignalException can be rescued" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x52502>
60
65
  fails "SignalException cannot be trapped with Signal.trap" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x52502>
@@ -10,6 +10,8 @@ opal_filter "File" do
10
10
  fails "File.absolute_path? returns false if it's a tricky relative path" # NoMethodError: undefined method `absolute_path?' for File
11
11
  fails "File.absolute_path? returns true if it's an absolute pathname" # NoMethodError: undefined method `absolute_path?' for File
12
12
  fails "File.absolute_path? takes into consideration the platform's root" # NoMethodError: undefined method `absolute_path?' for File
13
+ fails "File.dirname when level is passed calls #to_int if passed not numeric value" # NoMethodError: undefined method `<' for #<Object:0x56914>
14
+ fails "File.dirname when level is passed raises ArgumentError if the level is negative" # Expected ArgumentError (negative level: -1) but got: ArgumentError (level can't be negative)
13
15
  fails "File.expand_path accepts objects that have a #to_path method" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
14
16
  fails "File.expand_path converts a pathname to an absolute pathname" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
15
17
  fails "File.expand_path converts a pathname to an absolute pathname, Ruby-Talk:18512" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
@@ -6,6 +6,7 @@ opal_filter "Float" do
6
6
  fails "Float#<=> returns 0 when self is Infinity and other other is infinite?=1" # Expected nil == 0 to be truthy but was false
7
7
  fails "Float#<=> returns 1 when self is Infinity and other is infinite?=-1" # Expected nil == 1 to be truthy but was false
8
8
  fails "Float#<=> returns 1 when self is Infinity and other is infinite?=nil (which means finite)" # Expected nil == 1 to be truthy but was false
9
+ fails "Float#<=> returns the correct result when one side is infinite" # Expected 0 == 1 to be truthy but was false
9
10
  fails "Float#divmod returns an [quotient, modulus] from dividing self by other" # Expected 0 to be within 18446744073709552000 +/- 0.00004
10
11
  fails "Float#inspect emits a trailing '.0' for a whole number" # Expected "50" == "50.0" to be truthy but was false
11
12
  fails "Float#inspect emits a trailing '.0' for the mantissa in e format" # Expected "100000000000000000000" == "1.0e+20" to be truthy but was false
@@ -1,10 +1,10 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_unsupported_filter "freezing" do
3
- fails "Date constants freezes MONTHNAMES, DAYNAMES, ABBR_MONTHNAMES, ABBR_DAYSNAMES" # Expected FrozenError (/frozen/) but no exception was raised ([nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "Unknown"] was returned)
4
3
  fails "FalseClass#to_s returns a frozen string" # Expected "false".frozen? to be truthy but was false
5
4
  fails "File.basename returns a new unfrozen String" # Expected "foo.rb" not to be identical to "foo.rb"
6
- fails "FrozenError#receiver should return frozen object that modification was attempted on" # Expected #<Class:#<Object:0xa315c>> to be identical to #<Object:0xa315c>
7
- fails "Hash literal does not change encoding of literal string keys during creation" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
5
+ fails "Frozen properties is frozen if the object it is created from is frozen" # Expected false == true to be truthy but was false
6
+ fails "Frozen properties will be frozen if the object it is created from becomes frozen" # Expected false == true to be truthy but was false
7
+ fails "FrozenError#receiver should return frozen object that modification was attempted on" # Expected #<Class:#<Object:0x19582>> to be identical to #<Object:0x19582>
8
8
  fails "Hash literal freezes string keys on initialization" # NotImplementedError: String#reverse! not supported. Mutable String methods are not supported in Opal.
9
9
  fails "Kernel#clone with freeze: anything else raises ArgumentError when passed not true/false/nil" # Expected ArgumentError (/unexpected value for freeze: Integer/) but got: ArgumentError (unexpected value for freeze: Number)
10
10
  fails "Kernel#clone with freeze: false calls #initialize_clone with kwargs freeze: false even if #initialize_clone only takes a single argument" # Expected ArgumentError (wrong number of arguments (given 2, expected 1)) but got: ArgumentError ([Clone#initialize_clone] wrong number of arguments (given 2, expected 1))
@@ -31,58 +31,14 @@ opal_unsupported_filter "freezing" do
31
31
  fails "String#-@ returns a frozen copy if the String is not frozen" # Expected "foo".frozen? to be truthy but was false
32
32
  fails "String#<< raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#<< not supported. Mutable String methods are not supported in Opal.)
33
33
  fails "String#<< with Integer raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#<< not supported. Mutable String methods are not supported in Opal.)
34
- fails "String#capitalize! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#capitalize! not supported. Mutable String methods are not supported in Opal.)
35
- fails "String#chomp! raises a FrozenError on a frozen instance when it is modified" # Expected FrozenError but got: NotImplementedError (String#chomp! not supported. Mutable String methods are not supported in Opal.)
36
- fails "String#chomp! raises a FrozenError on a frozen instance when it would not be modified" # Expected FrozenError but got: NotImplementedError (String#chomp! not supported. Mutable String methods are not supported in Opal.)
37
- fails "String#chop! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#chop! not supported. Mutable String methods are not supported in Opal.)
38
- fails "String#chop! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#chop! not supported. Mutable String methods are not supported in Opal.)
39
- fails "String#clear raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#clear not supported. Mutable String methods are not supported in Opal.)
40
34
  fails "String#concat raises a FrozenError when self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `concat' for "hello")
41
35
  fails "String#concat with Integer raises a FrozenError when self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `concat' for "hello")
42
- fails "String#delete! raises a FrozenError when self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `delete!' for "hello")
43
- fails "String#delete_prefix! raises a FrozenError when self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `delete_prefix!' for "hello")
44
- fails "String#delete_suffix! raises a FrozenError when self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `delete_suffix!' for "hello")
45
- fails "String#downcase! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#downcase! not supported. Mutable String methods are not supported in Opal.)
46
- fails "String#encode! raises a FrozenError when called on a frozen String when it's a no-op" # NoMethodError: undefined method `default_internal' for Encoding
47
- fails "String#encode! raises a FrozenError when called on a frozen String" # NoMethodError: undefined method `default_internal' for Encoding
48
- fails "String#force_encoding raises a FrozenError if self is frozen" # Expected FrozenError but no exception was raised ("abcd" was returned)
49
- fails "String#freeze doesn't produce the same object for different instances of literals in the source" # Expected "abc" not to be identical to "abc"
50
- fails "String#gsub! with pattern and block raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#gsub! not supported. Mutable String methods are not supported in Opal.)
51
- fails "String#gsub! with pattern and replacement raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#gsub! not supported. Mutable String methods are not supported in Opal.)
52
36
  fails "String#initialize with an argument raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but no exception was raised (nil was returned)
53
37
  fails "String#initialize with an argument raises a FrozenError on a frozen instance when self-replacing" # Expected FrozenError but no exception was raised (nil was returned)
54
- fails "String#initialize with no arguments does not raise an exception when frozen" # Expected nil to be identical to "hello"
55
- fails "String#insert with index, other raises a FrozenError if self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `insert' for "abcd")
56
- fails "String#lstrip! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#lstrip! not supported. Mutable String methods are not supported in Opal.)
57
- fails "String#lstrip! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#lstrip! not supported. Mutable String methods are not supported in Opal.)
58
38
  fails "String#next! raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#next! not supported. Mutable String methods are not supported in Opal.)
59
- fails "String#prepend raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#prepend not supported. Mutable String methods are not supported in Opal.)
60
39
  fails "String#replace raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NoMethodError (undefined method `replace' for "hello")
61
40
  fails "String#replace raises a FrozenError on a frozen instance when self-replacing" # Expected FrozenError but got: NoMethodError (undefined method `replace' for "hello")
62
- fails "String#reverse! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#reverse! not supported. Mutable String methods are not supported in Opal.)
63
- fails "String#reverse! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#reverse! not supported. Mutable String methods are not supported in Opal.)
64
- fails "String#rstrip! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NoMethodError (undefined method `rstrip!' for " hello ")
65
- fails "String#rstrip! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NoMethodError (undefined method `rstrip!' for "hello")
66
- fails "String#setbyte raises a FrozenError if self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `setbyte' for "cold")
67
- fails "String#slice! Range raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
68
- fails "String#slice! Range raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
69
- fails "String#slice! with Regexp raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
70
- fails "String#slice! with Regexp raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
71
- fails "String#slice! with Regexp, index raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
72
- fails "String#slice! with String raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
73
- fails "String#slice! with index raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
74
- fails "String#slice! with index, length raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
75
- fails "String#squeeze! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#squeeze! not supported. Mutable String methods are not supported in Opal.)
76
- fails "String#strip! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#strip! not supported. Mutable String methods are not supported in Opal.)
77
- fails "String#strip! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#strip! not supported. Mutable String methods are not supported in Opal.)
78
- fails "String#sub! with pattern and block raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#sub! not supported. Mutable String methods are not supported in Opal.)
79
- fails "String#sub! with pattern, replacement raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#sub! not supported. Mutable String methods are not supported in Opal.)
80
41
  fails "String#succ! raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#succ! not supported. Mutable String methods are not supported in Opal.)
81
- fails "String#swapcase! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#swapcase! not supported. Mutable String methods are not supported in Opal.)
82
- fails "String#tr! raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#tr! not supported. Mutable String methods are not supported in Opal.)
83
- fails "String#tr_s! raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#tr_s! not supported. Mutable String methods are not supported in Opal.)
84
- fails "String#upcase! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#upcase! not supported. Mutable String methods are not supported in Opal.)
85
- fails "Time#localtime on a frozen time does not raise an error if already in the right time zone" # NoMethodError: undefined method `localtime' for 2022-12-07 05:39:36 +0100
86
- fails "Time#localtime on a frozen time raises a RuntimeError if the time has a different time zone" # Expected RuntimeError but got: NoMethodError (undefined method `localtime' for 2007-01-09 12:00:00 UTC)
87
- fails "TrueClass#to_s returns a frozen string" # Expected "true".frozen? to be truthy but was false
42
+ fails "Time#localtime on a frozen time does not raise an error if already in the right time zone" # NoMethodError: undefined method `localtime' for 2023-09-20 23:47:50 +0200
43
+ fails "TrueClass#to_s returns a frozen string" # Expected "true".frozen? to be truthy but was false
88
44
  end
@@ -21,31 +21,19 @@ opal_filter "Hash" do
21
21
  fails "Hash#inspect does not call #to_str on the object returned from #inspect when it is not a String" # Expected "{\"a\"=>#<MockObject:0x40e02>}" =~ /^\{:a=>#<MockObject:0x[0-9a-f]+>\}$/ to be truthy but was nil
22
22
  fails "Hash#inspect does not call #to_str on the object returned from #to_s when it is not a String" # Exception: Cannot convert object to primitive value
23
23
  fails "Hash#invert compares new keys with eql? semantics" # Expected "b" == "a" to be truthy but was false
24
- fails "Hash#rehash removes duplicate keys for large hashes" # Expected 102 == 101 to be truthy but was false
25
- fails "Hash#rehash removes duplicate keys" # Expected 2 == 1 to be truthy but was false
26
24
  fails "Hash#store does not dispatch to hash for Boolean, Integer, Float, String, or Symbol" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x627dc @method="store" @object=nil>
27
25
  fails "Hash#store keeps the existing String key in the hash if there is a matching one" # Expected "foo" not to be identical to "foo"
28
- fails "Hash#to_h with block does not coerce returned pair to Array with #to_a" # Expected TypeError (/wrong element type MockObject/) but got: TypeError (wrong element type NilClass at 0 (expected array))
29
- fails "Hash#to_h with block raises ArgumentError if block returns longer or shorter array" # Expected ArgumentError (/element has wrong array length/) but got: ArgumentError (wrong array length at 0 (expected 2, was 3))
30
- fails "Hash#to_h with block raises TypeError if block returns something other than Array" # Expected TypeError (/wrong element type String/) but got: TypeError (wrong element type NilClass at 0 (expected array))
31
26
  fails "Hash#to_proc the returned proc has an arity of 1" # Expected -1 == 1 to be truthy but was false
32
27
  fails "Hash#to_proc the returned proc is a lambda" # Expected #<Proc:0x42df6>.lambda? to be truthy but was false
33
28
  fails "Hash#to_s calls #to_s on the object returned from #inspect if the Object isn't a String" # Expected "{\"a\"=>abc}" == "{:a=>abc}" to be truthy but was false
34
29
  fails "Hash#to_s does not call #to_s on a String returned from #inspect" # Expected "{\"a\"=>\"abc\"}" == "{:a=>\"abc\"}" to be truthy but was false
35
30
  fails "Hash#to_s does not call #to_str on the object returned from #inspect when it is not a String" # Expected "{\"a\"=>#<MockObject:0xb4f9a>}" =~ /^\{:a=>#<MockObject:0x[0-9a-f]+>\}$/ to be truthy but was nil
36
31
  fails "Hash#to_s does not call #to_str on the object returned from #to_s when it is not a String" # Exception: Cannot convert object to primitive value
37
- fails "Hash#transform_keys allows a combination of hash and block argument" # ArgumentError: [Hash#transform_keys] wrong number of arguments (given 1, expected 0)
38
- fails "Hash#transform_keys allows a hash argument" # ArgumentError: [Hash#transform_keys] wrong number of arguments (given 1, expected 0)
39
- fails "Hash#transform_keys allows a partial transformation of keys when using a hash argument" # ArgumentError: [Hash#transform_keys] wrong number of arguments (given 1, expected 0)
40
- fails "Hash#transform_keys! allows a hash argument" # ArgumentError: [Hash#transform_keys!] wrong number of arguments (given 1, expected 0)
41
- fails "Hash#transform_keys! on frozen instance raises a FrozenError on hash argument" # Expected FrozenError but got: ArgumentError ([Hash#transform_keys!] wrong number of arguments (given 1, expected 0))
42
- fails "Hash#transform_keys! prevents conflicts between new keys and old ones" # Expected {"e"=>1} == {"b"=>1, "c"=>2, "d"=>3, "e"=>4} to be truthy but was false
43
- fails "Hash#transform_keys! returns the processed keys and non evaluated keys if we break from the block" # Expected {"c"=>1, "d"=>4} == {"b"=>1, "c"=>2, "d"=>4} to be truthy but was false
44
- fails "Hash.[] raises for elements that are not arrays" # Expected ArgumentError but no exception was raised (nil was returned)
45
32
  fails "Hash.ruby2_keywords_hash copies instance variables" # Expected nil == 42 to be truthy but was false
46
33
  fails "Hash.ruby2_keywords_hash raises TypeError for non-Hash" # Expected TypeError but no exception was raised (nil was returned)
47
34
  fails "Hash.ruby2_keywords_hash returns a copy of a Hash and marks the copy as a keywords Hash" # Expected false == true to be truthy but was false
48
35
  fails "Hash.ruby2_keywords_hash returns an instance of the subclass if called on an instance of a subclass of Hash" # Expected false == true to be truthy but was false
49
36
  fails "Hash.ruby2_keywords_hash? raises TypeError for non-Hash" # Expected TypeError but no exception was raised (false was returned)
50
37
  fails "Hash.ruby2_keywords_hash? returns true if the Hash is a keywords Hash marked by Module#ruby2_keywords" # Expected false == true to be truthy but was false
38
+ fails "Hash.try_convert sends #to_hash to the argument and raises TypeError if it's not a kind of Hash" # Expected TypeError (can't convert MockObject to Hash (MockObject#to_hash gives Object)) but got: TypeError (can't convert MockObject into Hash (MockObject#to_hash gives Object))
51
39
  end
@@ -1,9 +1,5 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Integer" do
3
- fails "Bignum is deprecated" # NameError: uninitialized constant Bignum
4
- fails "Bignum is unified into Integer" # NameError: uninitialized constant Bignum
5
- fails "Fixnum is deprecated" # Expected warning to match: /constant ::Fixnum is deprecated/ but got: ""
6
- fails "Fixnum is unified into Integer" # Expected Number to be identical to Integer
7
3
  fails "Integer is the class of both small and large integers" # Expected Number to be identical to Integer
8
4
  fails "Integer#& fixnum raises a TypeError when passed a Float" # Expected TypeError but no exception was raised (3 was returned)
9
5
  fails "Integer#** bignum switch to a Float when the values is too big" # Expected warning to match: /warning: in a\*\*b, b may be too big/ but got: ""
@@ -19,13 +15,13 @@ opal_filter "Integer" do
19
15
  fails "Integer#<< (with n << m) fixnum calls #to_int to convert the argument to an Integer" # Expected 3 == 0 to be truthy but was false
20
16
  fails "Integer#<< (with n << m) fixnum returns -1 when n < 0, m < 0 and n > -(2**-m)" # Expected -7 == -1 to be truthy but was false
21
17
  fails "Integer#<< (with n << m) fixnum returns 0 when n > 0, m < 0 and n < 2**-m" # Expected 7 == 0 to be truthy but was false
22
- fails "Integer#<< (with n << m) when m is a bignum or larger than int raises NoMemoryError when m > 0 and n != 0" # Expected NoMemoryError but no exception was raised (1 was returned)
18
+ fails "Integer#<< (with n << m) when m is a bignum or larger than int raises RangeError when m > 0 and n != 0" # Expected RangeError (shift width too big) but no exception was raised (1 was returned)
23
19
  fails "Integer#<< (with n << m) when m is a bignum or larger than int returns -1 when m < 0 and n < 0" # Expected 0 == -1 to be truthy but was false
24
20
  fails "Integer#<< (with n << m) when m is a bignum or larger than int returns 0 when m < 0 and n >= 0" # Expected 1 == 0 to be truthy but was false
25
21
  fails "Integer#>> (with n >> m) fixnum calls #to_int to convert the argument to an Integer" # Expected 8 == 0 to be truthy but was false
26
22
  fails "Integer#>> (with n >> m) fixnum returns -1 when n < 0, m > 0 and n > -(2**m)" # Expected -7 == -1 to be truthy but was false
27
23
  fails "Integer#>> (with n >> m) fixnum returns 0 when n > 0, m > 0 and n < 2**m" # Expected 7 == 0 to be truthy but was false
28
- fails "Integer#>> (with n >> m) when m is a bignum or larger than int raises NoMemoryError when m < 0 and n != 0" # Expected NoMemoryError but no exception was raised (1 was returned)
24
+ fails "Integer#>> (with n >> m) when m is a bignum or larger than int raises RangeError when m < 0 and n != 0" # Expected RangeError (shift width too big) but no exception was raised (1 was returned)
29
25
  fails "Integer#>> (with n >> m) when m is a bignum or larger than int returns -1 when m > 0 and n < 0" # Expected 0 == -1 to be truthy but was false
30
26
  fails "Integer#>> (with n >> m) when m is a bignum or larger than int returns 0 when m > 0 and n >= 0" # Expected 1 == 0 to be truthy but was false
31
27
  fails "Integer#[] fixnum when index and length passed ensures n[i, len] equals to (n >> i) & ((1 << len) - 1)" # ArgumentError: [Number#[]] wrong number of arguments (given 2, expected 1)
@@ -43,6 +39,7 @@ opal_filter "Integer" do
43
39
  fails "Integer#^ fixnum raises a TypeError when passed a Float" # Expected TypeError but no exception was raised (0 was returned)
44
40
  fails "Integer#^ fixnum returns self bitwise EXCLUSIVE OR other" # Expected 5 == 18446744078004520000 to be truthy but was false
45
41
  fails "Integer#^ fixnum returns self bitwise XOR other when one operand is negative" # Expected -3 == -8589934593 to be truthy but was false
42
+ fails "Integer#ceildiv returns a quotient of division which is rounded up to the nearest integer" # NoMethodError: undefined method `ceildiv' for 0
46
43
  fails "Integer#chr with an encoding argument accepts a String as an argument" # Expected to not get Exception but got: ArgumentError (unknown encoding name - euc-jp)
47
44
  fails "Integer#chr with an encoding argument raises RangeError if self is invalid as a codepoint in the specified encoding" # Expected RangeError but no exception was raised ("\x80" was returned)
48
45
  fails "Integer#chr with an encoding argument raises a RangeError if self is too large" # Expected RangeError but no exception was raised ("膀" was returned)
@@ -84,4 +81,6 @@ opal_filter "Integer" do
84
81
  fails "Integer#| fixnum returns self bitwise OR other when one operand is negative" # Expected -3 == -8589934593 to be truthy but was false
85
82
  fails "Integer#| fixnum returns self bitwise OR other" # Expected 65535 == 18446744073709617000 to be truthy but was false
86
83
  fails "Integer.sqrt returns the integer square root of the argument" # TypeError: can't convert Number into Integer (Number#to_int gives Number)
84
+ fails "Integer.try_convert responds with a different error message when it raises a TypeError, depending on the type of the non-Integer object :to_int returns" # Expected TypeError (can't convert MockObject to Integer (MockObject#to_int gives String)) but got: TypeError (can't convert MockObject into Integer (MockObject#to_int gives String))
85
+ fails "Integer.try_convert sends #to_int to the argument and raises TypeError if it's not a kind of Integer" # Expected TypeError (can't convert MockObject to Integer (MockObject#to_int gives Object)) but got: TypeError (can't convert MockObject into Integer (MockObject#to_int gives Object))
87
86
  end
@@ -1,7 +1,6 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Kernel" do
3
3
  fails "Kernel#=== does not call #object_id nor #equal? but still returns true for #== or #=== on the same object" # Mock '#<Object:0x2514>' expected to receive object_id("any_args") exactly 0 times but received it 2 times
4
- fails "Kernel#=~ returns nil matching any object" # Expected false to be nil
5
4
  fails "Kernel#Float for hexadecimal literals with binary exponent allows embedded _ in a number on either side of the P" # ArgumentError: invalid value for Float(): "0x1_0P10"
6
5
  fails "Kernel#Float for hexadecimal literals with binary exponent allows embedded _ in a number on either side of the p" # ArgumentError: invalid value for Float(): "0x1_0p10"
7
6
  fails "Kernel#Float for hexadecimal literals with binary exponent allows hexadecimal points on the left side of the 'P'" # ArgumentError: invalid value for Float(): "0x1.8P0"
@@ -14,25 +13,6 @@ opal_filter "Kernel" do
14
13
  fails "Kernel#Float for hexadecimal literals with binary exponent returns 0 for '0x1p-10000'" # ArgumentError: invalid value for Float(): "0x1p-10000"
15
14
  fails "Kernel#Float for hexadecimal literals with binary exponent returns Infinity for '0x1P10000'" # ArgumentError: invalid value for Float(): "0x1P10000"
16
15
  fails "Kernel#Float for hexadecimal literals with binary exponent returns Infinity for '0x1p10000'" # ArgumentError: invalid value for Float(): "0x1p10000"
17
- fails "Kernel#Float when passed exception: false and invalid input swallows an error" # ArgumentError: [Object#Float] wrong number of arguments (given 2, expected 1)
18
- fails "Kernel#Float when passed exception: false and nil swallows it" # ArgumentError: [Object#Float] wrong number of arguments (given 2, expected 1)
19
- fails "Kernel#Float when passed exception: false and valid input returns a Float number" # ArgumentError: [Object#Float] wrong number of arguments (given 2, expected 1)
20
- fails "Kernel#Integer raises a TypeError when to_int returns not-an-Integer object and to_i returns nil" # Expected TypeError but no exception was raised ("1" was returned)
21
- fails "Kernel#Integer return a result of to_i when to_int does not return an Integer" # Expected "1" == 42 to be truthy but was false
22
- fails "Kernel#Integer when passed exception: false and an argument that contains a period swallows an error" # TypeError: no implicit conversion of Hash into Integer
23
- fails "Kernel#Integer when passed exception: false and an empty string swallows an error" # TypeError: no implicit conversion of Hash into Integer
24
- fails "Kernel#Integer when passed exception: false and invalid argument swallows an error" # ArgumentError: [MSpecEnv#Integer] wrong number of arguments (given 3, expected -2)
25
- fails "Kernel#Integer when passed exception: false and multiple leading -s swallows an error" # TypeError: no implicit conversion of Hash into Integer
26
- fails "Kernel#Integer when passed exception: false and multiple trailing -s swallows an error" # TypeError: no implicit conversion of Hash into Integer
27
- fails "Kernel#Integer when passed exception: false and no to_int or to_i methods exist swallows an error" # ArgumentError: base specified for non string value
28
- fails "Kernel#Integer when passed exception: false and passed Infinity swallows an error" # ArgumentError: base specified for non string value
29
- fails "Kernel#Integer when passed exception: false and passed NaN swallows an error" # ArgumentError: base specified for non string value
30
- fails "Kernel#Integer when passed exception: false and passed a String that can't be converted to an Integer swallows an error" # TypeError: no implicit conversion of Hash into Integer
31
- fails "Kernel#Integer when passed exception: false and passed a String that contains numbers normally parses it and returns an Integer" # TypeError: no implicit conversion of Hash into Integer
32
- fails "Kernel#Integer when passed exception: false and passed nil swallows an error" # ArgumentError: base specified for non string value
33
- fails "Kernel#Integer when passed exception: false and to_i returns a value that is not an Integer swallows an error" # ArgumentError: base specified for non string value
34
- fails "Kernel#Integer when passed exception: false and to_int returns nil and no to_i exists swallows an error" # ArgumentError: base specified for non string value
35
- fails "Kernel#Integer when passed exception: false and valid argument returns an Integer number" # ArgumentError: [MSpecEnv#Integer] wrong number of arguments (given 3, expected -2)
36
16
  fails "Kernel#Pathname returns same argument when called with a pathname argument" # Expected #<Pathname:0xb23c2 @path="foo">.equal? #<Pathname:0xb23c4 @path="foo"> to be truthy but was false
37
17
  fails "Kernel#String calls #to_s if #respond_to?(:to_s) returns true" # TypeError: no implicit conversion of MockObject into String
38
18
  fails "Kernel#String raises a TypeError if #to_s is not defined, even though #respond_to?(:to_s) returns true" # Expected TypeError but got: NoMethodError (undefined method `to_s' for #<Object:0x2961a>)
@@ -67,6 +47,7 @@ opal_filter "Kernel" do
67
47
  fails "Kernel#eval evaluates string with given filename and negative linenumber" # Expected "unexpected token $end" =~ /speccing.rb:-100:.+/ to be truthy but was nil
68
48
  fails "Kernel#eval includes file and line information in syntax error" # Expected "unexpected token $end" =~ /speccing.rb:1:.+/ to be truthy but was nil
69
49
  fails "Kernel#eval raises a LocalJumpError if there is no lambda-style closure in the chain" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x4be5a>
50
+ fails "Kernel#eval returns from the method calling #eval when evaluating 'return' in BEGIN" # SyntaxError: Unsupported sexp: preexe
70
51
  fails "Kernel#eval unwinds through a Proc-style closure and returns from a lambda-style closure in the closure chain" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x4be5a>
71
52
  fails "Kernel#eval updates a local in a scope above a surrounding block scope" # Expected 1 == 2 to be truthy but was false
72
53
  fails "Kernel#eval updates a local in a scope above when modified in a nested block scope" # NoMethodError: undefined method `es' for #<MSpecEnv:0x4be5a>
@@ -90,6 +71,7 @@ opal_filter "Kernel" do
90
71
  fails "Kernel#initialize_copy does nothing if the argument is the same as the receiver" # Expected nil.equal? #<Object:0x3cb42> to be truthy but was false
91
72
  fails "Kernel#initialize_copy raises FrozenError if the receiver is frozen" # Expected FrozenError but no exception was raised (nil was returned)
92
73
  fails "Kernel#initialize_copy raises TypeError if the objects are of different class" # Expected TypeError (initialize_copy should take same class object) but no exception was raised (nil was returned)
74
+ fails "Kernel#initialize_copy returns self" # Expected nil.equal? #<Object:0x66548> to be truthy but was false
93
75
  fails "Kernel#inspect returns a String for an object without #class method" # NoMethodError: undefined method `class' for #<Object:0x42c12>
94
76
  fails "Kernel#instance_variable_set on frozen objects accepts unicode instance variable names" # NameError: '@💙' is not allowed as an instance variable name
95
77
  fails "Kernel#instance_variable_set on frozen objects raises for frozen objects" # Expected NameError but got: FrozenError (can't modify frozen NilClass: )
@@ -97,8 +79,11 @@ opal_filter "Kernel" do
97
79
  fails "Kernel#is_a? does not take into account `class` method overriding" # TypeError: can't define singleton
98
80
  fails "Kernel#kind_of? does not take into account `class` method overriding" # TypeError: can't define singleton
99
81
  fails "Kernel#local_variables is accessible from bindings" # Expected [] to include "a"
100
- fails "Kernel#method can be called even if we only repond_to_missing? method, true" # NameError: undefined method `handled_privately' for class `KernelSpecs::RespondViaMissing'
82
+ fails "Kernel#method can be called even if we only respond_to_missing? method, true" # NameError: undefined method `handled_privately' for class `KernelSpecs::RespondViaMissing'
101
83
  fails "Kernel#method can call a #method_missing accepting zero or one arguments" # NameError: undefined method `foo' for class `#<Class:0x4bc80>'
84
+ fails "Kernel#method converts the given name to a String using #to_str calls #to_str to convert the given name to a String" # Mock 'method-name' expected to receive to_str("any_args") exactly 1 times but received it 0 times
85
+ fails "Kernel#method converts the given name to a String using #to_str raises a NoMethodError if the given argument raises a NoMethodError during type coercion to a String" # Expected NoMethodError but got: NameError (undefined method `#<MockObject:0x9e5a6>' for class `Class')
86
+ fails "Kernel#method converts the given name to a String using #to_str raises a TypeError if the given name can't be converted to a String" # Expected TypeError but got: NameError (undefined method `' for class `Class')
102
87
  fails "Kernel#method returns a method object if respond_to_missing?(method) is true" # NameError: undefined method `handled_publicly' for class `KernelSpecs::RespondViaMissing'
103
88
  fails "Kernel#method the returned method object if respond_to_missing?(method) calls #method_missing with a Symbol name" # NameError: undefined method `handled_publicly' for class `KernelSpecs::RespondViaMissing'
104
89
  fails "Kernel#method will see an alias of the original method as == when in a derived class" # Expected #<Method: KernelSpecs::B#aliased_pub_method (defined in KernelSpecs::B in ruby/core/kernel/fixtures/classes.rb:164)> == #<Method: KernelSpecs::B#pub_method (defined in KernelSpecs::A in ruby/core/kernel/fixtures/classes.rb:164)> to be truthy but was false
@@ -134,7 +119,10 @@ opal_filter "Kernel" do
134
119
  fails "Kernel#respond_to? throws a type error if argument can't be coerced into a Symbol" # Expected TypeError (/is not a symbol nor a string/) but no exception was raised (false was returned)
135
120
  fails "Kernel#respond_to_missing? causes #respond_to? to return false if called and returning nil" # Expected nil to be false
136
121
  fails "Kernel#respond_to_missing? causes #respond_to? to return true if called and not returning false" # Expected "glark" to be true
122
+ fails "Kernel#singleton_class for an IO object with a replaced singleton class looks up singleton methods from the fresh singleton class after an object instance got a new one" # NoMethodError: undefined method `reopen' for #<File:0x6c204 @fd="ruby/core/kernel/singleton_class_spec.rb" @flags="r" @eof=false @closed="write">
137
123
  fails "Kernel#singleton_class raises TypeError for Symbol" # Expected TypeError but no exception was raised (#<Class:#<String:0x53aaa>> was returned)
124
+ fails "Kernel#singleton_class raises TypeError for a frozen deduplicated String" # Expected TypeError (can't define singleton) but no exception was raised (#<Class:#<String:0x6c200>> was returned)
125
+ fails "Kernel#singleton_class returns a frozen singleton class if object is frozen" # Expected false to be true
138
126
  fails "Kernel#singleton_method find a method defined on the singleton class" # NoMethodError: undefined method `singleton_method' for #<Object:0x4540a>
139
127
  fails "Kernel#singleton_method only looks at singleton methods and not at methods in the class" # Expected NoMethodError == NameError to be truthy but was false
140
128
  fails "Kernel#singleton_method raises a NameError if there is no such method" # Expected NoMethodError == NameError to be truthy but was false
@@ -323,31 +311,12 @@ opal_filter "Kernel" do
323
311
  fails "Kernel.Float for hexadecimal literals with binary exponent returns 0 for '0x1p-10000'" # ArgumentError: invalid value for Float(): "0x1p-10000"
324
312
  fails "Kernel.Float for hexadecimal literals with binary exponent returns Infinity for '0x1P10000'" # ArgumentError: invalid value for Float(): "0x1P10000"
325
313
  fails "Kernel.Float for hexadecimal literals with binary exponent returns Infinity for '0x1p10000'" # ArgumentError: invalid value for Float(): "0x1p10000"
326
- fails "Kernel.Float when passed exception: false and invalid input swallows an error" # ArgumentError: [Kernel.Float] wrong number of arguments (given 2, expected 1)
327
- fails "Kernel.Float when passed exception: false and nil swallows it" # ArgumentError: [Kernel.Float] wrong number of arguments (given 2, expected 1)
328
- fails "Kernel.Float when passed exception: false and valid input returns a Float number" # ArgumentError: [Kernel.Float] wrong number of arguments (given 2, expected 1)
329
- fails "Kernel.Integer raises a TypeError when to_int returns not-an-Integer object and to_i returns nil" # Expected TypeError but no exception was raised ("1" was returned)
330
- fails "Kernel.Integer return a result of to_i when to_int does not return an Integer" # Expected "1" == 42 to be truthy but was false
331
- fails "Kernel.Integer when passed exception: false and an argument that contains a period swallows an error" # TypeError: no implicit conversion of Hash into Integer
332
- fails "Kernel.Integer when passed exception: false and an empty string swallows an error" # TypeError: no implicit conversion of Hash into Integer
333
- fails "Kernel.Integer when passed exception: false and invalid argument swallows an error" # ArgumentError: [MSpecEnv#Integer] wrong number of arguments (given 3, expected -2)
334
- fails "Kernel.Integer when passed exception: false and multiple leading -s swallows an error" # TypeError: no implicit conversion of Hash into Integer
335
- fails "Kernel.Integer when passed exception: false and multiple trailing -s swallows an error" # TypeError: no implicit conversion of Hash into Integer
336
- fails "Kernel.Integer when passed exception: false and no to_int or to_i methods exist swallows an error" # ArgumentError: base specified for non string value
337
- fails "Kernel.Integer when passed exception: false and passed Infinity swallows an error" # ArgumentError: base specified for non string value
338
- fails "Kernel.Integer when passed exception: false and passed NaN swallows an error" # ArgumentError: base specified for non string value
339
- fails "Kernel.Integer when passed exception: false and passed a String that can't be converted to an Integer swallows an error" # TypeError: no implicit conversion of Hash into Integer
340
- fails "Kernel.Integer when passed exception: false and passed a String that contains numbers normally parses it and returns an Integer" # TypeError: no implicit conversion of Hash into Integer
341
- fails "Kernel.Integer when passed exception: false and passed nil swallows an error" # ArgumentError: base specified for non string value
342
- fails "Kernel.Integer when passed exception: false and to_i returns a value that is not an Integer swallows an error" # ArgumentError: base specified for non string value
343
- fails "Kernel.Integer when passed exception: false and to_int returns nil and no to_i exists swallows an error" # ArgumentError: base specified for non string value
344
- fails "Kernel.Integer when passed exception: false and valid argument returns an Integer number" # ArgumentError: [MSpecEnv#Integer] wrong number of arguments (given 3, expected -2)
314
+ fails "Kernel.Rational raises a TypeError if the first argument is a Symbol" # Expected TypeError but no exception was raised ((0/1) was returned)
315
+ fails "Kernel.Rational raises a TypeError if the second argument is a Symbol" # Expected TypeError but got: ZeroDivisionError (divided by 0)
316
+ fails "Kernel.Rational when passed a Numeric calls #to_r to convert the first argument to a Rational" # NoMethodError: undefined method `/' for #<RationalSpecs::SubNumeric:0x8bc3a @value=(2/1)>
345
317
  fails "Kernel.Rational when passed a String converts the String to a Rational using the same method as String#to_r" # Expected (0/1) == (13/25) to be truthy but was false
346
318
  fails "Kernel.Rational when passed a String does not use the same method as Float#to_r" # Expected (5404319552844595/9007199254740992) == (3/5) to be truthy but was false
347
- fails "Kernel.Rational when passed a String raises a TypeError if the first argument is a Symbol" # Expected TypeError but no exception was raised ((0/1) was returned)
348
- fails "Kernel.Rational when passed a String raises a TypeError if the second argument is a Symbol" # Expected TypeError but got: ZeroDivisionError (divided by 0)
349
319
  fails "Kernel.Rational when passed a String scales the Rational value of the first argument by the Rational value of the second" # ZeroDivisionError: divided by 0
350
- fails "Kernel.Rational when passed a String when passed a Numeric calls #to_r to convert the first argument to a Rational" # NoMethodError: undefined method `/' for #<RationalSpecs::SubNumeric:0x2b4dc @value=(2/1)>
351
320
  fails "Kernel.Rational when passed exception: false and [anything, non-Numeric] swallows an error" # ArgumentError: [MSpecEnv#Rational] wrong number of arguments (given 3, expected -2)
352
321
  fails "Kernel.Rational when passed exception: false and [non-Numeric, Numeric] swallows an error" # ArgumentError: [MSpecEnv#Rational] wrong number of arguments (given 3, expected -2)
353
322
  fails "Kernel.Rational when passed exception: false and [non-Numeric] swallows an error" # NoMethodError: undefined method `to_i' for {"exception"=>false}