opal 0.10.0.beta2 → 0.10.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -1
  3. data/lib/opal/compiler.rb +15 -9
  4. data/lib/opal/fragment.rb +8 -1
  5. data/lib/opal/nodes/args/restarg.rb +6 -1
  6. data/lib/opal/nodes/base.rb +1 -1
  7. data/lib/opal/nodes/call.rb +4 -0
  8. data/lib/opal/nodes/def.rb +20 -25
  9. data/lib/opal/nodes/hash.rb +89 -17
  10. data/lib/opal/nodes/iter.rb +30 -2
  11. data/lib/opal/nodes/logic.rb +54 -4
  12. data/lib/opal/nodes/node_with_args.rb +72 -0
  13. data/lib/opal/parser.rb +16 -0
  14. data/lib/opal/parser/grammar.rb +2555 -2562
  15. data/lib/opal/parser/grammar.y +28 -20
  16. data/lib/opal/parser/lexer.rb +4 -4
  17. data/lib/opal/regexp_anchors.rb +13 -5
  18. data/lib/opal/source_map.rb +2 -1
  19. data/lib/opal/version.rb +1 -1
  20. data/opal/corelib/array.rb +4 -0
  21. data/opal/corelib/basic_object.rb +3 -1
  22. data/opal/corelib/constants.rb +1 -1
  23. data/opal/corelib/file.rb +196 -4
  24. data/opal/corelib/hash.rb +7 -7
  25. data/opal/corelib/kernel.rb +7 -4
  26. data/opal/corelib/marshal.rb +31 -0
  27. data/opal/corelib/marshal/read_buffer.rb +427 -0
  28. data/opal/corelib/marshal/write_buffer.rb +383 -0
  29. data/opal/corelib/method.rb +8 -0
  30. data/opal/corelib/module.rb +21 -0
  31. data/opal/corelib/number.rb +19 -5
  32. data/opal/corelib/proc.rb +33 -6
  33. data/opal/corelib/range.rb +6 -0
  34. data/opal/corelib/regexp.rb +5 -1
  35. data/opal/corelib/runtime.js +69 -17
  36. data/opal/corelib/string.rb +8 -0
  37. data/opal/corelib/string/inheritance.rb +4 -0
  38. data/opal/corelib/struct.rb +5 -0
  39. data/opal/corelib/unsupported.rb +0 -18
  40. data/opal/opal/full.rb +1 -0
  41. data/spec/filters/bugs/basicobject.rb +0 -2
  42. data/spec/filters/bugs/compiler_opal.rb +5 -0
  43. data/spec/filters/bugs/enumerable.rb +1 -0
  44. data/spec/filters/bugs/enumerator.rb +0 -2
  45. data/spec/filters/bugs/exception.rb +0 -1
  46. data/spec/filters/bugs/kernel.rb +0 -5
  47. data/spec/filters/bugs/language.rb +7 -27
  48. data/spec/filters/bugs/marshal.rb +43 -0
  49. data/spec/filters/bugs/method.rb +0 -56
  50. data/spec/filters/bugs/module.rb +0 -1
  51. data/spec/filters/bugs/proc.rb +0 -46
  52. data/spec/filters/bugs/regexp.rb +1 -0
  53. data/spec/filters/bugs/unboundmethod.rb +0 -13
  54. data/spec/filters/unsupported/bignum.rb +5 -0
  55. data/spec/filters/unsupported/freeze.rb +2 -0
  56. data/spec/filters/unsupported/marshal.rb +46 -0
  57. data/spec/filters/unsupported/symbol.rb +5 -0
  58. data/spec/lib/compiler/call_spec.rb +29 -29
  59. data/spec/lib/compiler_spec.rb +7 -1
  60. data/spec/opal/core/kernel/instance_variables_spec.rb +40 -0
  61. data/spec/opal/core/language/ternary_operator_spec.rb +6 -0
  62. data/spec/opal/core/marshal/dump_spec.rb +53 -0
  63. data/spec/opal/core/marshal/load_spec.rb +7 -0
  64. data/spec/opal/core/source_map_spec.rb +35 -1
  65. data/spec/opal/javascript_api_spec.rb +16 -0
  66. data/spec/opal/stdlib/source_map_spec.rb +8 -0
  67. data/spec/ruby_specs +7 -4
  68. data/spec/support/match_helpers.rb +57 -0
  69. data/spec/support/mspec_rspec_adapter.rb +1 -1
  70. data/stdlib/opal-parser.rb +3 -1
  71. data/stdlib/pathname.rb +105 -7
  72. data/stdlib/racc/parser.rb +551 -138
  73. data/stdlib/source_map/vlq.rb +3 -2
  74. data/tasks/testing.rake +4 -2
  75. metadata +22 -2
@@ -62,11 +62,14 @@ class Proc < `Function`
62
62
  `!!self.$$is_lambda`
63
63
  end
64
64
 
65
- # FIXME: this should support the various splats and optional arguments
66
65
  def arity
67
- `if (self.$$is_curried) { return -1; }`
68
- `if (self.$$arity) { return self.$$arity }`
69
- `self.length`
66
+ %x{
67
+ if (self.$$is_curried) {
68
+ return -1;
69
+ } else {
70
+ return self.$$arity;
71
+ }
72
+ }
70
73
  end
71
74
 
72
75
  def source_location
@@ -80,8 +83,32 @@ class Proc < `Function`
80
83
  end
81
84
 
82
85
  def parameters
83
- `if (self.$$is_curried) { return #{[[:rest]]}; }`
84
- nil
86
+ %x{
87
+ if (self.$$is_curried) {
88
+ return #{[[:rest]]};
89
+ } else if (self.$$parameters) {
90
+ if (self.$$is_lambda) {
91
+ return self.$$parameters;
92
+ } else {
93
+ var result = [], i, length;
94
+
95
+ for (i = 0, length = self.$$parameters.length; i < length; i++) {
96
+ var parameter = self.$$parameters[i];
97
+
98
+ if (parameter[0] === 'req') {
99
+ // required arguments always have name
100
+ parameter = ['opt', parameter[1]];
101
+ }
102
+
103
+ result.push(parameter);
104
+ }
105
+
106
+ return result;
107
+ }
108
+ } else {
109
+ return [];
110
+ }
111
+ }
85
112
  end
86
113
 
87
114
  def curry(arity = undefined)
@@ -134,4 +134,10 @@ class Range
134
134
  end
135
135
 
136
136
  alias inspect to_s
137
+
138
+ def marshal_load(args)
139
+ @begin = args[:begin]
140
+ @end = args[:end]
141
+ @exclude = args[:excl]
142
+ end
137
143
  end
@@ -80,7 +80,7 @@ class Regexp < `RegExp`
80
80
 
81
81
  regexp = #{Opal.coerce_to!(regexp, String, :to_str)};
82
82
 
83
- if (regexp.charAt(regexp.length - 1) === '\\') {
83
+ if (regexp.charAt(regexp.length - 1) === '\\' && regexp.charAt(regexp.length - 2) !== '\\') {
84
84
  #{raise RegexpError, "too short escape sequence: /#{regexp}/"}
85
85
  }
86
86
 
@@ -202,6 +202,10 @@ class Regexp < `RegExp`
202
202
  end
203
203
 
204
204
  alias to_s source
205
+
206
+ def self._load(args)
207
+ self.new(*args)
208
+ end
205
209
  end
206
210
 
207
211
  class MatchData
@@ -327,6 +327,9 @@
327
327
  // Every class gets its own constant scope, inherited from current scope
328
328
  Opal.create_scope(base.$$scope, klass, name);
329
329
 
330
+ // Name new class directly onto current scope (Opal.Foo.Baz = klass)
331
+ base[name] = klass;
332
+
330
333
  if (bridged) {
331
334
  Opal.bridge(klass, alloc);
332
335
  }
@@ -1029,12 +1032,7 @@
1029
1032
  }
1030
1033
  }
1031
1034
  else {
1032
- if (obj.$$is_class || obj.$$is_module) {
1033
- dispatcher = obj.$$super;
1034
- }
1035
- else {
1036
- dispatcher = Opal.find_obj_super_dispatcher(obj, jsid, current_func);
1037
- }
1035
+ dispatcher = Opal.find_obj_super_dispatcher(obj, jsid, current_func);
1038
1036
  }
1039
1037
 
1040
1038
  dispatcher = dispatcher['$' + jsid];
@@ -1068,24 +1066,50 @@
1068
1066
 
1069
1067
  Opal.find_obj_super_dispatcher = function(obj, jsid, current_func) {
1070
1068
  var klass = obj.$$meta || obj.$$class;
1069
+
1070
+ // first we need to find the class/module current_func is located on
1071
+ klass = Opal.find_owning_class(klass, current_func);
1072
+
1073
+ if (!klass) {
1074
+ throw new Error("could not find current class for super()");
1075
+ }
1076
+
1071
1077
  jsid = '$' + jsid;
1078
+ return Opal.find_super_func(klass, jsid, current_func);
1079
+ };
1080
+
1081
+ Opal.find_owning_class = function(klass, current_func) {
1082
+ var owner = current_func.$$owner;
1072
1083
 
1073
- // first we need to find the class/module current_func is defined/donated on
1074
1084
  while (klass) {
1075
- // when a module has been included in a class, look for that
1076
- if ((klass.$$iclass && klass.$$module === current_func.$$owner) || klass === current_func.$$owner) {
1085
+ // repeating for readability
1086
+
1087
+ if (klass.$$iclass && klass.$$module === current_func.$$donated) {
1088
+ // this klass was the last one the module donated to
1089
+ // case is also hit with multiple module includes
1090
+ break;
1091
+ }
1092
+ else if (klass.$$iclass && klass.$$module === owner) {
1093
+ // module has donated to other classes but klass isn't one of those
1094
+ break;
1095
+ }
1096
+ else if (owner.$$is_singleton && klass === owner.$$singleton_of.$$class) {
1097
+ // cases like stdlib `Singleton::included` that use a singleton of a singleton
1098
+ break;
1099
+ }
1100
+ else if (klass === owner) {
1101
+ // no modules, pure class inheritance
1077
1102
  break;
1078
1103
  }
1079
1104
 
1080
1105
  klass = klass.$$parent;
1081
1106
  }
1082
1107
 
1083
- // if we arent in a class, we couldnt find current?
1084
- if (!klass) {
1085
- throw new Error("could not find current class for super()");
1086
- }
1108
+ return klass;
1109
+ };
1087
1110
 
1088
- klass = klass.$$parent;
1111
+ Opal.find_super_func = function(owning_klass, jsid, current_func) {
1112
+ var klass = owning_klass.$$parent;
1089
1113
 
1090
1114
  // now we can find the super
1091
1115
  while (klass) {
@@ -1132,7 +1156,14 @@
1132
1156
  throw Opal.LocalJumpError.$new("no block given");
1133
1157
  }
1134
1158
 
1135
- if (block.length > 1 && arg.$$is_array) {
1159
+ var has_mlhs = block.$$has_top_level_mlhs_arg,
1160
+ has_trailing_comma = block.$$has_trailing_comma_in_args;
1161
+
1162
+ if (block.length > 1 || ((has_mlhs || has_trailing_comma) && block.length === 1)) {
1163
+ arg = Opal.to_ary(arg);
1164
+ }
1165
+
1166
+ if ((block.length > 1 || (has_trailing_comma && block.length === 1)) && arg.$$is_array) {
1136
1167
  return block.apply(null, arg);
1137
1168
  }
1138
1169
  else {
@@ -1204,6 +1235,27 @@
1204
1235
  return false;
1205
1236
  };
1206
1237
 
1238
+ // Helpers for extracting kwsplats
1239
+ // Used for: { **h }
1240
+ Opal.to_hash = function(value) {
1241
+ if (value.$$is_hash) {
1242
+ return value;
1243
+ }
1244
+ else if (value['$respond_to?']('to_hash', true)) {
1245
+ var hash = value.$to_hash();
1246
+ if (hash.$$is_hash) {
1247
+ return hash;
1248
+ }
1249
+ else {
1250
+ throw Opal.TypeError.$new("Can't convert " + value.$$class +
1251
+ " to Hash (" + value.$$class + "#to_hash gives " + hash.$$class + ")");
1252
+ }
1253
+ }
1254
+ else {
1255
+ throw Opal.TypeError.$new("no implicit conversion of " + value.$$class + " into Hash");
1256
+ }
1257
+ };
1258
+
1207
1259
  // Helpers for implementing multiple assignment
1208
1260
  // Our code for extracting the values and assigning them only works if the
1209
1261
  // return value is a JS array.
@@ -1371,8 +1423,8 @@
1371
1423
  // a method is defined inside an `instance_eval` block.
1372
1424
  //
1373
1425
  // @param obj [Object, Class] the actual obj to define method for
1374
- // @param jsid [String] the javascript friendly method name (e.g. '$foo')
1375
- // @param body [JS.Function] the literal javascript function used as method
1426
+ // @param jsid [String] the JavaScript friendly method name (e.g. '$foo')
1427
+ // @param body [JS.Function] the literal JavaScript function used as method
1376
1428
  // @return [null]
1377
1429
  //
1378
1430
  Opal.defn = function(obj, jsid, body) {
@@ -1684,6 +1684,14 @@ class String < `String`
1684
1684
  return null;
1685
1685
  }
1686
1686
  }
1687
+
1688
+ def instance_variables
1689
+ []
1690
+ end
1691
+
1692
+ def self._load(*args)
1693
+ self.new(*args)
1694
+ end
1687
1695
  end
1688
1696
 
1689
1697
  Symbol = String
@@ -116,4 +116,8 @@ class String::Wrapper
116
116
  def %(data)
117
117
  @literal % data
118
118
  end
119
+
120
+ def instance_variables
121
+ super - ['@literal']
122
+ end
119
123
  end
@@ -260,4 +260,9 @@ class Struct
260
260
  return result;
261
261
  }
262
262
  end
263
+
264
+ def self._load(args)
265
+ attributes = args.values_at(*members)
266
+ self.new(*attributes)
267
+ end
263
268
  end
@@ -133,24 +133,6 @@ module Kernel
133
133
  end
134
134
  end
135
135
 
136
- module Marshal
137
- `var ERROR = "Marshalling is not supported by Opal";`
138
-
139
- module_function
140
-
141
- def dump(*)
142
- raise NotImplementedError, `ERROR`
143
- end
144
-
145
- def load(*)
146
- raise NotImplementedError, `ERROR`
147
- end
148
-
149
- def restore(*)
150
- raise NotImplementedError, `ERROR`
151
- end
152
- end
153
-
154
136
  class Module
155
137
  def public(*methods)
156
138
  %x{
@@ -0,0 +1 @@
1
+ require 'corelib/marshal'
@@ -3,13 +3,11 @@ opal_filter "BasicObject" do
3
3
  fails "BasicObject does not define built-in constants (according to defined?)"
4
4
  fails "BasicObject raises NameError when referencing built-in constants"
5
5
  fails "BasicObject raises NoMethodError for nonexistent methods after #method_missing is removed"
6
- fails "BasicObject#__send__ has a negative arity"
7
6
  fails "BasicObject#initialize does not accept arguments"
8
7
  fails "BasicObject#instance_eval raises a TypeError when defining methods on an immediate"
9
8
  fails "BasicObject#instance_eval raises a TypeError when defining methods on numerics"
10
9
  fails "BasicObject#instance_eval sets class variables in the receiver"
11
10
  fails "BasicObject#instance_exec binds the block's binding self to the receiver"
12
- fails "BasicObject#instance_exec has an arity of -1"
13
11
  fails "BasicObject#instance_exec raises a LocalJumpError unless given a block"
14
12
  fails "BasicObject#instance_exec raises a TypeError when defining methods on an immediate"
15
13
  fails "BasicObject#instance_exec raises a TypeError when defining methods on numerics"
@@ -0,0 +1,5 @@
1
+ opal_filter "compiler (opal)" do
2
+ fails 'Opal::Compiler should compile undef calls'
3
+ fails 'Opal::Compiler method names when function name is reserved generates a valid named function for method'
4
+ fails 'Opal::Compiler pre-processing require-ish methods #require_tree parses and resolve #require argument'
5
+ end
@@ -33,6 +33,7 @@ opal_filter "Enumerable" do
33
33
  fails "Enumerable#slice_when when given a block returns an enumerator"
34
34
  fails "Enumerable#slice_when when given a block splits chunks between adjacent elements i and j where the block returns true"
35
35
  fails "Enumerable#slice_when when not given a block raises an ArgumentError"
36
+ fails "Enumerable#slice_when when an iterator method yields more than one value processes all yielded values"
36
37
  fails "Enumerable#sort_by returns an array of elements when a block is supplied and #map returns an enumerable"
37
38
  fails "Enumerable#take_while calls the block with initial args when yielded with multiple arguments"
38
39
  fails "Enumerable#to_h calls #to_ary on contents"
@@ -1,5 +1,4 @@
1
1
  opal_filter "Enumerator" do
2
- fails "Enumerator#each requires multiple arguments"
3
2
  fails "Enumerator#each_with_index raises an ArgumentError if passed extra arguments"
4
3
  fails "Enumerator#each_with_index returns the object being enumerated when given a block"
5
4
  fails "Enumerator#enum_for exposes multi-arg yields as an array"
@@ -18,7 +17,6 @@ opal_filter "Enumerator" do
18
17
  fails "Enumerator#initialize sets size to the given size if the given size is a Fixnum"
19
18
  fails "Enumerator#initialize sets size to the given size if the given size is a Proc"
20
19
  fails "Enumerator#initialize sets size to the given size if the given size is Float::INFINITY"
21
- fails "Enumerator#inject requires multiple arguments"
22
20
  fails "Enumerator#next_values advances the position of the current element"
23
21
  fails "Enumerator#next_values advances the position of the enumerator each time when called multiple times"
24
22
  fails "Enumerator#next_values raises StopIteration if called on a finished enumerator"
@@ -53,7 +53,6 @@ opal_filter "Exception" do
53
53
  fails "SystemCallError.new accepts single Fixnum argument as errno"
54
54
  fails "SystemCallError.new constructs the appropriate Errno class"
55
55
  fails "SystemCallError.new requires at least one argument"
56
- fails "SystemCallError.new returns an arity of -1 for the initialize method"
57
56
  fails "SystemStackError is a subclass of Exception"
58
57
  fails "rescueing SignalException raises a SignalException when sent a signal"
59
58
  end
@@ -47,7 +47,6 @@ opal_filter "Kernel" do
47
47
  fails "Kernel#extend on frozen instance raises a RuntimeError"
48
48
  fails "Kernel#extend on frozen instance raises an ArgumentError when no arguments given"
49
49
  fails "Kernel#extend raises an ArgumentError when no arguments given"
50
- fails "Kernel#extend requires multiple arguments"
51
50
  fails "Kernel#freeze causes instance_variable_set to raise RuntimeError"
52
51
  fails "Kernel#freeze causes mutative calls to raise RuntimeError"
53
52
  fails "Kernel#freeze on a Float has no effect since it is already frozen"
@@ -118,7 +117,6 @@ opal_filter "Kernel" do
118
117
  fails "Kernel#public_methods returns a list of the names of publicly accessible methods in the object"
119
118
  fails "Kernel#public_methods when passed false returns a list of public methods in without its ancestors"
120
119
  fails "Kernel#public_methods when passed nil returns a list of public methods in without its ancestors"
121
- fails "Kernel#public_send has a negative arity"
122
120
  fails "Kernel#public_send raises a NoMethodError if the method is protected"
123
121
  fails "Kernel#public_send raises a NoMethodError if the named method is an alias of a private method"
124
122
  fails "Kernel#public_send raises a NoMethodError if the named method is an alias of a protected method"
@@ -149,7 +147,6 @@ opal_filter "Kernel" do
149
147
  fails "Kernel#respond_to_missing? isn't called when obj responds to the given protected method, include_private = true"
150
148
  fails "Kernel#respond_to_missing? isn't called when obj responds to the given public method"
151
149
  fails "Kernel#respond_to_missing? isn't called when obj responds to the given public method, include_private = true"
152
- fails "Kernel#send has a negative arity"
153
150
  fails "Kernel#singleton_class raises TypeError for Fixnum"
154
151
  fails "Kernel#singleton_class raises TypeError for Symbol"
155
152
  fails "Kernel#singleton_methods when not passed an argument does not return any included methods for a class including a module"
@@ -234,7 +231,6 @@ opal_filter "Kernel" do
234
231
  fails "Kernel#singleton_methods when passed true returns the names of singleton methods for an object extented with a module"
235
232
  fails "Kernel#singleton_methods when passed true returns the names of singleton methods for an object extented with two modules"
236
233
  fails "Kernel#singleton_methods when passed true returns the names of singleton methods for an object"
237
- fails "Kernel#warn requires multiple arguments"
238
234
  fails "Kernel.Complex() when passed Numerics n1 and n2 and at least one responds to #real? with false returns n1 + n2 * Complex(0, 1)"
239
235
  fails "Kernel.Complex() when passed [Complex, Complex] returns a new Complex number based on the two given numbers"
240
236
  fails "Kernel.Complex() when passed [Complex] returns the passed Complex number"
@@ -288,7 +284,6 @@ opal_filter "Kernel" do
288
284
  fails "Kernel.loop is a private method"
289
285
  fails "Kernel.loop rescues StopIteration"
290
286
  fails "Kernel.loop rescues StopIteration's subclasses"
291
- fails "Kernel.loop returns an enumerator if no block given"
292
287
  fails "Kernel.loop when no block is given returned Enumerator size returns Float::INFINITY"
293
288
  fails "Kernel.printf calls write on the first argument when it is not a string"
294
289
  fails "Kernel.printf writes to stdout when a string is the first argument"
@@ -18,6 +18,7 @@ opal_filter "language" do
18
18
  fails "A class variable defined in a module is not defined in these classes"
19
19
  fails "A class variable defined in a module is only updated in the module a method defined in the module is used"
20
20
  fails "A class variable defined in a module is updated in the class when a Method defined in the class is used"
21
+ fails "A class variable definition is created in a module if any of the parents do not define it"
21
22
  fails "A constant on a metaclass appears in the metaclass constant list"
22
23
  fails "A constant on a metaclass cannot be accessed via object::CONST"
23
24
  fails "A constant on a metaclass does not appear in the object's class constant list"
@@ -161,7 +162,6 @@ opal_filter "language" do
161
162
  fails "The super keyword calls the correct method when the method visibility is modified"
162
163
  fails "The super keyword passes along modified rest args when they were originally empty"
163
164
  fails "The super keyword passes along modified rest args when they weren't originally empty"
164
- fails "The super keyword sees the included version of a module a method is alias from"
165
165
  fails "The super keyword uses given block even if arguments are passed explicitly"
166
166
  fails "The super keyword when using keyword arguments passes any given keyword arguments including optional and required ones to the parent"
167
167
  fails "The super keyword without explicit arguments passes arguments and rest arguments including any modifications"
@@ -239,24 +239,6 @@ opal_filter "language" do
239
239
  fails "A block yielded a single Array does not treat hashes with string keys as keyword arguments"
240
240
  fails "A block yielded a single Array assigns the last element to a non-keyword argument if #to_hash returns nil"
241
241
  fails "A block yielded a single Array raises a TypeError if #to_hash does not return a Hash"
242
- fails "A block yielded a single Object calls #to_ary on the object when taking multiple arguments"
243
- fails "A block yielded a single Object receives the object if #to_ary returns nil"
244
- fails "A block yielded a single Object raises a TypeError if #to_ary does not return an Array"
245
- fails "A block allows for a leading space before the arguments"
246
- fails "A block taking |a, b| arguments calls #to_ary to convert a single yielded object to an Array"
247
- fails "A block taking |a, b| arguments raises a TypeError if #to_ary does not return an Array"
248
- fails "A block taking |a, b| arguments raises the original exception if #to_ary raises an exception"
249
- fails "A block taking |a, *b| arguments calls #to_ary to convert a single yielded object to an Array"
250
- fails "A block taking |a, *b| arguments raises a TypeError if #to_ary does not return an Array"
251
- fails "A block taking |a, | arguments assigns nil to the argument when passed an empty Array"
252
- fails "A block taking |a, | arguments assigns the argument the first element of the Array when passed a single Array"
253
- fails "A block taking |a, | arguments calls #to_ary to convert a single yielded object to an Array"
254
- fails "A block taking |a, | arguments does not call #to_ary if the single yielded object is an Array"
255
- fails "A block taking |a, | arguments raises a TypeError if #to_ary does not return an Array"
256
- fails "A block taking |(a, b)| arguments calls #to_ary to convert a single yielded object to an Array"
257
- fails "A block taking |(a, b)| arguments raises a TypeError if #to_ary does not return an Array"
258
- fails "A block taking |(a, b), c| arguments calls #to_ary to convert a single yielded object to an Array"
259
- fails "A block taking |(a, b), c| arguments raises a TypeError if #to_ary does not return an Array"
260
242
  fails "A block taking identically-named arguments raises a SyntaxError for standard arguments"
261
243
  fails "Block-local variables can not have the same name as one of the standard parameters"
262
244
  fails "Block-local variables override shadowed variables from the outer scope"
@@ -288,15 +270,7 @@ opal_filter "language" do
288
270
  fails "A Proc taking |(a, b)| arguments calls #to_ary to convert a single passed object to an Array"
289
271
  fails "A Proc taking |(a, b)| arguments calls #to_ary to convert a single passed object to an Array"
290
272
  fails "A Proc taking |(a, b)| arguments raises a TypeError if #to_ary does not return an Array"
291
- fails "A singleton method definition can be declared for a local variable"
292
- fails "A singleton method definition can be declared for an instance variable"
293
273
  fails "A singleton method definition can be declared for a global variable"
294
- fails "A singleton method definition can be declared for a class variable"
295
- fails "A singleton method defined with extreme default arguments may use a method definition as a default"
296
- fails "A singleton method defined with extreme default arguments may use an fcall as a default"
297
- fails "A singleton method defined with extreme default arguments evaluates the defaults in the singleton scope"
298
- fails "A singleton method defined with extreme default arguments may use preceding arguments as defaults"
299
- fails "A singleton method defined with extreme default arguments may use a lambda as a default"
300
274
  fails "A nested method definition creates an instance method when evaluated in an instance method"
301
275
  fails "A nested method definition creates a class method when evaluated in a class method"
302
276
  fails "A method defined with extreme default arguments may use an fcall as a default" # fails on phantomjs
@@ -306,4 +280,10 @@ opal_filter "language" do
306
280
  fails "An instance method with a default argument shadows an existing method with the same name as the local"
307
281
  fails "A nested method definition creates a method in the surrounding context when evaluated in a def expr.method"
308
282
  fails "The def keyword within a closure looks outside the closure for the visibility"
283
+ fails "Invoking a method allows []= with *args in the [] expanded to individual arguments"
284
+ fails "Invoking a method allows []= with multiple *args and does not unwrap the last splat"
285
+ fails "Invoking a method allows []= with multiple *args"
286
+ fails "Invoking a method allows []= with a *args and multiple rhs args"
287
+ fails "Invoking a method does not expand final array arguments after a splat expansion"
288
+ fails "Invoking a private getter method does not permit self as a receiver"
309
289
  end
@@ -0,0 +1,43 @@
1
+ opal_filter "Marshal" do
2
+ # Marshal.load
3
+ fails "Marshal.load loads an array containing objects having _dump method, and with proc"
4
+ fails "Marshal.load loads an array containing objects having marshal_dump method, and with proc"
5
+ fails "Marshal.load assigns classes to nested subclasses of Array correctly"
6
+ fails "Marshal.load loads a _dump object"
7
+ fails "Marshal.load loads a _dump object extended"
8
+ fails "Marshal.load when called with a proc returns the value of the proc"
9
+ fails "Marshal.load when called with a proc calls the proc for recursively visited data"
10
+ fails "Marshal.load when called with a proc loads an Array with proc"
11
+ fails "Marshal.load when called on objects with custom _dump methods does not set instance variables of an object with user-defined _dump/_load"
12
+ fails "Marshal.load when called on objects with custom _dump methods that return an immediate value loads an array containing an instance of the object, followed by multiple instances of another object"
13
+ fails "Marshal.load when called on objects with custom _dump methods that return an immediate value loads any structure with multiple references to the same object, followed by multiple instances of another object"
14
+ fails "Marshal.load when called on objects with custom _dump methods that return an immediate value loads an array containing references to multiple instances of the object, followed by multiple instances of another object"
15
+ fails "Marshal.load for an Array loads an extended Array object containing a user-marshaled object"
16
+ fails "Marshal.load for a String loads a String subclass with custom constructor"
17
+ fails "Marshal.load for a Struct does not call initialize on the unmarshaled struct"
18
+ fails "Marshal.load for an Exception loads a marshalled exception with no message"
19
+ fails "Marshal.load for an Exception loads a marshalled exception with a message"
20
+ fails "Marshal.load for an Exception loads a marshalled exception with a backtrace"
21
+ fails "Marshal.load for a user Class raises ArgumentError if the object from an 'o' stream is not dumpable as 'o' type user class"
22
+ fails "Marshal.load for a user Class loads an object having ivar"
23
+ fails "Marshal.load for a user Class that extends a core type other than Object or BasicObject raises ArgumentError if the resulting class does not extend the same type"
24
+ fails "Marshal.load for a Regexp loads a extended_user_regexp having ivar"
25
+ fails "Marshal.load for a Hash loads an extended_user_hash with a parameter to initialize"
26
+ fails "Marshal.load for a Time loads"
27
+ fails "Marshal.load for a Time loads nanoseconds"
28
+ fails "Marshal.load for a Module loads an old module"
29
+ fails "Marshal.load when a class does not exist in the namespace raises an ArgumentError" # an issue with constant resolving, e.g. String::Array
30
+
31
+ # Marshal.dump
32
+ fails "Marshal.dump ignores the recursion limit if the limit is negative" # no support yet
33
+ fails "Marshal.dump with an object responding to #_dump dumps the object returned by #marshal_dump"
34
+ fails "Marshal.dump with a Time dumps the zone and the offset"
35
+ fails "Marshal.dump with a Time dumps the zone and the offset"
36
+ fails "Marshal.dump with a Regexp dumps a Regexp with instance variables" # //.source.should == ''
37
+ fails "Marshal.dump with a Regexp dumps a Regexp subclass" # requires Class.new(Regexp).new("").class != Regexp
38
+ fails "Marshal.dump with an Object dumps a BasicObject subclass if it defines respond_to?"
39
+ fails "Marshal.dump with a Time dumps the zone, but not the offset if zone is UTC"
40
+ fails "Marshal.dump with an Exception dumps an empty Exception"
41
+ fails "Marshal.dump with an Exception dumps the message for the exception"
42
+ fails "Marshal.dump with an Exception contains the filename in the backtrace"
43
+ end