opal 1.8.0.beta1 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +150 -1
- data/UNRELEASED.md +1 -92
- data/lib/opal/nodes/args/parameters.rb +18 -11
- data/lib/opal/nodes/args.rb +0 -28
- data/lib/opal/nodes/super.rb +0 -9
- data/lib/opal/rewriter.rb +2 -0
- data/lib/opal/rewriters/deduplicate_arg_name.rb +48 -0
- data/lib/opal/rewriters/inline_args.rb +1 -13
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/array.rb +26 -22
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/hash.rb +6 -2
- data/opal/corelib/kernel.rb +11 -14
- data/opal/corelib/method.rb +1 -0
- data/opal/corelib/module.rb +43 -22
- data/opal/corelib/proc.rb +4 -6
- data/opal/corelib/range.rb +54 -10
- data/opal/corelib/runtime.js +40 -31
- data/spec/filters/bugs/array.rb +0 -36
- data/spec/filters/bugs/cgi.rb +40 -0
- data/spec/filters/bugs/enumerable.rb +1 -3
- data/spec/filters/bugs/kernel.rb +6 -9
- data/spec/filters/bugs/method.rb +0 -3
- data/spec/filters/bugs/module.rb +1 -10
- data/spec/filters/bugs/range.rb +2 -16
- data/spec/filters/bugs/ruby-32.rb +2 -2
- data/spec/filters/unsupported/kernel.rb +0 -4
- data/spec/opal/core/language/arguments/underscore_arg_spec.rb +89 -0
- data/spec/opal/core/module/define_method_spec.rb +29 -0
- data/spec/ruby_specs +1 -0
- data/stdlib/cgi/util.rb +89 -0
- data/stdlib/cgi.rb +1 -14
- metadata +15 -8
data/opal/corelib/hash.rb
CHANGED
@@ -210,7 +210,8 @@ class ::Hash < `Map`
|
|
210
210
|
def clone
|
211
211
|
%x{
|
212
212
|
var hash = self.$class().$new();
|
213
|
-
|
213
|
+
$hash_clone(self, hash);
|
214
|
+
return self["$frozen?"]() ? hash.$freeze() : hash;
|
214
215
|
}
|
215
216
|
end
|
216
217
|
|
@@ -365,6 +366,10 @@ class ::Hash < `Map`
|
|
365
366
|
item.dig(*keys)
|
366
367
|
end
|
367
368
|
|
369
|
+
def dup
|
370
|
+
`$hash_clone(self, self.$class().$new())`
|
371
|
+
end
|
372
|
+
|
368
373
|
def each(&block)
|
369
374
|
return enum_for(:each) { size } unless block
|
370
375
|
|
@@ -932,7 +937,6 @@ class ::Hash < `Map`
|
|
932
937
|
`Array.from(self.values())`
|
933
938
|
end
|
934
939
|
|
935
|
-
alias dup clone
|
936
940
|
alias each_pair each
|
937
941
|
alias eql? ==
|
938
942
|
alias filter select
|
data/opal/corelib/kernel.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# helpers: truthy, coerce_to, respond_to, Opal, deny_frozen_access, freeze, freeze_props, jsid
|
1
|
+
# helpers: truthy, coerce_to, respond_to, Opal, deny_frozen_access, freeze, freeze_props, jsid, each_ivar
|
2
2
|
# use_strict: true
|
3
3
|
# backtick_javascript: true
|
4
4
|
|
@@ -369,18 +369,14 @@ module ::Kernel
|
|
369
369
|
|
370
370
|
def instance_variables
|
371
371
|
%x{
|
372
|
-
var result = [],
|
372
|
+
var result = [], name;
|
373
373
|
|
374
|
-
|
375
|
-
if (
|
376
|
-
|
377
|
-
ivar = name.slice(0, name.length - 1);
|
378
|
-
} else {
|
379
|
-
ivar = name;
|
380
|
-
}
|
381
|
-
result.push('@' + ivar);
|
374
|
+
$each_ivar(self, function(name) {
|
375
|
+
if (name.substr(-1) === '$') {
|
376
|
+
name = name.slice(0, name.length - 1);
|
382
377
|
}
|
383
|
-
|
378
|
+
result.push('@' + name);
|
379
|
+
});
|
384
380
|
|
385
381
|
return result;
|
386
382
|
}
|
@@ -610,9 +606,10 @@ module ::Kernel
|
|
610
606
|
end
|
611
607
|
|
612
608
|
def printf(*args)
|
613
|
-
if args.
|
614
|
-
|
615
|
-
|
609
|
+
return if args.empty?
|
610
|
+
|
611
|
+
io = `args[0].$$is_string` ? $stdout : args.shift
|
612
|
+
io.write format(*args)
|
616
613
|
|
617
614
|
nil
|
618
615
|
end
|
data/opal/corelib/method.rb
CHANGED
data/opal/corelib/module.rb
CHANGED
@@ -1,7 +1,23 @@
|
|
1
|
-
# helpers: truthy, coerce_to, const_set, Object, return_ivar, assign_ivar, ivar, deny_frozen_access, freeze, prop, jsid
|
1
|
+
# helpers: truthy, coerce_to, const_set, Object, return_ivar, assign_ivar, ivar, deny_frozen_access, freeze, prop, jsid, each_ivar
|
2
2
|
# backtick_javascript: true
|
3
3
|
|
4
4
|
class ::Module
|
5
|
+
%x{
|
6
|
+
function ensure_symbol_or_string(name) {
|
7
|
+
if (name.$$is_string) {
|
8
|
+
return name;
|
9
|
+
};
|
10
|
+
var converted_name = #{::Opal.try_convert(`name`, ::String, :to_str)};
|
11
|
+
if (converted_name.$$is_string) {
|
12
|
+
return converted_name;
|
13
|
+
} else if (converted_name === nil) {
|
14
|
+
#{::Kernel.raise ::TypeError, "#{`name`} is not a symbol nor a string"}
|
15
|
+
} else {
|
16
|
+
#{::Kernel.raise ::TypeError, "can't convert #{`name`.class} to String (#{`name`.class}#to_str gives #{`converted_name`.class}"}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
5
21
|
def self.allocate
|
6
22
|
%x{
|
7
23
|
var module = Opal.allocate_module(nil, function(){});
|
@@ -388,9 +404,12 @@ class ::Module
|
|
388
404
|
|
389
405
|
if (method === undefined && block === nil)
|
390
406
|
#{::Kernel.raise ::ArgumentError, 'tried to create a Proc object without a block'}
|
407
|
+
|
408
|
+
name = ensure_symbol_or_string(name);
|
391
409
|
}
|
392
410
|
|
393
|
-
|
411
|
+
if `method !== undefined`
|
412
|
+
block = case method
|
394
413
|
when ::Proc
|
395
414
|
method
|
396
415
|
|
@@ -398,15 +417,21 @@ class ::Module
|
|
398
417
|
`#{method.to_proc}.$$unbound`
|
399
418
|
|
400
419
|
when ::UnboundMethod
|
401
|
-
|
402
|
-
bound = method.bind(self)
|
403
|
-
bound.call(*args)
|
404
|
-
}
|
420
|
+
`Opal.wrap_method_body(method.$$method)`
|
405
421
|
|
406
422
|
else
|
407
|
-
::Kernel.raise ::TypeError, "wrong argument type #{
|
423
|
+
::Kernel.raise ::TypeError, "wrong argument type #{method.class} (expected Proc/Method/UnboundMethod)"
|
408
424
|
end
|
409
425
|
|
426
|
+
if `!method.$$is_proc`
|
427
|
+
owner = method.owner
|
428
|
+
if `owner.$$is_class` && !(self <= owner) # rubocop:disable Style/InverseMethods
|
429
|
+
message = `owner.$$is_singleton` ? "can't bind singleton method to a different class" : "bind argument must be a subclass of #{owner}"
|
430
|
+
::Kernel.raise ::TypeError, message
|
431
|
+
end
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
410
435
|
%x{
|
411
436
|
if (typeof(Proxy) !== 'undefined') {
|
412
437
|
var meta = Object.create(null)
|
@@ -414,15 +439,17 @@ class ::Module
|
|
414
439
|
block.$$proxy_target = block
|
415
440
|
block = new Proxy(block, {
|
416
441
|
apply: function(target, self, args) {
|
417
|
-
var old_name = target.$$jsid
|
442
|
+
var old_name = target.$$jsid, old_lambda = target.$$is_lambda;
|
418
443
|
target.$$jsid = name;
|
444
|
+
target.$$is_lambda = true;
|
419
445
|
try {
|
420
446
|
return target.apply(self, args);
|
421
447
|
} catch(e) {
|
422
448
|
if (e === target.$$brk || e === target.$$ret) return e.$v;
|
423
449
|
throw e;
|
424
450
|
} finally {
|
425
|
-
target.$$jsid = old_name
|
451
|
+
target.$$jsid = old_name;
|
452
|
+
target.$$is_lambda = old_lambda;
|
426
453
|
}
|
427
454
|
}
|
428
455
|
})
|
@@ -453,10 +480,7 @@ class ::Module
|
|
453
480
|
def remove_method(*names)
|
454
481
|
%x{
|
455
482
|
for (var i = 0; i < names.length; i++) {
|
456
|
-
var name = names[i];
|
457
|
-
if (!(typeof name === "string" || name.$$is_string)) {
|
458
|
-
#{raise ::TypeError, "#{name} is not a symbol nor a string"}
|
459
|
-
}
|
483
|
+
var name = ensure_symbol_or_string(names[i]);
|
460
484
|
$deny_frozen_access(self);
|
461
485
|
|
462
486
|
Opal.rdef(self, "$" + name);
|
@@ -705,13 +729,10 @@ class ::Module
|
|
705
729
|
def undef_method(*names)
|
706
730
|
%x{
|
707
731
|
for (var i = 0; i < names.length; i++) {
|
708
|
-
var name = names[i];
|
709
|
-
if (!(typeof name === "string" || name.$$is_string)) {
|
710
|
-
#{raise ::TypeError, "#{name} is not a symbol nor a string"}
|
711
|
-
}
|
732
|
+
var name = ensure_symbol_or_string(names[i]);
|
712
733
|
$deny_frozen_access(self);
|
713
734
|
|
714
|
-
Opal.udef(self, "$" +
|
735
|
+
Opal.udef(self, "$" + name);
|
715
736
|
}
|
716
737
|
}
|
717
738
|
|
@@ -723,11 +744,11 @@ class ::Module
|
|
723
744
|
%x{
|
724
745
|
var result = [];
|
725
746
|
|
726
|
-
|
727
|
-
if (
|
747
|
+
$each_ivar(self, function(name) {
|
748
|
+
if (name !== 'constructor' && !#{consts.include?(`name`)}) {
|
728
749
|
result.push('@' + name);
|
729
750
|
}
|
730
|
-
}
|
751
|
+
});
|
731
752
|
|
732
753
|
return result;
|
733
754
|
}
|
@@ -740,7 +761,7 @@ class ::Module
|
|
740
761
|
var name = method_names[i],
|
741
762
|
jsid = $jsid(name),
|
742
763
|
body = from.$$prototype[jsid],
|
743
|
-
wrapped = Opal.
|
764
|
+
wrapped = Opal.wrap_method_body(body);
|
744
765
|
|
745
766
|
wrapped.$$jsid = name;
|
746
767
|
Opal.defn(to, jsid, wrapped);
|
data/opal/corelib/proc.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# helpers: slice
|
1
|
+
# helpers: slice, each_ivar
|
2
2
|
# backtick_javascript: true
|
3
3
|
|
4
4
|
class ::Proc < `Function`
|
@@ -181,11 +181,9 @@ class ::Proc < `Function`
|
|
181
181
|
return original_proc.apply(this, arguments);
|
182
182
|
};
|
183
183
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
}
|
188
|
-
}
|
184
|
+
$each_ivar(self, function(prop) {
|
185
|
+
proc[prop] = self[prop];
|
186
|
+
});
|
189
187
|
|
190
188
|
return proc;
|
191
189
|
}
|
data/opal/corelib/range.rb
CHANGED
@@ -19,7 +19,8 @@ class ::Range
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def ===(value)
|
22
|
-
|
22
|
+
return false if `value.$$is_range`
|
23
|
+
cover? value
|
23
24
|
end
|
24
25
|
|
25
26
|
%x{
|
@@ -44,13 +45,34 @@ class ::Range
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def cover?(value)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
compare = ->(a, b) {
|
49
|
+
a <=> b || 1
|
50
|
+
}
|
51
|
+
|
52
|
+
if `value.$$is_range`
|
53
|
+
val_begin = value.begin
|
54
|
+
val_end = value.end
|
55
|
+
val_excl = value.exclude_end?
|
56
|
+
if (@begin && val_begin.nil?) ||
|
57
|
+
(@end && val_end.nil?) ||
|
58
|
+
(val_begin && val_end && compare.call(val_begin, val_end).then { |c| val_excl ? c >= 0 : c > 0 }) ||
|
59
|
+
(val_begin && !cover?(val_begin))
|
60
|
+
return false
|
61
|
+
end
|
62
|
+
|
63
|
+
cmp = compare.call(@end, val_end)
|
64
|
+
return cmp >= 0 if @excl == val_excl
|
65
|
+
return cmp > 0 if @excl
|
66
|
+
return true if cmp >= 0
|
67
|
+
|
68
|
+
val_max = value.max
|
69
|
+
return !val_max.nil? && compare.call(val_max, @end) <= 0
|
70
|
+
end
|
71
|
+
|
72
|
+
return false if @begin && compare.call(@begin, value) > 0
|
73
|
+
return true if @end.nil?
|
74
|
+
end_cmp = compare.call(value, @end)
|
75
|
+
@excl ? end_cmp < 0 : end_cmp <= 0
|
54
76
|
end
|
55
77
|
|
56
78
|
def each(&block)
|
@@ -113,6 +135,29 @@ class ::Range
|
|
113
135
|
super
|
114
136
|
end
|
115
137
|
|
138
|
+
def include?(val)
|
139
|
+
if `self.begin.$$is_number || self.end.$$is_number` ||
|
140
|
+
@begin.is_a?(::Time) || @end.is_a?(::Time) ||
|
141
|
+
::Integer.try_convert(@begin) || ::Integer.try_convert(@end)
|
142
|
+
return cover?(val)
|
143
|
+
end
|
144
|
+
|
145
|
+
if `self.begin.$$is_string || self.end.$$is_string`
|
146
|
+
if `self.begin.$$is_string && self.end.$$is_string`
|
147
|
+
return @begin.upto(@end, @excl).any? { |s| s == val }
|
148
|
+
elsif @begin.nil?
|
149
|
+
cmp = val <=> @end
|
150
|
+
return !cmp.nil? && (@excl ? cmp < 0 : cmp <= 0)
|
151
|
+
elsif @end.nil?
|
152
|
+
cmp = @begin <=> val
|
153
|
+
return !cmp.nil? && cmp <= 0
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# invoke Enumerable#include?
|
158
|
+
super
|
159
|
+
end
|
160
|
+
|
116
161
|
def last(n = undefined)
|
117
162
|
::Kernel.raise ::RangeError, 'cannot get the maximum of endless range' if @end.nil?
|
118
163
|
return @end if `n == null`
|
@@ -319,6 +364,5 @@ class ::Range
|
|
319
364
|
end
|
320
365
|
|
321
366
|
alias == eql?
|
322
|
-
alias
|
323
|
-
alias member? cover?
|
367
|
+
alias member? include?
|
324
368
|
end
|
data/opal/corelib/runtime.js
CHANGED
@@ -940,7 +940,7 @@
|
|
940
940
|
};
|
941
941
|
|
942
942
|
Opal.instance_methods = function(mod) {
|
943
|
-
var
|
943
|
+
var processed = Object.create(null), results = [], ancestors = $ancestors(mod);
|
944
944
|
|
945
945
|
for (var i = 0, l = ancestors.length; i < l; i++) {
|
946
946
|
var ancestor = ancestors[i],
|
@@ -955,18 +955,18 @@
|
|
955
955
|
for (var j = 0, ll = props.length; j < ll; j++) {
|
956
956
|
var prop = props[j];
|
957
957
|
|
958
|
+
if (processed[prop]) {
|
959
|
+
continue;
|
960
|
+
}
|
958
961
|
if (Opal.is_method(prop)) {
|
959
|
-
var
|
960
|
-
method = proto[prop];
|
961
|
-
|
962
|
-
if (method.$$stub && exclude.indexOf(method_name) === -1) {
|
963
|
-
exclude.push(method_name);
|
964
|
-
}
|
962
|
+
var method = proto[prop];
|
965
963
|
|
966
|
-
if (!method.$$stub
|
964
|
+
if (!method.$$stub) {
|
965
|
+
var method_name = prop.slice(1);
|
967
966
|
results.push(method_name);
|
968
967
|
}
|
969
968
|
}
|
969
|
+
processed[prop] = true;
|
970
970
|
}
|
971
971
|
}
|
972
972
|
|
@@ -2207,7 +2207,7 @@
|
|
2207
2207
|
|
2208
2208
|
// We need a wrapper because otherwise properties
|
2209
2209
|
// would be overwritten on the original body.
|
2210
|
-
alias = Opal.
|
2210
|
+
alias = Opal.wrap_method_body(body);
|
2211
2211
|
|
2212
2212
|
// Try to make the browser pick the right name
|
2213
2213
|
alias.displayName = name;
|
@@ -2219,7 +2219,7 @@
|
|
2219
2219
|
return obj;
|
2220
2220
|
};
|
2221
2221
|
|
2222
|
-
Opal.
|
2222
|
+
Opal.wrap_method_body = function(body) {
|
2223
2223
|
var wrapped = function() {
|
2224
2224
|
var block = wrapped.$$p;
|
2225
2225
|
|
@@ -2580,33 +2580,42 @@
|
|
2580
2580
|
return obj;
|
2581
2581
|
};
|
2582
2582
|
|
2583
|
-
//
|
2584
|
-
|
2585
|
-
|
2583
|
+
// Iterate over every instance variable and call func for each one
|
2584
|
+
// giving name of the ivar and optionally the property descriptor.
|
2585
|
+
function $each_ivar(obj, func) {
|
2586
|
+
var own_props = Object.getOwnPropertyNames(obj), own_props_length = own_props.length, i, prop, desc;
|
2586
2587
|
|
2587
|
-
for(
|
2588
|
-
|
2588
|
+
for(i = 0; i < own_props_length; i++) {
|
2589
|
+
prop = own_props[i];
|
2589
2590
|
|
2590
|
-
|
2591
|
-
if ((prop_type === "string" || prop_type === "object") && prop[0] === '$') {
|
2592
|
-
continue;
|
2593
|
-
}
|
2591
|
+
if (prop[0] === '$') continue;
|
2594
2592
|
|
2595
2593
|
desc = Object.getOwnPropertyDescriptor(obj, prop);
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
(function() {
|
2600
|
-
// set v to undefined, as if the property is not set
|
2601
|
-
var cv = obj[prop];
|
2602
|
-
Object.defineProperty(obj, prop, {
|
2603
|
-
get: function() { return cv; },
|
2604
|
-
set: function(_val) { $deny_frozen_access(obj); },
|
2605
|
-
enumerable: true
|
2606
|
-
});
|
2607
|
-
})();
|
2594
|
+
|
2595
|
+
if (desc && desc.enumerable) {
|
2596
|
+
func(prop, desc);
|
2608
2597
|
}
|
2609
2598
|
}
|
2599
|
+
}
|
2600
|
+
|
2601
|
+
Opal.each_ivar = $each_ivar;
|
2602
|
+
|
2603
|
+
// freze props, make setters of instance variables throw FrozenError
|
2604
|
+
Opal.freeze_props = function(obj) {
|
2605
|
+
var dp_template = {
|
2606
|
+
get: null,
|
2607
|
+
set: function(_val) { $deny_frozen_access(obj); },
|
2608
|
+
enumerable: true
|
2609
|
+
};
|
2610
|
+
|
2611
|
+
$each_ivar(obj, function(prop, desc) {
|
2612
|
+
if (!desc.writable) return;
|
2613
|
+
|
2614
|
+
// Redefine a property with a setter that raises an error.
|
2615
|
+
dp_template.get = $return_val(desc.value);
|
2616
|
+
|
2617
|
+
Object.defineProperty(obj, prop, dp_template);
|
2618
|
+
});
|
2610
2619
|
};
|
2611
2620
|
|
2612
2621
|
// Regexps
|
data/spec/filters/bugs/array.rb
CHANGED
@@ -8,43 +8,19 @@ opal_filter "Array" do
|
|
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#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
11
|
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
|
18
12
|
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
|
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
|
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
|
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
|
24
|
-
fails "Array#each yields elements based on an internal index" # NoMethodError: undefined method `even?' for nil
|
25
|
-
fails "Array#each yields only elements that are still in the array" # NoMethodError: undefined method `even?' for nil
|
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
|
28
13
|
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)
|
29
14
|
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
|
30
15
|
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
|
34
16
|
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
|
35
17
|
fails "Array#flatten performs respond_to? and method_missing-aware checks when coercing elements to array" # NoMethodError: undefined method `respond_to?' for #<BasicObject:0x2698>
|
36
18
|
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
19
|
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: ""
|
39
20
|
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
21
|
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
22
|
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
23
|
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
24
|
fails "Array#pack with format 'A' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
|
49
25
|
fails "Array#pack with format 'A' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
|
50
26
|
fails "Array#pack with format 'C' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
|
@@ -67,13 +43,8 @@ opal_filter "Array" do
|
|
67
43
|
fails "Array#product returns converted arguments using :method_missing" # TypeError: no implicit conversion of ArraySpecs::ArrayMethodMissing into Array
|
68
44
|
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
|
69
45
|
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
|
73
46
|
fails "Array#sample returns nil for an empty array when called without n and a Random is given" # ArgumentError: invalid argument - 0
|
74
47
|
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
48
|
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
49
|
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
|
79
50
|
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
|
@@ -81,15 +52,8 @@ opal_filter "Array" do
|
|
81
52
|
fails "Array#slice raises TypeError if to_int returns non-integer" # Expected TypeError but no exception was raised ([1, 2, 3, 4] was returned)
|
82
53
|
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)
|
83
54
|
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)
|
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
55
|
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
|
89
56
|
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
|
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
57
|
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
58
|
fails "Array.new with no arguments does not use the given block" # Expected warning to match: /warning: given block not used/ but got: ""
|
95
59
|
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))
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# NOTE: run bin/format-filters after changing this file
|
2
|
+
opal_filter "CGI" do
|
3
|
+
fails "CGI#http_header CGI#http_header when passed Hash includes Cookies in the @output_cookies field" # NoMethodError: undefined method `http_header' for #<CGI:0x98198 @output_cookies=["multiple", "cookies"]>
|
4
|
+
fails "CGI#http_header CGI#http_header when passed Hash returns a HTTP header based on the Hash's key/value pairs" # NoMethodError: undefined method `http_header' for #<CGI:0x98194>
|
5
|
+
fails "CGI#http_header CGI#http_header when passed Hash returns a HTTP header specifying the Content-Type as text/html when passed an empty Hash" # NoMethodError: undefined method `http_header' for #<CGI:0x98190>
|
6
|
+
fails "CGI#http_header CGI#http_header when passed String includes Cookies in the @output_cookies field" # NoMethodError: undefined method `http_header' for #<CGI:0x98186 @output_cookies=["multiple", "cookies"]>
|
7
|
+
fails "CGI#http_header CGI#http_header when passed String returns a HTTP header specifying the Content-Type as the passed String's content" # NoMethodError: undefined method `http_header' for #<CGI:0x9818c>
|
8
|
+
fails "CGI#http_header CGI#http_header when passed no arguments includes Cookies in the @output_cookies field" # NoMethodError: undefined method `http_header' for #<CGI:0x9817c @output_cookies=["multiple", "cookies"]>
|
9
|
+
fails "CGI#http_header CGI#http_header when passed no arguments returns a HTTP header specifying the Content-Type as text/html" # NoMethodError: undefined method `http_header' for #<CGI:0x98182>
|
10
|
+
fails "CGI#initialize is private" # Expected CGI to have private instance method 'initialize' but it does not
|
11
|
+
fails "CGI#initialize when passed no arguments does not extend self with CGI::HtmlExtension" # NameError: uninitialized constant CGI::HtmlExtension
|
12
|
+
fails "CGI#initialize when passed no arguments does not extend self with any of the other HTML modules" # NameError: uninitialized constant CGI::Html3
|
13
|
+
fails "CGI#initialize when passed no arguments extends self with CGI::QueryExtension" # NameError: uninitialized constant CGI::QueryExtension
|
14
|
+
fails "CGI#initialize when passed no arguments sets #cookies based on ENV['HTTP_COOKIE']" # NoMethodError: undefined method `cookies' for #<CGI:0x12604>
|
15
|
+
fails "CGI#initialize when passed no arguments sets #params based on ENV['QUERY_STRING'] when ENV['REQUEST_METHOD'] is GET" # NoMethodError: undefined method `params' for #<CGI:0x12614>
|
16
|
+
fails "CGI#initialize when passed no arguments sets #params based on ENV['QUERY_STRING'] when ENV['REQUEST_METHOD'] is HEAD" # NoMethodError: undefined method `params' for #<CGI:0x12600>
|
17
|
+
fails "CGI#initialize when passed type extends self with CGI::QueryExtension" # NameError: uninitialized constant CGI::QueryExtension
|
18
|
+
fails "CGI#initialize when passed type extends self with CGI::QueryExtension, CGI::Html3 and CGI::HtmlExtension when the passed type is 'html3'" # NameError: uninitialized constant CGI::Html3
|
19
|
+
fails "CGI#initialize when passed type extends self with CGI::QueryExtension, CGI::Html4 and CGI::HtmlExtension when the passed type is 'html4'" # NameError: uninitialized constant CGI::Html4
|
20
|
+
fails "CGI#initialize when passed type extends self with CGI::QueryExtension, CGI::Html4Tr and CGI::HtmlExtension when the passed type is 'html4Tr'" # NameError: uninitialized constant CGI::Html4Tr
|
21
|
+
fails "CGI#initialize when passed type extends self with CGI::QueryExtension, CGI::Html4Tr, CGI::Html4Fr and CGI::HtmlExtension when the passed type is 'html4Fr'" # NameError: uninitialized constant CGI::Html4Tr
|
22
|
+
fails "CGI#out appends the block's return value to the HTML header" # NoMethodError: undefined method `out' for #<CGI:0x86a80>
|
23
|
+
fails "CGI#out automatically sets the Content-Length Header based on the block's return value" # NoMethodError: undefined method `out' for #<CGI:0x86a8c>
|
24
|
+
fails "CGI#out includes Cookies in the @output_cookies field" # NoMethodError: undefined method `out' for #<CGI:0x86a74 @output_cookies=["multiple", "cookies"]>
|
25
|
+
fails "CGI#out it writes a HTMl header based on the passed argument to $stdout" # NoMethodError: undefined method `out' for #<CGI:0x86a86>
|
26
|
+
fails "CGI#out when passed no block raises a LocalJumpError" # Expected LocalJumpError but got: NoMethodError (undefined method `out' for #<CGI:0x86a96>)
|
27
|
+
fails "CGI.escape url-encodes the passed argument" # Expected "%20!%22\#$%25&'()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D" == "+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D" to be truthy but was false
|
28
|
+
fails "CGI.escapeElement when passed String, elements, ... escapes only the tags of the passed elements in the passed String" # NoMethodError: undefined method `escapeElement' for CGI
|
29
|
+
fails "CGI.escapeElement when passed String, elements, ... is case-insensitive" # NoMethodError: undefined method `escapeElement' for CGI
|
30
|
+
fails "CGI.parse when passed String allows passing multiple values for one key" # NoMethodError: undefined method `parse' for CGI
|
31
|
+
fails "CGI.parse when passed String parses a HTTP Query String into a Hash" # NoMethodError: undefined method `parse' for CGI
|
32
|
+
fails "CGI.parse when passed String parses query strings with semicolons in place of ampersands" # NoMethodError: undefined method `parse' for CGI
|
33
|
+
fails "CGI.parse when passed String unescapes keys and values" # NoMethodError: undefined method `parse' for CGI
|
34
|
+
fails "CGI.pretty when passed html indents the passed html String with two spaces" # NoMethodError: undefined method `pretty' for CGI
|
35
|
+
fails "CGI.pretty when passed html, indentation_unit indents the passed html String with the passed indentation_unit" # NoMethodError: undefined method `pretty' for CGI
|
36
|
+
fails "CGI.rfc1123_date when passed Time returns the passed Time formatted in RFC1123 ('Sat, 01 Dec 2007 15:56:42 GMT')" # NoMethodError: undefined method `rfc1123_date' for CGI
|
37
|
+
fails "CGI.unescape url-decodes the passed argument" # Expected "+!\"%23%24%%26'()*%2B%2C-.%2F0123456789%3A%3B<%3D>%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" == " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" to be truthy but was false
|
38
|
+
fails "CGI.unescapeElement when passed String, elements, ... is case-insensitive" # NoMethodError: undefined method `unescapeElement' for CGI
|
39
|
+
fails "CGI.unescapeElement when passed String, elements, ... unescapes only the tags of the passed elements in the passed String" # NoMethodError: undefined method `unescapeElement' for CGI
|
40
|
+
end
|
@@ -17,14 +17,12 @@ opal_filter "Enumerable" do
|
|
17
17
|
fails "Enumerable#grep_v does not set $~ when given no block" # Expected "e" == "z" to be truthy but was false
|
18
18
|
fails "Enumerable#inject ignores the block if two arguments" # Expected warning to match: /ruby\/core\/enumerable\/shared\/inject.rb:23: warning: given block not used/ but got: ""
|
19
19
|
fails "Enumerable#inject raises an ArgumentError when no parameters or block is given" # Expected ArgumentError but got: Exception (Cannot read properties of undefined (reading '$inspect'))
|
20
|
-
fails "Enumerable#inject tolerates increasing a collection size during iterating Array" # Expected ["a", "b", "c"] == [0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 3, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 4, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 5, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 6, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 7, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 8, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 9, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, "a", "b", "c"] to be truthy but was false
|
21
20
|
fails "Enumerable#map reports the same arity as the given block" # Exception: Cannot read properties of undefined (reading '$$is_array')
|
22
21
|
fails "Enumerable#map yields 2 arguments for a Hash when block arity is 2" # ArgumentError: [#register] wrong number of arguments (given 1, expected 2)
|
23
22
|
fails "Enumerable#none? when given a pattern argument ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
|
24
23
|
fails "Enumerable#one? when given a pattern argument ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
|
25
24
|
fails "Enumerable#reduce ignores the block if two arguments" # Expected warning to match: /ruby\/core\/enumerable\/shared\/inject.rb:23: warning: given block not used/ but got: ""
|
26
25
|
fails "Enumerable#reduce raises an ArgumentError when no parameters or block is given" # Expected ArgumentError but got: Exception (Cannot read properties of undefined (reading '$inspect'))
|
27
|
-
fails "Enumerable#reduce tolerates increasing a collection size during iterating Array" # Expected ["a", "b", "c"] == [0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 3, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 4, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 5, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 6, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 7, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 8, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 9, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, "a", "b", "c"] to be truthy but was false
|
28
26
|
fails "Enumerable#reverse_each gathers whole arrays as elements when each yields multiple" # Expected [6, 3, 1] == [[6, 7, 8, 9], [3, 4, 5], [1, 2]] to be truthy but was false
|
29
27
|
fails "Enumerable#slice_when when an iterator method yields more than one value processes all yielded values" # Expected [] == [[[1, 2]]] to be truthy but was false
|
30
28
|
fails "Enumerable#slice_when when given a block doesn't yield an empty array on a small enumerable" # Expected [] == [[42]] to be truthy but was false
|
@@ -34,6 +32,6 @@ opal_filter "Enumerable" do
|
|
34
32
|
fails "Enumerable#tally counts values as gathered array when yielded with multiple arguments" # Expected {[]=>3, 0=>1, [0, 1]=>2, [0, 1, 2]=>3, nil=>1, "default_arg"=>1, [0]=>1} == {nil=>2, 0=>1, [0, 1]=>2, [0, 1, 2]=>3, "default_arg"=>1, []=>2, [0]=>1} to be truthy but was false
|
35
33
|
fails "Enumerable#tally with a hash calls #to_hash to convert argument to Hash implicitly if passed not a Hash" # NoMethodError: undefined method `fetch' for #<Object:0x8def0>
|
36
34
|
fails "Enumerable#uniq uses eql? semantics" # Expected [1] == [1, 1] to be truthy but was false
|
37
|
-
fails "Enumerable#zip passes each element of the result array to a block and return nil if a block is given" # Expected [[1, 4, 7], [2, 5, 8], [3, 6, 9]] == nil to be truthy but was false
|
35
|
+
fails "Enumerable#zip passes each element of the result array to a block and return nil if a block is given" # Expected [[1, 4, 7], [2, 5, 8], [3, 6, 9]] == nil to be truthy but was false
|
38
36
|
fails "Enumerable#zip raises TypeError when some argument isn't Array and doesn't respond to #to_ary and #to_enum" # Expected TypeError (wrong argument type Object (must respond to :each)) but got: NoMethodError (undefined method `each' for #<Object:0x2e1e6>)
|
39
37
|
end
|