opal 1.1.1 → 1.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +3 -2
  3. data/.github/ISSUE_TEMPLATE/bug-report.md +47 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. data/.github/workflows/build.yml +11 -5
  6. data/.gitignore +1 -0
  7. data/.jshintrc +1 -1
  8. data/Gemfile +0 -4
  9. data/HACKING.md +1 -1
  10. data/README.md +19 -15
  11. data/UNRELEASED.md +41 -0
  12. data/benchmark-ips/bm_array_unshift.rb +7 -0
  13. data/bin/opal-mspec +2 -0
  14. data/docs/compiler.md +1 -1
  15. data/examples/rack/Gemfile +0 -1
  16. data/examples/rack/Gemfile.lock +0 -4
  17. data/lib/opal/cli.rb +1 -0
  18. data/lib/opal/cli_options.rb +4 -0
  19. data/lib/opal/cli_runners/nodejs.rb +4 -0
  20. data/lib/opal/cli_runners/source-map-support-browser.js +3 -1
  21. data/lib/opal/cli_runners/source-map-support-node.js +3 -1
  22. data/lib/opal/cli_runners/source-map-support.js +3 -1
  23. data/lib/opal/compiler.rb +2 -2
  24. data/lib/opal/nodes/args/arity_check.rb +1 -0
  25. data/lib/opal/nodes/args/parameters.rb +6 -0
  26. data/lib/opal/nodes/class.rb +1 -13
  27. data/lib/opal/nodes/literal.rb +14 -7
  28. data/lib/opal/nodes/module.rb +13 -9
  29. data/lib/opal/nodes/variables.rb +13 -4
  30. data/lib/opal/nodes/while.rb +54 -17
  31. data/lib/opal/parser.rb +1 -5
  32. data/lib/opal/parser/patch.rb +34 -0
  33. data/lib/opal/repl.rb +7 -0
  34. data/lib/opal/rewriter.rb +2 -0
  35. data/lib/opal/rewriters/arguments.rb +4 -1
  36. data/lib/opal/rewriters/forward_args.rb +54 -0
  37. data/lib/opal/rewriters/logical_operator_assignment.rb +5 -2
  38. data/lib/opal/rewriters/opal_engine_check.rb +5 -7
  39. data/lib/opal/version.rb +1 -1
  40. data/opal/corelib/array.rb +42 -20
  41. data/opal/corelib/array/pack.rb +6 -1
  42. data/opal/corelib/complex.rb +2 -0
  43. data/opal/corelib/constants.rb +3 -3
  44. data/opal/corelib/hash.rb +36 -38
  45. data/opal/corelib/module.rb +2 -7
  46. data/opal/corelib/number.rb +2 -180
  47. data/opal/corelib/numeric.rb +156 -0
  48. data/opal/corelib/object_space.rb +102 -0
  49. data/opal/corelib/random.rb +31 -66
  50. data/opal/corelib/random/formatter.rb +122 -0
  51. data/opal/corelib/range.rb +50 -19
  52. data/opal/corelib/runtime.js +82 -21
  53. data/opal/corelib/string.rb +86 -52
  54. data/opal/corelib/string/encoding.rb +140 -25
  55. data/opal/corelib/string/unpack.rb +26 -40
  56. data/opal/opal.rb +1 -0
  57. data/opal/opal/full.rb +1 -0
  58. data/spec/filters/bugs/array.rb +0 -22
  59. data/spec/filters/bugs/basicobject.rb +3 -0
  60. data/spec/filters/bugs/encoding.rb +0 -2
  61. data/spec/filters/bugs/exception.rb +1 -0
  62. data/spec/filters/bugs/float.rb +0 -2
  63. data/spec/filters/bugs/hash.rb +2 -7
  64. data/spec/filters/bugs/integer.rb +0 -2
  65. data/spec/filters/bugs/kernel.rb +16 -3
  66. data/spec/filters/bugs/language.rb +6 -14
  67. data/spec/filters/bugs/marshal.rb +1 -3
  68. data/spec/filters/bugs/module.rb +16 -1
  69. data/spec/filters/bugs/numeric.rb +4 -12
  70. data/spec/filters/bugs/objectspace.rb +67 -0
  71. data/spec/filters/bugs/pack_unpack.rb +0 -9
  72. data/spec/filters/bugs/pathname.rb +1 -0
  73. data/spec/filters/bugs/proc.rb +8 -0
  74. data/spec/filters/bugs/random.rb +3 -6
  75. data/spec/filters/bugs/range.rb +83 -113
  76. data/spec/filters/bugs/set.rb +2 -0
  77. data/spec/filters/bugs/string.rb +31 -70
  78. data/spec/filters/bugs/struct.rb +2 -0
  79. data/spec/filters/bugs/time.rb +8 -2
  80. data/spec/filters/unsupported/float.rb +3 -0
  81. data/spec/filters/unsupported/freeze.rb +1 -0
  82. data/spec/filters/unsupported/integer.rb +3 -0
  83. data/spec/filters/unsupported/refinements.rb +5 -0
  84. data/spec/filters/unsupported/string.rb +100 -95
  85. data/spec/filters/unsupported/time.rb +4 -0
  86. data/spec/lib/compiler_spec.rb +16 -0
  87. data/spec/lib/rewriters/forward_args_spec.rb +61 -0
  88. data/spec/lib/rewriters/logical_operator_assignment_spec.rb +1 -1
  89. data/spec/lib/rewriters/numblocks_spec.rb +44 -0
  90. data/spec/lib/rewriters/opal_engine_check_spec.rb +49 -4
  91. data/spec/opal/core/language/forward_args_spec.rb +53 -0
  92. data/spec/opal/core/language/infinite_range_spec.rb +13 -0
  93. data/spec/opal/core/language/memoization_spec.rb +16 -0
  94. data/spec/opal/core/module_spec.rb +38 -2
  95. data/spec/opal/core/number/to_i_spec.rb +28 -0
  96. data/spec/opal/core/runtime/bridged_classes_spec.rb +16 -0
  97. data/spec/opal/core/runtime/constants_spec.rb +20 -1
  98. data/spec/opal/core/string/subclassing_spec.rb +16 -0
  99. data/spec/opal/core/string/unpack_spec.rb +22 -0
  100. data/spec/opal/core/string_spec.rb +4 -4
  101. data/spec/ruby_specs +4 -1
  102. data/stdlib/json.rb +3 -1
  103. data/stdlib/securerandom.rb +55 -35
  104. data/tasks/testing.rake +6 -3
  105. data/test/nodejs/test_string.rb +25 -0
  106. data/vendored-minitest/minitest/assertions.rb +2 -0
  107. metadata +31 -10
  108. data/lib/opal/parser/with_c_lexer.rb +0 -15
@@ -9,4 +9,7 @@ opal_filter "BasicObject" do
9
9
  fails "BasicObject#instance_exec binds the block's binding self to the receiver"
10
10
  fails "BasicObject#instance_exec raises a LocalJumpError unless given a block"
11
11
  fails "BasicObject#method_missing for an instance sets the receiver of the raised NoMethodError"
12
+ fails "BasicObject#singleton_method_added when singleton_method_added is undefined calls #method_missing" # Expected [] == [["singleton_method_added", "foo"], ["singleton_method_added", "bar"], ["singleton_method_added", "baz"]] to be truthy but was false
13
+ fails "BasicObject#singleton_method_added when singleton_method_added is undefined raises NoMethodError for a metaclass" # Expected NoMethodError (/undefined method `singleton_method_added' for/) but no exception was raised ("foo" was returned)
14
+ fails "BasicObject#singleton_method_added when singleton_method_added is undefined raises NoMethodError for a singleton instance" # Expected NoMethodError (/undefined method `singleton_method_added' for #<Object:/) but no exception was raised ("foo" was returned)
12
15
  end
@@ -103,8 +103,6 @@ opal_filter "Encoding" do
103
103
  fails "String#[]= with a Regexp index replaces multibyte characters with characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
104
104
  fails "String#[]= with a Regexp index replaces multibyte characters with multibyte characters" # NoMethodError: undefined method `[]=' for "ありがとう":String
105
105
  fails "String#ascii_only? returns false after appending non ASCII characters to an empty String" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
106
- fails "String#ascii_only? returns false for a non-empty String with non-ASCII-compatible encoding" # Expected true to be false
107
- fails "String#ascii_only? returns false for the empty String with a non-ASCII-compatible encoding" # Expected true to be false
108
106
  fails "String#ascii_only? returns false when concatenating an ASCII and non-ASCII String" # NoMethodError: undefined method `concat' for "":String
109
107
  fails "String#ascii_only? returns false when replacing an ASCII String with a non-ASCII String" # NoMethodError: undefined method `replace' for "":String
110
108
  fails "String#ascii_only? with non-ASCII only characters returns false if the encoding is ASCII-8BIT" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
@@ -53,6 +53,7 @@ opal_filter "Exception" do
53
53
  fails "Exception#to_s calls #to_s on the message" # Mock 'message' expected to receive 'to_s' exactly 1 times but received it 2 times
54
54
  fails "IOError is a superclass of EOFError"
55
55
  fails "Interrupt is a subclass of SignalException" # Expected Exception to equal SignalException
56
+ fails "Interrupt is raised on the main Thread by the default SIGINT handler" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2316>
56
57
  fails "Interrupt.new returns an instance of interrupt with no message given" # NoMethodError: undefined method `signo' for #<Interrupt: Interrupt>:Interrupt
57
58
  fails "Interrupt.new takes an optional message argument" # NoMethodError: undefined method `signo' for #<Interrupt: message>:Interrupt
58
59
  fails "KeyError accepts :receiver and :key options" # ArgumentError: no receiver is available
@@ -51,8 +51,6 @@ opal_filter "Float" do
51
51
  fails "Float#round rounds self to an optionally given precision with a half option" # ArgumentError: [Number#round] wrong number of arguments(2 for -1)
52
52
  fails "Float#round when 0.0 is given returns 0 for 0 or undefined ndigits" # TypeError: no implicit conversion of Hash into Integer
53
53
  fails "Float#round when 0.0 is given returns self for positive ndigits" # Expected "0" == "0.0" to be truthy but was false
54
- fails "Float#to_i returns self truncated to an Integer"
55
- fails "Float#to_int returns self truncated to an Integer"
56
54
  fails "Float#to_s encoding returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
57
55
  fails "Float#to_s encoding returns a String in US-ASCII encoding when Encoding.default_internal is not nil" # NoMethodError: undefined method `default_internal' for Encoding
58
56
  fails "Float#to_s matches random examples in all ranges" # Expected "4.9247416523566613e-8" to equal "4.9247416523566613e-08"
@@ -29,10 +29,7 @@ opal_filter "Hash" do
29
29
  fails "Hash#inspect does not call #to_str on the object returned from #inspect when it is not a String" # Expected "{\"a\"=>#<MockObject:0x30638>}" to match /^\{:a=>#<MockObject:0x[0-9a-f]+>\}$/
30
30
  fails "Hash#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
31
31
  fails "Hash#invert compares new keys with eql? semantics" # spec relies on integer and float being different
32
- fails "Hash#merge accepts multiple hashes" # ArgumentError: [Hash#merge] wrong number of arguments(3 for 1)
33
- fails "Hash#merge accepts zero arguments and returns a copy of self" # ArgumentError: [Hash#merge] wrong number of arguments(0 for 1)
34
- fails "Hash#merge! accepts multiple hashes" # ArgumentError: [Hash#merge!] wrong number of arguments(3 for 1)
35
- fails "Hash#merge! accepts zero arguments" # ArgumentError: [Hash#merge!] wrong number of arguments(0 for 1)
32
+ fails "Hash#rehash removes duplicate keys for large hashes" # Expected 102 == 101 to be truthy but was false
36
33
  fails "Hash#rehash removes duplicate keys" # Expected 2 to equal 1
37
34
  fails "Hash#shift allows shifting entries while iterating" # Exception: Cannot read property '$$is_string' of undefined
38
35
  fails "Hash#store does not dispatch to hash for Boolean, Integer, Float, String, or Symbol" # NoMethodError: undefined method `insert' for "rubyexe.rb"
@@ -47,9 +44,7 @@ opal_filter "Hash" do
47
44
  fails "Hash#to_s does not call #to_str on the object returned from #inspect when it is not a String" # Expected "{\"a\"=>#<MockObject:0x1b948>}" to match /^\{:a=>#<MockObject:0x[0-9a-f]+>\}$/
48
45
  fails "Hash#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
49
46
  fails "Hash#transform_keys! prevents conflicts between new keys and old ones" # Expected {"e"=>1} to equal {"b"=>1, "c"=>2, "d"=>3, "e"=>4}
50
- fails "Hash#transform_keys! returns the processed keys if we broke from the block" # Expected {"c"=>1, "d"=>4} to equal {"b"=>1, "c"=>2}
51
- fails "Hash#update accepts multiple hashes" # ArgumentError: [Hash#merge!] wrong number of arguments(3 for 1)
52
- fails "Hash#update accepts zero arguments" # ArgumentError: [Hash#merge!] wrong number of arguments(0 for 1)
47
+ fails "Hash#transform_keys! returns the processed keys and non evaluated keys if we broke from the block" # Expected {"c"=>1, "d"=>4} == {"b"=>1, "c"=>2, "d"=>4} to be truthy but was false
53
48
  fails "Hash.[] raises for elements that are not arrays" # Expected ArgumentError but no exception was raised (nil was returned)
54
49
  fails "Hash.ruby2_keywords_hash raises TypeError for non-Hash" # Expected TypeError but got: NoMethodError (undefined method `ruby2_keywords_hash' for Hash)
55
50
  fails "Hash.ruby2_keywords_hash returns a copy of a Hash and marks the copy as a keywords Hash" # NoMethodError: undefined method `ruby2_keywords_hash' for Hash
@@ -46,8 +46,6 @@ opal_filter "Integer" do
46
46
  fails "Integer#chr without argument raises a RangeError is self is less than 0"
47
47
  fails "Integer#chr without argument returns a new String for each call"
48
48
  fails "Integer#chr without argument when Encoding.default_internal is nil and self is between 0 and 127 (inclusive) returns a US-ASCII String"
49
- fails "Integer#chr without argument when Encoding.default_internal is nil and self is between 128 and 255 (inclusive) returns a String containing self interpreted as a byte"
50
- fails "Integer#chr without argument when Encoding.default_internal is nil and self is between 128 and 255 (inclusive) returns a binary String" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
51
49
  fails "Integer#chr without argument when Encoding.default_internal is nil and self is between 128 and 255 (inclusive) returns an ASCII-8BIT String"
52
50
  fails "Integer#chr without argument when Encoding.default_internal is nil raises a RangeError is self is greater than 255"
53
51
  fails "Integer#chr without argument when Encoding.default_internal is not nil and self is between 0 and 127 (inclusive) returns a String encoding self interpreted as a US-ASCII codepoint"
@@ -59,6 +59,7 @@ opal_filter "Kernel" do
59
59
  fails "Kernel#caller returns an Array of caller locations using a range" # NoMethodError: undefined method `+' for 1..1
60
60
  fails "Kernel#caller returns an Array with the block given to #at_exit at the base of the stack" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0xe208>
61
61
  fails "Kernel#caller returns the locations as String instances" # Expected "corelib/runtime.js:1675" to include "ruby/core/kernel/caller_spec.rb:32:in"
62
+ fails "Kernel#caller works with beginless ranges" # TypeError: no implicit conversion of NilClass into Integer
62
63
  fails "Kernel#caller works with endless ranges" # Opal::SyntaxError: undefined method `type' for nil
63
64
  fails "Kernel#class returns the class of the object"
64
65
  fails "Kernel#clone copies frozen?" # Expected false to be true
@@ -99,7 +100,6 @@ opal_filter "Kernel" do
99
100
  fails "Kernel#eval with a magic encoding comment ignores the frozen_string_literal magic comment if it appears after a token and warns if $VERBOSE is true" # Expected warning to match: /warning: `frozen_string_literal' is ignored after any tokens/ but got: ""
100
101
  fails "Kernel#eval with a magic encoding comment ignores the magic encoding comment if it is after a frozen_string_literal magic comment" # Opal::SyntaxError: unexpected token $end
101
102
  fails "Kernel#eval with a magic encoding comment uses the magic comment encoding for parsing constants" # Opal::SyntaxError: unexpected token $end
102
- fails "Kernel#eval with a magic encoding comment uses the magic comment encoding for the encoding of literal strings" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:UTF-8>
103
103
  fails "Kernel#extend does not calls append_features on arguments metaclass"
104
104
  fails "Kernel#extend raises an ArgumentError when no arguments given"
105
105
  fails "Kernel#fail accepts an Object with an exception method returning an Exception" # TypeError: exception class/object expected
@@ -108,17 +108,18 @@ opal_filter "Kernel" do
108
108
  fails "Kernel#initialize_copy raises FrozenError if the receiver is frozen" # Expected FrozenError but no exception was raised (nil was returned)
109
109
  fails "Kernel#initialize_copy raises TypeError if the objects are of different class" # Expected TypeError (initialize_copy should take same class object) but no exception was raised (nil was returned)
110
110
  fails "Kernel#inspect does not call #to_s if it is defined"
111
+ fails "Kernel#inspect returns a String for an object without #class method" # Exception: Maximum call stack size exceeded
111
112
  fails "Kernel#instance_variables immediate values returns the correct array if an instance variable is added"
112
113
  fails "Kernel#is_a? does not take into account `class` method overriding" # TypeError: can't define singleton
113
- fails "Kernel#is_a? returns true if given a Module that object has been extended with" # Requires string mutability
114
114
  fails "Kernel#kind_of? does not take into account `class` method overriding" # TypeError: can't define singleton
115
- fails "Kernel#kind_of? returns true if given a Module that object has been extended with" # Requires string mutability
116
115
  fails "Kernel#local_variables contains locals as they are added"
117
116
  fails "Kernel#local_variables includes only unique variable names" # NoMethodError: undefined method `local_variables' for #<MSpecEnv:0x476>
118
117
  fails "Kernel#local_variables is accessible from bindings"
119
118
  fails "Kernel#local_variables is accessible in eval"
120
119
  fails "Kernel#method can be called even if we only repond_to_missing? method, true"
120
+ fails "Kernel#method returns a method object if respond_to_missing?(method) is true" # NameError: undefined method `handled_publicly' for class `KernelSpecs::RespondViaMissing'
121
121
  fails "Kernel#method returns a method object if we repond_to_missing? method"
122
+ fails "Kernel#method the returned method object if respond_to_missing?(method) calls #method_missing with a Symbol name" # NameError: undefined method `handled_publicly' for class `KernelSpecs::RespondViaMissing'
122
123
  fails "Kernel#method will see an alias of the original method as == when in a derived class"
123
124
  fails "Kernel#methods does not return private singleton methods defined in 'class << self'"
124
125
  fails "Kernel#object_id returns a different value for two Bignum literals"
@@ -131,14 +132,21 @@ opal_filter "Kernel" do
131
132
  fails "Kernel#public_method raises a NameError if we only repond_to_missing? method, true"
132
133
  fails "Kernel#public_method returns a method object for a valid method"
133
134
  fails "Kernel#public_method returns a method object for a valid singleton method"
135
+ fails "Kernel#public_method returns a method object if respond_to_missing?(method) is true" # Expected "Done public_method(handled_publicly)" (String) to be an instance of Method
134
136
  fails "Kernel#public_method returns a method object if we repond_to_missing? method"
137
+ fails "Kernel#public_method the returned method object if respond_to_missing?(method) calls #method_missing with a Symbol name" # Expected "Done public_method(handled_publicly)" (String) to be an instance of Method
135
138
  fails "Kernel#public_methods returns a list of names without protected accessible methods in the object"
136
139
  fails "Kernel#public_methods when passed false returns a list of public methods in without its ancestors"
137
140
  fails "Kernel#public_methods when passed nil returns a list of public methods in without its ancestors"
141
+ fails "Kernel#public_send includes `public_send` in the backtrace when passed a single incorrect argument" # Expected TypeError but got: NoMethodError (undefined method `#<Object:0x3da7a>' for #<MSpecEnv:0x3d9f4>)
142
+ fails "Kernel#public_send includes `public_send` in the backtrace when passed not enough arguments" # Expected "ArgumentError: [MSpecEnv#__send__] wrong number of arguments(0 for -2)".include? "`public_send'" to be truthy but was false
138
143
  fails "Kernel#public_send raises a TypeError if the method name is not a string or symbol" # NoMethodError: undefined method `' for SendSpecs
139
144
  fails "Kernel#puts delegates to $stdout.puts"
145
+ fails "Kernel#raise accepts a cause keyword argument that overrides the last exception" # NoMethodError: undefined method `cause' for #<RuntimeError: error>
146
+ fails "Kernel#raise accepts a cause keyword argument that sets the cause" # NoMethodError: undefined method `cause' for #<RuntimeError: error>
140
147
  fails "Kernel#raise passes no arguments to the constructor when given only an exception class" # Expected #<Class:0x4c8> but got: ArgumentError ([#initialize] wrong number of arguments(1 for 0))
141
148
  fails "Kernel#raise raises RuntimeError if no exception class is given" # RuntimeError: RuntimeError
149
+ fails "Kernel#raise raises an ArgumentError when only cause is given" # Expected ArgumentError but got: TypeError (exception class/object expected)
142
150
  fails "Kernel#raise re-raises a previously rescued exception without overwriting the backtrace" # Expected "RuntimeError: raised" to include "ruby/shared/kernel/raise.rb:65:"
143
151
  fails "Kernel#respond_to? throws a type error if argument can't be coerced into a Symbol"
144
152
  fails "Kernel#respond_to_missing? causes #respond_to? to return false if called and returning nil"
@@ -211,6 +219,7 @@ opal_filter "Kernel" do
211
219
  fails "Kernel#singleton_methods when passed true returns the names of singleton methods for an object extented with a module"
212
220
  fails "Kernel#singleton_methods when passed true returns the names of singleton methods for an object extented with two modules"
213
221
  fails "Kernel#singleton_methods when passed true returns the names of singleton methods for an object"
222
+ fails "Kernel#sleep accepts any Object that reponds to divmod" # TypeError: can't convert Object into time interval
214
223
  fails "Kernel#sprintf can produce a string with invalid encoding" # Expected true to be false
215
224
  fails "Kernel#sprintf flags # applies to format o does nothing for negative argument" # Expected "0..7651" to equal "..7651"
216
225
  fails "Kernel#sprintf flags # applies to formats aAeEfgG changes format from dd.dddd to exponential form for gG" # Expected "1.234e+02" to equal "1.e+02"
@@ -245,6 +254,7 @@ opal_filter "Kernel" do
245
254
  fails "Kernel#sprintf integer formats i works well with large numbers" # Expected "1234567890987654400" to equal "1234567890987654321"
246
255
  fails "Kernel#sprintf integer formats u works well with large numbers" # Expected "1234567890987654400" to equal "1234567890987654321"
247
256
  fails "Kernel#sprintf other formats % alone raises an ArgumentError" # Expected ArgumentError but no exception was raised ("%" was returned)
257
+ fails "Kernel#sprintf other formats s preserves encoding of the format string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
248
258
  fails "Kernel#sprintf precision float types controls the number of decimal places displayed in fraction part" # NotImplementedError: `A` and `a` format field types are not implemented in Opal yet
249
259
  fails "Kernel#sprintf precision float types does not affect G format" # Expected "12.12340000" to equal "12.1234"
250
260
  fails "Kernel#sprintf precision string formats determines the maximum number of characters to be copied from the string" # Expected "1" to equal "["
@@ -353,6 +363,8 @@ opal_filter "Kernel" do
353
363
  fails "Kernel.lambda returns the passed Proc if given an existing Proc" # Expected true to be false
354
364
  fails "Kernel.loop returns StopIteration#result, the result value of a finished iterator" # requires changes in enumerator.rb
355
365
  fails "Kernel.printf calls write on the first argument when it is not a string"
366
+ fails "Kernel.printf formatting io is not specified other formats s preserves encoding of the format string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
367
+ fails "Kernel.printf formatting io is specified other formats s preserves encoding of the format string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
356
368
  fails "Kernel.printf writes to stdout when a string is the first argument"
357
369
  fails "Kernel.proc returned the passed Proc if given an existing Proc" # Expected false to be true
358
370
  fails "Kernel.rand is random on boot" # NoMethodError: undefined method `insert' for "rubyexe.rb"
@@ -391,6 +403,7 @@ opal_filter "Kernel" do
391
403
  fails "Kernel.sprintf integer formats i works well with large numbers" # Expected "1234567890987654400" to equal "1234567890987654321"
392
404
  fails "Kernel.sprintf integer formats u works well with large numbers" # Expected "1234567890987654400" to equal "1234567890987654321"
393
405
  fails "Kernel.sprintf other formats % alone raises an ArgumentError" # Expected ArgumentError but no exception was raised ("%" was returned)
406
+ fails "Kernel.sprintf other formats s preserves encoding of the format string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
394
407
  fails "Kernel.sprintf precision float types controls the number of decimal places displayed in fraction part" # NotImplementedError: `A` and `a` format field types are not implemented in Opal yet
395
408
  fails "Kernel.sprintf precision float types does not affect G format" # Expected "12.12340000" to equal "12.1234"
396
409
  fails "Kernel.sprintf precision string formats determines the maximum number of characters to be copied from the string" # Expected "1" to equal "["
@@ -59,6 +59,7 @@ opal_filter "language" do
59
59
  fails "A method assigns local variables from method parameters for definition 'def m(a=1, b: 2) [a, b] end'"
60
60
  fails "A method assigns local variables from method parameters for definition 'def m(a=1, b:) [a, b] end'"
61
61
  fails "A method assigns local variables from method parameters for definition \n def m(a, b = nil, c = nil, d, e: nil, **f)\n [a, b, c, d, e, f]\n end" # Exception: Cannot read property '$$is_array' of undefined
62
+ fails "A method assigns the last Hash to the last optional argument if the Hash contains non-Symbol keys and is not passed as keywords" # Exception: Object.defineProperty called on non-object
62
63
  fails "A method definition in an eval creates a class method"
63
64
  fails "A method definition in an eval creates a singleton method"
64
65
  fails "A method definition in an eval creates an instance method"
@@ -82,6 +83,7 @@ opal_filter "language" do
82
83
  fails "Allowed characters does not allow non-ASCII upcased characters at the beginning" # Expected SyntaxError (/dynamic constant assignment/) but no exception was raised ("test" was returned)
83
84
  fails "An ensure block inside 'do end' block is executed even when a symbol is thrown in it's corresponding begin block" # Expected ["begin", "rescue", "ensure"] to equal ["begin", "ensure"]
84
85
  fails "An ensure block inside a begin block is executed even when a symbol is thrown in it's corresponding begin block"
86
+ fails "An ensure block inside a begin block sets exception cause if raises exception in block and in ensure" # NoMethodError: undefined method `cause' for #<RuntimeError: from ensure>
85
87
  fails "An ensure block inside a class is executed even when a symbol is thrown" # Expected ["class", "rescue", "ensure"] to equal ["class", "ensure"]
86
88
  fails "An instance method definition with a splat requires the presence of any arguments that precede the *" # ArgumentError: [MSpecEnv#foo] wrong number of arguments(1 for -3)
87
89
  fails "An instance method raises FrozenError with the correct class name" # Expected FrozenError but no exception was raised (#<Module:0x225b4> was returned)
@@ -92,8 +94,6 @@ opal_filter "language" do
92
94
  fails "An instance method with a default argument shadows an existing method with the same name as the local"
93
95
  fails "An instance method with a default argument warns and uses a nil value when there is an existing local method with same name" # Expected warning to match: /circular argument reference/ but got: ""
94
96
  fails "Assigning an anonymous module to a constant sets the name of a module scoped by an anonymous module" # NoMethodError: undefined method `end_with?' for nil
95
- fails "Constant resolution within methods with dynamically assigned constants searches Object as a lexical scope only if Object is explicitly opened"
96
- fails "Constant resolution within methods with statically assigned constants searches Object as a lexical scope only if Object is explicitly opened"
97
97
  fails "Executing break from within a block raises LocalJumpError when converted into a proc during a a super call" # Expected LocalJumpError but no exception was raised (1 was returned)
98
98
  fails "Executing break from within a block returns from the original invoking method even in case of chained calls"
99
99
  fails "Executing break from within a block works when passing through a super call" # Expected to not get Exception
@@ -114,6 +114,7 @@ opal_filter "language" do
114
114
  fails "Global variable $FILENAME is read-only"
115
115
  fails "Global variable $VERBOSE converts truthy values to true" # Expected 1 to be true
116
116
  fails "Global variable $\" is read-only"
117
+ fails "Hash literal checks duplicated keys on initialization" # Expected warning to match: /key 1000 is duplicated|duplicated key/ but got: ""
117
118
  fails "Hash literal expands a BasicObject using ** into the containing Hash literal initialization" # NoMethodError: undefined method `respond_to?' for BasicObject
118
119
  fails "Heredoc string allow HEREDOC with <<\"identifier\", interpolated" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
119
120
  fails "Heredoc string allows HEREDOC with <<'identifier', no interpolation" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
@@ -128,8 +129,6 @@ opal_filter "language" do
128
129
  fails "Literal (A::X) constant resolution uses the module or class #inspect to craft the error message if they are anonymous" # Expected NameError (/uninitialized constant <unusable info>::DOES_NOT_EXIST/) but got: NameError (uninitialized constant #<Module:0x50c0>::DOES_NOT_EXIST)
129
130
  fails "Literal (A::X) constant resolution uses the module or class #name to craft the error message" # Expected NameError (/uninitialized constant ModuleName::DOES_NOT_EXIST/) but got: NameError (uninitialized constant #<Module:0x50ba>::DOES_NOT_EXIST)
130
131
  fails "Literal (A::X) constant resolution with dynamically assigned constants evaluates the right hand side before evaluating a constant path"
131
- fails "Literal Ranges creates beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
132
- fails "Literal Ranges creates endless ranges" # Opal::SyntaxError: undefined method `type' for nil
133
132
  fails "Literal Regexps caches the Regexp object"
134
133
  fails "Literal Regexps raises a RegexpError for lookbehind with specific characters" # Expected RegexpError but no exception was raised (0 was returned)
135
134
  fails "Literal Regexps support handling unicode 9.0 characters with POSIX bracket expressions" # Expected "" to equal "𐓘"
@@ -204,6 +203,8 @@ opal_filter "language" do
204
203
  fails "NoMethodError#message fallbacks to a simpler representation of the receiver when receiver.inspect raises an exception" # NoMethodError: undefined method `name' for #<NoMethodErrorSpecs::InstanceException: NoMethodErrorSpecs::InstanceException>
205
204
  fails "Numbered parameters does not support more than 9 parameters" # Expected NameError (/undefined local variable or method `_10'/) but got: NoMethodError (undefined method `_10' for #<MSpecEnv:0x5d700>)
206
205
  fails "Operators * / % are left-associative"
206
+ fails "Optional constant assignment with ||= causes side-effects of the module part to be applied (for nil constant)" # Expected 3 == 1 to be truthy but was false
207
+ fails "Optional constant assignment with ||= causes side-effects of the module part to be applied only once (for undefined constant)" # Expected 2 == 1 to be truthy but was false
207
208
  fails "Optional variable assignments using compounded constants with &&= assignments" # Expected warning to match: /already initialized constant/ but got: ""
208
209
  fails "Optional variable assignments using compounded constants with operator assignments" # Expected warning to match: /already initialized constant/ but got: ""
209
210
  fails "Optional variable assignments using compunded constants with ||= assignments"
@@ -394,6 +395,7 @@ opal_filter "language" do
394
395
  fails "The rescue keyword only accepts Module or Class in rescue clauses" # RuntimeError: error
395
396
  fails "The rescue keyword only accepts Module or Class in splatted rescue clauses" # RuntimeError: error
396
397
  fails "The rescue keyword rescues the exception in the deepest rescue block declared to handle the appropriate exception type" # Expected "StandardError: an error occurred" to include ":in `raise_standard_error'"
398
+ fails "The rescue keyword suppresses exception from block when raises one from rescue expression" # NoMethodError: undefined method `cause' for #<RuntimeError: from rescue expression>
397
399
  fails "The rescue keyword will execute an else block even without rescue and ensure" # Expected warning to match: /else without rescue is useless/ but got: ""
398
400
  fails "The rescue keyword without rescue expression will not rescue exceptions except StandardError" # NameError: uninitialized constant SystemStackError
399
401
  fails "The retry keyword inside a begin block's rescue block causes the begin block to be executed again"
@@ -422,23 +424,13 @@ opal_filter "language" do
422
424
  fails "The unpacking splat operator (*) when applied to a BasicObject coerces it to Array if it respond_to?(:to_a)" # NoMethodError: undefined method `respond_to?' for BasicObject
423
425
  fails "The until expression restarts the current iteration without reevaluating condition with redo"
424
426
  fails "The until modifier restarts the current iteration without reevaluating condition with redo"
425
- fails "The until modifier with begin .. end block evaluates condition after block execution"
426
427
  fails "The until modifier with begin .. end block restart the current iteration without reevaluating condition with redo" # Expected [1] to equal [0, 0, 0, 1, 2]
427
- fails "The until modifier with begin .. end block runs block at least once (even if the expression is true)"
428
- fails "The until modifier with begin .. end block skips to end of body with next"
429
428
  fails "The while expression stops running body if interrupted by break in a begin ... end element op-assign value"
430
429
  fails "The while expression stops running body if interrupted by break in a parenthesized element op-assign value"
431
- fails "The while modifier with begin .. end block evaluates condition after block execution"
432
- fails "The while modifier with begin .. end block restarts the current iteration without reevaluating condition with redo" # Expected [1, 1, 1, 2] to equal [0, 0, 0, 1, 2]
433
- fails "The while modifier with begin .. end block runs block at least once (even if the expression is false)"
434
- fails "The while modifier with begin .. end block skips to end of body with next"
435
430
  fails "The yield call taking a single argument yielding to a lambda should not destructure an Array into multiple arguments" # Expected ArgumentError but no exception was raised ([1, 2] was returned)
436
431
  fails "The yield call taking no arguments ignores assignment to the explicit block argument and calls the passed block"
437
432
  fails "a method definition that sets more than one default parameter all to the same value only allows overriding the default value of the first such parameter in each set" # ArgumentError: [MSpecEnv#foo] wrong number of arguments(2 for -1)
438
433
  fails "a method definition that sets more than one default parameter all to the same value treats the argument after the multi-parameter normally" # ArgumentError: [MSpecEnv#bar] wrong number of arguments(3 for -1)
439
- fails "delegation with def(...) delegates block" # Opal::SyntaxError: Unsupported sexp: forward_args
440
- fails "delegation with def(...) delegates rest and kwargs" # Opal::SyntaxError: Unsupported sexp: forward_args
441
- fails "delegation with def(...) parses as open endless Range when brackets are omitted" # Opal::SyntaxError: Unsupported sexp: forward_args
442
434
  fails "self in a metaclass body (class << obj) raises a TypeError for numbers"
443
435
  fails "self in a metaclass body (class << obj) raises a TypeError for symbols"
444
436
  fails "self.send(:block_given?) returns false when a method defined by define_method is called with a block"
@@ -21,6 +21,7 @@ opal_filter "Marshal" do
21
21
  fails "Marshal.load for a Regexp loads a extended_user_regexp having ivar"
22
22
  fails "Marshal.load for a Regexp loads an extended Regexp" # Expected /[a-z]/ == /(?:)/ to be truthy but was false
23
23
  fails "Marshal.load for a String loads a String as BINARY if no encoding is specified at the end" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
24
+ fails "Marshal.load for a String loads a String subclass with custom constructor" # ArgumentError: [UserCustomConstructorString#initialize] wrong number of arguments(1 for 2)
24
25
  fails "Marshal.load for a Struct does not call initialize on the unmarshaled struct"
25
26
  fails "Marshal.load for a Symbol loads a Symbol" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
26
27
  fails "Marshal.load for a Symbol loads a binary encoded Symbol" # Expected "â\u0086\u0092" to equal "→"
@@ -34,11 +35,8 @@ opal_filter "Marshal" do
34
35
  fails "Marshal.load for an Exception loads a marshalled exception with a message"
35
36
  fails "Marshal.load for an Exception loads a marshalled exception with no message"
36
37
  fails "Marshal.load for an Exception loads an marshalled exception with ivars" # Expected "Exception" == "foo" to be truthy but was false
37
- fails "Marshal.load for an Integer loads an Integer -2361183241434822606847" # Expected -2 == -2.3611832414348226e+21 to be truthy but was false
38
- fails "Marshal.load for an Integer loads an Integer 2361183241434822606847" # Expected 2 == 2.3611832414348226e+21 to be truthy but was false
39
38
  fails "Marshal.load for an Object loads an Object with a non-US-ASCII instance variable" # NameError: '@é' is not allowed as an instance variable name
40
39
  fails "Marshal.load for an Object raises ArgumentError if the object from an 'o' stream is not dumpable as 'o' type user class" # Expected ArgumentError but no exception was raised (#<File:0x3b160> was returned)
41
- fails "Marshal.load loads a Integer 2**90" # Expected 1 == 1.2379400392853803e+27 to be truthy but was false
42
40
  fails "Marshal.load loads a Regexp" # anchors difference
43
41
  fails "Marshal.load loads an array containing objects having _dump method, and with proc"
44
42
  fails "Marshal.load loads an array containing objects having marshal_dump method, and with proc"
@@ -16,6 +16,7 @@ opal_filter "Module" do
16
16
  fails "Module#attr_accessor converts non string/symbol/fixnum names to strings using to_str"
17
17
  fails "Module#attr_accessor not allows creating an attr_accessor on an immediate class"
18
18
  fails "Module#attr_accessor on immediates can read through the accessor" # NoMethodError: undefined method `foobar' for 1
19
+ fails "Module#attr_accessor raises FrozenError if the receiver if frozen" # Expected FrozenError but no exception was raised (42 was returned)
19
20
  fails "Module#attr_accessor raises a TypeError when the given names can't be converted to strings using to_str"
20
21
  fails "Module#attr_accessor returns an array of defined method names as symbols" # Expected nil == ["foo", "foo=", "bar", "bar="] to be truthy but was false
21
22
  fails "Module#attr_reader applies current visibility to methods created"
@@ -28,6 +29,7 @@ opal_filter "Module" do
28
29
  fails "Module#attr_writer converts non string/symbol names to strings using to_str" # Expected false == true to be truthy but was false
29
30
  fails "Module#attr_writer converts non string/symbol/fixnum names to strings using to_str"
30
31
  fails "Module#attr_writer not allows for adding an attr_writer to an immediate"
32
+ fails "Module#attr_writer raises FrozenError if the receiver if frozen" # Expected FrozenError but no exception was raised (42 was returned)
31
33
  fails "Module#attr_writer raises a TypeError when the given names can't be converted to strings using to_str"
32
34
  fails "Module#attr_writer returns an array of defined method names as symbols" # Expected nil == ["foo=", "bar="] to be truthy but was false
33
35
  fails "Module#autoload (concurrently) blocks a second thread while a first is doing the autoload"
@@ -78,11 +80,13 @@ opal_filter "Module" do
78
80
  fails "Module#class_eval resolves constants in the caller scope ignoring send"
79
81
  fails "Module#class_eval resolves constants in the caller scope" # fails because of the difference between module_eval("Const") and module_eval { Const } (only the second one is supported by Opal)
80
82
  fails "Module#class_eval uses the optional filename and lineno parameters for error messages"
83
+ fails "Module#const_defined? coerces the inherit flag to a boolean" # Expected true to be false
81
84
  fails "Module#const_defined? returns true for toplevel constant when the name begins with '::'"
82
85
  fails "Module#const_defined? returns true or false for the nested name"
83
86
  fails "Module#const_defined? returns true when passed a scoped constant name for a constant in the inheritance hierarchy and the inherited flag is default"
84
87
  fails "Module#const_defined? returns true when passed a scoped constant name for a constant in the inheritance hierarchy and the inherited flag is true"
85
88
  fails "Module#const_defined? returns true when passed a scoped constant name"
89
+ fails "Module#const_get coerces the inherit flag to a boolean" # Expected NameError but no exception was raised ("const1" was returned)
86
90
  fails "Module#const_get does autoload a constant with a toplevel scope qualifier" # NameError: uninitialized constant CSAutoloadB
87
91
  fails "Module#const_get does autoload a constant" # NameError: uninitialized constant CSAutoloadA
88
92
  fails "Module#const_get does autoload a module and resolve a constant within" # NameError: uninitialized constant CSAutoloadC
@@ -130,6 +134,7 @@ opal_filter "Module" do
130
134
  fails "Module#const_source_location with statically assigned constants searches location path the superclass chain" # NoMethodError: undefined method `__dir__' for #<MSpecEnv:0x6efae>
131
135
  fails "Module#constants doesn't returns inherited constants when passed nil"
132
136
  fails "Module#constants returns only public constants"
137
+ fails "Module#define_method passed { |a,| } creates a method that does not destructure the passed argument" # Expected [1, 2] == 1 to be truthy but was false
133
138
  fails "Module#define_method raises a TypeError when a Method from a singleton class is defined on another class"
134
139
  fails "Module#define_method raises a TypeError when a Method from one class is defined on an unrelated class"
135
140
  fails "Module#define_method raises a TypeError when an UnboundMethod from a child class is defined on a parent class"
@@ -180,6 +185,7 @@ opal_filter "Module" do
180
185
  fails "Module#prepend uses only new module when dupping the module" # Expected [#<Module:0x6c37a>] == [#<Module:0x6c38c>, #<Module:0x6c37a>] to be truthy but was false
181
186
  fails "Module#private with argument array as a single argument sets visibility of given method names" # Expected #<Module:0x7b0e0> to have private instance method 'test1' but it does not
182
187
  fails "Module#private with argument one or more arguments sets visibility of given method names" # Expected #<Module:0x2f186> to have private instance method 'test1' but it does not
188
+ fails "Module#private_constant marked constants in a module raises a NameError when accessed directly from modules that include the module" # Expected NameError but no exception was raised (true was returned)
183
189
  fails "Module#private_constant marked constants sends #const_missing to the original class or module" # Expected true == "Foo" to be truthy but was false
184
190
  fails "Module#private_method_defined? raises a TypeError if passed an Integer" # Expected TypeError but no exception was raised (false was returned)
185
191
  fails "Module#private_method_defined? when passed false as a second optional argument checks only the class itself" # ArgumentError: [Child.private_method_defined?] wrong number of arguments(2 for 1)
@@ -206,7 +212,9 @@ opal_filter "Module" do
206
212
  fails "Module#refine for methods accessed indirectly is honored by &" # NoMethodError: undefined method `refine' for #<Module:0x4b006>
207
213
  fails "Module#refine for methods accessed indirectly is honored by BasicObject#__send__" # NoMethodError: undefined method `refine' for #<Module:0x3aeb2>
208
214
  fails "Module#refine for methods accessed indirectly is honored by Kernel#binding" # NoMethodError: undefined method `refine' for #<Module:0x3aeaa>
215
+ fails "Module#refine for methods accessed indirectly is honored by Kernel#instance_method" # NoMethodError: undefined method `refine' for #<Module:0x3a6b2>
209
216
  fails "Module#refine for methods accessed indirectly is honored by Kernel#method" # NoMethodError: undefined method `refine' for #<Module:0x4b00a>
217
+ fails "Module#refine for methods accessed indirectly is honored by Kernel#public_method" # NoMethodError: undefined method `refine' for #<Module:0x3a6b6>
210
218
  fails "Module#refine for methods accessed indirectly is honored by Kernel#public_send" # NoMethodError: undefined method `refine' for #<Module:0x4b00e>
211
219
  fails "Module#refine for methods accessed indirectly is honored by Kernel#respond_to?" # NoMethodError: undefined method `refine' for #<Module:0x4b016>
212
220
  fails "Module#refine for methods accessed indirectly is honored by Kernel#send" # NoMethodError: undefined method `refine' for #<Module:0x3aeae>
@@ -248,6 +256,14 @@ opal_filter "Module" do
248
256
  fails "Module#remove_const calls #to_str to convert the given name to a String"
249
257
  fails "Module#remove_const raises a TypeError if conversion to a String by calling #to_str fails"
250
258
  fails "Module#remove_const returns nil when removing autoloaded constant"
259
+ fails "Module#ruby2_keywords acceps String as well" # NoMethodError: undefined method `ruby2_keywords' for #<Class:#<Object:0x40040>>
260
+ fails "Module#ruby2_keywords marks the final hash argument as keyword hash" # NoMethodError: undefined method `ruby2_keywords' for #<Class:#<Object:0x40036>>
261
+ fails "Module#ruby2_keywords prints warning when a method accepts keyword splat" # NoMethodError: undefined method `ruby2_keywords' for #<Class:#<Object:0x4001e>>
262
+ fails "Module#ruby2_keywords prints warning when a method accepts keywords" # NoMethodError: undefined method `ruby2_keywords' for #<Class:#<Object:0x40048>>
263
+ fails "Module#ruby2_keywords prints warning when a method does not accept argument splat" # NoMethodError: undefined method `ruby2_keywords' for #<Class:#<Object:0x4002e>>
264
+ fails "Module#ruby2_keywords raises NameError when passed not existing method name" # Expected NameError (/undefined method `not_existing'/) but got: NoMethodError (undefined method `ruby2_keywords' for #<Class:#<Object:0x4003a>>)
265
+ fails "Module#ruby2_keywords raises TypeError when passed not Symbol or String" # Expected TypeError (/is not a symbol nor a string/) but got: NoMethodError (undefined method `ruby2_keywords' for #<Class:#<Object:0x40026>>)
266
+ fails "Module#ruby2_keywords returns nil" # NoMethodError: undefined method `ruby2_keywords' for #<Class:#<Object:0x40044>>
251
267
  fails "Module#to_s always show the refinement name, even if the module is named" # NoMethodError: undefined method `refine' for ModuleSpecs::RefinementInspect
252
268
  fails "Module#to_s does not call #inspect or #to_s for singleton classes" # Expected "#<Class:#<:0x25bee>>" =~ /\A#<Class:#<#<Class:0x25bf2>:0x\h+>>\z/ to be truthy but was nil
253
269
  fails "Module#to_s for objects includes class name and object ID" # Expected "#<Class:#<ModuleSpecs::NamedClass:0xa424>>" =~ /^#<Class:#<ModuleSpecs::NamedClass:0x\h+>>$/ to be truthy but was nil
@@ -277,5 +293,4 @@ opal_filter "Module" do
277
293
  fails "Module#using scope of refinement is not active for code defined outside the current scope" # NoMethodError: undefined method `refine' for #<Module:0x2a072>
278
294
  fails "Module#using scope of refinement is not active when class/module reopens" # NoMethodError: undefined method `refine' for #<Module:0x2a056>
279
295
  fails "Module#using works in classes too" # NoMethodError: undefined method `refine' for #<Module:0x2a01c>
280
- fails "Module::Nesting returns the list of Modules nested at the point of call"
281
296
  end
@@ -9,18 +9,10 @@ opal_filter "Numeric" do
9
9
  fails "Numeric#remainder returns the result of calling self#% with other if self and other are less than 0"
10
10
  fails "Numeric#remainder returns the result of calling self#% with other if self is 0"
11
11
  fails "Numeric#singleton_method_added raises a TypeError when trying to define a singleton method on a Numeric"
12
- fails "Numeric#step with keyword arguments defaults to an infinite limit with a step size of 1 for Integers" # Expected [] to equal [1, 2, 3, 4, 5]
13
- fails "Numeric#step with keyword arguments defaults to an infinite limit with a step size of 1.0 for Floats" # Expected [] to equal [1, 2, 3, 4, 5]
14
- fails "Numeric#step with keyword arguments when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self < stop" # Expected #<Enumerator: 1:step({"to"=>2, "by"=>3})> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
15
- fails "Numeric#step with keyword arguments when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self > stop" # Expected #<Enumerator: 1:step({"to"=>0, "by"=>2})> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
16
- fails "Numeric#step with mixed arguments raises an ArgumentError when step is 0" # Expected ArgumentError but no exception was raised (nil was returned)
17
- fails "Numeric#step with mixed arguments defaults to an infinite limit with a step size of 1 for Integers" # Expected [] to equal [1, 2, 3, 4, 5]
18
- fails "Numeric#step with mixed arguments defaults to an infinite limit with a step size of 1.0 for Floats" # Expected [] to equal [1, 2, 3, 4, 5]
19
- fails "Numeric#step with mixed arguments raises an ArgumentError when step is 0.0" # Expected ArgumentError but no exception was raised (nil was returned)
20
- fails "Numeric#step with mixed arguments when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self < stop" # Expected #<Enumerator: 1:step(2, {"by"=>3})> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
21
- fails "Numeric#step with mixed arguments when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self > stop" # Expected #<Enumerator: 1:step(0, {"by"=>2})> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
22
- fails "Numeric#step with positional args defaults to an infinite limit with a step size of 1 for Integers" # Expected [] to equal [1, 2, 3, 4, 5]
23
- fails "Numeric#step with positional args defaults to an infinite limit with a step size of 1.0 for Floats" # Expected [] to equal [1, 2, 3, 4, 5]
12
+ fails "Numeric#step with keyword arguments when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self < stop" # Expected #<Enumerator: 1:step(2, 3)> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
13
+ fails "Numeric#step with keyword arguments when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self > stop" # Expected #<Enumerator: 1:step(0, 2)> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
14
+ fails "Numeric#step with mixed arguments when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self < stop" # Expected #<Enumerator: 1:step(2, 3)> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
15
+ fails "Numeric#step with mixed arguments when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self > stop" # Expected #<Enumerator: 1:step(0, 2)> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
24
16
  fails "Numeric#step with positional args when no block is given returned Enumerator::ArithmeticSequence type returns an instance of Enumerator::ArithmeticSequence" # Expected Enumerator == Enumerator::ArithmeticSequence to be truthy but was false
25
17
  fails "Numeric#step with positional args when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self < stop" # Expected #<Enumerator: 1:step(2, 3)> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
26
18
  fails "Numeric#step with positional args when no block is given returns an Enumerator::ArithmeticSequence when not passed a block and self > stop" # Expected #<Enumerator: 1:step(0, 2)> (Enumerator) to be an instance of Enumerator::ArithmeticSequence
@@ -0,0 +1,67 @@
1
+ # NOTE: run bin/format-filters after changing this file
2
+ opal_filter "ObjectSpace" do
3
+ fails "ObjectSpace._id2ref converts an object id to a reference to the object" # NoMethodError: undefined method `_id2ref' for ObjectSpace
4
+ fails "ObjectSpace._id2ref raises RangeError when an object could not be found" # Expected RangeError but got: NoMethodError (undefined method `_id2ref' for ObjectSpace)
5
+ fails "ObjectSpace._id2ref retrieves a String by object_id" # NoMethodError: undefined method `_id2ref' for ObjectSpace
6
+ fails "ObjectSpace._id2ref retrieves a Symbol by object_id" # NoMethodError: undefined method `_id2ref' for ObjectSpace
7
+ fails "ObjectSpace._id2ref retrieves a frozen literal String by object_id" # NoMethodError: undefined method `_id2ref' for ObjectSpace
8
+ fails "ObjectSpace._id2ref retrieves a large Integer by object_id" # NoMethodError: undefined method `_id2ref' for ObjectSpace
9
+ fails "ObjectSpace._id2ref retrieves a small Integer by object_id" # NoMethodError: undefined method `_id2ref' for ObjectSpace
10
+ fails "ObjectSpace._id2ref retrieves an Encoding by object_id" # NoMethodError: undefined method `_id2ref' for ObjectSpace
11
+ fails "ObjectSpace._id2ref retrieves false by object_id" # NoMethodError: undefined method `_id2ref' for ObjectSpace
12
+ fails "ObjectSpace._id2ref retrieves nil by object_id" # NoMethodError: undefined method `_id2ref' for ObjectSpace
13
+ fails "ObjectSpace._id2ref retrieves true by object_id" # NoMethodError: undefined method `_id2ref' for ObjectSpace
14
+ fails "ObjectSpace.define_finalizer allows multiple finalizers with different 'callables' to be defined" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2129a>
15
+ fails "ObjectSpace.define_finalizer calls a finalizer at exit even if it is indirectly self-referencing" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2129a>
16
+ fails "ObjectSpace.define_finalizer calls a finalizer at exit even if it is self-referencing" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2129a>
17
+ fails "ObjectSpace.define_finalizer calls a finalizer defined in a finalizer running at exit" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2129a>
18
+ fails "ObjectSpace.define_finalizer calls finalizer on process termination" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2129a>
19
+ fails "ObjectSpace.define_finalizer warns if the finalizer has the object as the receiver" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2129a>
20
+ fails "ObjectSpace.define_finalizer warns if the finalizer is a method bound to the receiver" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2129a>
21
+ fails "ObjectSpace.define_finalizer warns if the finalizer was a block in the receiver" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2129a>
22
+ fails "ObjectSpace.each_object calls the block once for each class, module in the Ruby process" # NoMethodError: undefined method `each_object' for ObjectSpace
23
+ fails "ObjectSpace.each_object calls the block once for each living, non-immediate object in the Ruby process" # NoMethodError: undefined method `each_object' for ObjectSpace
24
+ fails "ObjectSpace.each_object finds an object captured in an at_exit handler" # NoMethodError: undefined method `each_object' for ObjectSpace
25
+ fails "ObjectSpace.each_object finds an object captured in finalizer" # NoMethodError: undefined method `each_object' for ObjectSpace
26
+ fails "ObjectSpace.each_object finds an object stored in a fiber local" # NoMethodError: undefined method `each_object' for ObjectSpace
27
+ fails "ObjectSpace.each_object finds an object stored in a global variable" # NoMethodError: undefined method `each_object' for ObjectSpace
28
+ fails "ObjectSpace.each_object finds an object stored in a hash key" # NoMethodError: undefined method `each_object' for ObjectSpace
29
+ fails "ObjectSpace.each_object finds an object stored in a hash value" # NoMethodError: undefined method `each_object' for ObjectSpace
30
+ fails "ObjectSpace.each_object finds an object stored in a local variable captured in a Kernel#binding" # NoMethodError: undefined method `binding' for #<MSpecEnv:0x14f0c>
31
+ fails "ObjectSpace.each_object finds an object stored in a local variable captured in a Proc#binding" # NoMethodError: undefined method `each_object' for ObjectSpace
32
+ fails "ObjectSpace.each_object finds an object stored in a local variable captured in a block explicitly" # NoMethodError: undefined method `each_object' for ObjectSpace
33
+ fails "ObjectSpace.each_object finds an object stored in a local variable captured in a block implicitly" # NoMethodError: undefined method `each_object' for ObjectSpace
34
+ fails "ObjectSpace.each_object finds an object stored in a local variable captured in by a method defined with a block" # NoMethodError: undefined method `each_object' for ObjectSpace
35
+ fails "ObjectSpace.each_object finds an object stored in a local variable set in a binding manually" # NoMethodError: undefined method `binding' for #<MSpecEnv:0x14f0c>
36
+ fails "ObjectSpace.each_object finds an object stored in a local variable" # NoMethodError: undefined method `each_object' for ObjectSpace
37
+ fails "ObjectSpace.each_object finds an object stored in a second-level constant" # NoMethodError: undefined method `each_object' for ObjectSpace
38
+ fails "ObjectSpace.each_object finds an object stored in a thread local" # NotImplementedError: Thread creation not available
39
+ fails "ObjectSpace.each_object finds an object stored in a top-level constant" # NoMethodError: undefined method `each_object' for ObjectSpace
40
+ fails "ObjectSpace.each_object finds an object stored in an array" # NoMethodError: undefined method `each_object' for ObjectSpace
41
+ fails "ObjectSpace.each_object finds an object stored in an instance variable" # NoMethodError: undefined method `each_object' for ObjectSpace
42
+ fails "ObjectSpace.each_object on singleton classes does not walk hidden metaclasses" # NoMethodError: undefined method `each_object' for ObjectSpace
43
+ fails "ObjectSpace.each_object on singleton classes walks singleton classes" # NoMethodError: undefined method `each_object' for ObjectSpace
44
+ fails "ObjectSpace.each_object returns an enumerator if not given a block" # NoMethodError: undefined method `each_object' for ObjectSpace
45
+ fails "ObjectSpace.each_object walks a class and its normal descendants when passed the class's singleton class" # NoMethodError: undefined method `each_object' for ObjectSpace
46
+ fails "ObjectSpace.garbage_collect always returns nil" # NoMethodError: undefined method `garbage_collect' for ObjectSpace
47
+ fails "ObjectSpace.garbage_collect can be invoked without any exceptions" # Expected to not get Exception but got: NoMethodError (undefined method `garbage_collect' for ObjectSpace)
48
+ fails "ObjectSpace.garbage_collect doesn't accept any arguments" # Expected ArgumentError but got: NoMethodError (undefined method `garbage_collect' for ObjectSpace)
49
+ fails "ObjectSpace.garbage_collect ignores the supplied block" # Expected to not get Exception but got: NoMethodError (undefined method `garbage_collect' for ObjectSpace)
50
+ fails "ObjectSpace::WeakMap#[] matches using identity semantics" # Expected "x" == nil to be truthy but was false
51
+ fails "ObjectSpace::WeakMap#each is correct" # NotImplementedError: #each can't be implemented on top of JS interfaces
52
+ fails "ObjectSpace::WeakMap#each_key is correct" # NotImplementedError: #each_key can't be implemented on top of JS interfaces
53
+ fails "ObjectSpace::WeakMap#each_key must take a block, except when empty" # NotImplementedError: #each can't be implemented on top of JS interfaces
54
+ fails "ObjectSpace::WeakMap#each_pair is correct" # NotImplementedError: #each_pair can't be implemented on top of JS inerfaces
55
+ fails "ObjectSpace::WeakMap#each_value is correct" # NotImplementedError: #each_value can't be implemented on top of JS interfaces
56
+ fails "ObjectSpace::WeakMap#include? matches using identity semantics" # Exception: Invalid value used as weak map key
57
+ fails "ObjectSpace::WeakMap#include? reports true if the pair exists and the value is nil" # NotImplementedError: #size can't be implemented on top of JS interfaces
58
+ fails "ObjectSpace::WeakMap#inspect displays object pointers in output" # Expected "#<ObjectSpace::WeakMap:0x1ceec>" =~ /^\#<ObjectSpace::WeakMap:0x\h+>$/ to be truthy but was nil
59
+ fails "ObjectSpace::WeakMap#key? matches using identity semantics" # Exception: Invalid value used as weak map key
60
+ fails "ObjectSpace::WeakMap#key? reports true if the pair exists and the value is nil" # NotImplementedError: #size can't be implemented on top of JS interfaces
61
+ fails "ObjectSpace::WeakMap#keys is correct" # NotImplementedError: #keys can't be implemented on top of JS interfaces
62
+ fails "ObjectSpace::WeakMap#length is correct" # NotImplementedError: #length can't be implemented on top of JS interfaces
63
+ fails "ObjectSpace::WeakMap#member? matches using identity semantics" # Exception: Invalid value used as weak map key
64
+ fails "ObjectSpace::WeakMap#member? reports true if the pair exists and the value is nil" # NotImplementedError: #size can't be implemented on top of JS interfaces
65
+ fails "ObjectSpace::WeakMap#size is correct" # NotImplementedError: #size can't be implemented on top of JS interfaces
66
+ fails "ObjectSpace::WeakMap#values is correct" # NotImplementedError: #values can't be implemented on top of JS interfaces
67
+ end
@@ -18,13 +18,8 @@ opal_filter "String#unpack" do
18
18
  fails "String#unpack with format 'Q' with modifier '>' decodes two longs for two format characters" # Expected [7233738012216484000, 7233733596956420000] to equal [7233738012216485000, 7233733596956420000]
19
19
  fails "String#unpack with format 'Q' with modifier '>' ignores NULL bytes between directives" # Expected [7523094288207667000, 7233738012216484000] to equal [7523094288207668000, 7233738012216485000]
20
20
  fails "String#unpack with format 'Q' with modifier '>' ignores spaces between directives" # Expected [7523094288207667000, 7233738012216484000] to equal [7523094288207668000, 7233738012216485000]
21
- fails "String#unpack with format 'U' decodes UTF-8 BMP codepoints" # ArgumentError: malformed UTF-8 character
22
21
  fails "String#unpack with format 'U' decodes UTF-8 max codepoints" # Expected [65536] to be computed by "𐀀".unpack from "U" (computed [55296, 56320] instead)
23
- fails "String#unpack with format 'U' decodes Unicode codepoints as ASCII values" # ArgumentError: malformed UTF-8 character
24
- fails "String#unpack with format 'U' decodes all remaining characters when passed the '*' modifier" # ArgumentError: malformed UTF-8 character
25
- fails "String#unpack with format 'U' decodes the number of characters specified by the count modifier" # ArgumentError: malformed UTF-8 character
26
22
  fails "String#unpack with format 'U' does not decode any items for directives exceeding the input string size" # ArgumentError: malformed UTF-8 character
27
- fails "String#unpack with format 'U' implicitly has a count of one when no count modifier is passed" # ArgumentError: malformed UTF-8 character
28
23
  fails "String#unpack with format 'a' decodes into raw (ascii) string values" # Expected "UTF-16LE" to equal "ASCII-8BIT"
29
24
  fails "String#unpack with format 'b' decodes into US-ASCII string values" # Expected "UTF-16LE" to equal "US-ASCII"
30
25
  fails "String#unpack with format 'h' should make strings with US_ASCII encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
@@ -55,10 +50,8 @@ opal_filter "Array#pack" do
55
50
  fails "Array#pack with format 'A' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
56
51
  fails "Array#pack with format 'A' returns a string in encoding of common to the concatenated results" # RuntimeError: Unsupported pack directive "U" (no chunk reader defined)
57
52
  fails "Array#pack with format 'C' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
58
- fails "Array#pack with format 'C' returns a binary string" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
59
53
  fails "Array#pack with format 'C' returns an ASCII-8BIT string" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT>
60
54
  fails "Array#pack with format 'L' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
61
- fails "Array#pack with format 'L' returns a binary string" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
62
55
  fails "Array#pack with format 'L' returns an ASCII-8BIT string" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT>
63
56
  fails "Array#pack with format 'L' with modifier '>' and '!' calls #to_int to convert the pack argument to an Integer" # Mock 'to_int' expected to receive to_int("any_args") exactly 1 times but received it 0 times
64
57
  fails "Array#pack with format 'L' with modifier '>' and '!' encodes a Float truncated as an Integer" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
@@ -90,10 +83,8 @@ opal_filter "Array#pack" do
90
83
  fails "Array#pack with format 'a' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
91
84
  fails "Array#pack with format 'a' returns a string in encoding of common to the concatenated results" # RuntimeError: Unsupported pack directive "U" (no chunk reader defined)
92
85
  fails "Array#pack with format 'c' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
93
- fails "Array#pack with format 'c' returns a binary string" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
94
86
  fails "Array#pack with format 'c' returns an ASCII-8BIT string" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT>
95
87
  fails "Array#pack with format 'l' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
96
- fails "Array#pack with format 'l' returns a binary string" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
97
88
  fails "Array#pack with format 'l' returns an ASCII-8BIT string" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT>
98
89
  fails "Array#pack with format 'l' with modifier '>' and '!' calls #to_int to convert the pack argument to an Integer" # Mock 'to_int' expected to receive to_int("any_args") exactly 1 times but received it 0 times
99
90
  fails "Array#pack with format 'l' with modifier '>' and '!' encodes a Float truncated as an Integer" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)