opal 1.0.3 → 1.1.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (408) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +13 -12
  3. data/.gitattributes +1 -1
  4. data/.github/FUNDING.yml +1 -0
  5. data/.github/workflows/build.yml +90 -0
  6. data/.jshintrc +1 -1
  7. data/.overcommit.yml +35 -0
  8. data/.rubocop.yml +44 -7
  9. data/{.rubocop_todo.yml → .rubocop/todo.yml} +4 -5
  10. data/CHANGELOG.md +152 -1
  11. data/Gemfile +2 -3
  12. data/HACKING.md +2 -9
  13. data/LICENSE +1 -1
  14. data/README.md +21 -18
  15. data/UNRELEASED.md +4 -2
  16. data/benchmark-ips/bm_array_pop_1.rb +8 -0
  17. data/benchmark-ips/bm_array_shift.rb +7 -0
  18. data/benchmark-ips/bm_js_symbols_vs_strings.rb +7 -2
  19. data/benchmark-ips/class_shovel_vs_singleton_class.rb +16 -0
  20. data/bin/build-browser-source-map-support +4 -0
  21. data/bin/format-filters +54 -0
  22. data/bin/git-submodule-fast-install +49 -0
  23. data/bin/remove-filters +39 -0
  24. data/bin/setup +4 -0
  25. data/bin/yarn +11 -0
  26. data/docs/releasing.md +18 -0
  27. data/docs/roda-sprockets.md +86 -0
  28. data/docs/sinatra.md +5 -12
  29. data/examples/rack/Gemfile +1 -0
  30. data/examples/rack/app/application.rb +3 -0
  31. data/examples/rack/config.ru +5 -4
  32. data/exe/opal-repl +2 -83
  33. data/lib/opal/ast/builder.rb +1 -1
  34. data/lib/opal/builder.rb +2 -10
  35. data/lib/opal/builder_processors.rb +1 -1
  36. data/lib/opal/cli.rb +4 -1
  37. data/lib/opal/cli_options.rb +11 -3
  38. data/lib/opal/cli_runners.rb +27 -37
  39. data/lib/opal/cli_runners/applescript.rb +5 -44
  40. data/lib/opal/cli_runners/chrome.js +7 -35
  41. data/lib/opal/cli_runners/chrome.rb +75 -17
  42. data/lib/opal/cli_runners/compiler.rb +17 -0
  43. data/lib/opal/cli_runners/nashorn.rb +9 -43
  44. data/lib/opal/cli_runners/nodejs.rb +18 -47
  45. data/lib/opal/cli_runners/server.rb +18 -6
  46. data/lib/opal/cli_runners/source-map-support-browser.js +6449 -0
  47. data/lib/opal/cli_runners/source-map-support-node.js +3704 -0
  48. data/lib/opal/cli_runners/source-map-support.js +639 -0
  49. data/lib/opal/cli_runners/system_runner.rb +45 -0
  50. data/lib/opal/compiler.rb +57 -29
  51. data/lib/opal/config.rb +0 -5
  52. data/lib/opal/erb.rb +1 -1
  53. data/lib/opal/magic_comments.rb +34 -0
  54. data/lib/opal/nodes/args/arity_check.rb +2 -1
  55. data/lib/opal/nodes/base.rb +1 -1
  56. data/lib/opal/nodes/call.rb +1 -4
  57. data/lib/opal/nodes/def.rb +2 -0
  58. data/lib/opal/nodes/iter.rb +1 -1
  59. data/lib/opal/nodes/literal.rb +19 -14
  60. data/lib/opal/nodes/logic.rb +5 -80
  61. data/lib/opal/nodes/masgn.rb +2 -0
  62. data/lib/opal/nodes/rescue.rb +1 -1
  63. data/lib/opal/nodes/super.rb +24 -10
  64. data/lib/opal/nodes/top.rb +5 -4
  65. data/lib/opal/parser/with_c_lexer.rb +2 -1
  66. data/lib/opal/parser/with_ruby_lexer.rb +1 -1
  67. data/lib/opal/path_reader.rb +2 -2
  68. data/lib/opal/paths.rb +8 -5
  69. data/lib/opal/repl.rb +103 -0
  70. data/lib/opal/rewriter.rb +4 -0
  71. data/lib/opal/rewriters/for_rewriter.rb +1 -1
  72. data/lib/opal/rewriters/js_reserved_words.rb +7 -7
  73. data/lib/opal/rewriters/numblocks.rb +31 -0
  74. data/lib/opal/rewriters/returnable_logic.rb +33 -0
  75. data/lib/opal/util.rb +11 -48
  76. data/lib/opal/version.rb +1 -1
  77. data/opal.gemspec +26 -26
  78. data/opal/corelib/array.rb +160 -118
  79. data/opal/corelib/array/pack.rb +5 -3
  80. data/opal/corelib/basic_object.rb +4 -4
  81. data/opal/corelib/class.rb +2 -1
  82. data/opal/corelib/comparable.rb +49 -31
  83. data/opal/corelib/constants.rb +5 -5
  84. data/opal/corelib/enumerable.rb +108 -46
  85. data/opal/corelib/enumerator.rb +27 -12
  86. data/opal/corelib/file.rb +3 -1
  87. data/opal/corelib/hash.rb +6 -1
  88. data/opal/corelib/helpers.rb +8 -28
  89. data/opal/corelib/io.rb +12 -7
  90. data/opal/corelib/kernel.rb +45 -14
  91. data/opal/corelib/kernel/format.rb +3 -1
  92. data/opal/corelib/math.rb +8 -6
  93. data/opal/corelib/method.rb +8 -0
  94. data/opal/corelib/module.rb +17 -2
  95. data/opal/corelib/number.rb +3 -12
  96. data/opal/corelib/proc.rb +16 -0
  97. data/opal/corelib/random/mersenne_twister.rb +147 -0
  98. data/opal/corelib/range.rb +3 -13
  99. data/opal/corelib/regexp.rb +10 -6
  100. data/opal/corelib/runtime.js +208 -81
  101. data/opal/corelib/string.rb +55 -49
  102. data/opal/corelib/string/encoding.rb +109 -32
  103. data/opal/corelib/string/unpack.rb +2 -17
  104. data/opal/corelib/struct.rb +14 -1
  105. data/opal/corelib/time.rb +4 -0
  106. data/opal/opal.rb +1 -1
  107. data/opal/opal/mini.rb +1 -1
  108. data/package.json +16 -0
  109. data/spec/README.md +10 -0
  110. data/spec/filters/bugs/array.rb +76 -0
  111. data/spec/filters/bugs/base64.rb +10 -0
  112. data/spec/filters/bugs/basicobject.rb +12 -0
  113. data/spec/filters/bugs/bigdecimal.rb +248 -0
  114. data/spec/filters/bugs/class.rb +12 -0
  115. data/spec/filters/bugs/complex.rb +7 -0
  116. data/spec/filters/bugs/date.rb +104 -0
  117. data/spec/filters/bugs/encoding.rb +259 -0
  118. data/spec/filters/bugs/enumerable.rb +26 -0
  119. data/spec/filters/bugs/enumerator.rb +48 -0
  120. data/spec/filters/bugs/exception.rb +120 -0
  121. data/spec/filters/bugs/file.rb +48 -0
  122. data/spec/filters/bugs/float.rb +74 -0
  123. data/spec/filters/bugs/hash.rb +60 -0
  124. data/spec/filters/bugs/integer.rb +78 -0
  125. data/spec/filters/bugs/io.rb +9 -0
  126. data/spec/filters/bugs/kernel.rb +401 -0
  127. data/spec/filters/bugs/language.rb +451 -0
  128. data/spec/filters/bugs/marshal.rb +50 -0
  129. data/spec/filters/bugs/math.rb +4 -0
  130. data/spec/filters/bugs/method.rb +79 -0
  131. data/spec/filters/bugs/module.rb +281 -0
  132. data/spec/filters/bugs/nilclass.rb +4 -0
  133. data/spec/filters/bugs/numeric.rb +27 -0
  134. data/spec/filters/bugs/openstruct.rb +8 -0
  135. data/spec/filters/bugs/pack_unpack.rb +138 -0
  136. data/spec/filters/bugs/pathname.rb +9 -0
  137. data/spec/filters/bugs/proc.rb +80 -0
  138. data/spec/filters/bugs/random.rb +20 -0
  139. data/spec/filters/bugs/range.rb +139 -0
  140. data/spec/filters/bugs/rational.rb +12 -0
  141. data/spec/filters/bugs/regexp.rb +91 -0
  142. data/spec/filters/bugs/set.rb +51 -0
  143. data/spec/filters/bugs/singleton.rb +7 -0
  144. data/spec/filters/bugs/string.rb +341 -0
  145. data/spec/filters/bugs/stringscanner.rb +78 -0
  146. data/spec/filters/bugs/struct.rb +26 -0
  147. data/spec/filters/bugs/symbol.rb +7 -0
  148. data/spec/filters/bugs/time.rb +109 -0
  149. data/spec/filters/bugs/unboundmethod.rb +33 -0
  150. data/spec/filters/bugs/warnings.rb +30 -0
  151. data/spec/filters/unsupported/array.rb +168 -0
  152. data/spec/filters/unsupported/basicobject.rb +15 -0
  153. data/spec/filters/unsupported/bignum.rb +55 -0
  154. data/spec/filters/unsupported/class.rb +5 -0
  155. data/spec/filters/unsupported/delegator.rb +6 -0
  156. data/spec/filters/unsupported/enumerable.rb +12 -0
  157. data/spec/filters/unsupported/enumerator.rb +14 -0
  158. data/spec/filters/unsupported/file.rb +4 -0
  159. data/spec/filters/unsupported/fixnum.rb +15 -0
  160. data/spec/filters/unsupported/float.rb +47 -0
  161. data/spec/filters/unsupported/freeze.rb +259 -0
  162. data/spec/filters/unsupported/hash.rb +44 -0
  163. data/spec/filters/unsupported/integer.rb +101 -0
  164. data/spec/filters/unsupported/kernel.rb +35 -0
  165. data/spec/filters/unsupported/language.rb +25 -0
  166. data/spec/filters/unsupported/marshal.rb +44 -0
  167. data/spec/filters/unsupported/matchdata.rb +63 -0
  168. data/spec/filters/unsupported/math.rb +4 -0
  169. data/spec/filters/unsupported/pathname.rb +4 -0
  170. data/spec/filters/unsupported/privacy.rb +287 -0
  171. data/spec/filters/unsupported/proc.rb +4 -0
  172. data/spec/filters/unsupported/random.rb +5 -0
  173. data/spec/filters/unsupported/range.rb +8 -0
  174. data/spec/filters/unsupported/regexp.rb +70 -0
  175. data/spec/filters/unsupported/set.rb +5 -0
  176. data/spec/filters/unsupported/singleton.rb +7 -0
  177. data/spec/filters/unsupported/string.rb +687 -0
  178. data/spec/filters/unsupported/struct.rb +7 -0
  179. data/spec/filters/unsupported/symbol.rb +21 -0
  180. data/spec/filters/unsupported/taint.rb +162 -0
  181. data/spec/filters/unsupported/thread.rb +10 -0
  182. data/spec/filters/unsupported/time.rb +204 -0
  183. data/spec/filters/unsupported/usage_of_files.rb +262 -0
  184. data/spec/lib/builder_processors_spec.rb +44 -0
  185. data/spec/lib/builder_spec.rb +133 -0
  186. data/spec/lib/cli_runners/server_spec.rb +25 -0
  187. data/spec/lib/cli_runners_spec.rb +16 -0
  188. data/spec/lib/cli_spec.rb +256 -0
  189. data/spec/lib/compiler_spec.rb +693 -0
  190. data/spec/lib/config_spec.rb +112 -0
  191. data/spec/lib/dependency_resolver_spec.rb +43 -0
  192. data/spec/lib/deprecations_spec.rb +17 -0
  193. data/spec/lib/fixtures/complex_sprockets.js.rb.erb +4 -0
  194. data/spec/lib/fixtures/file_with_directives.js +2 -0
  195. data/spec/lib/fixtures/jst_file.js.jst +1 -0
  196. data/spec/lib/fixtures/no_requires.rb +1 -0
  197. data/spec/lib/fixtures/opal_file.rb +2 -0
  198. data/spec/lib/fixtures/require_tree_test.rb +3 -0
  199. data/spec/lib/fixtures/required_file.js +1 -0
  200. data/spec/lib/fixtures/required_tree_test/required_file1.rb +1 -0
  201. data/spec/lib/fixtures/required_tree_test/required_file2.rb +1 -0
  202. data/spec/lib/fixtures/requires.rb +7 -0
  203. data/spec/lib/fixtures/source_location_test.rb +7 -0
  204. data/spec/lib/fixtures/source_map.rb +1 -0
  205. data/spec/lib/fixtures/source_map/subfolder/other_file.rb +1 -0
  206. data/spec/lib/fixtures/sprockets_file.js.rb +3 -0
  207. data/spec/lib/fixtures/sprockets_require_tree_test.rb +3 -0
  208. data/spec/lib/path_reader_spec.rb +47 -0
  209. data/spec/lib/paths_spec.rb +18 -0
  210. data/spec/lib/repl_spec.rb +28 -0
  211. data/spec/lib/rewriters/base_spec.rb +68 -0
  212. data/spec/lib/rewriters/binary_operator_assignment_spec.rb +153 -0
  213. data/spec/lib/rewriters/block_to_iter_spec.rb +28 -0
  214. data/spec/lib/rewriters/dot_js_syntax_spec.rb +108 -0
  215. data/spec/lib/rewriters/explicit_writer_return_spec.rb +186 -0
  216. data/spec/lib/rewriters/for_rewriter_spec.rb +92 -0
  217. data/spec/lib/rewriters/hashes/key_duplicates_rewriter_spec.rb +47 -0
  218. data/spec/lib/rewriters/js_reserved_words_spec.rb +119 -0
  219. data/spec/lib/rewriters/logical_operator_assignment_spec.rb +202 -0
  220. data/spec/lib/rewriters/opal_engine_check_spec.rb +84 -0
  221. data/spec/lib/rewriters/returnable_logic_spec.rb +52 -0
  222. data/spec/lib/rewriters/rubyspec/filters_rewriter_spec.rb +59 -0
  223. data/spec/lib/simple_server_spec.rb +56 -0
  224. data/spec/lib/source_map/file_spec.rb +67 -0
  225. data/spec/lib/source_map/index_spec.rb +80 -0
  226. data/spec/lib/spec_helper.rb +105 -0
  227. data/spec/mspec-opal/formatters.rb +197 -0
  228. data/spec/mspec-opal/runner.rb +172 -0
  229. data/spec/opal/compiler/irb_spec.rb +44 -0
  230. data/spec/opal/compiler/unicode_spec.rb +10 -0
  231. data/spec/opal/core/array/dup_spec.rb +23 -0
  232. data/spec/opal/core/array/intersection_spec.rb +38 -0
  233. data/spec/opal/core/array/minus_spec.rb +38 -0
  234. data/spec/opal/core/array/union_spec.rb +38 -0
  235. data/spec/opal/core/array/uniq_spec.rb +49 -0
  236. data/spec/opal/core/class/inherited_spec.rb +18 -0
  237. data/spec/opal/core/enumerable/all_break_spec.rb +5 -0
  238. data/spec/opal/core/enumerable/any_break_spec.rb +5 -0
  239. data/spec/opal/core/enumerable/collect_break_spec.rb +13 -0
  240. data/spec/opal/core/enumerable/count_break_spec.rb +5 -0
  241. data/spec/opal/core/enumerable/detect_break_spec.rb +5 -0
  242. data/spec/opal/core/enumerable/drop_while_break_spec.rb +5 -0
  243. data/spec/opal/core/enumerable/each_slice_break_spec.rb +6 -0
  244. data/spec/opal/core/enumerable/each_with_index_break_spec.rb +5 -0
  245. data/spec/opal/core/enumerable/each_with_object_break_spec.rb +5 -0
  246. data/spec/opal/core/enumerable/find_all_break_spec.rb +5 -0
  247. data/spec/opal/core/enumerable/find_index_break_spec.rb +5 -0
  248. data/spec/opal/core/enumerable/grep_break_spec.rb +5 -0
  249. data/spec/opal/core/enumerable/max_break_spec.rb +5 -0
  250. data/spec/opal/core/enumerable/max_by_break_spec.rb +5 -0
  251. data/spec/opal/core/enumerable/min_break_spec.rb +5 -0
  252. data/spec/opal/core/enumerable/min_by_break_spec.rb +5 -0
  253. data/spec/opal/core/enumerable/none_break_spec.rb +5 -0
  254. data/spec/opal/core/enumerable/one_break_spec.rb +5 -0
  255. data/spec/opal/core/enumerable/reduce_break_spec.rb +5 -0
  256. data/spec/opal/core/enumerable/take_while_break_spec.rb +5 -0
  257. data/spec/opal/core/enumerator/with_index_spec.rb +6 -0
  258. data/spec/opal/core/exception_spec.rb +8 -0
  259. data/spec/opal/core/fixtures/require_tree_files/file 1.rb +1 -0
  260. data/spec/opal/core/fixtures/require_tree_files/file 2.rb +1 -0
  261. data/spec/opal/core/fixtures/require_tree_files/file 3.rb +1 -0
  262. data/spec/opal/core/fixtures/require_tree_files/file 4.rb +1 -0
  263. data/spec/opal/core/fixtures/require_tree_files/file 5.rb +1 -0
  264. data/spec/opal/core/fixtures/require_tree_files/nested/nested 1.rb +1 -0
  265. data/spec/opal/core/fixtures/require_tree_files/nested/nested 2.rb +1 -0
  266. data/spec/opal/core/fixtures/require_tree_files/other/other 1.rb +1 -0
  267. data/spec/opal/core/fixtures/require_tree_with_dot/file 1.rb +1 -0
  268. data/spec/opal/core/fixtures/require_tree_with_dot/file 2.rb +1 -0
  269. data/spec/opal/core/fixtures/require_tree_with_dot/file 3.rb +1 -0
  270. data/spec/opal/core/fixtures/require_tree_with_dot/index.rb +3 -0
  271. data/spec/opal/core/hash/internals_spec.rb +339 -0
  272. data/spec/opal/core/helpers_spec.rb +14 -0
  273. data/spec/opal/core/iterable_props_spec.rb +53 -0
  274. data/spec/opal/core/kernel/at_exit_spec.rb +70 -0
  275. data/spec/opal/core/kernel/freeze_spec.rb +15 -0
  276. data/spec/opal/core/kernel/instance_variables_spec.rb +110 -0
  277. data/spec/opal/core/kernel/methods_spec.rb +25 -0
  278. data/spec/opal/core/kernel/public_methods_spec.rb +25 -0
  279. data/spec/opal/core/kernel/require_tree_spec.rb +18 -0
  280. data/spec/opal/core/kernel/respond_to_spec.rb +15 -0
  281. data/spec/opal/core/language/DATA/characters_support_spec.rb +9 -0
  282. data/spec/opal/core/language/DATA/empty___END___spec.rb +7 -0
  283. data/spec/opal/core/language/DATA/multiple___END___spec.rb +10 -0
  284. data/spec/opal/core/language/arguments/mlhs_arg_spec.rb +18 -0
  285. data/spec/opal/core/language/keyword_arguments_spec.rb +9 -0
  286. data/spec/opal/core/language/numblocks_spec.rb +16 -0
  287. data/spec/opal/core/language/safe_navigator_spec.rb +7 -0
  288. data/spec/opal/core/language/while_spec.rb +31 -0
  289. data/spec/opal/core/language_spec.rb +29 -0
  290. data/spec/opal/core/marshal/dump_spec.rb +81 -0
  291. data/spec/opal/core/marshal/load_spec.rb +13 -0
  292. data/spec/opal/core/module_spec.rb +27 -0
  293. data/spec/opal/core/object_id_spec.rb +56 -0
  294. data/spec/opal/core/regexp/interpolation_spec.rb +40 -0
  295. data/spec/opal/core/regexp/match_spec.rb +78 -0
  296. data/spec/opal/core/runtime/bridged_classes_spec.rb +123 -0
  297. data/spec/opal/core/runtime/constants_spec.rb +16 -0
  298. data/spec/opal/core/runtime/eval_spec.rb +5 -0
  299. data/spec/opal/core/runtime/exit_spec.rb +29 -0
  300. data/spec/opal/core/runtime/is_a_spec.rb +48 -0
  301. data/spec/opal/core/runtime/loaded_spec.rb +20 -0
  302. data/spec/opal/core/runtime/main_methods_spec.rb +39 -0
  303. data/spec/opal/core/runtime/method_missing_spec.rb +68 -0
  304. data/spec/opal/core/runtime/rescue_spec.rb +37 -0
  305. data/spec/opal/core/runtime/string_spec.rb +25 -0
  306. data/spec/opal/core/runtime/truthy_spec.rb +61 -0
  307. data/spec/opal/core/runtime_spec.rb +58 -0
  308. data/spec/opal/core/string/each_byte_spec.rb +19 -0
  309. data/spec/opal/core/string/gsub_spec.rb +35 -0
  310. data/spec/opal/core/string/to_sym_spec.rb +9 -0
  311. data/spec/opal/core/string_spec.rb +28 -0
  312. data/spec/opal/core/struct/dup_spec.rb +11 -0
  313. data/spec/opal/core/time_spec.rb +68 -0
  314. data/spec/opal/stdlib/erb/erb_spec.rb +30 -0
  315. data/spec/opal/stdlib/erb/inline_block.opalerb +3 -0
  316. data/spec/opal/stdlib/erb/quoted.opalerb +1 -0
  317. data/spec/opal/stdlib/erb/simple.opalerb +1 -0
  318. data/spec/opal/stdlib/js_spec.rb +72 -0
  319. data/spec/opal/stdlib/json/ext_spec.rb +55 -0
  320. data/spec/opal/stdlib/json/parse_spec.rb +37 -0
  321. data/spec/opal/stdlib/logger/logger_spec.rb +308 -0
  322. data/spec/opal/stdlib/native/alias_native_spec.rb +27 -0
  323. data/spec/opal/stdlib/native/array_spec.rb +11 -0
  324. data/spec/opal/stdlib/native/date_spec.rb +12 -0
  325. data/spec/opal/stdlib/native/deprecated_include_spec.rb +8 -0
  326. data/spec/opal/stdlib/native/each_spec.rb +13 -0
  327. data/spec/opal/stdlib/native/element_reference_spec.rb +16 -0
  328. data/spec/opal/stdlib/native/exposure_spec.rb +33 -0
  329. data/spec/opal/stdlib/native/ext_spec.rb +19 -0
  330. data/spec/opal/stdlib/native/hash_spec.rb +67 -0
  331. data/spec/opal/stdlib/native/initialize_spec.rb +17 -0
  332. data/spec/opal/stdlib/native/method_missing_spec.rb +51 -0
  333. data/spec/opal/stdlib/native/native_alias_spec.rb +26 -0
  334. data/spec/opal/stdlib/native/native_class_spec.rb +18 -0
  335. data/spec/opal/stdlib/native/native_module_spec.rb +13 -0
  336. data/spec/opal/stdlib/native/native_reader_spec.rb +22 -0
  337. data/spec/opal/stdlib/native/native_writer_spec.rb +30 -0
  338. data/spec/opal/stdlib/native/new_spec.rb +92 -0
  339. data/spec/opal/stdlib/native/struct_spec.rb +12 -0
  340. data/spec/opal/stdlib/pp_spec.rb +5 -0
  341. data/spec/opal/stdlib/promise/always_spec.rb +49 -0
  342. data/spec/opal/stdlib/promise/error_spec.rb +15 -0
  343. data/spec/opal/stdlib/promise/rescue_spec.rb +53 -0
  344. data/spec/opal/stdlib/promise/then_spec.rb +79 -0
  345. data/spec/opal/stdlib/promise/trace_spec.rb +51 -0
  346. data/spec/opal/stdlib/promise/value_spec.rb +15 -0
  347. data/spec/opal/stdlib/promise/when_spec.rb +34 -0
  348. data/spec/opal/stdlib/source_map_spec.rb +8 -0
  349. data/spec/opal/stdlib/strscan/scan_spec.rb +11 -0
  350. data/spec/opal/stdlib/template/paths_spec.rb +10 -0
  351. data/spec/opal/stdlib/thread/mutex_spec.rb +40 -0
  352. data/spec/opal/stdlib/thread/thread_queue_spec.rb +32 -0
  353. data/spec/opal/stdlib/thread/thread_spec.rb +60 -0
  354. data/spec/ruby_specs +183 -0
  355. data/spec/spec_helper.rb +31 -0
  356. data/spec/support/guard_platform.rb +4 -0
  357. data/spec/support/match_helpers.rb +57 -0
  358. data/spec/support/mspec_rspec_adapter.rb +33 -0
  359. data/spec/support/rewriters_helper.rb +54 -0
  360. data/spec/support/source_map_helper.rb +190 -0
  361. data/stdlib/base64.rb +2 -2
  362. data/stdlib/bigdecimal.rb +15 -3
  363. data/stdlib/bigdecimal/bignumber.js.rb +1 -1
  364. data/stdlib/bigdecimal/util.rb +148 -0
  365. data/stdlib/delegate.rb +8 -0
  366. data/stdlib/nodejs/fileutils.rb +1 -1
  367. data/stdlib/nodejs/kernel.rb +0 -13
  368. data/stdlib/nodejs/stacktrace.rb +4 -179
  369. data/stdlib/ostruct.rb +5 -0
  370. data/stdlib/pp.rb +586 -19
  371. data/stdlib/prettyprint.rb +556 -0
  372. data/stdlib/rbconfig/sizeof.rb +2 -0
  373. data/stdlib/securerandom.rb +32 -0
  374. data/stdlib/set.rb +36 -0
  375. data/stdlib/strscan.rb +15 -0
  376. data/tasks/benchmarking.rake +1 -1
  377. data/tasks/linting.rake +3 -5
  378. data/tasks/releasing.rake +2 -5
  379. data/tasks/testing.rake +16 -11
  380. data/tasks/testing/mspec_special_calls.rb +1 -19
  381. data/test/nodejs/fixtures/cat.png +0 -0
  382. data/test/nodejs/fixtures/hello.rb +1 -0
  383. data/test/nodejs/fixtures/iso88591.txt +1 -0
  384. data/test/nodejs/fixtures/utf8.txt +1 -0
  385. data/test/nodejs/fixtures/win1258.txt +1 -0
  386. data/test/nodejs/test_dir.rb +39 -0
  387. data/test/nodejs/test_env.rb +62 -0
  388. data/test/nodejs/test_error.rb +29 -0
  389. data/test/nodejs/test_file.rb +206 -0
  390. data/test/nodejs/test_file_encoding.rb +20 -0
  391. data/test/nodejs/test_io.rb +18 -0
  392. data/test/nodejs/test_opal_builder.rb +12 -0
  393. data/test/nodejs/test_pathname.rb +16 -0
  394. data/test/opal/cat.png +0 -0
  395. data/test/opal/http_server.rb +52 -0
  396. data/test/opal/test_base64.rb +115 -0
  397. data/test/opal/test_keyword.rb +590 -0
  398. data/test/opal/test_matrix.rb +661 -0
  399. data/test/opal/test_openuri.rb +53 -0
  400. data/test/opal/unsupported_and_bugs.rb +39 -0
  401. data/yarn.lock +1355 -0
  402. metadata +905 -40
  403. data/.travis.yml +0 -109
  404. data/appveyor.yml +0 -35
  405. data/lib/opal/nodes/runtime_helpers.rb +0 -51
  406. data/opal/corelib/random/MersenneTwister.js +0 -137
  407. data/opal/corelib/random/mersenne_twister.js.rb +0 -13
  408. data/stdlib/bigdecimal/kernel.rb +0 -5
@@ -0,0 +1,12 @@
1
+ # NOTE: run bin/format-filters after changing this file
2
+ opal_filter "Class" do
3
+ fails "Class#allocate raises TypeError for #superclass"
4
+ fails "Class#dup duplicates both the class and the singleton class"
5
+ fails "Class#dup retains an included module in the ancestor chain for the singleton class"
6
+ fails "Class#dup retains the correct ancestor chain for the singleton class"
7
+ fails "Class#initialize raises a TypeError when called on BasicObject"
8
+ fails "Class#initialize raises a TypeError when called on already initialized classes"
9
+ fails "Class#initialize when given the Class raises a TypeError"
10
+ fails "Class#new uses the internal allocator and does not call #allocate" # RuntimeError: allocate should not be called
11
+ fails "Class.new raises a TypeError if passed a metaclass"
12
+ end
@@ -0,0 +1,7 @@
1
+ # NOTE: run bin/format-filters after changing this file
2
+ opal_filter "Complex" do
3
+ fails "Complex#<=> returns 0, 1, or -1 if self and argument do not have imaginary part" # Expected nil == 1 to be truthy but was false
4
+ fails "Complex#coerce returns an array containing other as Complex and self when other is a Numeric which responds to #real? with true"
5
+ fails "Complex#to_c returns self" # Expected ((1+5i)+0i) to be identical to (1+5i)
6
+ fails "Complex#to_c returns the same value" # Expected ((1+5i)+0i) == (1+5i) to be truthy but was false
7
+ end
@@ -0,0 +1,104 @@
1
+ # NOTE: run bin/format-filters after changing this file
2
+ opal_filter "Date" do
3
+ fails "Date#>> returns the day of the reform if date falls within calendar reform"
4
+ fails "Date#ajd determines the Astronomical Julian day"
5
+ fails "Date#amjd determines the Astronomical Modified Julian day"
6
+ fails "Date#civil creates a Date for different calendar reform dates"
7
+ fails "Date#civil doesn't create dates for invalid arguments"
8
+ fails "Date#commercial creates a Date for Julian Day Number day 0 by default"
9
+ fails "Date#commercial creates a Date for the correct day given the year, week and day number" # NoMethodError: undefined method `commercial' for Date
10
+ fails "Date#commercial creates a Date for the monday in the year and week given" # NoMethodError: undefined method `commercial' for Date
11
+ fails "Date#commercial creates only Date objects for valid weeks"
12
+ fails "Date#cwyear determines the commercial year"
13
+ fails "Date#day_fraction determines the day fraction"
14
+ fails "Date#england converts a date object into another with the English calendar reform"
15
+ fails "Date#gregorian converts a date object into another with the Gregorian calendar"
16
+ fails "Date#gregorian? marks a day after the calendar reform as Julian"
17
+ fails "Date#gregorian? marks a day before the calendar reform as Julian"
18
+ fails "Date#hash returns the same value for equal dates"
19
+ fails "Date#italy converts a date object into another with the Italian calendar reform"
20
+ fails "Date#julian converts a date object into another with the Julian calendar"
21
+ fails "Date#julian? marks a day before the calendar reform as Julian"
22
+ fails "Date#ld determines the Modified Julian day"
23
+ fails "Date#mday determines the day of the month"
24
+ fails "Date#mjd determines the Modified Julian day"
25
+ fails "Date#mon determines the month"
26
+ fails "Date#new_start converts a date object into another with a new calendar reform"
27
+ fails "Date#parse coerces using to_str" # ArgumentError: invalid date
28
+ fails "Date#parse parses a day name into a Date object"
29
+ fails "Date#parse parses a month day into a Date object"
30
+ fails "Date#parse parses a month name into a Date object"
31
+ fails "Date#parse raises a TypeError trying to parse non-String-like object" # ArgumentError: invalid date
32
+ fails "Date#strftime should be able to print the commercial year with leading zeroes"
33
+ fails "Date#strftime should be able to print the commercial year with only two digits"
34
+ fails "Date#strftime should be able to show a full notation"
35
+ fails "Date#strftime should be able to show the commercial week day"
36
+ fails "Date#strftime should be able to show the commercial week"
37
+ fails "Date#strftime should be able to show the number of seconds since the unix epoch for a date" # Expected "954964800" to equal "954979200"
38
+ fails "Date#strftime should be able to show the number of seconds since the unix epoch"
39
+ fails "Date#strftime should be able to show the timezone of the date with a : separator"
40
+ fails "Date#strftime should be able to show the timezone with a : separator"
41
+ fails "Date#strftime should be able to show the week number with the week starting on Sunday (%U) and Monday (%W)"
42
+ fails "Date#strftime shows the number of milliseconds since epoch"
43
+ fails "Date#strptime parses a century"
44
+ fails "Date#strptime parses a commercial week day"
45
+ fails "Date#strptime parses a commercial week"
46
+ fails "Date#strptime parses a commercial year with leading zeroes"
47
+ fails "Date#strptime parses a commercial year with only two digits"
48
+ fails "Date#strptime parses a date given MM/DD/YY"
49
+ fails "Date#strptime parses a date given as YYYY-MM-DD"
50
+ fails "Date#strptime parses a date given in full notation"
51
+ fails "Date#strptime parses a date with slashes"
52
+ fails "Date#strptime parses a full date"
53
+ fails "Date#strptime parses a full day name"
54
+ fails "Date#strptime parses a full month name"
55
+ fails "Date#strptime parses a month day with leading spaces"
56
+ fails "Date#strptime parses a month day with leading zeroes"
57
+ fails "Date#strptime parses a month with leading zeroes"
58
+ fails "Date#strptime parses a short day name"
59
+ fails "Date#strptime parses a short month name"
60
+ fails "Date#strptime parses a week day"
61
+ fails "Date#strptime parses a week number for a week starting on Monday"
62
+ fails "Date#strptime parses a week number for a week starting on Sunday"
63
+ fails "Date#strptime parses a year day with leading zeroes"
64
+ fails "Date#strptime parses a year in YY format"
65
+ fails "Date#strptime parses a year in YYYY format"
66
+ fails "Date#strptime returns January 1, 4713 BCE when given no arguments"
67
+ fails "Date#strptime uses the default format when not given a date format"
68
+ fails "Date#valid_civil? handles negative months and days"
69
+ fails "Date#valid_civil? returns false if it is not a valid civil date"
70
+ fails "Date#valid_civil? returns true if it is a valid civil date"
71
+ fails "Date#valid_commercial? handles negative week and day numbers"
72
+ fails "Date#valid_commercial? returns false it is not a valid commercial date"
73
+ fails "Date#valid_commercial? returns true if it is a valid commercial date"
74
+ fails "Date#valid_date? handles negative months and days"
75
+ fails "Date#valid_date? returns false if it is not a valid civil date"
76
+ fails "Date#valid_date? returns true if it is a valid civil date"
77
+ fails "Date#yday determines the year"
78
+ fails "Date._iso8601 returns an empty hash if the argument is a invalid Date" # NoMethodError: undefined method `_iso8601' for Date
79
+ fails "Date._rfc3339 returns an empty hash if the argument is a invalid Date" # NoMethodError: undefined method `_rfc3339' for Date
80
+ fails "Date.iso8601 parses YYYY-MM-DD into a Date object" # NoMethodError: undefined method `iso8601' for Date
81
+ fails "Date.iso8601 parses YYYYMMDD into a Date object" # NoMethodError: undefined method `iso8601' for Date
82
+ fails "Date.iso8601 parses a StringSubclass into a Date object" # NoMethodError: undefined method `iso8601' for Date
83
+ fails "Date.iso8601 parses a Symbol into a Date object" # NoMethodError: undefined method `iso8601' for Date
84
+ fails "Date.iso8601 parses a negative Date" # NoMethodError: undefined method `iso8601' for Date
85
+ fails "Date.iso8601 raises a TypeError when passed an Object" # NoMethodError: undefined method `iso8601' for Date
86
+ fails "Date.iso8601 raises an ArgumentError when passed a Symbol without a valid Date" # NoMethodError: undefined method `iso8601' for Date
87
+ fails "Date.jd constructs a Date object if passed a Julian day"
88
+ fails "Date.jd constructs a Date object if passed a negative number"
89
+ fails "Date.jd returns a Date object representing Julian day 0 (-4712-01-01) if no arguments passed"
90
+ fails "Date.julian_leap? determines whether a year is a leap year in the Julian calendar"
91
+ fails "Date.julian_leap? determines whether a year is not a leap year in the Julian calendar"
92
+ fails "Date.new creates a Date for different calendar reform dates"
93
+ fails "Date.new doesn't create dates for invalid arguments"
94
+ fails "Date.ordinal constructs a Date object from an ordinal date"
95
+ fails "Date.valid_jd? returns false if passed false" # NoMethodError: undefined method `valid_jd?' for Date
96
+ fails "Date.valid_jd? returns false if passed nil"
97
+ fails "Date.valid_jd? returns false if passed symbol" # NoMethodError: undefined method `valid_jd?' for Date
98
+ fails "Date.valid_jd? returns true if passed a number value" # NoMethodError: undefined method `valid_jd?' for Date
99
+ fails "Date.valid_jd? returns true if passed any value other than nil"
100
+ fails "Date.valid_jd? returns true if passed false"
101
+ fails "Date.valid_jd? returns true if passed symbol" # NoMethodError: undefined method `valid_jd?' for Date
102
+ fails "Date.valid_ordinal? determines if the date is a valid ordinal date"
103
+ fails "Date.valid_ordinal? handles negative day numbers"
104
+ end
@@ -0,0 +1,259 @@
1
+ # NOTE: run bin/format-filters after changing this file
2
+ opal_filter "Encoding" do
3
+ fails "File.basename returns basename windows forward slash" # Expected "C:" to equal "/"
4
+ fails "File.basename returns basename windows unc" # Expected "\\\\foo\\bar\\baz.txt" to equal "baz.txt"
5
+ fails "File.basename returns basename with windows suffix" # Expected "c:\\bar" to equal "bar"
6
+ fails "File.basename returns the basename for windows" # Expected "C:\\foo\\bar\\baz.txt" to equal "baz.txt"
7
+ fails "File.basename returns the basename with the same encoding as the original" # NameError: uninitialized constant Encoding::Windows_1250
8
+ fails "File.dirname returns all the components of filename except the last one (edge cases on windows)" # Expected "/" to equal "//foo"
9
+ fails "File.dirname returns the return all the components of filename except the last one (Windows format)" # Expected "." to equal "C:\\foo\\bar"
10
+ fails "File.dirname returns the return all the components of filename except the last one (forward_slash)" # Expected "." to equal "C:/"
11
+ fails "File.dirname returns the return all the components of filename except the last one (windows unc)" # Expected "." to equal "\\\\foo\\bar"
12
+ fails "File.expand_path expands C:/./dir to C:/dir" # Exception: cd is not defined
13
+ fails "File.join respects given separator if only one part has a boundary separator" # Expected "C:\\/windows" to equal "C:\\windows"
14
+ fails "Fixnum#to_s returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
15
+ fails "Fixnum#to_s returns a String in US-ASCII encoding when Encoding.default_internal is not nil" # NoMethodError: undefined method `default_internal' for Encoding
16
+ fails "Float#to_s returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
17
+ fails "Float#to_s returns a String in US-ASCII encoding when Encoding.default_internal is not nil" # NoMethodError: undefined method `default_internal' for Encoding
18
+ fails "Integer#to_s bignum returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
19
+ fails "Integer#to_s bignum returns a String in US-ASCII encoding when Encoding.default_internal is not nil" # NoMethodError: undefined method `default_internal' for Encoding
20
+ fails "Integer#to_s bignum when given a base raises an ArgumentError if the base is less than 2 or higher than 36" # NoMethodError: undefined method `default_internal' for Encoding
21
+ fails "Integer#to_s bignum when given a base returns self converted to a String using the given base" # NoMethodError: undefined method `default_internal' for Encoding
22
+ fails "Integer#to_s bignum when given no base returns self converted to a String using base 10" # NoMethodError: undefined method `default_internal' for Encoding
23
+ fails "Integer#to_s fixnum returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
24
+ fails "Integer#to_s fixnum returns a String in US-ASCII encoding when Encoding.default_internal is not nil" # NoMethodError: undefined method `default_internal' for Encoding
25
+ fails "Integer#to_s fixnum when given a base raises an ArgumentError if the base is less than 2 or higher than 36" # NoMethodError: undefined method `default_internal' for Encoding
26
+ fails "Integer#to_s fixnum when given a base returns self converted to a String in the given base" # NoMethodError: undefined method `default_internal' for Encoding
27
+ fails "Integer#to_s fixnum when no base given returns self converted to a String using base 10" # NoMethodError: undefined method `default_internal' for Encoding
28
+ fails "Kernel#sprintf returns a String in the same encoding as the format String if compatible" # NameError: uninitialized constant Encoding::KOI8_U
29
+ fails "Marshal.dump when passed an IO calls binmode when it's defined" # ArgumentError: [Marshal.dump] wrong number of arguments(2 for 1)
30
+ fails "Marshal.dump with a String dumps a String in another encoding" # Expected "\u0004\b\"\u000Fm\u0000ö\u0000h\u0000r\u0000e\u0000" to equal "\u0004\bI\"\u000Fm\u0000ö\u0000h\u0000r\u0000e\u0000\u0006:\rencoding\"\rUTF-16LE"
31
+ fails "Marshal.dump with a String dumps a US-ASCII String" # Expected "\u0004\b\"\babc" to equal "\u0004\bI\"\babc\u0006:\u0006EF"
32
+ fails "Marshal.dump with a String dumps a UTF-8 String" # Expected "\u0004\b\"\nmöhre" to equal "\u0004\bI\"\vmöhre\u0006:\u0006ET"
33
+ fails "Marshal.dump with a String dumps multiple strings using symlinks for the :E (encoding) symbol" # Expected "\u0004\b[\a\"\u0000@\u0006" to equal "\u0004\b[\aI\"\u0000\u0006:\u0006EFI\"\u0000\u0006;\u0000T"
34
+ fails "Marshal.load for a String loads a String as ASCII-8BIT if no encoding is specified at the end" # ArgumentError: marshal data too short
35
+ fails "Marshal.load for a String loads a String in another encoding" # NameError: 'encoding' is not allowed as an instance variable name
36
+ fails "Marshal.load for a String loads a US-ASCII String" # Expected #<Encoding:UTF-16LE> to be identical to #<Encoding:ASCII-8BIT (dummy)>
37
+ fails "MatchData#post_match sets an empty result to the encoding of the source String" # NameError: uninitialized constant Encoding::ISO_8859_1
38
+ fails "MatchData#post_match sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
39
+ fails "MatchData#pre_match sets an empty result to the encoding of the source String" # NameError: uninitialized constant Encoding::ISO_8859_1
40
+ fails "MatchData#pre_match sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
41
+ fails "Predefined global $& sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
42
+ fails "Predefined global $' sets an empty result to the encoding of the source String" # NameError: uninitialized constant Encoding::ISO_8859_1
43
+ fails "Predefined global $' sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
44
+ fails "Predefined global $+ sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
45
+ fails "Predefined global $` sets an empty result to the encoding of the source String" # NameError: uninitialized constant Encoding::ISO_8859_1
46
+ fails "Predefined global $` sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
47
+ fails "Predefined globals $1..N sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
48
+ fails "Proc#inspect for a proc created with Proc.new has an ASCII-8BIT encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
49
+ fails "Proc#inspect for a proc created with UnboundMethod#to_proc has an ASCII-8BIT encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
50
+ fails "Proc#inspect for a proc created with lambda has an ASCII-8BIT encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
51
+ fails "Proc#inspect for a proc created with proc has an ASCII-8BIT encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
52
+ fails "Proc#to_s for a proc created with Proc.new has an ASCII-8BIT encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
53
+ fails "Proc#to_s for a proc created with UnboundMethod#to_proc has an ASCII-8BIT encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
54
+ fails "Proc#to_s for a proc created with lambda has an ASCII-8BIT encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
55
+ fails "Proc#to_s for a proc created with proc has an ASCII-8BIT encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
56
+ fails "Regexp#match with [string, position] when given a negative position raises an ArgumentError for an invalid encoding" # NoMethodError: undefined method `pack' for [150]:Array
57
+ fails "Regexp#match with [string, position] when given a positive position raises an ArgumentError for an invalid encoding" # NoMethodError: undefined method `pack' for [150]:Array
58
+ fails "Ruby String interpolation creates a String having an Encoding compatible with all components" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:UTF-8>
59
+ fails "Ruby String interpolation creates a String having the Encoding of the components when all are the same Encoding" # ArgumentError: unknown encoding name - euc-jp
60
+ fails "Ruby String interpolation raises an Encoding::CompatibilityError if the Encodings are not compatible" # Expected Encoding::CompatibilityError but no exception was raised ("あ ÿ" was returned)
61
+ fails "Source files encoded in UTF-16 BE with a BOM are invalid because they contain an invalid UTF-8 sequence before the encoding comment" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7a11e>
62
+ fails "Source files encoded in UTF-16 BE without a BOM are parsed as empty because they contain a NUL byte before the encoding comment" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7a11e>
63
+ fails "Source files encoded in UTF-16 LE with a BOM are invalid because they contain an invalid UTF-8 sequence before the encoding comment" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7a11e>
64
+ fails "Source files encoded in UTF-16 LE without a BOM are parsed because empty as they contain a NUL byte before the encoding comment" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7a11e>
65
+ fails "Source files encoded in UTF-8 with a BOM can be parsed" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7a11e>
66
+ fails "Source files encoded in UTF-8 without a BOM can be parsed" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7a11e>
67
+ fails "String#% output's encoding negotiates a compatible encoding if necessary" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
68
+ fails "String#* raises an ArgumentError if the length of the resulting string doesn't fit into a long" # RangeError: multiply count must not overflow maximum string size
69
+ fails "String#[]= with Fixnum index calls #to_int to convert the index" # Mock 'string element set' expected to receive 'to_int' exactly 1 times but received it 0 times
70
+ fails "String#[]= with Fixnum index encodes the String in an encoding compatible with the replacement" # NoMethodError: undefined method `pack' for [160]:Array
71
+ fails "String#[]= with Fixnum index raises a TypeError if #to_int does not return an Fixnum" # Mock 'string element set' expected to receive 'to_int' exactly 1 times but received it 0 times
72
+ fails "String#[]= with Fixnum index raises a TypeError if passed a Fixnum replacement" # NoMethodError: undefined method `[]=' for "abc":String
73
+ fails "String#[]= with Fixnum index raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
74
+ fails "String#[]= with Fixnum index raises an IndexError if #to_int returns a value out of range" # Mock 'string element set' expected to receive 'to_int' exactly 1 times but received it 0 times
75
+ fails "String#[]= with Fixnum index raises an IndexError if the index is greater than character size" # NoMethodError: undefined method `[]=' for "あれ":String
76
+ fails "String#[]= with Fixnum index replaces a character with a multibyte character" # NoMethodError: undefined method `[]=' for "ありがとu":String
77
+ fails "String#[]= with Fixnum index replaces a multibyte character with a character" # NoMethodError: undefined method `[]=' for "ありがとう":String
78
+ fails "String#[]= with Fixnum index replaces a multibyte character with a multibyte character" # NoMethodError: undefined method `[]=' for "ありがとお":String
79
+ fails "String#[]= with Fixnum index, count deletes a multibyte character" # NoMethodError: undefined method `[]=' for "ありとう":String
80
+ fails "String#[]= with Fixnum index, count encodes the String in an encoding compatible with the replacement" # NoMethodError: undefined method `pack' for [160]:Array
81
+ fails "String#[]= with Fixnum index, count inserts a multibyte character" # NoMethodError: undefined method `[]=' for "ありとう":String
82
+ fails "String#[]= with Fixnum index, count raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
83
+ fails "String#[]= with Fixnum index, count raises an IndexError if the character index is out of range of a multibyte String" # NoMethodError: undefined method `[]=' for "あれ":String
84
+ fails "String#[]= with Fixnum index, count replaces characters with a multibyte character" # NoMethodError: undefined method `[]=' for "ありgaとう":String
85
+ fails "String#[]= with Fixnum index, count replaces multibyte characters with characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
86
+ fails "String#[]= with Fixnum index, count replaces multibyte characters with multibyte characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
87
+ fails "String#[]= with String index encodes the String in an encoding compatible with the replacement" # NoMethodError: undefined method `pack' for [160]:Array
88
+ fails "String#[]= with String index raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
89
+ fails "String#[]= with String index replaces characters with a multibyte character" # NoMethodError: undefined method `[]=' for "ありgaとう":String
90
+ fails "String#[]= with String index replaces multibyte characters with characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
91
+ fails "String#[]= with String index replaces multibyte characters with multibyte characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
92
+ fails "String#[]= with a Range index deletes a multibyte character" # NoMethodError: undefined method `[]=' for "ありとう":String
93
+ fails "String#[]= with a Range index encodes the String in an encoding compatible with the replacement" # NoMethodError: undefined method `pack' for [160]:Array
94
+ fails "String#[]= with a Range index inserts a multibyte character" # NoMethodError: undefined method `[]=' for "ありとう":String
95
+ fails "String#[]= with a Range index raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
96
+ fails "String#[]= with a Range index replaces characters with a multibyte character" # NoMethodError: undefined method `[]=' for "ありgaとう":String
97
+ fails "String#[]= with a Range index replaces multibyte characters by negative indexes" # NoMethodError: undefined method `[]=' for "ありがとう":String
98
+ fails "String#[]= with a Range index replaces multibyte characters with characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
99
+ fails "String#[]= with a Range index replaces multibyte characters with multibyte characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
100
+ fails "String#[]= with a Regexp index encodes the String in an encoding compatible with the replacement" # NoMethodError: undefined method `pack' for [160]:Array
101
+ fails "String#[]= with a Regexp index raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
102
+ fails "String#[]= with a Regexp index replaces characters with a multibyte character" # NoMethodError: undefined method `[]=' for "ありgaとう":String
103
+ fails "String#[]= with a Regexp index replaces multibyte characters with characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
104
+ fails "String#[]= with a Regexp index replaces multibyte characters with multibyte characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
105
+ fails "String#ascii_only? returns false after appending non ASCII characters to an empty String" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
106
+ fails "String#ascii_only? returns false for a non-empty String with non-ASCII-compatible encoding" # Expected true to be false
107
+ fails "String#ascii_only? returns false for the empty String with a non-ASCII-compatible encoding" # Expected true to be false
108
+ fails "String#ascii_only? returns false when concatenating an ASCII and non-ASCII String" # NoMethodError: undefined method `concat' for "":String
109
+ fails "String#ascii_only? returns false when replacing an ASCII String with a non-ASCII String" # NoMethodError: undefined method `replace' for "":String
110
+ fails "String#ascii_only? with non-ASCII only characters returns false if the encoding is ASCII-8BIT" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
111
+ fails "String#b copies own tainted/untrusted status to the returning value" # NoMethodError: undefined method `untrust' for "こんちには":String
112
+ fails "String#b returns new string without modifying self" # NoMethodError: undefined method `b' for "こんちには":String
113
+ fails "String#byteslice on on non ASCII strings returns byteslice of unicode strings" # Expected nil to equal "\u0081"
114
+ fails "String#center with length, padding with width returns a String in the same encoding as the original" # NameError: uninitialized constant Encoding::IBM437
115
+ fails "String#center with length, padding with width, pattern raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
116
+ fails "String#center with length, padding with width, pattern returns a String in the compatible encoding" # NameError: uninitialized constant Encoding::IBM437
117
+ fails "String#chars returns a different character if the String is transcoded" # ArgumentError: unknown encoding name - iso-8859-15
118
+ fails "String#chars returns characters in the same encoding as self" # ArgumentError: unknown encoding name - Shift_JIS
119
+ fails "String#chars taints resulting strings when self is tainted" # Expected false to equal true
120
+ fails "String#chars uses the String's encoding to determine what characters it contains" # Expected ["�", "�"] to equal ["𤭢"]
121
+ fails "String#chars works if the String's contents is invalid for its encoding" # NoMethodError: undefined method `pack' for [164]:Array
122
+ fails "String#chr returns a String in the same encoding as self" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
123
+ fails "String#chr returns a copy of self" # Expected "e" not to equal "e"
124
+ fails "String#codepoints is synonomous with #bytes for Strings which are single-byte optimisable" # Expected false to be true
125
+ fails "String#codepoints raises an ArgumentError if self's encoding is invalid and a block is given" # Expected true to be false
126
+ fails "String#codepoints raises an ArgumentError when no block is given if self has an invalid encoding" # Expected true to be false
127
+ fails "String#codepoints raises an ArgumentError when self has an invalid encoding and a method is called on the returned Enumerator" # Expected true to be false
128
+ fails "String#codepoints round-trips to the original String using Integer#chr" # Expected "\u0013眑တ" to equal ""
129
+ fails "String#each_char returns a different character if the String is transcoded" # ArgumentError: unknown encoding name - iso-8859-15
130
+ fails "String#each_char returns characters in the same encoding as self" # ArgumentError: unknown encoding name - Shift_JIS
131
+ fails "String#each_char taints resulting strings when self is tainted" # Expected false to equal true
132
+ fails "String#each_char uses the String's encoding to determine what characters it contains" # Expected ["�", "�"] to equal ["𤭢"]
133
+ fails "String#each_char works if the String's contents is invalid for its encoding" # NoMethodError: undefined method `pack' for [164]:Array
134
+ fails "String#each_codepoint raises an ArgumentError if self's encoding is invalid and a block is given" # Expected true to be false
135
+ fails "String#each_codepoint raises an ArgumentError when self has an invalid encoding and a method is called on the returned Enumerator" # Expected true to be false
136
+ fails "String#each_codepoint round-trips to the original String using Integer#chr" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
137
+ fails "String#each_codepoint when no block is given returned Enumerator size should return the size of the string even when the string has an invalid encoding" # Expected true to be false
138
+ fails "String#each_codepoint when no block is given returned Enumerator size should return the size of the string" # NoMethodError: undefined method `each_codepoint' for "hello":String
139
+ fails "String#each_codepoint when no block is given returns an Enumerator even when self has an invalid encoding" # Expected true to be false
140
+ fails "String#encode given the xml: :attr option replaces all instances of '&' with '&amp;'" # NoMethodError: undefined method `default_internal' for Encoding
141
+ fails "String#encode given the xml: :attr option replaces all instances of '<' with '&lt;'" # NoMethodError: undefined method `default_internal' for Encoding
142
+ fails "String#encode given the xml: :attr option replaces all instances of '>' with '&gt;'" # NoMethodError: undefined method `default_internal' for Encoding
143
+ fails "String#encode given the xml: :attr option replaces all instances of '\"' with '&quot;'" # NoMethodError: undefined method `default_internal' for Encoding
144
+ fails "String#encode given the xml: :attr option replaces undefined characters with their upper-case hexadecimal numeric character references" # NoMethodError: undefined method `default_internal' for Encoding
145
+ fails "String#encode given the xml: :attr option surrounds the encoded text with double-quotes" # NoMethodError: undefined method `default_internal' for Encoding
146
+ fails "String#encode given the xml: :text option does not replace '\"'" # NoMethodError: undefined method `default_internal' for Encoding
147
+ fails "String#encode given the xml: :text option replaces all instances of '&' with '&amp;'" # NoMethodError: undefined method `default_internal' for Encoding
148
+ fails "String#encode given the xml: :text option replaces all instances of '<' with '&lt;'" # NoMethodError: undefined method `default_internal' for Encoding
149
+ fails "String#encode given the xml: :text option replaces all instances of '>' with '&gt;'" # NoMethodError: undefined method `default_internal' for Encoding
150
+ fails "String#encode given the xml: :text option replaces undefined characters with their upper-case hexadecimal numeric character references" # NoMethodError: undefined method `default_internal' for Encoding
151
+ fails "String#encode raises ArgumentError if the value of the :xml option is not :text or :attr" # NoMethodError: undefined method `default_internal' for Encoding
152
+ fails "String#encode when passed no options encodes an ascii substring of a binary string to UTF-8" # NoMethodError: undefined method `default_internal' for Encoding
153
+ fails "String#encode when passed no options raises an Encoding::ConverterNotFoundError when no conversion is possible" # NoMethodError: undefined method `default_internal' for Encoding
154
+ fails "String#encode when passed no options returns a copy for a ASCII-only String when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
155
+ fails "String#encode when passed no options returns a copy when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
156
+ fails "String#encode when passed no options transcodes a 7-bit String despite no generic converting being available" # NoMethodError: undefined method `default_internal' for Encoding
157
+ fails "String#encode when passed no options transcodes to Encoding.default_internal when set" # NoMethodError: undefined method `default_internal' for Encoding
158
+ fails "String#encode when passed options calls #to_hash to convert the object" # NoMethodError: undefined method `default_internal' for Encoding
159
+ fails "String#encode when passed options does not process transcoding options if not transcoding" # NoMethodError: undefined method `default_internal' for Encoding
160
+ fails "String#encode when passed options normalizes newlines" # NoMethodError: undefined method `default_internal' for Encoding
161
+ fails "String#encode when passed options raises an Encoding::ConverterNotFoundError when no conversion is possible despite 'invalid: :replace, undef: :replace'" # NoMethodError: undefined method `default_internal' for Encoding
162
+ fails "String#encode when passed options replaces invalid characters when replacing Emacs-Mule encoded strings" # NoMethodError: undefined method `default_internal' for Encoding
163
+ fails "String#encode when passed options returns a copy when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
164
+ fails "String#encode when passed options transcodes to Encoding.default_internal when set" # NoMethodError: undefined method `default_internal' for Encoding
165
+ fails "String#encode when passed to encoding accepts a String argument" # NoMethodError: undefined method `default_internal' for Encoding
166
+ fails "String#encode when passed to encoding calls #to_str to convert the object to an Encoding" # NoMethodError: undefined method `default_internal' for Encoding
167
+ fails "String#encode when passed to encoding raises an Encoding::ConverterNotFoundError for an invalid encoding" # NoMethodError: undefined method `default_internal' for Encoding
168
+ fails "String#encode when passed to encoding raises an Encoding::ConverterNotFoundError when no conversion is possible" # NoMethodError: undefined method `default_internal' for Encoding
169
+ fails "String#encode when passed to encoding returns a copy when passed the same encoding as the String" # NoMethodError: undefined method `default_internal' for Encoding
170
+ fails "String#encode when passed to encoding round trips a String" # NoMethodError: undefined method `default_internal' for Encoding
171
+ fails "String#encode when passed to encoding transcodes Japanese multibyte characters" # NoMethodError: undefined method `default_internal' for Encoding
172
+ fails "String#encode when passed to encoding transcodes a 7-bit String despite no generic converting being available" # NoMethodError: undefined method `default_internal' for Encoding
173
+ fails "String#encode when passed to encoding transcodes to the passed encoding" # NoMethodError: undefined method `default_internal' for Encoding
174
+ fails "String#encode when passed to, from calls #to_str to convert the from object to an Encoding" # NoMethodError: undefined method `default_internal' for Encoding
175
+ fails "String#encode when passed to, from returns a copy in the destination encoding when both encodings are the same" # NoMethodError: undefined method `default_internal' for Encoding
176
+ fails "String#encode when passed to, from returns the transcoded string" # NoMethodError: undefined method `default_internal' for Encoding
177
+ fails "String#encode when passed to, from transcodes between the encodings ignoring the String encoding" # NoMethodError: undefined method `default_internal' for Encoding
178
+ fails "String#encode when passed to, from, options calls #to_hash to convert the options object" # NoMethodError: undefined method `default_internal' for Encoding
179
+ fails "String#encode when passed to, from, options calls #to_str to convert the from object to an encoding" # NoMethodError: undefined method `default_internal' for Encoding
180
+ fails "String#encode when passed to, from, options calls #to_str to convert the to object to an encoding" # NoMethodError: undefined method `default_internal' for Encoding
181
+ fails "String#encode when passed to, from, options replaces invalid characters in the destination encoding" # NoMethodError: undefined method `default_internal' for Encoding
182
+ fails "String#encode when passed to, from, options replaces undefined characters in the destination encoding" # NoMethodError: undefined method `default_internal' for Encoding
183
+ fails "String#encode when passed to, from, options returns a copy when both encodings are the same" # NoMethodError: undefined method `default_internal' for Encoding
184
+ fails "String#encode when passed to, options calls #to_hash to convert the options object" # NoMethodError: undefined method `default_internal' for Encoding
185
+ fails "String#encode when passed to, options replaces invalid characters in the destination encoding" # NoMethodError: undefined method `default_internal' for Encoding
186
+ fails "String#encode when passed to, options replaces undefined characters in the destination encoding" # NoMethodError: undefined method `default_internal' for Encoding
187
+ fails "String#encode when passed to, options returns a copy when the destination encoding is the same as the String encoding" # NoMethodError: undefined method `default_internal' for Encoding
188
+ fails "String#encoding for Strings with \\u escapes is not affected by both the default internal and external encoding being set at the same time" # NoMethodError: undefined method `default_internal' for Encoding
189
+ fails "String#encoding for Strings with \\u escapes is not affected by the default external encoding" # NameError: uninitialized constant Encoding::SHIFT_JIS
190
+ fails "String#encoding for Strings with \\u escapes is not affected by the default internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
191
+ fails "String#encoding for Strings with \\u escapes returns US-ASCII if self is US-ASCII only" # Expected false to be true
192
+ fails "String#encoding for Strings with \\u escapes returns the given encoding if #encode!has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
193
+ fails "String#encoding for Strings with \\u escapes returns the given encoding if #force_encoding has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
194
+ fails "String#encoding for Strings with \\x escapes is not affected by both the default internal and external encoding being set at the same time" # NoMethodError: undefined method `default_internal' for Encoding
195
+ fails "String#encoding for Strings with \\x escapes is not affected by the default external encoding" # NameError: uninitialized constant Encoding::SHIFT_JIS
196
+ fails "String#encoding for Strings with \\x escapes is not affected by the default internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
197
+ fails "String#encoding for Strings with \\x escapes returns ASCII-8BIT when an escape creates a byte with the 8th bit set if the source encoding is US-ASCII" # Expected #<Encoding:UTF-8> to equal #<Encoding:ASCII-8BIT (dummy)>
198
+ fails "String#encoding for Strings with \\x escapes returns US-ASCII if self is US-ASCII only" # Expected false to be true
199
+ fails "String#encoding for Strings with \\x escapes returns the given encoding if #encode!has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
200
+ fails "String#encoding for Strings with \\x escapes returns the given encoding if #force_encoding has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
201
+ fails "String#encoding for Strings with \\x escapes returns the source encoding when an escape creates a byte with the 8th bit set if the source encoding isn't US-ASCII" # NameError: uninitialized constant Encoding::ISO8859_9
202
+ fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII only, despite the default encodings being different" # NoMethodError: undefined method `default_internal' for Encoding
203
+ fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII only, despite the default external encoding being different" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
204
+ fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII only, despite the default internal and external encodings being different" # NoMethodError: undefined method `default_internal' for Encoding
205
+ fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII only, despite the default internal encoding being different" # NoMethodError: undefined method `default_internal' for Encoding
206
+ fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
207
+ fails "String#encoding returns the given encoding if #encode!has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
208
+ fails "String#encoding returns the given encoding if #force_encoding has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
209
+ fails "String#force_encoding accepts a String as the name of an Encoding" # ArgumentError: unknown encoding name - shift_jis
210
+ fails "String#force_encoding accepts an Encoding instance" # NameError: uninitialized constant Encoding::SHIFT_JIS
211
+ fails "String#force_encoding calls #to_str to convert an object to an encoding name" # ArgumentError: unknown encoding name - #<MockObject:0xa7ea>
212
+ fails "String#force_encoding does not transcode self" # Expected "蘒" not to equal "蘒"
213
+ fails "String#force_encoding raises a RuntimeError if self is frozen" # Expected RuntimeError but no exception was raised ("abcd" was returned)
214
+ fails "String#force_encoding raises a TypeError if #to_str does not return a String" # ArgumentError: unknown encoding name - #<MockObject:0xa7d8>
215
+ fails "String#force_encoding raises a TypeError if passed nil" # ArgumentError: unknown encoding name -
216
+ fails "String#force_encoding sets the encoding even if the String contents are invalid in that encoding" # ArgumentError: unknown encoding name - euc-jp
217
+ fails "String#index with Regexp raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
218
+ fails "String#index with String raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
219
+ fails "String#insert with index, other inserts a character into a multibyte encoded string" # NoMethodError: undefined method `insert' for "ありがとう":String
220
+ fails "String#insert with index, other raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
221
+ fails "String#insert with index, other returns a String in the compatible encoding" # NoMethodError: undefined method `insert' for "":String
222
+ fails "String#length returns the length of a string in different encodings" # NameError: uninitialized constant Encoding::UTF_32BE
223
+ fails "String#length returns the length of the new self after encoding is changed" # Expected 4 to equal 12
224
+ fails "String#ljust with length, padding with width returns a String in the same encoding as the original" # NameError: uninitialized constant Encoding::IBM437
225
+ fails "String#ljust with length, padding with width, pattern raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
226
+ fails "String#ljust with length, padding with width, pattern returns a String in the compatible encoding" # NameError: uninitialized constant Encoding::IBM437
227
+ fails "String#ord raises an ArgumentError if called on an empty String" # Expected ArgumentError but no exception was raised (NaN was returned)
228
+ fails "String#rindex with Regexp raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
229
+ fails "String#rjust with length, padding with width returns a String in the same encoding as the original" # NameError: uninitialized constant Encoding::IBM437
230
+ fails "String#rjust with length, padding with width, pattern raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
231
+ fails "String#rjust with length, padding with width, pattern returns a String in the compatible encoding" # NameError: uninitialized constant Encoding::IBM437
232
+ fails "String#size returns the length of a string in different encodings" # NameError: uninitialized constant Encoding::UTF_32BE
233
+ fails "String#size returns the length of the new self after encoding is changed" # Expected 4 to equal 12
234
+ fails "String#split with String throws an ArgumentError if the pattern is not a valid string" # NotImplementedError: String#chop! not supported. Mutable String methods are not supported in Opal.
235
+ fails "String#valid_encoding? returns false if a valid String had an invalid character appended to it" # NoMethodError: undefined method `pack' for [221]:Array
236
+ fails "String#valid_encoding? returns false if self contains a character invalid in the associated encoding" # NoMethodError: undefined method `pack' for [128]:Array
237
+ fails "String#valid_encoding? returns false if self is valid in one encoding, but invalid in the one it's tagged with" # Expected true to be false
238
+ fails "String#valid_encoding? returns true for all encodings self is valid in" # Expected true to be false
239
+ fails "String#valid_encoding? returns true if an invalid string is appended another invalid one but both make a valid string" # NoMethodError: undefined method `pack' for [208]:Array
240
+ fails "The predefined global constant ARGV contains Strings encoded in locale Encoding" # NoMethodError: undefined method `default_internal' for Encoding
241
+ fails "The predefined global constant STDERR has nil for the external encoding despite Encoding.default_external being changed" # NoMethodError: undefined method `default_internal' for Encoding
242
+ fails "The predefined global constant STDERR has nil for the external encoding" # NoMethodError: undefined method `default_internal' for Encoding
243
+ fails "The predefined global constant STDERR has nil for the internal encoding despite Encoding.default_internal being changed" # NoMethodError: undefined method `default_internal' for Encoding
244
+ fails "The predefined global constant STDERR has nil for the internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
245
+ fails "The predefined global constant STDERR has the encodings set by #set_encoding" # NoMethodError: undefined method `default_internal' for Encoding
246
+ fails "The predefined global constant STDIN has nil for the internal encoding despite Encoding.default_internal being changed" # NoMethodError: undefined method `default_internal' for Encoding
247
+ fails "The predefined global constant STDIN has nil for the internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
248
+ fails "The predefined global constant STDIN has the encodings set by #set_encoding" # NoMethodError: undefined method `default_internal' for Encoding
249
+ fails "The predefined global constant STDIN has the same external encoding as Encoding.default_external when that encoding is changed" # NoMethodError: undefined method `default_internal' for Encoding
250
+ fails "The predefined global constant STDIN has the same external encoding as Encoding.default_external" # NoMethodError: undefined method `default_internal' for Encoding
251
+ fails "The predefined global constant STDIN retains the encoding set by #set_encoding when Encoding.default_external is changed" # NoMethodError: undefined method `default_internal' for Encoding
252
+ fails "The predefined global constant STDOUT has nil for the external encoding despite Encoding.default_external being changed" # NoMethodError: undefined method `default_internal' for Encoding
253
+ fails "The predefined global constant STDOUT has nil for the external encoding" # NoMethodError: undefined method `default_internal' for Encoding
254
+ fails "The predefined global constant STDOUT has nil for the internal encoding despite Encoding.default_internal being changed" # NoMethodError: undefined method `default_internal' for Encoding
255
+ fails "The predefined global constant STDOUT has nil for the internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
256
+ fails "The predefined global constant STDOUT has the encodings set by #set_encoding" # NoMethodError: undefined method `default_internal' for Encoding
257
+ fails "Time#inspect returns a US-ASCII encoded string" # Expected #<Encoding:UTF-16LE> to be identical to #<Encoding:ASCII-8BIT (dummy)>
258
+ fails "Time#to_s returns a US-ASCII encoded string" # Expected #<Encoding:UTF-16LE> to be identical to #<Encoding:ASCII-8BIT (dummy)>
259
+ end
@@ -0,0 +1,26 @@
1
+ # NOTE: run bin/format-filters after changing this file
2
+ opal_filter "Enumerable" do
3
+ fails "Enumerable#chain returns a chain of self and provided enumerables" # NoMethodError: undefined method `chain' for #<EnumerableSpecs::Numerous:0x8c490>
4
+ fails "Enumerable#chain returns an Enumerator::Chain if given a block" # NoMethodError: undefined method `chain' for #<EnumerableSpecs::Numerous:0x6b0b4>
5
+ fails "Enumerable#chunk_while on a single-element array ignores the block and returns an enumerator that yields [element]" # Expected [] to equal [[1]]
6
+ fails "Enumerable#collect reports the same arity as the given block" # Exception: Cannot read property '$$is_array' of undefined
7
+ fails "Enumerable#collect yields 2 arguments for a Hash when block arity is 2" # ArgumentError: [#register] wrong number of arguments(1 for 2)
8
+ fails "Enumerable#first returns a gathered array from yield parameters"
9
+ fails "Enumerable#grep does not set $~ when given no block" # Expected nil == "z" to be truthy but was false
10
+ fails "Enumerable#grep_v does not set $~ when given no block" # Expected "e" == "z" to be truthy but was false
11
+ fails "Enumerable#map reports the same arity as the given block" # Exception: Cannot read property '$$is_array' of undefined
12
+ fails "Enumerable#map yields 2 arguments for a Hash when block arity is 2" # ArgumentError: [#register] wrong number of arguments(1 for 2)
13
+ fails "Enumerable#none? given a pattern argument returns true iff none match that pattern" # Works, but depends on the difference between Integer and Float
14
+ fails "Enumerable#reverse_each gathers whole arrays as elements when each yields multiple"
15
+ fails "Enumerable#slice_when when an iterator method yields more than one value processes all yielded values"
16
+ fails "Enumerable#slice_when when given a block doesn't yield an empty array on a small enumerable" # Expected [] to equal [[42]]
17
+ fails "Enumerable#sort_by calls #each to iterate over the elements to be sorted" # Mock '#<EnumerableSpecs::Numerous:0x64116>' expected to receive each("any_args") exactly 1 times but received it 0 times
18
+ fails "Enumerable#sort_by returns an array of elements when a block is supplied and #map returns an enumerable"
19
+ fails "Enumerable#take_while calls the block with initial args when yielded with multiple arguments"
20
+ fails "Enumerable#tally counts values as gathered array when yielded with multiple arguments" # NoMethodError: undefined method `tally' for #<EnumerableSpecs::YieldsMixed2:0x8e6b4>
21
+ 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 (expected array))
22
+ fails "Enumerable#to_h with block raises ArgumentError if block returns longer or shorter array" # Expected ArgumentError (/element has wrong array length/) but got: TypeError (wrong element type NilClass (expected array))
23
+ 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 (expected array))
24
+ fails "Enumerable#uniq uses eql? semantics" # Depends on the difference between Integer and Float
25
+ fails "Enumerable#zip passes each element of the result array to a block and return nil if a block is given"
26
+ end
@@ -0,0 +1,48 @@
1
+ # NOTE: run bin/format-filters after changing this file
2
+ opal_filter "Enumerator" do
3
+ fails "Enumerator#+ calls #each on each argument" # Mock 'obj1' expected to receive each("any_args") exactly 1 times but received it 0 times
4
+ fails "Enumerator#+ returns a chain of self and provided enumerators" # NoMethodError: undefined method `+' for #<Enumerator: #<Enumerator::Generator:0x55192>:each>
5
+ fails "Enumerator#enum_for exposes multi-arg yields as an array"
6
+ fails "Enumerator#feed can be called for each iteration"
7
+ fails "Enumerator#feed causes yield to return the value if called during iteration"
8
+ fails "Enumerator#feed raises a TypeError if called more than once without advancing the enumerator"
9
+ fails "Enumerator#feed returns nil"
10
+ fails "Enumerator#feed sets the future return value of yield if called before advancing the iterator"
11
+ fails "Enumerator#feed sets the return value of Yielder#yield"
12
+ fails "Enumerator#initialize returns self when given a block"
13
+ fails "Enumerator#initialize returns self when given an object"
14
+ fails "Enumerator#initialize sets size to nil if size is not given"
15
+ fails "Enumerator#initialize sets size to nil if the given size is nil"
16
+ fails "Enumerator#initialize sets size to the given size if the given size is Float::INFINITY"
17
+ fails "Enumerator#initialize sets size to the given size if the given size is a Fixnum"
18
+ fails "Enumerator#initialize sets size to the given size if the given size is a Proc"
19
+ 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
20
+ fails "Enumerator#next restarts the enumerator if an exception terminated a previous iteration" # Expected [#<NoMethodError: undefined method `next' for #<Enumerator: #<Enumerator::Generator:0x4f2>:each>>, #<NoMethodError: undefined method `next' for #<Enumerator: #<Enumerator::Generator:0x4f2>:each>>] == [#<StandardError: StandardError>, #<StandardError: StandardError>] to be truthy but was false
21
+ fails "Enumerator#next_values advances the position of the current element"
22
+ fails "Enumerator#next_values advances the position of the enumerator each time when called multiple times"
23
+ fails "Enumerator#next_values raises StopIteration if called on a finished enumerator"
24
+ fails "Enumerator#next_values returns an array with only nil if yield is called with nil"
25
+ fails "Enumerator#next_values returns an empty array if yield is called without arguments"
26
+ fails "Enumerator#next_values returns the next element in self"
27
+ fails "Enumerator#next_values works in concert with #rewind"
28
+ fails "Enumerator#peek can be called repeatedly without advancing the position of the current element"
29
+ fails "Enumerator#peek does not advance the position of the current element"
30
+ fails "Enumerator#peek raises StopIteration if called on a finished enumerator"
31
+ fails "Enumerator#peek returns the next element in self"
32
+ fails "Enumerator#peek works in concert with #rewind"
33
+ fails "Enumerator#peek_values can be called repeatedly without advancing the position of the current element"
34
+ fails "Enumerator#peek_values does not advance the position of the current element"
35
+ fails "Enumerator#peek_values raises StopIteration if called on a finished enumerator"
36
+ fails "Enumerator#peek_values returns an array with only nil if yield is called with nil"
37
+ fails "Enumerator#peek_values returns an empty array if yield is called without arguments"
38
+ fails "Enumerator#peek_values returns the next element in self"
39
+ fails "Enumerator#peek_values works in concert with #rewind"
40
+ fails "Enumerator#to_enum exposes multi-arg yields as an array" # NoMethodError: undefined method `next' for #<Enumerator: #<Object:0x53e80>:each>
41
+ fails "Enumerator.new no block given raises" # Expected ArgumentError but no exception was raised (#<Enumerator: 1:upto(3)> was returned)
42
+ fails "Enumerator.new when passed a block defines iteration with block, yielder argument and treating it as a proc" # Expected [] == ["a\n", "b\n", "c"] to be truthy but was false
43
+ fails "Enumerator.new when passed a block yielded values handles yield arguments properly" # Expected 1 == [1, 2] to be truthy but was false
44
+ fails "Enumerator.produce creates an infinite enumerator" # NoMethodError: undefined method `produce' for Enumerator
45
+ fails "Enumerator.produce terminates iteration when block raises StopIteration exception" # NoMethodError: undefined method `produce' for Enumerator
46
+ fails "Enumerator.produce when initial value skipped starts enumerable from result of first block call" # NoMethodError: undefined method `produce' for Enumerator
47
+ fails "Enumerator.produce when initial value skipped uses nil instead" # NoMethodError: undefined method `produce' for Enumerator
48
+ end