opal 1.8.0.alpha1 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.js +1 -0
- data/CHANGELOG.md +119 -2
- data/README.md +7 -7
- data/UNRELEASED.md +1 -78
- data/docs/releasing.md +8 -16
- data/lib/opal/cli_runners/chrome.rb +5 -1
- data/lib/opal/nodes/closure.rb +15 -7
- data/lib/opal/nodes/defined.rb +1 -1
- data/lib/opal/nodes/literal.rb +10 -6
- data/lib/opal/nodes/rescue.rb +1 -1
- data/lib/opal/simple_server.rb +2 -2
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/array.rb +39 -21
- data/opal/corelib/class.rb +26 -8
- data/opal/corelib/complex.rb +1 -1
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/enumerator/arithmetic_sequence.rb +1 -1
- data/opal/corelib/error.rb +10 -0
- data/opal/corelib/hash.rb +36 -20
- data/opal/corelib/kernel.rb +0 -1
- data/opal/corelib/method.rb +1 -0
- data/opal/corelib/module.rb +82 -22
- data/opal/corelib/number.rb +28 -1
- data/opal/corelib/range.rb +55 -11
- data/opal/corelib/rational.rb +1 -1
- data/opal/corelib/runtime.js +132 -50
- data/opal/corelib/string.rb +36 -8
- data/opal/corelib/struct.rb +1 -1
- data/opal/corelib/time.rb +1 -1
- data/spec/filters/bugs/array.rb +58 -0
- data/spec/filters/bugs/basicobject.rb +7 -0
- data/spec/filters/bugs/bigdecimal.rb +1 -2
- data/spec/filters/bugs/binding.rb +1 -0
- data/spec/filters/bugs/cgi.rb +40 -0
- data/spec/filters/bugs/class.rb +2 -3
- data/spec/filters/bugs/complex.rb +3 -0
- data/spec/filters/bugs/date.rb +5 -2
- data/spec/filters/bugs/datetime.rb +1 -0
- data/spec/filters/bugs/delegate.rb +1 -2
- data/spec/filters/bugs/encoding.rb +1 -1
- data/spec/filters/bugs/enumerable.rb +11 -0
- data/spec/filters/bugs/enumerator.rb +15 -2
- data/spec/filters/bugs/exception.rb +9 -4
- data/spec/filters/bugs/file.rb +2 -0
- data/spec/filters/bugs/float.rb +1 -0
- data/spec/filters/bugs/freeze.rb +5 -49
- data/spec/filters/bugs/hash.rb +1 -0
- data/spec/filters/bugs/integer.rb +5 -6
- data/spec/filters/bugs/kernel.rb +12 -6
- data/spec/filters/bugs/language.rb +33 -15
- data/spec/filters/bugs/marshal.rb +63 -4
- data/spec/filters/bugs/method.rb +2 -13
- data/spec/filters/bugs/module.rb +19 -17
- data/spec/filters/bugs/objectspace.rb +2 -0
- data/spec/filters/bugs/pathname.rb +1 -0
- data/spec/filters/bugs/proc.rb +4 -2
- data/spec/filters/bugs/random.rb +0 -3
- data/spec/filters/bugs/range.rb +3 -17
- data/spec/filters/bugs/rational.rb +2 -0
- data/spec/filters/bugs/refinement.rb +19 -0
- data/spec/filters/bugs/regexp.rb +27 -5
- data/spec/filters/bugs/ruby-32.rb +0 -4
- data/spec/filters/bugs/set.rb +10 -2
- data/spec/filters/bugs/singleton.rb +0 -2
- data/spec/filters/bugs/string.rb +140 -1
- data/spec/filters/bugs/struct.rb +15 -5
- data/spec/filters/bugs/time.rb +56 -2
- data/spec/filters/bugs/trace_point.rb +1 -0
- data/spec/filters/bugs/unboundmethod.rb +4 -9
- data/spec/filters/bugs/warnings.rb +0 -1
- data/spec/filters/platform/firefox/exception.rb +3 -3
- data/spec/filters/platform/firefox/kernel.rb +1 -0
- data/spec/filters/platform/safari/exception.rb +2 -2
- data/spec/filters/platform/safari/float.rb +1 -0
- data/spec/filters/platform/safari/kernel.rb +1 -0
- data/spec/filters/platform/safari/literal_regexp.rb +2 -2
- data/spec/filters/unsupported/hash.rb +1 -1
- data/spec/lib/compiler_spec.rb +4 -0
- data/spec/opal/core/class/clone_spec.rb +36 -0
- data/spec/opal/core/module/define_method_spec.rb +29 -0
- data/spec/opal/core/object_id_spec.rb +0 -6
- data/spec/opal/language/predefined_spec.rb +20 -0
- data/spec/opal/language/yield_spec.rb +43 -0
- data/spec/ruby_specs +1 -2
- data/stdlib/bigdecimal.rb +2 -0
- data/stdlib/cgi/util.rb +89 -0
- data/stdlib/cgi.rb +1 -14
- data/stdlib/delegate.rb +3 -4
- data/stdlib/pathname.rb +1 -1
- data/stdlib/promise/v2.rb +22 -7
- data/stdlib/stringio.rb +2 -0
- data/tasks/testing.rake +15 -11
- data/test/opal/promisev2/test_always.rb +14 -0
- data/test/opal/unsupported_and_bugs.rb +0 -8
- metadata +16 -8
data/opal/corelib/runtime.js
CHANGED
@@ -119,14 +119,16 @@
|
|
119
119
|
|
120
120
|
// @private
|
121
121
|
// Pops an exception from the stack and updates `$!`.
|
122
|
-
Opal.pop_exception = function() {
|
122
|
+
Opal.pop_exception = function(rescued_exception) {
|
123
123
|
var exception = Opal.exceptions.pop();
|
124
|
-
if (exception) {
|
124
|
+
if (exception === rescued_exception) {
|
125
|
+
// Current $! is raised in the rescue block, so we don't update it
|
126
|
+
}
|
127
|
+
else if (exception) {
|
125
128
|
$gvars["!"] = exception;
|
126
|
-
$gvars["@"] = exception.$backtrace();
|
127
129
|
}
|
128
130
|
else {
|
129
|
-
$gvars["!"] =
|
131
|
+
$gvars["!"] = nil;
|
130
132
|
}
|
131
133
|
};
|
132
134
|
|
@@ -152,6 +154,14 @@
|
|
152
154
|
}
|
153
155
|
}
|
154
156
|
|
157
|
+
// Reuse the same object for performance/memory sake
|
158
|
+
var prop_options = {
|
159
|
+
value: undefined,
|
160
|
+
enumerable: false,
|
161
|
+
configurable: true,
|
162
|
+
writable: true
|
163
|
+
};
|
164
|
+
|
155
165
|
function $prop(object, name, initialValue) {
|
156
166
|
if (typeof(object) === "string") {
|
157
167
|
// Special case for:
|
@@ -163,12 +173,8 @@
|
|
163
173
|
// numbers, true, false and null do not support it.
|
164
174
|
object[name] = initialValue;
|
165
175
|
} else {
|
166
|
-
|
167
|
-
|
168
|
-
enumerable: false,
|
169
|
-
configurable: true,
|
170
|
-
writable: true
|
171
|
-
});
|
176
|
+
prop_options.value = initialValue;
|
177
|
+
Object.defineProperty(object, name, prop_options);
|
172
178
|
}
|
173
179
|
}
|
174
180
|
|
@@ -607,6 +613,7 @@
|
|
607
613
|
$prop(klass, '$$ancestors', []);
|
608
614
|
$prop(klass, '$$ancestors_cache_version', null);
|
609
615
|
$prop(klass, '$$subclasses', []);
|
616
|
+
$prop(klass, '$$cloned_from', []);
|
610
617
|
|
611
618
|
$prop(klass.$$prototype, '$$class', klass);
|
612
619
|
|
@@ -774,6 +781,7 @@
|
|
774
781
|
$prop(module, '$$own_prepended_modules', []);
|
775
782
|
$prop(module, '$$ancestors', [module]);
|
776
783
|
$prop(module, '$$ancestors_cache_version', null);
|
784
|
+
$prop(module, '$$cloned_from', []);
|
777
785
|
|
778
786
|
$set_proto(module, Opal.Module.prototype);
|
779
787
|
|
@@ -932,7 +940,7 @@
|
|
932
940
|
};
|
933
941
|
|
934
942
|
Opal.instance_methods = function(mod) {
|
935
|
-
var
|
943
|
+
var processed = Object.create(null), results = [], ancestors = $ancestors(mod);
|
936
944
|
|
937
945
|
for (var i = 0, l = ancestors.length; i < l; i++) {
|
938
946
|
var ancestor = ancestors[i],
|
@@ -947,18 +955,18 @@
|
|
947
955
|
for (var j = 0, ll = props.length; j < ll; j++) {
|
948
956
|
var prop = props[j];
|
949
957
|
|
958
|
+
if (processed[prop]) {
|
959
|
+
continue;
|
960
|
+
}
|
950
961
|
if (Opal.is_method(prop)) {
|
951
|
-
var
|
952
|
-
method = proto[prop];
|
953
|
-
|
954
|
-
if (method.$$stub && exclude.indexOf(method_name) === -1) {
|
955
|
-
exclude.push(method_name);
|
956
|
-
}
|
962
|
+
var method = proto[prop];
|
957
963
|
|
958
|
-
if (!method.$$stub
|
964
|
+
if (!method.$$stub) {
|
965
|
+
var method_name = prop.slice(1);
|
959
966
|
results.push(method_name);
|
960
967
|
}
|
961
968
|
}
|
969
|
+
processed[prop] = true;
|
962
970
|
}
|
963
971
|
}
|
964
972
|
|
@@ -1606,15 +1614,22 @@
|
|
1606
1614
|
|
1607
1615
|
// Super dispatcher
|
1608
1616
|
Opal.find_super = function(obj, mid, current_func, defcheck, allow_stubs) {
|
1609
|
-
var jsid = $jsid(mid), ancestors, super_method;
|
1617
|
+
var jsid = $jsid(mid), ancestors, ancestor, super_method, method_owner, current_index = -1, i;
|
1610
1618
|
|
1611
1619
|
ancestors = get_ancestors(obj);
|
1620
|
+
method_owner = current_func.$$owner;
|
1612
1621
|
|
1613
|
-
|
1622
|
+
for (i = 0; i < ancestors.length; i++) {
|
1623
|
+
ancestor = ancestors[i];
|
1624
|
+
if (ancestor === method_owner || ancestor.$$cloned_from.indexOf(method_owner) !== -1) {
|
1625
|
+
current_index = i;
|
1626
|
+
break;
|
1627
|
+
}
|
1628
|
+
}
|
1614
1629
|
|
1615
|
-
for (
|
1616
|
-
|
1617
|
-
|
1630
|
+
for (i = current_index + 1; i < ancestors.length; i++) {
|
1631
|
+
ancestor = ancestors[i];
|
1632
|
+
var proto = ancestor.$$prototype;
|
1618
1633
|
|
1619
1634
|
if (proto.hasOwnProperty('$$dummy')) {
|
1620
1635
|
proto = proto.$$define_methods_on;
|
@@ -1662,6 +1677,17 @@
|
|
1662
1677
|
// @deprecated
|
1663
1678
|
Opal.find_iter_super_dispatcher = Opal.find_block_super;
|
1664
1679
|
|
1680
|
+
function call_lambda(block, arg, ret) {
|
1681
|
+
try {
|
1682
|
+
block(arg);
|
1683
|
+
} catch (e) {
|
1684
|
+
if (e === ret) {
|
1685
|
+
return ret.$v;
|
1686
|
+
}
|
1687
|
+
throw e;
|
1688
|
+
}
|
1689
|
+
}
|
1690
|
+
|
1665
1691
|
// handles yield calls for 1 yielded arg
|
1666
1692
|
Opal.yield1 = function(block, arg) {
|
1667
1693
|
if (typeof(block) !== "function") {
|
@@ -1669,16 +1695,23 @@
|
|
1669
1695
|
}
|
1670
1696
|
|
1671
1697
|
var has_mlhs = block.$$has_top_level_mlhs_arg,
|
1672
|
-
has_trailing_comma = block.$$has_trailing_comma_in_args
|
1698
|
+
has_trailing_comma = block.$$has_trailing_comma_in_args,
|
1699
|
+
is_returning_lambda = block.$$is_lambda && block.$$ret;
|
1673
1700
|
|
1674
1701
|
if (block.length > 1 || ((has_mlhs || has_trailing_comma) && block.length === 1)) {
|
1675
1702
|
arg = Opal.to_ary(arg);
|
1676
1703
|
}
|
1677
1704
|
|
1678
1705
|
if ((block.length > 1 || (has_trailing_comma && block.length === 1)) && arg.$$is_array) {
|
1706
|
+
if (is_returning_lambda) {
|
1707
|
+
return call_lambda(block.apply.bind(block, null), arg, block.$$ret);
|
1708
|
+
}
|
1679
1709
|
return block.apply(null, arg);
|
1680
1710
|
}
|
1681
1711
|
else {
|
1712
|
+
if (is_returning_lambda) {
|
1713
|
+
return call_lambda(block, arg, block.$$ret);
|
1714
|
+
}
|
1682
1715
|
return block(arg);
|
1683
1716
|
}
|
1684
1717
|
};
|
@@ -1691,10 +1724,13 @@
|
|
1691
1724
|
|
1692
1725
|
if (block.length > 1 && args.length === 1) {
|
1693
1726
|
if (args[0].$$is_array) {
|
1694
|
-
|
1727
|
+
args = args[0];
|
1695
1728
|
}
|
1696
1729
|
}
|
1697
1730
|
|
1731
|
+
if (block.$$is_lambda && block.$$ret) {
|
1732
|
+
return call_lambda(block.apply.bind(block, null), args, block.$$ret);
|
1733
|
+
}
|
1698
1734
|
return block.apply(null, args);
|
1699
1735
|
};
|
1700
1736
|
|
@@ -1854,9 +1890,14 @@
|
|
1854
1890
|
}
|
1855
1891
|
|
1856
1892
|
// Optimization for a costly operation of prepending '$' to method names
|
1857
|
-
var jsid_cache =
|
1893
|
+
var jsid_cache = new Map();
|
1858
1894
|
function $jsid(name) {
|
1859
|
-
|
1895
|
+
var jsid = jsid_cache.get(name);
|
1896
|
+
if (!jsid) {
|
1897
|
+
jsid = '$' + name;
|
1898
|
+
jsid_cache.set(name, jsid);
|
1899
|
+
}
|
1900
|
+
return jsid;
|
1860
1901
|
}
|
1861
1902
|
Opal.jsid = $jsid;
|
1862
1903
|
|
@@ -2166,10 +2207,23 @@
|
|
2166
2207
|
|
2167
2208
|
// We need a wrapper because otherwise properties
|
2168
2209
|
// would be overwritten on the original body.
|
2169
|
-
alias =
|
2170
|
-
var block = alias.$$p, i, ii;
|
2210
|
+
alias = Opal.wrap_method_body(body);
|
2171
2211
|
|
2172
|
-
|
2212
|
+
// Try to make the browser pick the right name
|
2213
|
+
alias.displayName = name;
|
2214
|
+
alias.$$alias_of = body;
|
2215
|
+
alias.$$alias_name = name;
|
2216
|
+
|
2217
|
+
Opal.defn(obj, id, alias);
|
2218
|
+
|
2219
|
+
return obj;
|
2220
|
+
};
|
2221
|
+
|
2222
|
+
Opal.wrap_method_body = function(body) {
|
2223
|
+
var wrapped = function() {
|
2224
|
+
var block = wrapped.$$p;
|
2225
|
+
|
2226
|
+
wrapped.$$p = null;
|
2173
2227
|
|
2174
2228
|
return Opal.send(this, body, arguments, block);
|
2175
2229
|
};
|
@@ -2179,21 +2233,14 @@
|
|
2179
2233
|
// It doesn't work in older browsers (like Chrome 38), where
|
2180
2234
|
// an exception is thrown breaking Opal altogether.
|
2181
2235
|
try {
|
2182
|
-
Object.defineProperty(
|
2236
|
+
Object.defineProperty(wrapped, 'length', { value: body.length });
|
2183
2237
|
} catch (e) {}
|
2184
2238
|
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
alias.$$arity = body.$$arity == null ? body.length : body.$$arity;
|
2189
|
-
alias.$$parameters = body.$$parameters;
|
2190
|
-
alias.$$source_location = body.$$source_location;
|
2191
|
-
alias.$$alias_of = body;
|
2192
|
-
alias.$$alias_name = name;
|
2193
|
-
|
2194
|
-
Opal.defn(obj, id, alias);
|
2239
|
+
wrapped.$$arity = body.$$arity == null ? body.length : body.$$arity;
|
2240
|
+
wrapped.$$parameters = body.$$parameters;
|
2241
|
+
wrapped.$$source_location = body.$$source_location;
|
2195
2242
|
|
2196
|
-
return
|
2243
|
+
return wrapped;
|
2197
2244
|
};
|
2198
2245
|
|
2199
2246
|
Opal.alias_gvar = function(new_name, old_name) {
|
@@ -2264,7 +2311,7 @@
|
|
2264
2311
|
object;
|
2265
2312
|
|
2266
2313
|
for (var i=0; i<objects.length; i++) {
|
2267
|
-
object = objects[
|
2314
|
+
object = objects[i];
|
2268
2315
|
if (key === object || key['$eql?'](object)) {
|
2269
2316
|
hash.set(object, value);
|
2270
2317
|
return;
|
@@ -2922,6 +2969,20 @@
|
|
2922
2969
|
return array;
|
2923
2970
|
}
|
2924
2971
|
|
2972
|
+
// Opal32-checksum algorithm for #hash
|
2973
|
+
// -----------------------------------
|
2974
|
+
Opal.opal32_init = $return_val(0x4f70616c);
|
2975
|
+
|
2976
|
+
function $opal32_ror(n, d) {
|
2977
|
+
return (n << d)|(n >>> (32 - d));
|
2978
|
+
};
|
2979
|
+
|
2980
|
+
Opal.opal32_add = function(hash, next) {
|
2981
|
+
hash ^= next;
|
2982
|
+
hash = $opal32_ror(hash, 1);
|
2983
|
+
return hash;
|
2984
|
+
};
|
2985
|
+
|
2925
2986
|
// Initialization
|
2926
2987
|
// --------------
|
2927
2988
|
Opal.BasicObject = BasicObject = $allocate_class('BasicObject', null);
|
@@ -2993,16 +3054,37 @@
|
|
2993
3054
|
Object.seal(nil);
|
2994
3055
|
|
2995
3056
|
Opal.thrower = function(type) {
|
2996
|
-
var thrower = {
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3057
|
+
var thrower = {
|
3058
|
+
$thrower_type: type,
|
3059
|
+
$throw: function(value, called_from_lambda) {
|
3060
|
+
if (value == null) value = nil;
|
3061
|
+
if (this.is_orphan && !called_from_lambda) {
|
3062
|
+
$raise(Opal.LocalJumpError, 'unexpected ' + type, value, type.$to_sym());
|
3063
|
+
}
|
3064
|
+
this.$v = value;
|
3065
|
+
throw this;
|
3066
|
+
},
|
3067
|
+
is_orphan: false
|
3068
|
+
}
|
3003
3069
|
return thrower;
|
3004
3070
|
};
|
3005
3071
|
|
3072
|
+
// Define a "$@" global variable, which would compute and return a backtrace on demand.
|
3073
|
+
Object.defineProperty($gvars, "@", {
|
3074
|
+
enumerable: true,
|
3075
|
+
configurable: true,
|
3076
|
+
get: function() {
|
3077
|
+
if ($truthy($gvars["!"])) return $gvars["!"].$backtrace();
|
3078
|
+
return nil;
|
3079
|
+
},
|
3080
|
+
set: function(bt) {
|
3081
|
+
if ($truthy($gvars["!"]))
|
3082
|
+
$gvars["!"].$set_backtrace(bt);
|
3083
|
+
else
|
3084
|
+
$raise(Opal.ArgumentError, "$! not set");
|
3085
|
+
}
|
3086
|
+
});
|
3087
|
+
|
3006
3088
|
Opal.t_eval_return = Opal.thrower("return");
|
3007
3089
|
|
3008
3090
|
TypeError.$$super = Error;
|
data/opal/corelib/string.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
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
2
|
# backtick_javascript: true
|
3
3
|
|
4
4
|
require 'corelib/comparable'
|
@@ -9,11 +9,43 @@ class ::String < `String`
|
|
9
9
|
|
10
10
|
%x{
|
11
11
|
Opal.prop(#{self}.$$prototype, '$$is_string', true);
|
12
|
+
|
13
|
+
var string_id_map = new Map();
|
12
14
|
}
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
+
}
|
17
49
|
|
18
50
|
def self.try_convert(what)
|
19
51
|
::Opal.coerce_to?(what, ::String, :to_str)
|
@@ -562,10 +594,6 @@ class ::String < `String`
|
|
562
594
|
}
|
563
595
|
end
|
564
596
|
|
565
|
-
def hash
|
566
|
-
`self.toString()`
|
567
|
-
end
|
568
|
-
|
569
597
|
def hex
|
570
598
|
to_i 16
|
571
599
|
end
|
data/opal/corelib/struct.rb
CHANGED
data/opal/corelib/time.rb
CHANGED
data/spec/filters/bugs/array.rb
CHANGED
@@ -7,32 +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)
|
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
|
36
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
|
37
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))
|
38
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
|
@@ -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
|