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
data/opal/corelib/set.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  # helpers: freeze
2
+ # backtick_javascript: true
3
+
2
4
  # Portions Copyright (c) 2002-2013 Akinori MUSHA <knu@iDaemons.org>
3
5
  class ::Set
4
6
  include ::Enumerable
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  require 'corelib/string'
2
4
 
3
5
  class ::Encoding
@@ -103,6 +105,7 @@ class ::Encoding
103
105
 
104
106
  class ::EncodingError < ::StandardError; end
105
107
  class ::CompatibilityError < ::EncodingError; end
108
+ class UndefinedConversionError < ::EncodingError; end
106
109
  end
107
110
 
108
111
  ::Encoding.register 'UTF-8', aliases: ['CP65001'], ascii: true do
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  require 'base64'
2
4
  require 'corelib/pack_unpack/format_string_parser'
3
5
 
@@ -1,4 +1,5 @@
1
- # helpers: coerce_to, respond_to, global_multiline_regexp, prop
1
+ # helpers: coerce_to, respond_to, global_multiline_regexp, prop, opal32_init, opal32_add
2
+ # backtick_javascript: true
2
3
 
3
4
  require 'corelib/comparable'
4
5
  require 'corelib/regexp'
@@ -8,11 +9,43 @@ class ::String < `String`
8
9
 
9
10
  %x{
10
11
  Opal.prop(#{self}.$$prototype, '$$is_string', true);
12
+
13
+ var string_id_map = new Map();
11
14
  }
12
15
 
13
- def __id__
14
- `self.toString()`
15
- end
16
+ # Force strict mode to suppress autoboxing of `this`
17
+ %x{
18
+ (function() {
19
+ 'use strict';
20
+ #{
21
+ def __id__
22
+ %x{
23
+ if (typeof self === 'object') {
24
+ return #{super}
25
+ }
26
+ if (string_id_map.has(self)) {
27
+ return string_id_map.get(self);
28
+ }
29
+ var id = Opal.uid();
30
+ string_id_map.set(self, id);
31
+ return id;
32
+ }
33
+ end
34
+
35
+ def hash
36
+ %x{
37
+ var hash = $opal32_init(), i, length = self.length;
38
+ hash = $opal32_add(hash, 0x5);
39
+ hash = $opal32_add(hash, length);
40
+ for (i = 0; i < length; i++) {
41
+ hash = $opal32_add(hash, self.charCodeAt(i));
42
+ }
43
+ return hash;
44
+ }
45
+ end
46
+ }
47
+ })();
48
+ }
16
49
 
17
50
  def self.try_convert(what)
18
51
  ::Opal.coerce_to?(what, ::String, :to_str)
@@ -24,7 +57,7 @@ class ::String < `String`
24
57
  var opts = args[args.length-1];
25
58
  str = $coerce_to(str, #{::String}, 'to_str');
26
59
  if (opts && opts.$$is_hash) {
27
- if (opts.$$smap.encoding) str = str.$force_encoding(opts.$$smap.encoding);
60
+ if (opts.has('encoding')) str = str.$force_encoding(opts.get('encoding').value);
28
61
  }
29
62
  str = new self.$$constructor(str);
30
63
  if (!str.$initialize.$$pristine) #{`str`.initialize(*args)};
@@ -561,10 +594,6 @@ class ::String < `String`
561
594
  }
562
595
  end
563
596
 
564
- def hash
565
- `self.toString()`
566
- end
567
-
568
597
  def hex
569
598
  to_i 16
570
599
  end
@@ -1060,17 +1089,18 @@ class ::String < `String`
1060
1089
  string = self.toString(),
1061
1090
  index = 0,
1062
1091
  match,
1063
- i, ii;
1092
+ match_count = 0,
1093
+ valid_result_length = 0,
1094
+ i, max;
1064
1095
 
1065
1096
  if (pattern.$$is_regexp) {
1066
1097
  pattern = $global_multiline_regexp(pattern);
1067
1098
  } else {
1068
1099
  pattern = $coerce_to(pattern, #{::String}, 'to_str').$to_s();
1100
+
1069
1101
  if (pattern === ' ') {
1070
1102
  pattern = /\s+/gm;
1071
1103
  string = string.replace(/^\s+/, '');
1072
- } else {
1073
- pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm');
1074
1104
  }
1075
1105
  }
1076
1106
 
@@ -1086,16 +1116,21 @@ class ::String < `String`
1086
1116
 
1087
1117
  if (limit === 0) {
1088
1118
  while (result[result.length - 1] === '') {
1089
- result.length -= 1;
1119
+ result.pop();
1090
1120
  }
1091
1121
  return result;
1092
1122
  }
1093
1123
 
1124
+ if (!pattern.$$is_regexp) {
1125
+ pattern = Opal.escape_regexp(pattern)
1126
+ pattern = new RegExp(pattern, 'gm');
1127
+ }
1128
+
1094
1129
  match = pattern.exec(string);
1095
1130
 
1096
1131
  if (limit < 0) {
1097
1132
  if (match !== null && match[0] === '' && pattern.source.indexOf('(?=') === -1) {
1098
- for (i = 0, ii = match.length; i < ii; i++) {
1133
+ for (i = 0, max = match.length; i < max; i++) {
1099
1134
  result.push('');
1100
1135
  }
1101
1136
  }
@@ -1103,7 +1138,8 @@ class ::String < `String`
1103
1138
  }
1104
1139
 
1105
1140
  if (match !== null && match[0] === '') {
1106
- result.splice(limit - 1, result.length - 1, result.slice(limit - 1).join(''));
1141
+ valid_result_length = (match.length - 1) * (limit - 1) + limit
1142
+ result.splice(valid_result_length - 1, result.length - 1, result.slice(valid_result_length - 1).join(''));
1107
1143
  return result;
1108
1144
  }
1109
1145
 
@@ -1111,16 +1147,16 @@ class ::String < `String`
1111
1147
  return result;
1112
1148
  }
1113
1149
 
1114
- i = 0;
1115
1150
  while (match !== null) {
1116
- i++;
1151
+ match_count++;
1117
1152
  index = pattern.lastIndex;
1118
- if (i + 1 === limit) {
1153
+ valid_result_length += match.length
1154
+ if (match_count + 1 === limit) {
1119
1155
  break;
1120
1156
  }
1121
1157
  match = pattern.exec(string);
1122
1158
  }
1123
- result.splice(limit - 1, result.length - 1, string.slice(index));
1159
+ result.splice(valid_result_length, result.length - 1, string.slice(index));
1124
1160
  return result;
1125
1161
  }
1126
1162
  end
@@ -1154,7 +1190,7 @@ class ::String < `String`
1154
1190
  } else {
1155
1191
  var prefix = $coerce_to(prefixes[i], #{::String}, 'to_str').$to_s();
1156
1192
 
1157
- if (self.indexOf(prefix) === 0) {
1193
+ if (self.length >= prefix.length && self.startsWith(prefix)) {
1158
1194
  return true;
1159
1195
  }
1160
1196
  }
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  require 'corelib/enumerable'
2
4
 
3
5
  class ::Struct
@@ -128,7 +130,7 @@ class ::Struct
128
130
  end
129
131
 
130
132
  def hash
131
- Hash.new(`self.$$data`).hash
133
+ [self.class, to_a].hash
132
134
  end
133
135
 
134
136
  def [](name)
@@ -288,7 +290,7 @@ class ::Struct
288
290
  `inspect_stack.pop()` if pushed
289
291
  end
290
292
 
291
- def to_h(&block)
293
+ def to_h(*args, &block)
292
294
  return map(&block).to_h(*args) if block_given?
293
295
 
294
296
  self.class.members.each_with_object({}) { |name, h| h[name] = self[name] }
data/opal/corelib/time.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # helpers: slice, deny_frozen_access
2
+ # backtick_javascript: true
2
3
 
3
4
  require 'corelib/comparable'
4
5
 
@@ -388,7 +389,7 @@ class ::Time < `Date`
388
389
  end
389
390
 
390
391
  def hash
391
- `'Time:' + self.getTime()`
392
+ [::Time, `self.getTime()`].hash
392
393
  end
393
394
 
394
395
  def inspect
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  class ::TracePoint
2
4
  # partial implementation of TracePoint
3
5
  # for the moment only supports the :class event
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  %x{
2
4
  var warnings = {};
3
5
 
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  # regexp matches
2
4
  %x{$gvars['&'] = $gvars['~'] = $gvars['`'] = $gvars["'"] = nil}
3
5
 
data/opal.gemspec CHANGED
@@ -45,8 +45,8 @@ Gem::Specification.new do |spec|
45
45
  spec.add_development_dependency 'selenium-webdriver'
46
46
  spec.add_development_dependency 'benchmark-ips', '< 2.8'
47
47
  spec.add_development_dependency 'sinatra', '~> 3.0'
48
- spec.add_development_dependency 'rubocop', '~> 0.67.0'
49
- spec.add_development_dependency 'rubocop-performance', '~> 1.1.0'
48
+ spec.add_development_dependency 'rubocop', '~> 1.50'
49
+ spec.add_development_dependency 'rubocop-performance', '~> 1.1'
50
50
  spec.add_development_dependency 'rack', '~> 2.2'
51
51
  spec.add_development_dependency 'webrick'
52
52
  spec.add_development_dependency 'benchmark_driver', '0.15.17' # version taken from test/cruby/common.mk
@@ -7,34 +7,90 @@ opal_filter "Array" do
7
7
  fails "Array#[] raises TypeError if to_int returns non-integer" # Expected TypeError but no exception was raised ([1, 2, 3, 4] was returned)
8
8
  fails "Array#[] raises a RangeError if passed a range with a bound that is too large" # Expected RangeError but no exception was raised (nil was returned)
9
9
  fails "Array#[] raises a type error if a range is passed with a length" # Expected TypeError but no exception was raised ([2, 3] was returned)
10
+ fails "Array#all? ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
11
+ fails "Array#all? tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
12
+ fails "Array#any? when given a pattern argument ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
13
+ fails "Array#any? with a block given tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
14
+ fails "Array#collect tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
15
+ fails "Array#collect! tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
16
+ fails "Array#count when a block argument given tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
17
+ fails "Array#delete_if tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
10
18
  fails "Array#drop raises a TypeError when the passed argument isn't an integer and #to_int returns non-Integer" # Expected TypeError but no exception was raised ([1, 2] was returned)
19
+ fails "Array#drop_while tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
11
20
  fails "Array#each does not yield elements deleted from the end of the array" # Expected [2, 3, nil] == [2, 3] to be truthy but was false
21
+ fails "Array#each tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
12
22
  fails "Array#each yields each element to the block even if the array is changed during iteration" # Expected [1, 2, 3, 4, 5] == [1, 2, 3, 4, 5, 7, 9] to be truthy but was false
13
23
  fails "Array#each yields elements added to the end of the array by the block" # Expected [2] == [2, 0, 0] to be truthy but was false
14
24
  fails "Array#each yields elements based on an internal index" # NoMethodError: undefined method `even?' for nil
15
25
  fails "Array#each yields only elements that are still in the array" # NoMethodError: undefined method `even?' for nil
16
26
  fails "Array#each yields the same element multiple times if inserting while iterating" # Expected [1, 1] == [1, 1, 2] to be truthy but was false
27
+ fails "Array#each_index tolerates increasing an array size during iteration" # Expected [0, 1, 2] == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102] to be truthy but was false
17
28
  fails "Array#fill with (filler, index, length) raises a TypeError when the length is not numeric" # Expected TypeError (/no implicit conversion of Symbol into Integer/) but got: TypeError (no implicit conversion of String into Integer)
18
29
  fails "Array#fill with (filler, range) works with endless ranges" # Expected [1, 2, 3, 4] == [1, 2, 3, "x"] to be truthy but was false
19
30
  fails "Array#filter returns a new array of elements for which block is true" # Expected [1] == [1, 4, 6] to be truthy but was false
31
+ fails "Array#filter tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
32
+ fails "Array#filter! tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
33
+ fails "Array#find_index tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
20
34
  fails "Array#flatten does not call #to_ary on elements beyond the given level" # Mock '1' expected to receive to_ary("any_args") exactly 0 times but received it 1 times
21
35
  fails "Array#flatten performs respond_to? and method_missing-aware checks when coercing elements to array" # NoMethodError: undefined method `respond_to?' for #<BasicObject:0x2698>
22
36
  fails "Array#flatten with a non-Array object in the Array calls #method_missing if defined" # Expected [#<MockObject:0x2730 @name="Array#flatten", @null=nil>] == [1, 2, 3] to be truthy but was false
37
+ fails "Array#index tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
38
+ fails "Array#initialize with no arguments does not use the given block" # Expected warning to match: /ruby\/core\/array\/initialize_spec.rb:57: warning: given block not used/ but got: ""
23
39
  fails "Array#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
40
+ fails "Array#intersect? tries to convert the passed argument to an Array using #to_ary" # Expected false == true to be truthy but was false
41
+ fails "Array#keep_if tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
42
+ fails "Array#map tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
43
+ fails "Array#map! tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
44
+ fails "Array#none? ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
45
+ fails "Array#none? tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
46
+ fails "Array#one? ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
47
+ fails "Array#one? tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
48
+ fails "Array#pack with format 'A' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
49
+ fails "Array#pack with format 'A' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
50
+ fails "Array#pack with format 'C' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
51
+ fails "Array#pack with format 'C' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
52
+ fails "Array#pack with format 'L' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
53
+ fails "Array#pack with format 'L' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
54
+ fails "Array#pack with format 'U' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
55
+ fails "Array#pack with format 'U' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
56
+ fails "Array#pack with format 'a' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
57
+ fails "Array#pack with format 'a' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
58
+ fails "Array#pack with format 'c' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
59
+ fails "Array#pack with format 'c' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
60
+ fails "Array#pack with format 'l' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
61
+ fails "Array#pack with format 'l' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
24
62
  fails "Array#pack with format 'u' calls #to_str to convert an Object to a String" # Mock 'pack u string' expected to receive to_str("any_args") exactly 1 times but received it 0 times
63
+ fails "Array#pack with format 'u' ignores comments in the format string" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
64
+ fails "Array#pack with format 'u' warns that a directive is unknown" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
25
65
  fails "Array#pack with format 'u' will not implicitly convert a number to a string" # Expected TypeError but got: RuntimeError (Unsupported pack directive "u" (no chunk reader defined))
26
66
  fails "Array#partition returns in the left array values for which the block evaluates to true" # Expected [[0], [1, 2, 3, 4, 5]] == [[0, 1, 2], [3, 4, 5]] to be truthy but was false
67
+ fails "Array#product returns converted arguments using :method_missing" # TypeError: no implicit conversion of ArraySpecs::ArrayMethodMissing into Array
27
68
  fails "Array#rassoc calls elem == obj on the second element of each contained array" # Expected [1, "foobar"] == [2, #<MockObject:0x4a6b4 @name="foobar", @null=nil>] to be truthy but was false
28
69
  fails "Array#rassoc does not check the last element in each contained but specifically the second" # Expected [1, "foobar", #<MockObject:0x4a37e @name="foobar", @null=nil>] == [2, #<MockObject:0x4a37e @name="foobar", @null=nil>, 1] to be truthy but was false
70
+ fails "Array#reject tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
71
+ fails "Array#reject! tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
72
+ fails "Array#reverse_each tolerates increasing an array size during iteration" # Expected ["c", "b", "a"] == ["c", "a", 1] to be truthy but was false
29
73
  fails "Array#sample returns nil for an empty array when called without n and a Random is given" # ArgumentError: invalid argument - 0
30
74
  fails "Array#select returns a new array of elements for which block is true" # Expected [1] == [1, 4, 6] to be truthy but was false
75
+ fails "Array#select tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
76
+ fails "Array#select! tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
77
+ fails "Array#shuffle! matches CRuby with random:" # Expected [7, 4, 5, 0, 3, 9, 2, 8, 10, 1, 6] == [2, 6, 8, 5, 7, 10, 3, 1, 0, 4, 9] to be truthy but was false
78
+ fails "Array#shuffle! matches CRuby with srand" # Expected ["d", "j", "g", "f", "i", "e", "c", "k", "b", "h", "a"] == ["a", "e", "f", "h", "i", "j", "d", "b", "g", "k", "c"] to be truthy but was false
31
79
  fails "Array#slice can be sliced with Enumerator::ArithmeticSequence has endless range with start outside of array's bounds" # Expected [] == nil to be truthy but was false
32
80
  fails "Array#slice can be sliced with Enumerator::ArithmeticSequence has range with bounds outside of array" # Expected RangeError but no exception was raised ([0, 2, 4] was returned)
33
81
  fails "Array#slice raises TypeError if to_int returns non-integer" # Expected TypeError but no exception was raised ([1, 2, 3, 4] was returned)
34
82
  fails "Array#slice raises a RangeError if passed a range with a bound that is too large" # Expected RangeError but no exception was raised (nil was returned)
35
83
  fails "Array#slice raises a type error if a range is passed with a length" # Expected TypeError but no exception was raised ([2, 3] was returned)
36
- fails "Array#to_h with block does not coerce returned pair to Array with #to_a" # Expected TypeError (/wrong element type MockObject at 0/) but got: TypeError (wrong element type NilClass at 0 (expected array))
37
- fails "Array#to_h with block raises TypeError if block returns something other than Array" # Expected TypeError (/wrong element type String at 0/) but got: TypeError (wrong element type NilClass at 0 (expected array))
84
+ fails "Array#sort_by! tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
85
+ fails "Array#sum calls + on the init value" # NoMethodError: undefined method `-' for #<MockObject:0x7f7c2 @name="b" @null=nil>
86
+ fails "Array#sum tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
87
+ fails "Array#take_while tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
88
+ fails "Array#to_h tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
38
89
  fails "Array#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
90
+ fails "Array#uniq tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
39
91
  fails "Array#uniq! properly handles recursive arrays" # Expected [1, "two", 3, [...], [...], [...]] == [1, "two", 3, [1, "two", 3, [...], [...], [...]]] to be truthy but was false
92
+ fails "Array#uniq! tolerates increasing an array size during iteration" # Expected [1, 2, 3] == [1, 2, 3, "a", "b", "c", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] to be truthy but was false
93
+ fails "Array#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:0x6273e>)
94
+ fails "Array.new with no arguments does not use the given block" # Expected warning to match: /warning: given block not used/ but got: ""
95
+ fails "Array.try_convert sends #to_ary to the argument and raises TypeError if it's not a kind of Array" # Expected TypeError (can't convert MockObject to Array (MockObject#to_ary gives Object)) but got: TypeError (can't convert MockObject into Array (MockObject#to_ary gives Object))
40
96
  end
@@ -2,6 +2,12 @@
2
2
  opal_filter "BasicObject" do
3
3
  fails "BasicObject raises NoMethodError for nonexistent methods after #method_missing is removed" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0xb5dc8>
4
4
  fails "BasicObject#initialize does not accept arguments" # NoMethodError: undefined method `class' for #<BasicObject:0x99f0>
5
+ fails "BasicObject#instance_eval class variables lookup does not have access to class variables in the receiver class when called with a String" # Expected NameError (/uninitialized class variable @@cvar/) but no exception was raised ("value_defined_in_receiver_scope" was returned)
6
+ fails "BasicObject#instance_eval class variables lookup gets class variables in the caller class when called with a String" # Expected "value_defined_in_receiver_scope" == "value_defined_in_caller_scope" to be truthy but was false
7
+ fails "BasicObject#instance_eval class variables lookup sets class variables in the caller class when called with a String" # NameError: uninitialized class variable @@cvar in BasicObjectSpecs::InstEval::CVar::Set::CallerScope
8
+ fails "BasicObject#instance_eval constants lookup when a String given looks in the caller class next" # Expected "ReceiverParent" == "Caller" to be truthy but was false
9
+ fails "BasicObject#instance_eval constants lookup when a String given looks in the caller outer scopes next" # Expected "ReceiverParent" == "CallerScope" to be truthy but was false
10
+ fails "BasicObject#instance_eval constants lookup when a String given looks in the receiver singleton class first" # Expected "Receiver" == "singleton_class" to be truthy but was false
5
11
  fails "BasicObject#instance_eval converts filename argument with #to_str method" # Expected "<internal" == "file.rb" to be truthy but was false
6
12
  fails "BasicObject#instance_eval converts lineno argument with #to_int method" # Expected "corelib/kernel.rb>" == "15" to be truthy but was false
7
13
  fails "BasicObject#instance_eval converts string argument with #to_str method" # NoMethodError: undefined method `encoding' for #<Object:0x72810>
@@ -10,6 +16,7 @@ opal_filter "BasicObject" do
10
16
  fails "BasicObject#instance_eval has access to the caller's local variables" # Expected nil == "value" to be truthy but was false
11
17
  fails "BasicObject#instance_eval raises ArgumentError if returned value is not Integer" # Expected TypeError (/can't convert Object to Integer/) but got: RuntimeError ()
12
18
  fails "BasicObject#instance_eval raises ArgumentError if returned value is not String" # Expected TypeError (/can't convert Object to String/) but got: NoMethodError (undefined method `encoding' for #<Object:0x72a4a>)
19
+ fails "BasicObject#instance_eval raises TypeError for frozen objects when tries to set receiver's instance variables" # Expected FrozenError (can't modify frozen NilClass: nil) but no exception was raised (42 was returned)
13
20
  fails "BasicObject#instance_eval raises an ArgumentError when a block and normal arguments are given" # Expected ArgumentError (wrong number of arguments (given 2, expected 0)) but got: ArgumentError (wrong number of arguments (2 for 0))
14
21
  fails "BasicObject#instance_eval raises an ArgumentError when more than 3 arguments are given" # Expected ArgumentError (wrong number of arguments (given 4, expected 1..3)) but got: ArgumentError (wrong number of arguments (0 for 1..3))
15
22
  fails "BasicObject#instance_eval raises an ArgumentError when no arguments and no block are given" # Expected ArgumentError (wrong number of arguments (given 0, expected 1..3)) but got: ArgumentError (wrong number of arguments (0 for 1..3))
@@ -5,7 +5,6 @@ opal_filter "BigDecimal" do
5
5
  fails "BidDecimal#hash two BigDecimal objects with the same value should have the same hash for infinite values" # Expected 27530 == 27534 to be truthy but was false
6
6
  fails "BidDecimal#hash two BigDecimal objects with the same value should have the same hash for ordinary values" # Expected 27574 == 27578 to be truthy but was false
7
7
  fails "BidDecimal#hash two BigDecimal objects with the same value should have the same hash for zero values" # Expected 27442 == 27446 to be truthy but was false
8
- fails "BigDecimal constants defines a VERSION value" # Expected false to be true
9
8
  fails "BigDecimal constants exception-related constants has a EXCEPTION_ALL value" # NameError: uninitialized constant BigDecimal::EXCEPTION_ALL
10
9
  fails "BigDecimal constants exception-related constants has a EXCEPTION_INFINITY value" # NameError: uninitialized constant BigDecimal::EXCEPTION_INFINITY
11
10
  fails "BigDecimal constants exception-related constants has a EXCEPTION_NaN value" # NameError: uninitialized constant BigDecimal::EXCEPTION_NaN
@@ -176,7 +175,7 @@ opal_filter "BigDecimal" do
176
175
  fails "BigDecimal#to_s can use conventional floating point notation" # NoMethodError: undefined method `default_internal' for Encoding
177
176
  fails "BigDecimal#to_s can use engineering notation" # NoMethodError: undefined method `default_internal' for Encoding
178
177
  fails "BigDecimal#to_s does not add an exponent for zero values" # NoMethodError: undefined method `default_internal' for Encoding
179
- fails "BigDecimal#to_s inserts a space every n chars, if integer n is supplied" # NoMethodError: undefined method `default_internal' for Encoding
178
+ fails "BigDecimal#to_s inserts a space every n chars to fraction part, if integer n is supplied" # NoMethodError: undefined method `default_internal' for Encoding
180
179
  fails "BigDecimal#to_s removes trailing spaces in floating point notation" # NoMethodError: undefined method `default_internal' for Encoding
181
180
  fails "BigDecimal#to_s return type is of class String" # NoMethodError: undefined method `default_internal' for Encoding
182
181
  fails "BigDecimal#to_s returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
@@ -23,4 +23,5 @@ opal_filter "Binding" do
23
23
  fails "Binding#local_variables includes local variables defined after calling binding.local_variables" # Expected [] == ["a", "b"] to be truthy but was false
24
24
  fails "Binding#local_variables includes local variables of inherited scopes and eval'ed context" # Expected ["c"] == ["c", "a", "b", "p"] to be truthy but was false
25
25
  fails "Binding#local_variables includes new variables defined in the binding" # Expected ["b"] == ["a", "b"] to be truthy but was false
26
+ fails "Binding#source_location works for eval with a given line" # Expected ["foo", 1] == ["foo", 100] to be truthy but was false
26
27
  end
@@ -1,13 +1,12 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Class" do
3
3
  fails "Class#allocate raises TypeError for #superclass" # Expected TypeError but no exception was raised (nil was returned)
4
- fails "Class#dup duplicates both the class and the singleton class" # Exception: self.$$constructor is not a constructor
5
- fails "Class#dup retains an included module in the ancestor chain for the singleton class" # NoMethodError: undefined method `hello' for #<Module:0x402e6>
6
- fails "Class#dup retains the correct ancestor chain for the singleton class" # Exception: self.$$constructor is not a constructor
4
+ fails "Class#dup raises TypeError if called on BasicObject" # Expected TypeError (can't copy the root class) but got: Exception (Cannot read properties of null (reading '$$is_number'))
7
5
  fails "Class#initialize raises a TypeError when called on BasicObject" # Expected TypeError but no exception was raised (nil was returned)
8
6
  fails "Class#initialize raises a TypeError when called on already initialized classes" # Expected TypeError but no exception was raised (nil was returned)
9
7
  fails "Class#initialize when given the Class raises a TypeError" # Expected TypeError but got: ArgumentError ([.initialize] wrong number of arguments (given 1, expected 0))
10
8
  fails "Class#new uses the internal allocator and does not call #allocate" # RuntimeError: allocate should not be called
9
+ fails "Class#subclasses works when creating subclasses concurrently" # NotImplementedError: Thread creation not available
11
10
  fails "Class.new raises a TypeError if passed a metaclass" # Expected TypeError but no exception was raised (#<Class:0x34cae> was returned)
12
11
  fails_badly "Class#descendants returns a list of classes descended from self (excluding self)" # GC/Spec order issue. Expected [#<Class:0x2e77c>, #<Class:0x2e79a>, #<Class:0x37368>, ModuleSpecs::Child, ModuleSpecs::Child2, ModuleSpecs::Grandchild] == [ModuleSpecs::Child, ModuleSpecs::Child2, ModuleSpecs::Grandchild] to be truthy but was false
13
12
  fails_badly "Class#subclasses returns a list of classes directly inheriting from self" # GC/Spec order issue. Expected [#<Class:0x2e77c>, #<Class:0x2e79a>, #<Class:0x37368>, ModuleSpecs::Child, ModuleSpecs::Child2] == [ModuleSpecs::Child, ModuleSpecs::Child2] to be truthy but was false
@@ -2,7 +2,10 @@
2
2
  opal_filter "Complex" do
3
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
4
  fails "Complex#coerce returns an array containing other as Complex and self when other is a Numeric which responds to #real? with true" # Expected (#<NumericMockObject:0x1574c @name="other" @null=nil>+0i) to have same value and type as (#<NumericMockObject:0x1574c @name="other" @null=nil>+0i)
5
+ fails "Complex#inspect adds an `*' before the `i' if the last character of the imaginary part is not numeric" # ArgumentError: comparison of NumericSpecs::Subclass with 0 failed
6
+ fails "Complex#inspect calls #inspect on real and imaginary" # ArgumentError: comparison of NumericSpecs::Subclass with 0 failed
5
7
  fails "Complex#to_c returns self" # Expected ((1+5i)+0i) to be identical to (1+5i)
6
8
  fails "Complex#to_c returns the same value" # Expected ((1+5i)+0i) == (1+5i) to be truthy but was false
9
+ fails "Complex#to_s treats real and imaginary parts as strings" # ArgumentError: comparison of NumericSpecs::Subclass with 0 failed
7
10
  fails "Complex.polar computes the real values of the real & imaginary parts from the polar form" # TypeError: not a real
8
11
  end
@@ -1,10 +1,10 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Date" do
3
+ fails "Date constants defines MONTHNAMES" # Expected [nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "Unknown"] == [nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] to be truthy but was false
4
+ 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)
3
5
  fails "Date#>> returns the day of the reform if date falls within calendar reform" # Expected #<Date:0x28ea @date=1582-10-09 00:00:00 +0124, @start=2299161> == #<Date:0x28e6 @date=1582-10-04 00:00:00 +0124, @start=2299161> to be truthy but was false
4
6
  fails "Date#ajd determines the Astronomical Julian day" # NoMethodError: undefined method `ajd' for #<Date:0x9f5b0 @date=2007-01-17 00:00:00 +0100 @start=2299161>
5
7
  fails "Date#amjd determines the Astronomical Modified Julian day" # NoMethodError: undefined method `amjd' for #<Date:0x9f5ba @date=2007-01-17 00:00:00 +0100 @start=2299161>
6
- fails "Date#civil creates a Date for different calendar reform dates" # Expected 5 == 15 to be truthy but was false
7
- fails "Date#civil doesn't create dates for invalid arguments" # Expected ArgumentError but no exception was raised (#<Date:0x73d98 @date=2001-01-31 00:00:00 +0100, @start=2299161> was returned)
8
8
  fails "Date#commercial creates a Date for Julian Day Number day 0 by default" # NoMethodError: undefined method `commercial' for Date
9
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
10
  fails "Date#commercial creates a Date for the monday in the year and week given" # NoMethodError: undefined method `commercial' for Date
@@ -31,6 +31,7 @@ opal_filter "Date" do
31
31
  fails "Date#strftime should be able to print the commercial year with only two digits" # TypeError: no implicit conversion of Range into Integer
32
32
  fails "Date#strftime should be able to show a full notation" # Expected "%+" == "Sun Apr 9 00:00:00 +00:00 2000" to be truthy but was false
33
33
  fails "Date#strftime should be able to show the commercial week day" # Expected "1" == "7" to be truthy but was false
34
+ fails "Date#strftime should be able to show the commercial week" # Expected " 9-APR-2000" == " 9-Apr-2000" to be truthy but was false
34
35
  fails "Date#strftime should be able to show the number of seconds since the unix epoch for a date" # Expected "954972000" == "954979200" to be truthy but was false
35
36
  fails "Date#strftime should be able to show the timezone of the date with a : separator" # Expected "+0200" == "+0000" to be truthy but was false
36
37
  fails "Date#strftime should be able to show the timezone with a : separator" # Expected "Central European Summer Time" == "+00:00" to be truthy but was false
@@ -72,6 +73,8 @@ opal_filter "Date" do
72
73
  fails "Date#valid_date? returns true if it is a valid civil date" # NoMethodError: undefined method `valid_date?' for Date
73
74
  fails "Date._iso8601 returns an empty hash if the argument is a invalid Date" # NoMethodError: undefined method `_iso8601' for Date
74
75
  fails "Date._rfc3339 returns an empty hash if the argument is a invalid Date" # NoMethodError: undefined method `_rfc3339' for Date
76
+ fails "Date.civil creates a Date for different calendar reform dates" # Expected 5 == 15 to be truthy but was false
77
+ fails "Date.civil doesn't create dates for invalid arguments" # Expected ArgumentError but no exception was raised (#<Date:0x9c330 @date=2001-01-31 00:00:00 +0100, @start=2299161> was returned)
75
78
  fails "Date.iso8601 parses YYYY-MM-DD into a Date object" # NoMethodError: undefined method `iso8601' for Date
76
79
  fails "Date.iso8601 parses YYYYMMDD into a Date object" # NoMethodError: undefined method `iso8601' for Date
77
80
  fails "Date.iso8601 parses a StringSubclass into a Date object" # NoMethodError: undefined method `iso8601' for Date
@@ -16,6 +16,7 @@ opal_filter "DateTime" do
16
16
  fails "DateTime#strftime should be able to show a full notation" # Expected "%+" == "Sat Feb 3 04:05:06 +00:00 2001" to be truthy but was false
17
17
  fails "DateTime#strftime should be able to show default Logger format" # Expected "2001-12-03T04:05:06.000000 " == "2001-12-03T04:05:06.100000 " to be truthy but was false
18
18
  fails "DateTime#strftime should be able to show the commercial week day" # Expected "1" == "7" to be truthy but was false
19
+ fails "DateTime#strftime should be able to show the commercial week" # Expected " 3-FEB-2001" == " 3-Feb-2001" to be truthy but was false
19
20
  fails "DateTime#strftime should be able to show the number of seconds since the unix epoch" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
20
21
  fails "DateTime#strftime should be able to show the timezone of the date with a : separator" # Expected "-0000" == "+0000" to be truthy but was false
21
22
  fails "DateTime#strftime should be able to show the timezone with a : separator" # Expected "UTC" == "+00:00" to be truthy but was false
@@ -3,7 +3,6 @@ opal_filter "Delegate" do
3
3
  fails "Delegator#!= is delegated in general" # Exception: Maximum call stack size exceeded
4
4
  fails "Delegator#== is delegated in general" # Exception: Maximum call stack size exceeded
5
5
  fails "Delegator#method raises a NameError if method is no longer valid because object has changed" # Expected NameError but no exception was raised ("foo" was returned)
6
+ fails "Delegator#method returns a method object for public methods of the delegate object" # NameError: undefined method `pub' for class `DelegateSpecs::Delegator'
6
7
  fails "Delegator#method returns a method that respond_to_missing?" # NameError: undefined method `pub_too' for class `DelegateSpecs::Simple'
7
- fails "Delegator#methods includes instance methods of the Delegator class" # Expected ["singleton_method", "pub", "respond_to_missing?", "method_missing", "priv", "prot", "to_json", "guard", "guard_not", "with_feature", "without_feature", "new_fd", "new_io", "should", "should_not", "version_is", "ruby_version_is", "kernel_version_is", "suppress_warning", "suppress_keyword_warning", "should_receive", "should_not_receive", "stub!", "mock", "mock_int", "mock_numeric", "evaluate", "before", "after", "describe", "it", "it_should_behave_like", "context", "specify", "it_behaves_like", "ruby_bug", "conflicts_with", "big_endian", "little_endian", "platform_is", "platform_is_not", "quarantine!", "not_supported_on", "as_superuser", "as_real_superuser", "as_user", "argf", "argv", "new_datetime", "with_timezone", "fixture", "flunk", "cp", "mkdir_p", "rm_r", "touch", "mock_to_path", "nan_value", "infinity_value", "bignum_value", "max_long", "min_long", "fixnum_max", "fixnum_min", "ruby_exe_options", "resolve_ruby_exe", "ruby_exe", "ruby_cmd", "opal_filter", "opal_unsupported_filter", "frozen_error_class", "pack_format", "DelegateClass", "module_specs_public_method_on_object", "module_specs_private_method_on_object", "module_specs_protected_method_on_object", "module_specs_private_method_on_object_for_kernel_public", "module_specs_public_method_on_object_for_kernel_protected", "module_specs_public_method_on_object_for_kernel_private", "unpack_format", "toplevel_define_other_method", "some_toplevel_method", "public_toplevel_method", "shellsplit", "shellwords", "shellescape", "shelljoin", "expect", "eq", "pretty_print", "pretty_print_cycle", "pretty_print_instance_variables", "pretty_print_inspect", "=~", "!~", "===", "<=>", "method", "methods", "public_methods", "Array", "at_exit", "caller", "caller_locations", "class", "copy_instance_variables", "copy_singleton_methods", "clone", "initialize_clone", "define_singleton_method", "dup", "initialize_dup", "enum_for", "equal?", "exit", "extend", "freeze", "frozen?", "gets", "hash", "initialize_copy", "inspect", "instance_of?", "instance_variable_defined?", "instance_variable_get", "instance_variable_set", "remove_instance_variable", "instance_variables", "Integer", "Float", "Hash", "is_a?", "itself", "lambda", "load", "loop", "nil?", "printf", "proc", "puts", "p", "print", "readline", "warn", "raise", "rand", "respond_to?", "require", "require_relative", "require_tree", "singleton_class", "sleep", "srand", "String", "tap", "to_proc", "to_s", "catch", "throw", "open", "yield_self", "fail", "kind_of?", "object_id", "public_send", "send", "then", "to_enum", "format", "sprintf", "Complex", "Rational", "taint", "untaint", "tainted?", "private_methods", "protected_methods", "private_instance_methods", "protected_instance_methods", "eval", "binding", "Pathname", "require_remote", "pretty_inspect", "pp", "opal_parse", "eval_js", "BigDecimal", "module_specs_public_method_on_kernel", "module_specs_alias_on_kernel", "__send__", "__id__", "==", "!", "initialize", "eql?", "!=", "instance_eval", "instance_exec", "singleton_method_added", "singleton_method_removed", "singleton_method_undefined", "__marshal__"] to include "extra"
8
- fails "Delegator#tap yield the delegator object" # Expected 0 == 1 to be truthy but was false
9
8
  end
@@ -1,6 +1,7 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Encoding" do
3
3
  fails "File.basename returns the basename with the same encoding as the original" # NameError: uninitialized constant Encoding::Windows_1250
4
+ 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
4
5
  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
5
6
  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
6
7
  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
@@ -36,7 +37,6 @@ opal_filter "Encoding" do
36
37
  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:0x49e4c>
37
38
  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:0x49e4c>
38
39
  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:0x49e4c>
39
- 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:0x49e4c>
40
40
  fails "Source files encoded in UTF-8 with a BOM can be parsed" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x49e4c>
41
41
  fails "Source files encoded in UTF-8 without a BOM can be parsed" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x49e4c>
42
42
  fails "String#% output's encoding negotiates a compatible encoding if necessary" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false