opal 0.9.0.rc1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -114,20 +114,24 @@
114
114
  // base. Constants are looked up through their parents, so the base
115
115
  // scope will be the outer scope of the new klass.
116
116
  //
117
- Opal.create_scope = function(base, klass, id) {
117
+ // @param base_scope [$$scope] the scope in which the new scope should be created
118
+ // @param klass [Class]
119
+ // @param id [String, null] the name of the newly created scope
120
+ //
121
+ Opal.create_scope = function(base_scope, klass, id) {
118
122
  var const_alloc = function() {};
119
- var const_scope = const_alloc.prototype = new base.constructor();
123
+ var const_scope = const_alloc.prototype = new base_scope.constructor();
120
124
 
121
125
  klass.$$scope = const_scope;
122
- klass.$$base_module = base.base;
126
+ klass.$$base_module = base_scope.base;
123
127
 
124
128
  const_scope.base = klass;
125
129
  const_scope.constructor = const_alloc;
126
130
  const_scope.constants = [];
127
131
 
128
132
  if (id) {
129
- Opal.cdecl(base, id, klass);
130
- const_alloc.displayName = id+"_alloc";
133
+ Opal.cdecl(base_scope, id, klass);
134
+ const_alloc.displayName = id+"_scope_alloc";
131
135
  }
132
136
  }
133
137
 
@@ -149,11 +153,12 @@
149
153
  // If `base` is an object (not a class/module), we simple get its class and
150
154
  // use that as the base instead.
151
155
  //
152
- // @param [Object] base where the class is being created
153
- // @param [Class] superklass superclass of the new class (may be null)
154
- // @param [String] id the name of the class to be created
155
- // @param [Function] constructor function to use as constructor
156
- // @return [Class] new or existing ruby class
156
+ // @param base [Object] where the class is being created
157
+ // @param superklass [Class,null] superclass of the new class (may be null)
158
+ // @param id [String] the name of the class to be created
159
+ // @param constructor [Function] function to use as constructor
160
+ //
161
+ // @return new [Class] or existing ruby class
157
162
  //
158
163
  Opal.klass = function(base, superklass, id, constructor) {
159
164
  var klass, bridged, alloc;
@@ -341,9 +346,9 @@
341
346
  // Otherwise, a new module is created in the base with the given name, and that
342
347
  // new instance is returned back (to be referenced at runtime).
343
348
  //
344
- // @param [RubyModule or Class] base class or module this definition is inside
345
- // @param [String] id the name of the new (or existing) module
346
- // @return [RubyModule]
349
+ // @param base [Module, Class] class or module this definition is inside
350
+ // @param id [String] the name of the new (or existing) module
351
+ // @return [Module]
347
352
  //
348
353
  Opal.module = function(base, id) {
349
354
  var module;
@@ -696,7 +701,17 @@
696
701
  }
697
702
 
698
703
 
699
- // constant assign
704
+ // Constant assignment, see also `Opal.cdecl`
705
+ //
706
+ // @param base_module [Module, Class] the constant namespace
707
+ // @param name [String] the name of the constant
708
+ // @param value [Object] the value of the constant
709
+ //
710
+ // @example Assigning a namespaced constant
711
+ // self::FOO = 'bar'
712
+ //
713
+ // @example Assigning with Module#const_set
714
+ // Foo.const_set :BAR, 123
700
715
  //
701
716
  Opal.casgn = function(base_module, name, value) {
702
717
  function update(klass, name) {
@@ -714,7 +729,8 @@
714
729
  var scope = base_module.$$scope;
715
730
 
716
731
  if (value.$$is_class || value.$$is_module) {
717
- // only checking _Object prevents setting a const on an anonymous class that has a superclass that's not Object
732
+ // Only checking _Object prevents setting a const on an anonymous class
733
+ // that has a superclass that's not Object
718
734
  if (value.$$is_class || value.$$base_module === _Object) {
719
735
  value.$$base_module = base_module;
720
736
  }
@@ -1575,7 +1575,7 @@ class String < `String`
1575
1575
  return enum_for :upto, stop, excl unless block_given?
1576
1576
  stop = Opal.coerce_to(stop, String, :to_str)
1577
1577
  %x{
1578
- var a, b, s = self.toString();
1578
+ var a, b, s = self.toString(), value;
1579
1579
 
1580
1580
  if (s.length === 1 && stop.length === 1) {
1581
1581
 
@@ -1586,7 +1586,10 @@ class String < `String`
1586
1586
  if (excl && a === b) {
1587
1587
  break;
1588
1588
  }
1589
- block(String.fromCharCode(a));
1589
+
1590
+ value = block(String.fromCharCode(a));
1591
+ if (value === $breaker) { return $breaker.$v; }
1592
+
1590
1593
  a += 1;
1591
1594
  }
1592
1595
 
@@ -1599,7 +1602,10 @@ class String < `String`
1599
1602
  if (excl && a === b) {
1600
1603
  break;
1601
1604
  }
1602
- block(a.toString());
1605
+
1606
+ value = block(a.toString());
1607
+ if (value === $breaker) { return $breaker.$v; }
1608
+
1603
1609
  a += 1;
1604
1610
  }
1605
1611
 
@@ -1609,7 +1615,10 @@ class String < `String`
1609
1615
  if (excl && s === stop) {
1610
1616
  break;
1611
1617
  }
1612
- block(s);
1618
+
1619
+ value = block(s);
1620
+ if (value === $breaker) { return $breaker.$v; }
1621
+
1613
1622
  s = #{`s`.succ};
1614
1623
  }
1615
1624
 
@@ -6,10 +6,10 @@ opal_filter "language" do
6
6
  fails "A class definition extending an object (sclass) can use return to cause the enclosing method to return"
7
7
  fails "A class definition extending an object (sclass) raises a TypeError when trying to extend numbers"
8
8
  fails "A class definition has no class variables"
9
- fails "A class definition raises a TypeError if inheriting from a metaclass"
10
9
  fails "A class definition raises TypeError if any constant qualifying the class is not a Module"
11
10
  fails "A class definition raises TypeError if constant given as class name exists and is not a Module"
12
11
  fails "A class definition raises TypeError if the constant qualifying the class is nil"
12
+ fails "A class definition raises a TypeError if inheriting from a metaclass"
13
13
  fails "A class variable defined in a module can be accessed from classes that extend the module"
14
14
  fails "A class variable defined in a module can be accessed from modules that extend the module"
15
15
  fails "A class variable defined in a module can be accessed inside the class using the module methods"
@@ -31,6 +31,52 @@ opal_filter "language" do
31
31
  fails "A constant on a singleton class is not defined on the object's class"
32
32
  fails "A constant on a singleton class is not preserved when the object is duped"
33
33
  fails "A constant on a singleton class raises a NameError for anonymous_module::CONST"
34
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda do |(a, b, *c, d), (*e, f, g), (*h)|\n [a, b, c, d, e, f, g, h]\n end"
35
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda do |a, (b, (c, *d, (e, (*f)), g), (h, (i, j)))|\n [a, b, c, d, e, f, g, h, i, j]\n end"
36
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda do |a, b=1, *c, (*d, (e)), f: 2, g:, h:, **k, &l|\n [a, b, c, d, e, f, g, h, k, l]\n end"
37
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda do |a, b=1, *c, d, e:, f: 2, g:, **k, &l|\n [a, b, c, d, e, f, g, k, l]\n end"
38
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda do |a: (@a = -> (a: 1) { a }), b:|\n [a, b]\n end"
39
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |(*a, b)| [a, b] }"
40
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |(a)| a }"
41
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |**k| k }"
42
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |**| }"
43
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |*, &b| b }"
44
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |*, **k| k }"
45
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |*| }"
46
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |a, | a }"
47
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |a: 1, b: 2| [a, b] }"
48
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |a: 1, b:| [a, b] }"
49
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |a: 1| a }"
50
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |a:, b: 1| [a, b] }"
51
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |a:, b:| [a, b] }"
52
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n @a = lambda { |a:| a }"
53
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n def m(*a) yield(*a) end\n @a = lambda { |a| a }"
54
+ fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition \n def m(a) yield a end\n def m2() yield end\n @a = lambda { |a, | a }"
55
+ fails "A lambda expression 'lambda { ... }' requires a block"
56
+ fails "A lambda expression 'lambda { ... }' with an implicit block can be created"
57
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> ((*a, b)) { [a, b] }"
58
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> ((a)) { a }"
59
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> ((a, b, *c, d), (*e, f, g), (*h)) do\n [a, b, c, d, e, f, g, h]\n end"
60
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (*) { }"
61
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (**) { }"
62
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (**k) { k }"
63
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (*, &b) { b }"
64
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (*, **k) { k }"
65
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a, (b, (c, *d, (e, (*f)), g), (h, (i, j)))) do\n [a, b, c, d, e, f, g, h, i, j]\n end"
66
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a, b) { [a, b] }"
67
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a, b=1, *c, (*d, (e)), f: 2, g:, h:, **k, &l) do\n [a, b, c, d, e, f, g, h, k, l]\n end"
68
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a: 1) { a }"
69
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a: 1, b: 2) { [a, b] }"
70
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a: 1, b:) { [a, b] }"
71
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a: @a = -> (a: 1) { a }, b:) do\n [a, b]\n end"
72
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a:) { a }"
73
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a:, b: 1) { [a, b] }"
74
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a:, b:) { [a, b] }"
75
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> (a={}) { a }"
76
+ fails "A lambda literal -> () { } assigns variables from parameters for definition \n @a = -> a, b=1, *c, d, e:, f: 2, g:, **k, &l do\n [a, b, c, d, e, f, g, k, l]\n end"
77
+ fails "A lambda literal -> () { } assigns variables from parameters with circular optional argument reference shadows an existing local with the same name as the argument"
78
+ fails "A lambda literal -> () { } assigns variables from parameters with circular optional argument reference shadows an existing method with the same name as the argument"
79
+ fails "A lambda literal -> () { } returns a Proc object when used in a BasicObject method"
34
80
  fails "A method call evaluates block pass after arguments"
35
81
  fails "A number literal can be a binary literal with trailing 'i' to represent a Complex"
36
82
  fails "A number literal can be a binary literal with trailing 'r' to represent a Rational"
@@ -46,8 +92,8 @@ opal_filter "language" do
46
92
  fails "A singleton class for BasicObject has Class as it's superclass"
47
93
  fails "A singleton class for BasicObject has the proper level of superclass for Class"
48
94
  fails "A singleton class inherits from Class for classes"
49
- fails "A singleton class is a subclass of a superclass's singleton class"
50
95
  fails "A singleton class is a subclass of Class's singleton class"
96
+ fails "A singleton class is a subclass of a superclass's singleton class"
51
97
  fails "A singleton class is a subclass of the same level of Class's singleton class"
52
98
  fails "A singleton class is a subclass of the same level of superclass's singleton class"
53
99
  fails "A singleton class raises a TypeError for Fixnum's"
@@ -55,31 +101,45 @@ opal_filter "language" do
55
101
  fails "An ensure block inside a begin block is executed even when a symbol is thrown in it's corresponding begin block"
56
102
  fails "Assigning an anonymous module to a constant sets the name of contained modules when assigning a toplevel anonymous module"
57
103
  fails "Assigning an anonymous module to a constant sets the name of the module"
58
- fails "calling methods on the metaclass calls a method defined on the metaclass of the metaclass"
59
104
  fails "Class methods of a singleton class for a class include class methods of Class"
60
105
  fails "Class methods of a singleton class for a class include instance methods of the singleton class of Class"
61
106
  fails "Class methods of a singleton class for a singleton class include class methods of the singleton class of Class"
62
107
  fails "Instance methods of a singleton class for a singleton class includes instance methods of the singleton class of Class"
63
108
  fails "Instantiating a singleton class raises a TypeError when allocate is called"
64
109
  fails "Instantiating a singleton class raises a TypeError when new is called"
65
- fails "not() returns false if the argument is true"
66
- fails "not() returns true if the argument is false"
67
- fails "not() returns true if the argument is nil"
110
+ fails "Literal Regexps caches the Regexp object"
111
+ fails "Literal Regexps disallows alphabets as non-paired delimiter with %r"
112
+ fails "Literal Regexps disallows first part of paired delimiters to be used as non-paired delimiters"
113
+ fails "Literal Regexps disallows spaces after %r and delimiter"
114
+ fails "Literal Regexps matches against $_ (last input) in a conditional if no explicit matchee provided"
115
+ fails "Literal Regexps supports (?# )"
116
+ fails "Literal Regexps supports (?<! ) (negative lookbehind)"
117
+ fails "Literal Regexps supports (?<= ) (positive lookbehind)"
118
+ fails "Literal Regexps supports (?> ) (embedded subexpression)"
119
+ fails "Literal Regexps supports \\g (named backreference)"
120
+ fails "Literal Regexps supports character class composition"
121
+ fails "Literal Regexps supports non-paired delimiters delimiters with %r"
122
+ fails "Literal Regexps supports possessive quantifiers"
123
+ fails "Literal Regexps throws SyntaxError for malformed literals"
68
124
  fails "Operators * / % are left-associative"
69
- fails "self in a metaclass body (class << obj) raises a TypeError for numbers"
70
- fails "self in a metaclass body (class << obj) raises a TypeError for symbols"
125
+ fails "Reopening a class adds new methods to subclasses"
126
+ fails "The =~ operator with named captures on syntax of /regexp/ =~ string_variable sets local variables by the captured pairs"
127
+ fails "The =~ operator with named captures on syntax of regexp_variable =~ string_variable does not set local variables"
128
+ fails "The =~ operator with named captures on syntax of string_variable =~ /regexp/ does not set local variables"
129
+ fails "The =~ operator with named captures on the method calling does not set local variables"
130
+ fails "The BEGIN keyword accesses variables outside the eval scope"
131
+ fails "The BEGIN keyword must appear in a top-level context"
132
+ fails "The BEGIN keyword runs first in a given code unit"
133
+ fails "The BEGIN keyword runs in a shared scope"
134
+ fails "The BEGIN keyword runs multiple begins in FIFO order"
71
135
  fails "The __FILE__ pseudo-variable equals the absolute path of a file loaded by a relative path" # we can't clear $LOADED_FEATURES, should be treated as readonly
72
136
  fails "The __FILE__ pseudo-variable equals the absolute path of a file loaded by an absolute path" # we can't clear $LOADED_FEATURES, should be treated as readonly
137
+ fails "The __LINE__ pseudo-variable equals the line number of the text in a loaded file"
73
138
  fails "The alias keyword is not allowed against Fixnum or String instances"
74
139
  fails "The alias keyword on top level defines the alias on Object"
75
140
  fails "The alias keyword operates on methods defined via attr, attr_reader, and attr_accessor"
76
141
  fails "The alias keyword operates on methods with splat arguments defined in a superclass using text block for class eval"
77
142
  fails "The alias keyword operates on the object's metaclass when used in instance_eval"
78
- fails "The BEGIN keyword accesses variables outside the eval scope"
79
- fails "The BEGIN keyword must appear in a top-level context"
80
- fails "The BEGIN keyword runs first in a given code unit"
81
- fails "The BEGIN keyword runs in a shared scope"
82
- fails "The BEGIN keyword runs multiple begins in FIFO order"
83
143
  fails "The defined? keyword for a scoped constant does not call .const_missing if the constant is not defined"
84
144
  fails "The defined? keyword for a scoped constant returns nil when a constant is defined on top-level but not on the module"
85
145
  fails "The defined? keyword for a scoped constant returns nil when an undefined constant is scoped to a defined constant"
@@ -89,8 +149,8 @@ opal_filter "language" do
89
149
  fails "The defined? keyword for a simple constant returns 'constant' when the constant is defined"
90
150
  fails "The defined? keyword for a simple constant returns nil when the constant is not defined"
91
151
  fails "The defined? keyword for a top-level scoped constant returns nil when an undefined constant is scoped to a defined constant"
92
- fails "The defined? keyword for an expression returns nil for an expression with !~ and an undefined method"
93
152
  fails "The defined? keyword for an expression returns nil for an expression with != and an undefined method"
153
+ fails "The defined? keyword for an expression returns nil for an expression with !~ and an undefined method"
94
154
  fails "The defined? keyword for an expression returns nil for an expression with == and an undefined method"
95
155
  fails "The defined? keyword for an expression with logical connectives does not propagate an exception raised by a method in a 'not' expression"
96
156
  fails "The defined? keyword for an expression with logical connectives returns nil for an expression with '!' and an undefined method"
@@ -151,8 +211,8 @@ opal_filter "language" do
151
211
  fails "The super keyword raises an error error when super method does not exist"
152
212
  fails "The super keyword uses given block even if arguments are passed explicitly"
153
213
  fails "The super keyword without explicit arguments passes arguments and rest arguments including any modifications"
154
- fails "The super keyword without explicit arguments passes optional arguments that have a default value"
155
214
  fails "The super keyword without explicit arguments passes optional arguments that have a default value but were modified"
215
+ fails "The super keyword without explicit arguments passes optional arguments that have a default value"
156
216
  fails "The super keyword without explicit arguments passes optional arguments that have a non-default value but were modified"
157
217
  fails "The super keyword without explicit arguments passes rest arguments including any modifications"
158
218
  fails "The unpacking splat operator (*) unpacks arguments as if they were listed statically"
@@ -162,4 +222,19 @@ opal_filter "language" do
162
222
  fails "The until modifier with begin .. end block restart the current iteration without reevaluting condition with redo"
163
223
  fails "The until modifier with begin .. end block runs block at least once (even if the expression is true)"
164
224
  fails "The until modifier with begin .. end block skips to end of body with next"
225
+ fails "The while expression stops running body if interrupted by break in a begin ... end attribute op-assign-or value"
226
+ fails "The while expression stops running body if interrupted by break in a begin ... end element op-assign value"
227
+ fails "The while expression stops running body if interrupted by break in a begin ... end element op-assign-or value"
228
+ fails "The while expression stops running body if interrupted by break in a parenthesized attribute op-assign-or value"
229
+ fails "The while expression stops running body if interrupted by break in a parenthesized element op-assign value"
230
+ fails "The while modifier with begin .. end block evaluates condition after block execution"
231
+ fails "The while modifier with begin .. end block restarts the current iteration without reevaluting condition with redo"
232
+ fails "The while modifier with begin .. end block runs block at least once (even if the expression is false)"
233
+ fails "The while modifier with begin .. end block skips to end of body with next"
234
+ fails "calling methods on the metaclass calls a method defined on the metaclass of the metaclass"
235
+ fails "not() returns false if the argument is true"
236
+ fails "not() returns true if the argument is false"
237
+ fails "not() returns true if the argument is nil"
238
+ fails "self in a metaclass body (class << obj) raises a TypeError for numbers"
239
+ fails "self in a metaclass body (class << obj) raises a TypeError for symbols"
165
240
  end
@@ -1,22 +1,5 @@
1
1
  opal_filter "Module" do
2
- fails "Module#< raises a TypeError if the argument is not a class/module"
3
- fails "Module#< returns nil if self is not related to the given module"
4
- fails "Module#< returns true if self is a subclass of or includes the given module"
5
- fails "Module#<= raises a TypeError if the argument is not a class/module"
6
- fails "Module#<= returns nil if self is not related to the given module"
7
- fails "Module#<= returns true if self is a subclass of, the same as or includes the given module"
8
- fails "Module#<=> returns +1 if self is a superclas of or included by the given module"
9
- fails "Module#<=> returns -1 if self is a subclass of or includes the given module"
10
2
  fails "Module#=== returns true when the given Object's class includes self or when the given Object is extended by self"
11
- fails "Module#> raises a TypeError if the argument is not a class/module"
12
- fails "Module#> returns false if self is a subclass of or includes the given module"
13
- fails "Module#> returns false if self is the same as the given module"
14
- fails "Module#> returns nil if self is not related to the given module"
15
- fails "Module#> returns true if self is a superclass of or included by the given module"
16
- fails "Module#>= raises a TypeError if the argument is not a class/module"
17
- fails "Module#>= returns false if self is a subclass of or includes the given module"
18
- fails "Module#>= returns nil if self is not related to the given module"
19
- fails "Module#>= returns true if self is a superclass of, the same as or included by given module"
20
3
  fails "Module#alias_method can call a method with super aliased twice"
21
4
  fails "Module#alias_method preserves the arguments information of the original methods"
22
5
  fails "Module#alias_method raises a TypeError when the given name can't be converted using to_str"
@@ -44,6 +27,46 @@ opal_filter "Module" do
44
27
  fails "Module#attr_writer converts non string/symbol/fixnum names to strings using to_str"
45
28
  fails "Module#attr_writer not allows for adding an attr_writer to an immediate"
46
29
  fails "Module#attr_writer raises a TypeError when the given names can't be converted to strings using to_str"
30
+ fails "Module#autoload (concurrently) blocks a second thread while a first is doing the autoload"
31
+ fails "Module#autoload (concurrently) blocks others threads while doing an autoload"
32
+ fails "Module#autoload allows multiple autoload constants for a single file"
33
+ fails "Module#autoload calls #to_path on non-String filename arguments"
34
+ fails "Module#autoload calls #to_path on non-string filenames"
35
+ fails "Module#autoload does NOT raise a NameError when the autoload file did not define the constant and a module is opened with the same name"
36
+ fails "Module#autoload does not load the file if the file is manually required"
37
+ fails "Module#autoload does not load the file when accessing the constants table of the module"
38
+ fails "Module#autoload does not load the file when refering to the constant in defined?"
39
+ fails "Module#autoload does not remove the constant from the constant table if load fails"
40
+ fails "Module#autoload does not remove the constant from the constant table if the loaded files does not define it"
41
+ fails "Module#autoload ignores the autoload request if the file is already loaded"
42
+ fails "Module#autoload loads a file with .rb extension when passed the name without the extension"
43
+ fails "Module#autoload loads the file that defines subclass XX::YY < YY and YY is a top level constant"
44
+ fails "Module#autoload loads the file when opening a module that is the autoloaded constant"
45
+ fails "Module#autoload loads the registered constant into a dynamically created class"
46
+ fails "Module#autoload loads the registered constant into a dynamically created module"
47
+ fails "Module#autoload loads the registered constant when it is accessed"
48
+ fails "Module#autoload loads the registered constant when it is included"
49
+ fails "Module#autoload loads the registered constant when it is inherited from"
50
+ fails "Module#autoload loads the registered constant when it is opened as a class"
51
+ fails "Module#autoload loads the registered constant when it is opened as a module"
52
+ fails "Module#autoload looks up the constant in the scope where it is referred"
53
+ fails "Module#autoload looks up the constant when in a meta class scope"
54
+ fails "Module#autoload on a frozen module raises a RuntimeError before setting the name"
55
+ fails "Module#autoload raises a NameError when the constant name has a space in it"
56
+ fails "Module#autoload raises a NameError when the constant name starts with a lower case letter"
57
+ fails "Module#autoload raises a NameError when the constant name starts with a number"
58
+ fails "Module#autoload raises a TypeError if not passed a String or object respodning to #to_path for the filename"
59
+ fails "Module#autoload raises a TypeError if opening a class with a different superclass than the class defined in the autoload file"
60
+ fails "Module#autoload raises an ArgumentError when an empty filename is given"
61
+ fails "Module#autoload registers a file to load the first time the named constant is accessed"
62
+ fails "Module#autoload retains the autoload even if the request to require fails"
63
+ fails "Module#autoload returns 'constant' on refering the constant with defined?()"
64
+ fails "Module#autoload runs for an exception condition class and doesn't trample the exception"
65
+ fails "Module#autoload sets the autoload constant in the constants table"
66
+ fails "Module#autoload shares the autoload request across dup'ed copies of modules"
67
+ fails "Module#autoload when changing $LOAD_PATH does not reload a file due to a different load path"
68
+ fails "Module#autoload? returns nil if no file has been registered for a constant"
69
+ fails "Module#autoload? returns the name of the file that will be autoloaded"
47
70
  fails "Module#class_eval adds methods respecting the lexical constant scope"
48
71
  fails "Module#class_eval converts a non-string filename to a string using to_str"
49
72
  fails "Module#class_eval converts non string eval-string to string using to_str"
@@ -81,6 +104,9 @@ opal_filter "Module" do
81
104
  fails "Module#const_get with dynamically assigned constants searches a module included in the superclass"
82
105
  fails "Module#const_get with dynamically assigned constants searches the superclass chain"
83
106
  fails "Module#const_missing raises NameError and does not include toplevel Object"
107
+ fails "Module#const_set calls #to_str to convert the given name to a String"
108
+ fails "Module#const_set on a frozen module raises a RuntimeError before setting the name"
109
+ fails "Module#const_set raises a TypeError if conversion to a String by calling #to_str fails"
84
110
  fails "Module#constants doesn't returns inherited constants when passed false"
85
111
  fails "Module#constants doesn't returns inherited constants when passed nil"
86
112
  fails "Module#constants includes names of constants defined after a module is included"
@@ -150,6 +176,10 @@ opal_filter "Module" do
150
176
  fails "Module#module_function on Class raises a TypeError if calling after rebinded to Class"
151
177
  fails "Module#module_function with specific method names raises a TypeError when the given names can't be converted to string using to_str"
152
178
  fails "Module#module_function with specific method names tries to convert the given names to strings using to_str"
179
+ fails "Module#name is not nil for a nested module created with the module keyword"
180
+ fails "Module#name is set with a conditional assignment to a constant"
181
+ fails "Module#name is set with a conditional assignment to a nested constant"
182
+ fails "Module#name preserves the encoding in which the class was defined"
153
183
  fails "Module#prepend accepts no-arguments"
154
184
  fails "Module#prepend adds the module in the subclass chains"
155
185
  fails "Module#prepend allows wrapping methods"
@@ -4,13 +4,47 @@ opal_filter "Proc" do
4
4
  fails "Proc as an implicit block pass argument remains the same object if re-vivified by the target method"
5
5
  fails "Proc#=== on a Proc created with Kernel#lambda or Kernel#proc raises an ArgumentError on excess arguments when self is a lambda"
6
6
  fails "Proc#=== on a Proc created with Kernel#lambda or Kernel#proc raises an ArgumentError on missing arguments when self is a lambda"
7
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (*) { }\n @b = -> (*a) { }"
8
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (**k, &l) { }\n @b= -> (*a, **k) { }\n @c = ->(a: 1, b: 2, **k) { }"
9
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (*a, b) { }\n @b = -> (*a, b, c) { }\n @c = -> (*a, b, c, d) { }"
10
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a, *) { }\n @b = -> (a, *b) { }\n @c = -> (a, b, *c) { }\n @d = -> (a, b, c, *d) { }"
11
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a, *b, c) { }\n @b = -> (a, b, *c, d, e) { }"
12
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a, b=1) { }\n @b = -> (a, b, c=1, d=2) { }"
13
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a, b=1, *c, d, e:, f: 2, **k, &l) { }\n @b = -> (a, b=1, *c, d:, e:, f: 2, **k, &l) { }\n @c = -> (a=0, b=1, *c, d, e:, f: 2, **k, &l) { }\n @d = -> (a=0, b=1, *c, d:, e:, f: 2, **k, &l) { }"
14
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a, b=1, c=2, *d, e, f) { }\n @b = -> (a, b, c=1, *d, e, f, g) { }"
15
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a: 1) { }\n @b = -> (a: 1, b: 2) { }"
16
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a=1) { }\n @b = -> (a=1, b=2) { }"
17
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a=1, *b) { }\n @b = -> (a=1, b=2, *c) { }"
18
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a=1, *b, c:, d: 2, **k, &l) { }"
19
+ fails "Proc#arity for instances created with -> () { } returns negative values for definition \n @a = -> (a=1, b: 2) { }\n @b = -> (*a, b: 1) { }\n @c = -> (a=1, b: 2) { }\n @d = -> (a=1, *b, c: 2, &l) { }"
20
+ fails "Proc#arity for instances created with -> () { } returns positive values for definition \n @a = -> ((a, (*b, c))) { }\n @b = -> (a, (*b, c), d, (*e), (*)) { }"
21
+ fails "Proc#arity for instances created with -> () { } returns positive values for definition \n @a = -> (a, b, c:, d: 1) { }\n @b = -> (a, b, c:, d: 1, **k, &l) { }"
22
+ fails "Proc#arity for instances created with -> () { } returns positive values for definition \n @a = -> (a, b:) { }\n @b = -> (a, b:, &l) { }"
23
+ fails "Proc#arity for instances created with -> () { } returns positive values for definition \n @a = -> (a:) { }\n @b = -> (a:, b:) { }\n @c = -> (a: 1, b:, c:, d: 2) { }"
24
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |(a, (*b, c)), d=1| }\n @b = lambda { |a, (*b, c), d, (*e), (*), **k| }\n @c = lambda { |a, (b, c), *, d:, e: 2, **| }"
25
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |**k, &l| }\n @b = lambda { |*a, **k| }\n @c = lambda { |a: 1, b: 2, **k| }"
26
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |*a, b| }\n @b = lambda { |*a, b, c| }\n @c = lambda { |*a, b, c, d| }"
27
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |*| }\n @b = lambda { |*a| }"
28
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a, *b, c| }\n @b = lambda { |a, b, *c, d, e| }"
29
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a, *| }\n @b = lambda { |a, *b| }\n @c = lambda { |a, b, *c| }\n @d = lambda { |a, b, c, *d| }"
30
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a, b=1, *c, d, e:, f: 2, **k, &l| }\n @b = lambda { |a, b=1, *c, d:, e:, f: 2, **k, &l| }\n @c = lambda { |a=0, b=1, *c, d, e:, f: 2, **k, &l| }\n @d = lambda { |a=0, b=1, *c, d:, e:, f: 2, **k, &l| }"
31
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a, b=1, c=2, *d, e, f| }\n @b = lambda { |a, b, c=1, *d, e, f, g| }"
32
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a, b=1| }\n @b = lambda { |a, b, c=1, d=2| }"
33
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a: 1| }\n @b = lambda { |a: 1, b: 2| }"
34
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a=1, *b, c:, d: 2, **k, &l| }"
35
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a=1, *b| }\n @b = lambda { |a=1, b=2, *c| }"
36
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a=1, b: 2| }\n @b = lambda { |*a, b: 1| }\n @c = lambda { |a=1, b: 2| }\n @d = lambda { |a=1, *b, c: 2, &l| }"
37
+ fails "Proc#arity for instances created with lambda { || } returns negative values for definition \n @a = lambda { |a=1| }\n @b = lambda { |a=1, b=2| }"
38
+ fails "Proc#arity for instances created with lambda { || } returns positive values for definition \n @a = lambda { |a, b, c:, d: 1| }\n @b = lambda { |a, b, c:, d: 1, **k, &l| }"
39
+ fails "Proc#arity for instances created with lambda { || } returns positive values for definition \n @a = lambda { |a, b:| }\n @b = lambda { |a, b:, &l| }"
40
+ fails "Proc#arity for instances created with lambda { || } returns positive values for definition \n @a = lambda { |a:| }\n @b = lambda { |a:, b:| }\n @c = lambda { |a: 1, b:, c:, d: 2| }"
7
41
  fails "Proc#binding returns a Binding instance"
8
42
  fails "Proc#binding returns the binding associated with self"
9
43
  fails "Proc#call on a Proc created with Kernel#lambda or Kernel#proc raises an ArgumentError on excess arguments when self is a lambda"
10
44
  fails "Proc#call on a Proc created with Kernel#lambda or Kernel#proc raises an ArgumentError on missing arguments when self is a lambda"
11
45
  fails "Proc#curry with arity argument returns Procs with arities of -1 regardless of the value of _arity_"
12
- fails "Proc#inspect for a proc created with lambda returns a description including '(lambda)' and optionally including file and line number"
13
46
  fails "Proc#inspect for a proc created with UnboundMethod#to_proc returns a description including '(lambda)' and optionally including file and line number"
47
+ fails "Proc#inspect for a proc created with lambda returns a description including '(lambda)' and optionally including file and line number"
14
48
  fails "Proc#lambda? is preserved when passing a Proc with & to the lambda keyword"
15
49
  fails "Proc#lambda? is preserved when passing a Proc with & to the proc keyword"
16
50
  fails "Proc#source_location returns an Array"
@@ -19,8 +53,8 @@ opal_filter "Proc" do
19
53
  fails "Proc#source_location sets the first value to the path of the file in which the proc was defined"
20
54
  fails "Proc#source_location sets the last value to a Fixnum representing the line on which the proc was defined"
21
55
  fails "Proc#source_location works even if the proc was created on the same line"
22
- fails "Proc#to_s for a proc created with lambda returns a description including '(lambda)' and optionally including file and line number"
23
56
  fails "Proc#to_s for a proc created with UnboundMethod#to_proc returns a description including '(lambda)' and optionally including file and line number"
57
+ fails "Proc#to_s for a proc created with lambda returns a description including '(lambda)' and optionally including file and line number"
24
58
  fails "Proc#yield on a Proc created with Kernel#lambda or Kernel#proc raises an ArgumentError on excess arguments when self is a lambda"
25
59
  fails "Proc#yield on a Proc created with Kernel#lambda or Kernel#proc raises an ArgumentError on missing arguments when self is a lambda"
26
60
  fails "Proc.allocate raises a TypeError"