opal 1.6.1 → 1.7.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +17 -0
  3. data/Gemfile +1 -0
  4. data/HACKING.md +47 -26
  5. data/UNRELEASED.md +28 -0
  6. data/benchmark/benchmarks +415 -103
  7. data/benchmark/bm_call_overhead.yml +28 -0
  8. data/benchmark/run.rb +61 -40
  9. data/docs/cdp_common.json +3364 -0
  10. data/docs/cdp_common.md +18 -0
  11. data/docs/{headless_chrome.md → headless_browsers.md} +31 -12
  12. data/lib/opal/ast/builder.rb +1 -1
  13. data/lib/opal/builder.rb +6 -1
  14. data/lib/opal/builder_processors.rb +5 -3
  15. data/lib/opal/cache.rb +1 -7
  16. data/lib/opal/cli_options.rb +72 -58
  17. data/lib/opal/cli_runners/chrome.rb +47 -9
  18. data/lib/opal/cli_runners/chrome_cdp_interface.rb +238 -112
  19. data/lib/opal/cli_runners/compiler.rb +146 -13
  20. data/lib/opal/cli_runners/deno.rb +32 -0
  21. data/lib/opal/cli_runners/firefox.rb +350 -0
  22. data/lib/opal/cli_runners/firefox_cdp_interface.rb +212 -0
  23. data/lib/opal/cli_runners/node_modules/.bin/chrome-remote-interface.cmd +17 -0
  24. data/lib/opal/cli_runners/node_modules/.bin/chrome-remote-interface.ps1 +28 -0
  25. data/lib/opal/cli_runners/node_modules/.package-lock.json +41 -0
  26. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/LICENSE +1 -1
  27. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/README.md +322 -182
  28. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/bin/client.js +99 -114
  29. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/chrome-remote-interface.js +1 -11
  30. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js +16 -11
  31. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/api.js +41 -33
  32. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/chrome.js +224 -214
  33. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/devtools.js +71 -191
  34. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/external-request.js +26 -6
  35. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/protocol.json +20788 -9049
  36. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/websocket-wrapper.js +10 -3
  37. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/package.json +59 -123
  38. data/lib/opal/cli_runners/node_modules/chrome-remote-interface/webpack.config.js +25 -32
  39. data/lib/opal/cli_runners/node_modules/commander/History.md +298 -0
  40. data/lib/opal/cli_runners/node_modules/commander/LICENSE +22 -0
  41. data/lib/opal/cli_runners/node_modules/commander/Readme.md +217 -61
  42. data/lib/opal/cli_runners/node_modules/commander/index.js +431 -145
  43. data/lib/opal/cli_runners/node_modules/commander/package.json +16 -79
  44. data/lib/opal/cli_runners/node_modules/ws/README.md +334 -98
  45. data/lib/opal/cli_runners/node_modules/ws/browser.js +8 -0
  46. data/lib/opal/cli_runners/node_modules/ws/index.js +5 -10
  47. data/lib/opal/cli_runners/node_modules/ws/lib/buffer-util.js +129 -0
  48. data/lib/opal/cli_runners/node_modules/ws/lib/constants.js +10 -0
  49. data/lib/opal/cli_runners/node_modules/ws/lib/event-target.js +184 -0
  50. data/lib/opal/cli_runners/node_modules/ws/lib/extension.js +223 -0
  51. data/lib/opal/cli_runners/node_modules/ws/lib/limiter.js +55 -0
  52. data/lib/opal/cli_runners/node_modules/ws/lib/permessage-deflate.js +518 -0
  53. data/lib/opal/cli_runners/node_modules/ws/lib/receiver.js +607 -0
  54. data/lib/opal/cli_runners/node_modules/ws/lib/sender.js +409 -0
  55. data/lib/opal/cli_runners/node_modules/ws/lib/stream.js +180 -0
  56. data/lib/opal/cli_runners/node_modules/ws/lib/validation.js +104 -0
  57. data/lib/opal/cli_runners/node_modules/ws/lib/websocket-server.js +447 -0
  58. data/lib/opal/cli_runners/node_modules/ws/lib/websocket.js +1195 -0
  59. data/lib/opal/cli_runners/node_modules/ws/package.json +40 -106
  60. data/lib/opal/cli_runners/package-lock.json +62 -0
  61. data/lib/opal/cli_runners/package.json +1 -1
  62. data/lib/opal/cli_runners.rb +26 -4
  63. data/lib/opal/nodes/args/prepare_post_args.rb +2 -2
  64. data/lib/opal/nodes/def.rb +8 -8
  65. data/lib/opal/nodes/iter.rb +12 -12
  66. data/lib/opal/nodes/logic.rb +1 -1
  67. data/lib/opal/nodes/masgn.rb +2 -2
  68. data/lib/opal/parser/with_ruby_lexer.rb +1 -1
  69. data/lib/opal/paths.rb +14 -0
  70. data/lib/opal/rewriter.rb +2 -0
  71. data/lib/opal/rewriters/forward_args.rb +52 -4
  72. data/lib/opal/rewriters/targeted_patches.rb +94 -0
  73. data/lib/opal/version.rb +1 -1
  74. data/opal/corelib/basic_object.rb +1 -1
  75. data/opal/corelib/boolean.rb +2 -2
  76. data/opal/corelib/class.rb +11 -0
  77. data/opal/corelib/constants.rb +3 -3
  78. data/opal/corelib/enumerable.rb +4 -0
  79. data/opal/corelib/enumerator.rb +1 -1
  80. data/opal/corelib/hash.rb +2 -2
  81. data/opal/corelib/helpers.rb +1 -1
  82. data/opal/corelib/kernel.rb +3 -3
  83. data/opal/corelib/method.rb +1 -1
  84. data/opal/corelib/module.rb +29 -8
  85. data/opal/corelib/proc.rb +7 -5
  86. data/opal/corelib/runtime.js +141 -78
  87. data/opal/corelib/set.rb +252 -0
  88. data/opal/corelib/string.rb +2 -1
  89. data/opal/corelib/time.rb +2 -2
  90. data/opal/opal.rb +1 -0
  91. data/opal.gemspec +1 -0
  92. data/spec/filters/bugs/array.rb +22 -13
  93. data/spec/filters/bugs/base64.rb +5 -5
  94. data/spec/filters/bugs/basicobject.rb +16 -8
  95. data/spec/filters/bugs/bigdecimal.rb +161 -160
  96. data/spec/filters/bugs/binding.rb +10 -10
  97. data/spec/filters/bugs/class.rb +8 -8
  98. data/spec/filters/bugs/complex.rb +2 -1
  99. data/spec/filters/bugs/date.rb +79 -81
  100. data/spec/filters/bugs/datetime.rb +29 -29
  101. data/spec/filters/bugs/delegate.rb +1 -3
  102. data/spec/filters/bugs/encoding.rb +69 -69
  103. data/spec/filters/bugs/enumerable.rb +22 -20
  104. data/spec/filters/bugs/enumerator.rb +88 -85
  105. data/spec/filters/bugs/exception.rb +46 -40
  106. data/spec/filters/bugs/file.rb +32 -32
  107. data/spec/filters/bugs/float.rb +26 -21
  108. data/spec/filters/bugs/freeze.rb +88 -0
  109. data/spec/filters/bugs/hash.rb +39 -38
  110. data/spec/filters/bugs/integer.rb +57 -44
  111. data/spec/filters/bugs/io.rb +1 -1
  112. data/spec/filters/bugs/kernel.rb +349 -269
  113. data/spec/filters/bugs/language.rb +220 -188
  114. data/spec/filters/bugs/main.rb +5 -3
  115. data/spec/filters/bugs/marshal.rb +38 -38
  116. data/spec/filters/bugs/math.rb +2 -1
  117. data/spec/filters/bugs/method.rb +73 -62
  118. data/spec/filters/bugs/module.rb +163 -143
  119. data/spec/filters/bugs/numeric.rb +6 -6
  120. data/spec/filters/bugs/objectspace.rb +16 -16
  121. data/spec/filters/bugs/openstruct.rb +1 -1
  122. data/spec/filters/bugs/pack_unpack.rb +51 -51
  123. data/spec/filters/bugs/pathname.rb +7 -7
  124. data/spec/filters/bugs/proc.rb +63 -63
  125. data/spec/filters/bugs/random.rb +7 -6
  126. data/spec/filters/bugs/range.rb +12 -9
  127. data/spec/filters/bugs/rational.rb +8 -7
  128. data/spec/filters/bugs/regexp.rb +49 -48
  129. data/spec/filters/bugs/ruby-32.rb +56 -0
  130. data/spec/filters/bugs/set.rb +30 -30
  131. data/spec/filters/bugs/singleton.rb +4 -4
  132. data/spec/filters/bugs/string.rb +187 -99
  133. data/spec/filters/bugs/stringio.rb +7 -0
  134. data/spec/filters/bugs/stringscanner.rb +68 -68
  135. data/spec/filters/bugs/struct.rb +11 -9
  136. data/spec/filters/bugs/symbol.rb +1 -1
  137. data/spec/filters/bugs/time.rb +78 -63
  138. data/spec/filters/bugs/trace_point.rb +4 -4
  139. data/spec/filters/bugs/unboundmethod.rb +32 -17
  140. data/spec/filters/bugs/warnings.rb +8 -12
  141. data/spec/filters/unsupported/array.rb +24 -107
  142. data/spec/filters/unsupported/basicobject.rb +12 -12
  143. data/spec/filters/unsupported/bignum.rb +27 -52
  144. data/spec/filters/unsupported/class.rb +1 -2
  145. data/spec/filters/unsupported/delegator.rb +3 -3
  146. data/spec/filters/unsupported/enumerable.rb +2 -9
  147. data/spec/filters/unsupported/enumerator.rb +2 -11
  148. data/spec/filters/unsupported/file.rb +1 -1
  149. data/spec/filters/unsupported/float.rb +28 -47
  150. data/spec/filters/unsupported/hash.rb +8 -14
  151. data/spec/filters/unsupported/integer.rb +75 -91
  152. data/spec/filters/unsupported/kernel.rb +17 -35
  153. data/spec/filters/unsupported/language.rb +11 -19
  154. data/spec/filters/unsupported/marshal.rb +22 -41
  155. data/spec/filters/unsupported/matchdata.rb +28 -52
  156. data/spec/filters/unsupported/math.rb +1 -1
  157. data/spec/filters/unsupported/privacy.rb +229 -285
  158. data/spec/filters/unsupported/range.rb +1 -5
  159. data/spec/filters/unsupported/regexp.rb +40 -66
  160. data/spec/filters/unsupported/set.rb +2 -2
  161. data/spec/filters/unsupported/singleton.rb +4 -4
  162. data/spec/filters/unsupported/string.rb +305 -508
  163. data/spec/filters/unsupported/struct.rb +3 -4
  164. data/spec/filters/unsupported/symbol.rb +15 -18
  165. data/spec/filters/unsupported/thread.rb +1 -7
  166. data/spec/filters/unsupported/time.rb +159 -202
  167. data/spec/filters/unsupported/usage_of_files.rb +170 -259
  168. data/spec/lib/builder_spec.rb +4 -4
  169. data/spec/lib/rewriters/forward_args_spec.rb +32 -12
  170. data/spec/mspec-opal/runner.rb +2 -0
  171. data/spec/ruby_specs +4 -0
  172. data/stdlib/deno/base.rb +28 -0
  173. data/stdlib/deno/file.rb +340 -0
  174. data/stdlib/{headless_chrome.rb → headless_browser/base.rb} +1 -1
  175. data/stdlib/headless_browser/file.rb +15 -0
  176. data/stdlib/headless_browser.rb +4 -0
  177. data/stdlib/native.rb +1 -1
  178. data/stdlib/nodejs/file.rb +5 -0
  179. data/stdlib/opal/platform.rb +8 -6
  180. data/stdlib/opal-platform.rb +14 -8
  181. data/stdlib/set.rb +1 -258
  182. data/tasks/benchmarking.rake +62 -19
  183. data/tasks/performance.rake +1 -1
  184. data/tasks/testing.rake +5 -3
  185. data/test/nodejs/test_file.rb +29 -10
  186. data/test/opal/http_server.rb +28 -11
  187. data/test/opal/unsupported_and_bugs.rb +2 -1
  188. metadata +91 -52
  189. data/lib/opal/cli_runners/node_modules/ultron/LICENSE +0 -22
  190. data/lib/opal/cli_runners/node_modules/ultron/index.js +0 -138
  191. data/lib/opal/cli_runners/node_modules/ultron/package.json +0 -112
  192. data/lib/opal/cli_runners/node_modules/ws/SECURITY.md +0 -33
  193. data/lib/opal/cli_runners/node_modules/ws/lib/BufferUtil.fallback.js +0 -56
  194. data/lib/opal/cli_runners/node_modules/ws/lib/BufferUtil.js +0 -15
  195. data/lib/opal/cli_runners/node_modules/ws/lib/ErrorCodes.js +0 -28
  196. data/lib/opal/cli_runners/node_modules/ws/lib/EventTarget.js +0 -158
  197. data/lib/opal/cli_runners/node_modules/ws/lib/Extensions.js +0 -69
  198. data/lib/opal/cli_runners/node_modules/ws/lib/PerMessageDeflate.js +0 -339
  199. data/lib/opal/cli_runners/node_modules/ws/lib/Receiver.js +0 -520
  200. data/lib/opal/cli_runners/node_modules/ws/lib/Sender.js +0 -438
  201. data/lib/opal/cli_runners/node_modules/ws/lib/Validation.fallback.js +0 -9
  202. data/lib/opal/cli_runners/node_modules/ws/lib/Validation.js +0 -17
  203. data/lib/opal/cli_runners/node_modules/ws/lib/WebSocket.js +0 -705
  204. data/lib/opal/cli_runners/node_modules/ws/lib/WebSocketServer.js +0 -336
  205. data/spec/filters/bugs/boolean.rb +0 -3
  206. data/spec/filters/bugs/matrix.rb +0 -3
  207. data/spec/filters/unsupported/fixnum.rb +0 -15
  208. data/spec/filters/unsupported/freeze.rb +0 -102
  209. data/spec/filters/unsupported/pathname.rb +0 -4
  210. data/spec/filters/unsupported/proc.rb +0 -4
  211. data/spec/filters/unsupported/random.rb +0 -5
  212. data/spec/filters/unsupported/taint.rb +0 -162
@@ -0,0 +1,252 @@
1
+ # helpers: freeze
2
+ # Portions Copyright (c) 2002-2013 Akinori MUSHA <knu@iDaemons.org>
3
+ class ::Set
4
+ include ::Enumerable
5
+
6
+ def self.[](*ary)
7
+ new(ary)
8
+ end
9
+
10
+ def initialize(enum = nil, &block)
11
+ @hash = {}
12
+
13
+ return if enum.nil?
14
+ ::Kernel.raise ::ArgumentError, 'value must be enumerable' unless ::Enumerable === enum
15
+
16
+ if block
17
+ enum.each { |item| add yield(item) }
18
+ else
19
+ merge(enum)
20
+ end
21
+ end
22
+
23
+ def dup
24
+ result = self.class.new
25
+ result.merge(self)
26
+ end
27
+
28
+ def -(enum)
29
+ unless enum.respond_to? :each
30
+ ::Kernel.raise ::ArgumentError, 'value must be enumerable'
31
+ end
32
+
33
+ dup.subtract(enum)
34
+ end
35
+
36
+ def inspect
37
+ "#<Set: {#{to_a.join(',')}}>"
38
+ end
39
+
40
+ def ==(other)
41
+ if equal?(other)
42
+ true
43
+ elsif other.instance_of?(self.class)
44
+ @hash == other.instance_variable_get(:@hash)
45
+ elsif other.is_a?(::Set) && size == other.size
46
+ other.all? { |o| @hash.include?(o) }
47
+ else
48
+ false
49
+ end
50
+ end
51
+
52
+ def add(o)
53
+ @hash[o] = true
54
+ self
55
+ end
56
+
57
+ def classify(&block)
58
+ return enum_for(:classify) unless block_given?
59
+
60
+ result = ::Hash.new { |h, k| h[k] = self.class.new }
61
+
62
+ each { |item| result[yield(item)].add item }
63
+
64
+ result
65
+ end
66
+
67
+ def collect!(&block)
68
+ return enum_for(:collect!) unless block_given?
69
+ result = self.class.new
70
+ each { |item| result << yield(item) }
71
+ replace result
72
+ end
73
+
74
+ def compare_by_identity
75
+ if @hash.respond_to?(:compare_by_identity)
76
+ @hash.compare_by_identity
77
+ self
78
+ else
79
+ raise NotImplementedError, "#{self.class.name}\##{__method__} is not implemented"
80
+ end
81
+ end
82
+
83
+ def compare_by_identity?
84
+ @hash.respond_to?(:compare_by_identity?) && @hash.compare_by_identity?
85
+ end
86
+
87
+ def delete(o)
88
+ @hash.delete(o)
89
+ self
90
+ end
91
+
92
+ def delete?(o)
93
+ if include?(o)
94
+ delete(o)
95
+ self
96
+ end
97
+ end
98
+
99
+ def delete_if
100
+ return enum_for(:delete_if) unless block_given?
101
+ # @hash.delete_if should be faster, but using it breaks the order
102
+ # of enumeration in subclasses.
103
+ select { |o| yield o }.each { |o| @hash.delete(o) }
104
+ self
105
+ end
106
+
107
+ def freeze
108
+ return self if frozen?
109
+
110
+ @hash.freeze
111
+ `$freeze(self)`
112
+ end
113
+
114
+ def keep_if
115
+ return enum_for(:keep_if) unless block_given?
116
+ reject { |o| yield o }.each { |o| @hash.delete(o) }
117
+ self
118
+ end
119
+
120
+ def reject!(&block)
121
+ return enum_for(:reject!) unless block_given?
122
+ before = size
123
+ delete_if(&block)
124
+ size == before ? nil : self
125
+ end
126
+
127
+ def select!(&block)
128
+ return enum_for(:select!) unless block_given?
129
+ before = size
130
+ keep_if(&block)
131
+ size == before ? nil : self
132
+ end
133
+
134
+ def add?(o)
135
+ if include?(o)
136
+ nil
137
+ else
138
+ add(o)
139
+ end
140
+ end
141
+
142
+ def each(&block)
143
+ return enum_for(:each) unless block_given?
144
+ @hash.each_key(&block)
145
+ self
146
+ end
147
+
148
+ def empty?
149
+ @hash.empty?
150
+ end
151
+
152
+ def eql?(other)
153
+ @hash.eql?(other.instance_eval { @hash })
154
+ end
155
+
156
+ def clear
157
+ @hash.clear
158
+ self
159
+ end
160
+
161
+ def include?(o)
162
+ @hash.include?(o)
163
+ end
164
+
165
+ def merge(enum)
166
+ enum.each { |item| add item }
167
+ self
168
+ end
169
+
170
+ def replace(enum)
171
+ clear
172
+ merge(enum)
173
+
174
+ self
175
+ end
176
+
177
+ def size
178
+ @hash.size
179
+ end
180
+
181
+ def subtract(enum)
182
+ enum.each { |item| delete item }
183
+ self
184
+ end
185
+
186
+ def |(enum)
187
+ unless enum.respond_to? :each
188
+ ::Kernel.raise ::ArgumentError, 'value must be enumerable'
189
+ end
190
+ dup.merge(enum)
191
+ end
192
+
193
+ %x{
194
+ function is_set(set) {
195
+ #{`set`.is_a?(::Set) || ::Kernel.raise(::ArgumentError, 'value must be a set')}
196
+ }
197
+ }
198
+
199
+ def superset?(set)
200
+ `is_set(set)`
201
+ return false if size < set.size
202
+ set.all? { |o| include?(o) }
203
+ end
204
+
205
+ def proper_superset?(set)
206
+ `is_set(set)`
207
+ return false if size <= set.size
208
+ set.all? { |o| include?(o) }
209
+ end
210
+
211
+ def subset?(set)
212
+ `is_set(set)`
213
+ return false if set.size < size
214
+ all? { |o| set.include?(o) }
215
+ end
216
+
217
+ def proper_subset?(set)
218
+ `is_set(set)`
219
+ return false if set.size <= size
220
+ all? { |o| set.include?(o) }
221
+ end
222
+
223
+ def intersect?(set)
224
+ `is_set(set)`
225
+ if size < set.size
226
+ any? { |o| set.include?(o) }
227
+ else
228
+ set.any? { |o| include?(o) }
229
+ end
230
+ end
231
+
232
+ def disjoint?(set)
233
+ !intersect?(set)
234
+ end
235
+
236
+ def to_a
237
+ @hash.keys
238
+ end
239
+
240
+ alias + |
241
+ alias < proper_subset?
242
+ alias << add
243
+ alias <= subset?
244
+ alias > proper_superset?
245
+ alias >= superset?
246
+ alias difference -
247
+ alias filter! select!
248
+ alias length size
249
+ alias map! collect!
250
+ alias member? include?
251
+ alias union |
252
+ end
@@ -1333,6 +1333,7 @@ class ::String < `String`
1333
1333
 
1334
1334
  def to_proc
1335
1335
  method_name = `self.valueOf()`
1336
+ jsid = `Opal.jsid(method_name)`
1336
1337
 
1337
1338
  proc = ::Kernel.proc do |*args, &block|
1338
1339
  %x{
@@ -1344,7 +1345,7 @@ class ::String < `String`
1344
1345
 
1345
1346
  if (recv == null) recv = nil;
1346
1347
 
1347
- var body = recv['$' + #{method_name}];
1348
+ var body = recv[jsid];
1348
1349
 
1349
1350
  if (!body) {
1350
1351
  body = recv.$method_missing;
data/opal/corelib/time.rb CHANGED
@@ -207,7 +207,7 @@ class ::Time < `Date`
207
207
  var args, result;
208
208
 
209
209
  if (arguments.length === 10) {
210
- args = $slice.call(arguments);
210
+ args = $slice(arguments);
211
211
  year = args[5];
212
212
  month = args[4];
213
213
  day = args[3];
@@ -238,7 +238,7 @@ class ::Time < `Date`
238
238
  var args, result;
239
239
 
240
240
  if (arguments.length === 10) {
241
- args = $slice.call(arguments);
241
+ args = $slice(arguments);
242
242
  year = args[5];
243
243
  month = args[4];
244
244
  day = args[3];
data/opal/opal.rb CHANGED
@@ -10,6 +10,7 @@
10
10
  ::Object.autoload :Rational, 'corelib/rational'
11
11
  ::Object.require 'corelib/time'
12
12
  ::Object.autoload :Struct, 'corelib/struct'
13
+ ::Object.autoload :Set, 'corelib/set'
13
14
  ::Object.autoload :Dir, 'corelib/dir'
14
15
  ::Object.autoload :File, 'corelib/file'
15
16
 
data/opal.gemspec CHANGED
@@ -49,4 +49,5 @@ Gem::Specification.new do |spec|
49
49
  spec.add_development_dependency 'rubocop-performance', '~> 1.1.0'
50
50
  spec.add_development_dependency 'rack', '~> 2.2'
51
51
  spec.add_development_dependency 'webrick'
52
+ spec.add_development_dependency 'benchmark_driver', '0.15.17' # version taken from test/cruby/common.mk
52
53
  end
@@ -1,25 +1,34 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Array" do
3
3
  fails "Array#== compares with an equivalent Array-like object using #to_ary" # Expected false to be true
4
- fails "Array#== returns true for [NaN] == [NaN] because Array#== first checks with #equal? and NaN.equal?(NaN) is true" # Expected [NaN] to equal [NaN]
4
+ fails "Array#== returns true for [NaN] == [NaN] because Array#== first checks with #equal? and NaN.equal?(NaN) is true" # Expected [NaN] == [NaN] to be truthy but was false
5
5
  fails "Array#[] can be sliced with Enumerator::ArithmeticSequence has endless range with start outside of array's bounds" # Expected [] == nil to be truthy but was false
6
6
  fails "Array#[] 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)
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
10
  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)
11
- fails "Array#each does not yield elements deleted from the end of the array" # Expected [2, 3, nil] to equal [2, 3]
12
- fails "Array#each yields elements added to the end of the array by the block" # Expected [2] to equal [2, 0, 0]
13
- fails "Array#fill with (filler, range) works with endless ranges" # Opal::SyntaxError: undefined method `type' for nil
14
- fails "Array#filter returns a new array of elements for which block is true" # NoMethodError: undefined method `filter' for [1, 3, 4, 5, 6, 9]
15
- fails "Array#flatten does not call #to_ary on elements beyond the given level"
16
- fails "Array#flatten performs respond_to? and method_missing-aware checks when coercing elements to array"
17
- fails "Array#flatten with a non-Array object in the Array calls #method_missing if defined"
11
+ 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
12
+ 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
+ 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
+ fails "Array#each yields elements based on an internal index" # NoMethodError: undefined method `even?' for nil
15
+ fails "Array#each yields only elements that are still in the array" # NoMethodError: undefined method `even?' for nil
16
+ 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
17
+ 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
+ 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
+ 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
20
+ 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
+ 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
+ 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
18
23
  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
19
- fails "Array#partition returns in the left array values for which the block evaluates to true"
20
- fails "Array#rassoc calls elem == obj on the second element of each contained array"
21
- fails "Array#rassoc does not check the last element in each contained but specifically the second" # Expected [1, "foobar", #<MockObject:0x4ef6e>] to equal [2, #<MockObject:0x4ef6e>, 1]
22
- fails "Array#select returns a new array of elements for which block is true"
24
+ 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
25
+ 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
+ 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
27
+ 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
+ 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
29
+ fails "Array#sample returns nil for an empty array when called without n and a Random is given" # ArgumentError: invalid argument - 0
30
+ fails "Array#sample samples evenly" # Expected 15.82 <= 13.277 to be truthy but was false
31
+ 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
23
32
  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
24
33
  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)
25
34
  fails "Array#slice raises TypeError if to_int returns non-integer" # Expected TypeError but no exception was raised ([1, 2, 3, 4] was returned)
@@ -28,5 +37,5 @@ opal_filter "Array" do
28
37
  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))
29
38
  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))
30
39
  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
31
- fails "Array#uniq! properly handles recursive arrays"
40
+ fails "Array#uniq! properly handles recursive arrays" # Expected [1, "two", 3, [...], [...], [...]] == [1, "two", 3, [1, "two", 3, [...], [...], [...]]] to be truthy but was false
32
41
  end
@@ -1,10 +1,10 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Base64" do
3
- fails "Base64#decode64 returns a binary encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
4
- fails "Base64#decode64 returns the Base64-decoded version of the given string with wrong padding" # Expected "]M\u0095¹\u0090\u0081É\u0095¥¹\u0099½É\u008D\u0095µ\u0095¹ÑÌ" == "]M\u0095¹\u0090\u0081ɕ¥¹\u0099½ɍ\u0095µ\u0095¹ÑÌ" to be truthy but was false
5
- fails "Base64#encode64 returns a US_ASCII encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
3
+ fails "Base64#decode64 returns a binary encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
4
+ fails "Base64#decode64 returns the Base64-decoded version of the given string with wrong padding" # Expected "]M\u0095¹\u0090\u0081É\u0095¥¹\u0099½É\u008D\u0095µ\u0095¹ÑÌ" == "]M\x95¹\x90\x81ɕ¥¹\x99½ɍ\x95µ\x95¹ÑÌ" to be truthy but was false
5
+ fails "Base64#encode64 returns a US_ASCII encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
6
6
  fails "Base64#strict_decode64 raises ArgumentError when the given string contains an invalid character" # Expected ArgumentError but no exception was raised ("Ü" was returned)
7
7
  fails "Base64#strict_decode64 raises ArgumentError when the given string has wrong padding" # Expected ArgumentError but no exception was raised ("\u0001M\u0095¹\u0090\u0081É\u0095¥¹\u0099½É\u008D\u0095µ\u0095¹ÑÌ" was returned)
8
- fails "Base64#strict_decode64 returns a binary encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
9
- fails "Base64#strict_encode64 returns a US_ASCII encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
8
+ fails "Base64#strict_decode64 returns a binary encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
9
+ fails "Base64#strict_encode64 returns a US_ASCII encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
10
10
  end
@@ -1,13 +1,21 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "BasicObject" do
3
- fails "BasicObject raises NoMethodError for nonexistent methods after #method_missing is removed"
4
- fails "BasicObject#initialize does not accept arguments"
5
- fails "BasicObject#instance_eval evaluates string with given filename and linenumber"
6
- fails "BasicObject#instance_eval evaluates string with given filename and negative linenumber" # Expected ["RuntimeError"] to equal ["b_file", "-98"]
7
- fails "BasicObject#instance_eval has access to the caller's local variables" # Expected nil to equal "value"
8
- fails "BasicObject#instance_exec raises a LocalJumpError unless given a block"
9
- fails "BasicObject#method_missing for an instance sets the receiver of the raised NoMethodError"
3
+ fails "BasicObject raises NoMethodError for nonexistent methods after #method_missing is removed" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0xb5dc8>
4
+ fails "BasicObject#initialize does not accept arguments" # NoMethodError: undefined method `class' for #<BasicObject:0x99f0>
5
+ fails "BasicObject#instance_eval converts filename argument with #to_str method" # Expected "<internal" == "file.rb" to be truthy but was false
6
+ fails "BasicObject#instance_eval converts lineno argument with #to_int method" # Expected "corelib/kernel.rb>" == "15" to be truthy but was false
7
+ fails "BasicObject#instance_eval converts string argument with #to_str method" # NoMethodError: undefined method `encoding' for #<Object:0x72810>
8
+ fails "BasicObject#instance_eval evaluates string with given filename and linenumber" # Expected ["<internal", "corelib/kernel.rb>"] == ["a_file", "10"] to be truthy but was false
9
+ fails "BasicObject#instance_eval evaluates string with given filename and negative linenumber" # Expected ["<internal", "corelib/kernel.rb>"] == ["b_file", "-98"] to be truthy but was false
10
+ fails "BasicObject#instance_eval has access to the caller's local variables" # Expected nil == "value" to be truthy but was false
11
+ fails "BasicObject#instance_eval raises ArgumentError if returned value is not Integer" # Expected TypeError (/can't convert Object to Integer/) but got: RuntimeError ()
12
+ 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>)
13
+ 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
+ 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
+ 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))
16
+ fails "BasicObject#instance_exec raises a LocalJumpError unless given a block" # Expected LocalJumpError but got: ArgumentError (no block given)
17
+ fails "BasicObject#method_missing for an instance sets the receiver of the raised NoMethodError" # No behavior expectation was found in the example
10
18
  fails "BasicObject#singleton_method_added when singleton_method_added is undefined calls #method_missing" # Expected [] == [["singleton_method_added", "foo"], ["singleton_method_added", "bar"], ["singleton_method_added", "baz"]] to be truthy but was false
11
19
  fails "BasicObject#singleton_method_added when singleton_method_added is undefined raises NoMethodError for a metaclass" # Expected NoMethodError (/undefined method `singleton_method_added' for/) but no exception was raised ("foo" was returned)
12
- fails "BasicObject#singleton_method_added when singleton_method_added is undefined raises NoMethodError for a singleton instance" # Expected NoMethodError (/undefined method `singleton_method_added' for #<Object:/) but no exception was raised ("foo" was returned)
20
+ fails "BasicObject#singleton_method_added when singleton_method_added is undefined raises NoMethodError for a singleton instance" # Expected NoMethodError (/undefined method `singleton_method_added' for #<Object:/) but no exception was raised ("foo" was returned)
13
21
  end