repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/array/intersection_spec.rb | spec/opal/core/array/intersection_spec.rb | describe "Array#&" do
it "relies on Ruby's #hash (not JavaScript's #toString) for identifying array items" do
a1 = [ 123, '123']
a2 = ['123', 123 ]
(a1 & a2).should == a1
(a2 & a1).should == a2
a1 = [ Time.at(1429521600.1), Time.at(1429521600.9) ]
a2 = [ Time.at(1429521600.9), Time.at(1429521600.1) ]
(a1 & a2).should == a1
(a2 & a1).should == a2
a1 = [ Object.new, Object.new ]
a2 = [ Object.new, Object.new ]
(a1 & a2).should == []
(a2 & a1).should == []
a1 = [ 1, 2, 3, '1', '2', '3']
a2 = ['1', '2', '3', 1, 2, 3 ]
(a1 & a2).should == a1
(a2 & a1).should == a2
a1 = [ [1, 2, 3], '1,2,3']
a2 = ['1,2,3', [1, 2, 3] ]
(a1 & a2).should == a1
(a2 & a1).should == a2
a1 = [ true, 'true']
a2 = ['true', true ]
(a1 & a2).should == a1
(a2 & a1).should == a2
a1 = [ false, 'false']
a2 = ['false', false ]
(a1 & a2).should == a1
(a2 & a1).should == a2
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/class/inherited_spec.rb | spec/opal/core/class/inherited_spec.rb | module ModuleInheritedTestModule
class A
def self.inherited(subclass)
$ScratchPad << subclass.name
end
end
end
describe 'Class#inherited' do
it 'gets called after setting a base scope of the subclass' do
$ScratchPad = []
module ModuleInheritedTestModule
class B < A
end
end
$ScratchPad.should == ['ModuleInheritedTestModule::B']
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/class/clone_spec.rb | spec/opal/core/class/clone_spec.rb | require 'spec_helper'
describe "Class#clone" do
it "should copy an instance method including super call" do
parent = Class.new do
def hello
"hello"
end
end
child = Class.new(parent) do
def hello
super + " world"
end
end
child.clone.new.hello.should == "hello world"
end
it "retains an included module in the ancestor chain" do
klass = Class.new
mod = Module.new do
def hello
"hello"
end
end
klass.include(mod)
klass.clone.new.hello.should == "hello"
end
it "copies a method with a block argument defined by define_method" do
klass = Class.new
klass.define_method(:add_one) { |&block| block.call + 1 }
klass.clone.new.add_one { 1 }.should == 2
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/module/define_method_spec.rb | spec/opal/core/module/define_method_spec.rb | require 'spec_helper'
describe "Module#define_method" do
describe "when passed an UnboundMethod object" do
it "defines a method taking a block" do
klass = Class.new do
def foo = yield :bar
end
klass.define_method(:baz, klass.instance_method(:foo))
klass.new.baz { |a| a }.should == :bar
end
end
describe "when called inside a def" do
it "returns correctly" do
klass = Class.new do
def self.my_method_definer
define_method(:a) do
return :foo
:bar
end
end
end
klass.my_method_definer
klass.new.a.should == :foo
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/module/include_spec.rb | spec/opal/core/module/include_spec.rb | require 'spec_helper'
module ModuleIncludeSpecs
module A
def initialize
$ScratchPad << :A
super
end
end
module B
def initialize
$ScratchPad << :B
super
end
end
module C
def initialize
$ScratchPad << :C
super
end
end
module D
def initialize
$ScratchPad << :D
super
end
end
class Test
include A
prepend B
prepend C
include D
def initialize
$ScratchPad << :Test
super
end
end
end
describe 'Module#include' do
describe 'called after #prepend' do
it 'inserts the module after self in the ancestor chain' do
ModuleIncludeSpecs::Test.ancestors.take(5).should == [
ModuleIncludeSpecs::C,
ModuleIncludeSpecs::B,
ModuleIncludeSpecs::Test,
ModuleIncludeSpecs::D,
ModuleIncludeSpecs::A,
]
end
it 'modifies the prototype chain as expected' do
$ScratchPad = []
ModuleIncludeSpecs::Test.new
$ScratchPad.should == [:C, :B, :Test, :D, :A]
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/io/read_spec.rb | spec/opal/core/io/read_spec.rb | require 'spec_helper'
describe "IO reading methods" do
examples = [
"abc\n|def\n|ghi\n",
"ab|c\nd|ef\n|ghi\n",
"©©©\n|ŋææ\n|æπ®\n",
"🫃🫃🫃\n|🫃🫃🫃\n|🫃🫃🫃\n",
"efhasdfhasf|asdfasdfasdf|asdfasdfasdf",
"gsdfgsdg🫃|🫃🫃\n|🫃",
"a\nb\nc\nd\ne\nf",
"abcððefsdf🫃|s\nd",
"a|b|c|d|e|f|g|h|i|\n|j|k|l|\n",
"a b\n|c| d\n|e f",
"",
"asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfsafsdsdf\nsadfasdf"
]
examples += examples.map { |i| i.gsub("\n", "\r\n") }
examples += examples.map { |i| i.gsub("\n", "\r|\n") }
examples = examples.uniq
prepare_io_for = proc do |example|
example_lines = example.split("|")
io = IO.new(99)
io.read_proc = proc do |_length|
example_lines.shift
end
io
end
describe "#readlines" do
examples.each do |example|
it "correctly splits messages for input #{example.inspect}" do
io = prepare_io_for.(example)
expected_output = example.gsub("|", "").split(/\n/).map { |e| e + "\n" }
len = expected_output.length
last = expected_output.last
expected_output[len-1] = last.chop if !example.end_with?("\n") && last
io.readlines.should == expected_output
end
end
end
describe "#readline" do
examples.each do |example|
it "correctly splits messages for input #{example.inspect}" do
io = prepare_io_for.(example)
expected_output = example.gsub("|", "").split(/\n/).map { |e| e + "\n" }
len = expected_output.length
last = expected_output.last
expected_output[len-1] = last.chop if !example.end_with?("\n") && last
loop do
expected_output.shift.should == io.readline
rescue EOFError
expected_output.should == []
break
end
end
end
end
describe "#gets" do
examples.each do |example|
it "correctly splits messages for input #{example.inspect}" do
io = prepare_io_for.(example)
expected_output = example.gsub("|", "").split(/\n/).map { |e| e + "\n" }
len = expected_output.length
last = expected_output.last
expected_output[len-1] = last.chop if !example.end_with?("\n") && last
loop do
line = io.gets
expected_output.shift.should == line
break unless line
end
end
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/memoization_spec.rb | spec/opal/core/language/memoization_spec.rb | describe "memoization" do
it "memoizes a value with complex internal logic" do
klass = Class.new do
def memoized_value(dependency: nil)
@memoized_value ||= begin
return nil if dependency.nil?
dependency.call
end
end
end
expect(klass.new.memoized_value(dependency: proc { :value })).to eq :value
expect(klass.new.memoized_value).to eq nil
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/string_spec.rb | spec/opal/core/language/string_spec.rb | describe "Ruby string interpolation" do
it "uses an internal representation when #to_s doesn't return a String" do
obj = Object.new
def obj.to_s
BasicObject.new
end
str = "#{obj}"
str.should be_an_instance_of(String)
str.should =~ /\A#<Object:0x[0-9a-fA-F]+>\z/
end
it "uses Ruby's to_s rather than JavaScript's toString" do
# Array.prototype.toString returns "1,2"
"#{[1, 2]}".should == "[1, 2]"
# Function.prototype.toString returns its source code
"#{-> {}}".should =~ /\A#<Proc:0x[0-9a-fA-F]+>\z/
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/forward_args_spec.rb | spec/opal/core/language/forward_args_spec.rb | describe "Forward arguments" do
it "forwards args, kwargs and blocks" do
def fwd_t1_pass1(...)
fwd_t1_pass2(...)
end
def fwd_t1_pass2(*args, **kwargs, &block)
[args.count, kwargs.count, block_given?]
end
fwd_t1_pass1(1, 2, 3, a: 1, b: 2).should == [3, 2, false]
fwd_t1_pass1(1, 2, &:itself).should == [2, 0, true]
fwd_t1_pass1(a: 1, b: 2).should == [0, 2, false]
end
it "supports forwarding with initial arguments (3.0 behavior)" do
def fwd_t2_pass1(initial, ...)
fwd_t2_pass2(0, initial + 1, ...)
end
def fwd_t2_pass2(a, b, c)
a + b + c
end
fwd_t2_pass1(2, 3).should == 6
error = nil
begin
fwd_t2_pass1(2, 3, 4) # Too many arguments passwd to fwd_t2_pass2
rescue ArgumentError
error = :ArgumentError
end
error.should == :ArgumentError
end
it "supports forwarding to multiple methods at once" do
def fwd_t3_pass1(...)
fwd_t3_pass2a(...) + fwd_t3_pass2b(...) + fwd_t3_pass2c(...)
end
def fwd_t3_pass2a(*args)
-2 * args.count
end
def fwd_t3_pass2b(*args)
1 * args.count
end
def fwd_t3_pass2c(*args)
0 * args.count
end
fwd_t3_pass1(0, 0, 0).should == -3
fwd_t3_pass1(0, 0).should == -2
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/xstring_spec.rb | spec/opal/core/language/xstring_spec.rb | # backtick_javascript: true
describe "The x-string expression" do
it "works with multiline, case and assignment" do
a = case 1
when 1
%x{
var b = 5;
return b;
}
end
a.should == 5
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/if_spec.rb | spec/opal/core/language/if_spec.rb | describe "If statement" do
it "returns when wrapped" do
begin
123
if true
foo while false
5
end
end.should == 5
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/pattern_matching_spec.rb | spec/opal/core/language/pattern_matching_spec.rb | require 'spec_helper'
describe "pattern matching" do
it "supports basic assignment" do
5 => a
a.should == 5
end
it "supports array pattern" do
[1,2,3,4] => [1,2,*rest]
rest.should == [3,4]
[1,2,3,4] => [*rest,3,x]
rest.should == [1,2]
x.should == 4
end
it "supports hash pattern" do
{a: 4} => {a:}
a.should == 4
{a: 4, b: 6} => {b:}
b.should == 6
{a: 1, b: 2, c: 3} => {a: 1, **rest}
rest.should == {b: 2, c: 3}
end
it "supports pinning" do
a = 6
6 => ^a
a.should == 6
end
it "supports a lambda literal" do
[6, 7] => [->(a) { a == 6 }, b]
b.should == 7
end
it "supports constants" do
[6, 7, 8] => [Integer, a, Integer]
a.should == 7
end
it "supports regexps" do
"test" => /e(s)t/
$1.should == 's'
end
it "supports save pattern" do
[6, 7, 8] => [Integer=>a, Integer=>b, Integer=>c]
[a,b,c].should == [6, 7, 8]
end
it "supports find pattern with save" do
[1, 2, 3, 4, 5] => [*before, 3 => three, 4 => four, *after]
before.should == [1,2]
three.should == 3
four.should == 4
after.should == [5]
end
it "supports custom classes" do
class TotallyArrayOrHashLike
def deconstruct
[1,2,3]
end
def deconstruct_keys(_)
{a: 1, b: 2}
end
end
TotallyArrayOrHashLike.new => TotallyArrayOrHashLike[*array]
array.should == [1,2,3]
TotallyArrayOrHashLike.new => TotallyArrayOrHashLike(**hash)
hash.should == {a: 1, b: 2}
end
it "supports case expressions" do
case 4
in 4
z = true
in 5
z = false
end
z.should == true
end
it "supports case expressions with guards" do
case 4
in 4 if false
z = true
in 4 if true
z = false
end
z.should == false
end
it "raises if case expression is unmatched" do
proc do
case 4
in 5
:test
end
end.should raise_error NoMatchingPatternError
end
it "doesn't raise when else in a case expression is present" do
case 4
in 5
z = true
else
z = false
end
z.should == false
end
it "doesn't raise or set variables if an in expression is unmatched" do
4 in String => a
a.should == nil
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/numblocks_spec.rb | spec/opal/core/language/numblocks_spec.rb | require 'spec_helper'
describe "numblocks" do
it "supports numblocks" do
[1,2,3].map { _1 * 2 }.should == [2,4,6]
[[1,2],[3,4]].map { _1 * _2 }.should == [2,12]
end
it "reports correct arity" do
proc { [_1, _2] + [_3] }.arity.should == 3
end
it "reports correct parameters" do
proc { [_1, _2] }.parameters.should == [[:opt, :_1], [:opt, :_2]]
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/keyword_arguments_spec.rb | spec/opal/core/language/keyword_arguments_spec.rb | describe "Keyword arguments" do
it 'works with keys that are reserved words in JS' do
o = Object.new
def o.foo(default:)
default
end
o.foo(default: :bar).should == :bar
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/case_spec.rb | spec/opal/core/language/case_spec.rb | describe "Case statement" do
it "works with JS object-wrapped values" do
a = false
objwr = `new String("abc")`
case objwr
when "abc"
a = true
end
a.should == true
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/while_spec.rb | spec/opal/core/language/while_spec.rb | describe "The while expression" do
it "restarts the current iteration without reevaluating condition with redo" do
a = []
i = 0
j = 0
while (i+=1)<3
a << i
j+=1
redo if j<3
a << 5
end
a.should == [1, 1, 1, 5, 2, 5]
end
it "restarts the current iteration without evaluation the code below redo" do
a = []
i = 0
while true
i += 1
a << i
if i < 3
redo
else
break
end
a << 5 # should never get here
end
a.should == [1, 2, 3]
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/safe_navigator_spec.rb | spec/opal/core/language/safe_navigator_spec.rb | # backtick_javascript: true
describe 'Safe navigator' do
it "handles also null and undefined" do
[`null`, `undefined`].each do |value|
value&.unknown.should == nil
end
end
it "calls a receiver exactly once" do
def receiver
@calls += 1
end
@calls = 0
receiver&.itself.should == 1
@calls = 0
receiver&.itself{}.should == 1
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/defined_spec.rb | spec/opal/core/language/defined_spec.rb | describe "defined?" do
it "works with constants set to 0" do
class TestingDefined
RDONLY = 0
end
res = defined? TestingDefined::RDONLY
res.should == 'constant'
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/xstring_send_spec.rb | spec/opal/core/language/xstring_send_spec.rb | # backtick_javascript: false
describe "The x-string expression for send" do
def `(command)
"Linux x86_64" if command == "uname -a"
end
it "compiles as send if backtick_javascript is false" do
`uname -a`.should == "Linux x86_64"
end
it "compiles as send with dstr if backtick_javascript is false" do
`uname#{" "}-a`.should == "Linux x86_64"
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/infinite_range_spec.rb | spec/opal/core/language/infinite_range_spec.rb | describe "Infinite ranges" do
it "supports endless ranges" do
range = (10..)
range.begin.should == 10
range.end.should == nil
end
it "supports beginless ranges" do
range = (..10)
range.begin.should == nil
range.end.should == 10
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/super_spec.rb | spec/opal/core/language/super_spec.rb | describe 'super without explicit argument' do
it 'passes arguments named with js reserved word' do
parent = Class.new do
def test_args(*args) = args
def test_rest_args(*args) = args
def test_kwargs(**args) = args
def test_rest_kwargs(**args) = args
end
klass = Class.new(parent) do
def test_args(native) = super
def test_rest_args(*native) = super
def test_kwargs(native:) = super
def test_rest_kwargs(**native) = super
end
klass.new.test_args(1).should == [1]
klass.new.test_rest_args(2).should == [2]
klass.new.test_kwargs(native: 3).should == {native: 3}
klass.new.test_rest_kwargs(native: 4).should == {native: 4}
end
end
class ABlockWithSuperSpec
BLOCK = proc {
return [self, super()]
}
def foo; :foo; end
def bar; :bar; end
def foo_bar; [foo, bar]; end
end
describe "a block with super" do
it "can be used to define multiple methods" do
block = nil
c = Class.new(ABlockWithSuperSpec) {
define_method :foo, ABlockWithSuperSpec::BLOCK
define_method :bar, ABlockWithSuperSpec::BLOCK
define_method :foo_bar, ABlockWithSuperSpec::BLOCK
}
obj = c.new
obj.foo.should == [obj, :foo]
obj.bar.should == [obj, :bar]
obj.foo_bar.should == [obj, [[obj, :foo], [obj, :bar]]]
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/arguments/underscore_arg_spec.rb | spec/opal/core/language/arguments/underscore_arg_spec.rb | describe 'duplicated underscore parameter' do
it 'assigns the first arg' do
klass = Class.new {
def req_req(_, _) = _
def req_rest_req(_, *, _) = _
def rest_req(*_, _) = _
def req_opt(_, _ = 0) = _
def opt_req(_ = 0, _) = _
def req_kwopt(_, _: 0) = _
def req_kwrest(_, **_) = _
def req_block(_, &_) = _
def req_mlhs(_, (_)) = _
def mlhs_req((_), _) = _
def rest_kw(*_, _:) = _
def nested_mlhs(((_), _)) = _
def nested_mlhs_rest(((*_, _))) = _
}
o = klass.new
o.req_req(1, 2).should == 1
o.req_rest_req(1, 2, 3, 4).should == 1
o.rest_req(1, 2, 3).should == [1, 2]
o.req_opt(1).should == 1
o.req_opt(1, 2).should == 1
o.opt_req(1).should == 0
o.opt_req(1, 2).should == 1
o.req_kwopt(1, _: 2).should == 1
o.req_kwrest(1, a: 2).should == 1
o.req_block(1).should == 1
o.req_block(1) {}.should == 1
o.req_mlhs(1, [2]).should == 1
o.mlhs_req([1], 2).should == 1
o.rest_kw(1, 2, _: 3).should == [1, 2]
o.nested_mlhs([[1], 2]).should == 1
o.nested_mlhs_rest([[1, 2, 3]]).should == [1, 2]
end
context 'in block parameters' do
it 'assignes the first arg' do
proc { |_, _| _ }.call(1, 2).should == 1
proc { |_, *_| _ }.call(1, 2, 3).should == 1
proc { |*_, _| _ }.call(1, 2, 3).should == [1, 2]
proc { |_, _:| _ }.call(1, _: 2).should == 1
proc { |**_, &_| _ }.call(a: 1) {}.should == {a: 1}
end
end
it 'distinguishes two arguments starting with _' do
klass = Class.new {
def foo(_a, _a, _b, _b) = [_a, _b]
}
o = klass.new
o.foo(1, 2, 3, 4).should == [1, 3]
end
it 'works with yield' do
klass = Class.new {
def foo(_, &_) = yield * 2
}
o = klass.new
o.foo(1) { 2 }.should == 4
end
it 'works with block_given?' do
klass = Class.new {
def foo(_, &_) = block_given?
}
o = klass.new
o.foo(1).should == false
o.foo(1) {}.should == true
end
it 'works with zsuper' do
parent = Class.new {
def foo(*args, **kwargs, &blk)
[args, kwargs, blk.call]
end
}
child = Class.new(parent) {
def foo(_, _ = 0, *_, _, _:, **_, &_)
super
end
}
o = child.new
o.foo(1, 2, 3, 4, _: 5, a: 6) { 7 }.should == [[1, 2, 3, 4], {_: 5, a: 6}, 7]
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/arguments/mlhs_arg_spec.rb | spec/opal/core/language/arguments/mlhs_arg_spec.rb | # backtick_javascript: true
describe 'mlhs argument' do
context 'when pased value is falsey in JS' do
it 'still returns it' do
p = ->((a)){ a }
p.call(false).should == false
p.call("").should == ""
p.call(0).should == 0
end
end
context 'when passed value == null' do
it 'replaces it with nil' do
p = ->((a)){ a }
p.call([`undefined`]).should == nil
p.call([`null`]).should == nil
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/DATA/empty___END___spec.rb | spec/opal/core/language/DATA/empty___END___spec.rb | describe "empty __END__ section without trailing newline" do
it "returns an empty string" do
DATA.read.should == ""
end
end
__END__ | ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/DATA/characters_support_spec.rb | spec/opal/core/language/DATA/characters_support_spec.rb | describe "characters support of the DATA contstant" do
it "supports all characters" do
DATA.read.should == "azAZ09`~!@#$%^&*(\n)_+{}\\|;:'\",<.>/?\n"
end
end
__END__
azAZ09`~!@#$%^&*(
)_+{}\|;:'",<.>/?
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/DATA/multiple___END___crlf_spec.rb | spec/opal/core/language/DATA/multiple___END___crlf_spec.rb | describe "DATA constant with multiple __END__ sections" do
it "returns everything after first __END__" do
DATA.read.should == "1\r\n__END__\r\n2\r\n"
end
end
__END__
1
__END__
2
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/DATA/characters_support_crlf_spec.rb | spec/opal/core/language/DATA/characters_support_crlf_spec.rb | describe "characters support of the DATA contstant" do
it "supports all characters" do
DATA.read.should == "azAZ09`~!@#$%^&*(\r\n)_+{}\\|;:'\",<.>/?\r\n"
end
end
__END__
azAZ09`~!@#$%^&*(
)_+{}\|;:'",<.>/?
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language/DATA/multiple___END___spec.rb | spec/opal/core/language/DATA/multiple___END___spec.rb | describe "DATA constant with multiple __END__ sections" do
it "returns everything after first __END__" do
DATA.read.should == "1\n__END__\n2\n"
end
end
__END__
1
__END__
2
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/number/to_s_spec.rb | spec/opal/core/number/to_s_spec.rb | require 'spec_helper'
describe 'Number#to_s' do
it "should convert 0.0 to '0.0'" do
0.0.to_s.should == '0'
end
it "should convert -0.0 to '-0.0'" do
-0.0.to_s.should == '-0.0'
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/number/to_i_spec.rb | spec/opal/core/number/to_i_spec.rb | # backtick_javascript: true
require 'spec_helper'
describe 'Number#to_i' do
it "should not change huge number" do
1504642339053716000000.to_i.should == 1504642339053716000000
end
it "should not change negative huge number" do
-1504642339053716000000.to_i.should == -1504642339053716000000
end
it "equals Number#truncate(0) with huge number" do
1504642339053716000000.to_i.should == 1504642339053716000000.truncate(0)
end
it "should not change Infinity" do
`Infinity`.to_i.should == `Infinity`
end
it "should not change -Infinity" do
`-Infinity`.to_i.should == `-Infinity`
end
it "should not change NaN" do
x = `NaN`.to_i
`Number.isNaN(x)`.should be_true
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/source_map_spec.rb | spec/opal/stdlib/source_map_spec.rb | require 'spec_helper'
require 'opal/source_map'
describe 'Opal::SourceMap::VLQ' do
it 'encodes properly' do
Opal::SourceMap::VLQ.encode([0]).should == 'A'
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/pp_spec.rb | spec/opal/stdlib/pp_spec.rb | describe 'Object#pretty_inspect' do
it "doesn't throw due to the use of #<<" do
expect("test".pretty_inspect).to eq %{"test"\n}
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/opal_raw_spec.rb | spec/opal/stdlib/opal_raw_spec.rb | # backtick_javascript: true
require 'spec_helper'
require 'opal/raw'
describe 'javascript operations using Opal::Raw module' do
it 'Opal::Raw.typeof uses typeof to return underlying javascript type' do
[1, `null`, `undefined`, Object.new, [], ""].each do |v|
Opal::Raw.typeof(v).should == `typeof #{v}`
end
end
it 'Opal::Raw.new uses new to create new instance' do
f = `function(){}`
f.JS[:prototype].JS[:color] = 'black'
Opal::Raw.new(f).JS[:color].should == 'black'
end
it 'Opal::Raw.new handles blocks' do
f = `function(a){this.a = a}`
Opal::Raw.new(f){1}.JS.a.should == 1
end
it 'Opal::Raw.instanceof uses instanceof to check if value is an instance of a function' do
f = `function(){}`
Opal::Raw.instanceof(Opal::Raw.new(f), f).should == true
Opal::Raw.instanceof(Opal::Raw.new(f), `function(){}`).should == false
end
it 'Opal::Raw.delete uses delete to remove properties from objects' do
f = `{a:1}`
f.JS[:a].should == 1
Opal::Raw.delete(f, :a)
`#{f.JS[:a]} === undefined`.should == true
end
it 'Opal::Raw.in uses in to check for properties in objects' do
f = `{a:1}`
Opal::Raw.in(:a, f).should == true
Opal::Raw.in(:b, f).should == false
end
it 'Opal::Raw.void returns undefined' do
f = 1
`#{Opal::Raw.void(f += 1)} === undefined`.should == true
f.should == 2
end
it 'Opal::Raw.call calls global javascript methods' do
Opal::Raw.call(:parseFloat, '1.0').should == 1
Opal::Raw.call(:parseInt, '1').should == 1
Opal::Raw.call(:eval, "({a:1})").JS[:a].should == 1
end
it 'Opal::Raw.method_missing calls global javascript methods' do
Opal::Raw.parseFloat('1.0').should == 1
Opal::Raw.parseInt('1').should == 1
end
it 'Opal::Raw.call calls global javascript methods with blocks' do
begin
Opal::Raw.global.JS[:_test_global_function] = lambda{|pr| pr.call + 1}
Opal::Raw._test_global_function{1}.should == 2
ensure
Opal::Raw.delete(Opal::Raw.global, :_test_global_function)
end
end
it 'JS.<METHOD> supports complex method calls' do
obj = `{ foo: function(){return "foo"} }`
args = [1,2,3]
obj.JS.foo(*args).should == :foo
end
it 'JS.<METHOD> supports block arguments with self' do
# We want to ensure, that there's no "x" argument present
obj = `{ foo: function(arg, block, x) { block(arg, x); } }`
z = nil
obj.JS.foo(123) { |arg,x| z = [self, arg, x] }
# And also we want to ensure that self is not garbled
z.should == [self, 123, nil]
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/new_spec.rb | spec/opal/stdlib/native/new_spec.rb | # backtick_javascript: true
require 'native'
describe "Native()" do
it "should return nil for null or undefined" do
Native(`null`).should be_nil
Native(`undefined`).should be_nil
end
it "should return String" do
Native(`""`).should be_an_instance_of String
end
it "should return Integer" do
Native(`0`).should be_an_instance_of Number
end
it "should return Float" do
Native(`0.01`).should be_an_instance_of Float
end
it "should return Array" do
Native(`[]`).should be_an_instance_of Array
end
it "should return Native::Object" do
Native(`{}`).instance_of?(Native::Object).should be_true
end
it "should return Array of String" do
Native(`[""]`).first.should be_an_instance_of String
end
it "should return Array of Integer" do
Native(`[0]`).first.should be_an_instance_of Number
end
it "should return Array of Float" do
Native(`[0.01]`).first.should be_an_instance_of Float
end
it "should return Array of Array" do
Native(`[[]]`).first.should be_an_instance_of Array
end
it "should return Array of Native::Object" do
Native(`[{}]`).first.instance_of?(Native::Object).should be_true
end
it "should return Object with String" do
Native(`{"key": ""}`)["key"].should be_an_instance_of String
end
it "should return Object with Integer" do
Native(`{"key": 0}`)["key"].should be_an_instance_of Number
end
it "should return Object with Float" do
Native(`{"key": 0.01}`)["key"].should be_an_instance_of Float
end
it "should return Object with Array" do
Native(`{"key": []}`)["key"].should be_an_instance_of Array
end
it "should return Native::Object with Native::Object" do
Native(`{"key": {}}`)["key"].instance_of?(Native::Object).should be_true
end
it "should return Proc" do
Native(`function(){}`).should be_an_instance_of Proc
end
it "should return Proc that return String" do
Native(`function(){return ""}`).call.should be_an_instance_of String
end
it "should return Proc that return Integer" do
Native(`function(){return 0}`).call.should be_an_instance_of Integer
end
it "should return Proc that return Float" do
Native(`function(){return 0.01}`).call.should be_an_instance_of Float
end
it "should return Proc that return Array" do
Native(`function(){return []}`).call.should be_an_instance_of Array
end
it "should return Proc that return Native::Object" do
Native(`function(){return {}}`).call.instance_of?(Native::Object).should be_true
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/method_missing_spec.rb | spec/opal/stdlib/native/method_missing_spec.rb | # backtick_javascript: true
require 'native'
describe "Native::Object#method_missing" do
it "should return values" do
Native(`{ a: 23 }`).a.should == 23
Native(`{ a: { b: 42 } }`).a.b.should == 42
end
it "should call functions" do
Native(`{ a: function() { return 42 } }`).a.should == 42
end
it "should pass the proper this to functions" do
%x{
function foo() {
this.baz = 42;
}
foo.prototype.bar = function () {
return this.baz;
}
}
obj = `new foo()`
Native(obj).bar.should == 42
Native(obj).baz = 23
Native(obj).bar.should == 23
end
it "should set values" do
var = `{}`
Native(var).a = 42
`#{var}.a`.should == 42
Native(var).a.should == 42
end
it "should pass the block as function" do
Native(`{ a: function(func) { return func(); } }`).a { 42 }.should == 42
end
it "should unwrap arguments" do
x = `{}`
Native(`{ a: function(a, b) { return a === b } }`).a(Native(x), x).should == true
end
it "should wrap result" do
Native(`{ a: function() { return {}; } }`).a.class.should == Native::Object
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/element_reference_spec.rb | spec/opal/stdlib/native/element_reference_spec.rb | # backtick_javascript: true
require 'native'
describe "Native::Object#[]" do
it "should return the same value for bridged classes" do
Native(`2`).should === 2
Native(`"lol"`).should === "lol"
end
it "should return functions as is" do
Native(`{ a: function(){} }`)[:a].should be_kind_of Proc
end
it "should wrap natives into a Native object" do
Native(`{ a: { b: 2 } }`)[:a][:b].should == 2
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/array_spec.rb | spec/opal/stdlib/native/array_spec.rb | # backtick_javascript: true
require 'native'
describe Array do
describe '#to_n' do
it 'converts an array with native objects to a JS array' do
obj = [`{ key: 1 }`]
native = obj.to_n
`#{native}[0].key`.should == 1
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/native_module_spec.rb | spec/opal/stdlib/native/native_module_spec.rb | # backtick_javascript: true
require 'native'
describe "Module#native_module" do
module SomeModule
end
after {`delete Opal.global.SomeModule`}
it "adds current constant to the global JS object" do
SomeModule.native_module
`Opal.global.SomeModule`.should == SomeModule
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/deprecated_include_spec.rb | spec/opal/stdlib/native/deprecated_include_spec.rb | require 'native'
describe "Native inclusion" do
it "is deprecated" do
Native.should_receive(:warn).with("Including ::Native is deprecated. Please include Native::Wrapper instead.")
Class.new { include Native }
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/native_writer_spec.rb | spec/opal/stdlib/native/native_writer_spec.rb | # backtick_javascript: true
require 'native'
describe "Native.native_writer" do
it "refers to an attribute on @native" do
n = Class.new {
include Native::Wrapper
native_reader :a
native_writer :a
}.new(`{ a: 2 }`)
n.a = 4
n.a.should == 4
end
it "supports multiple names" do
n = Class.new {
include Native::Wrapper
native_reader :a, :b
native_writer :a, :b
}.new(`{ a: 2, b: 3 }`)
n.a = 4
n.b = 5
n.a.should == 4
n.b.should == 5
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/struct_spec.rb | spec/opal/stdlib/native/struct_spec.rb | # backtick_javascript: true
require 'native'
describe Struct do
describe '#to_n' do
it 'converts a struct with native attributes to a JS object' do
klass = Struct.new(:attribute)
obj = klass.new(`{ key: 1 }`)
native = obj.to_n
`#{native}.attribute.key`.should == 1
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/alias_native_spec.rb | spec/opal/stdlib/native/alias_native_spec.rb | # backtick_javascript: true
require 'native'
describe "Native.alias_native" do
it "refers to an attribute on @native" do
Class.new {
include Native::Wrapper
alias_native :a, :a
}.new(`{ a: 2 }`).a.should == 2
end
it "refers to an attribute on @native and calls it if it's a function" do
Class.new {
include Native::Wrapper
alias_native :a, :a
}.new(`{ a: function() { return 42; } }`).a.should == 42
end
it "defaults old to new" do
Class.new {
include Native::Wrapper
alias_native :a
}.new(`{ a: 42 }`).a.should == 42
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/native_class_spec.rb | spec/opal/stdlib/native/native_class_spec.rb | # backtick_javascript: true
require 'native'
describe "Class#native_class" do
class SomeClass
end
after {`delete Opal.global.SomeClass`}
it "adds current constant to the global JS object" do
SomeClass.native_class
`Opal.global.SomeClass`.should == SomeClass
end
it 'aliases Class#new to the unprefixed new method in JS world' do
SomeClass.native_class
`Opal.global.SomeClass["new"]()`.is_a?(SomeClass).should == true
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/hash_spec.rb | spec/opal/stdlib/native/hash_spec.rb | # backtick_javascript: true
require 'native'
describe Hash do
it 'turns a native JS object into a hash' do
obj = %x{
{
a: 1,
b: "two",
c: {
d: 1,
},
e: [
{
f: 'g',
h: [null],
},
],
}
}
h = Hash.new(obj)
expected_hash = {
a: 1,
b: "two",
c: {
d: 1,
},
e: [
{
f: 'g',
h: [nil],
},
],
}
expect(h).to eq(expected_hash)
end
it 'turns a native JS Map into a hash' do
obj = %x{
new Map([ ['a', 1],
['b', "two"],
['c', new Map([['d', 1]])],
['e', [{f: 'g',h: [null]}]] ]);
}
h = Hash.new(obj)
expected_hash = {
a: 1,
b: "two",
c: {
d: 1,
},
e: [
{
f: 'g',
h: [nil],
},
],
}
expect(h).to eq(expected_hash)
end
it 'turns Object.create(null) JS objects into a hash' do
%x{
var obj = Object.create(null);
var foo = Object.create(null);
var bar = Object.create(null);
obj.foo = foo;
foo.bar = bar;
bar.baz = 'baz';
}
hash = Hash.new(`obj`)
expect(hash).to eq({ foo: { bar: { baz: 'baz' } } })
end
it 'returns proper values when building a Hash from a JS object with a Hash' do
# see github issue #2670
h = { a: "A" }
g = Hash.new(`{ h: #{h} }`)
expect(g['h']['b']).to eq(nil)
expect(g['h'][:a]).to eq("A")
end
describe '#to_n' do
it 'converts a hash with native objects as values' do
obj = { 'a_key' => `{ key: 1 }` }
native = obj.to_n
`#{native}.a_key.key`.should == 1
end
it 'passes Ruby objects that cannot be converted' do
object = Object.new
hash = { foo: object }
native = hash.to_n
expect(`#{native}.foo`).to eq object
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/initialize_spec.rb | spec/opal/stdlib/native/initialize_spec.rb | # backtick_javascript: true
require 'native'
describe "Native#initialize" do
it "works when Native is included in a BasicObject" do
basic_class = Class.new(BasicObject)
basic_object = basic_class.new
lambda { basic_object.native? }.should raise_error(NoMethodError)
basic_class.send :include, Native
lambda { basic_class.new(`{}`) }.should_not raise_error
end
it "detects a non native object" do
object = Object.new
lambda { Native::Object.new(object) }.should raise_error(ArgumentError)
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/native_reader_spec.rb | spec/opal/stdlib/native/native_reader_spec.rb | # backtick_javascript: true
require 'native'
describe "Native.native_reader" do
it "refers to an attribute on @native" do
Class.new {
include Native::Wrapper
native_reader :a
}.new(`{ a: 2 }`).a.should == 2
end
it "uses multiple names" do
n = Class.new {
include Native::Wrapper
native_reader :a, :b
}.new(`{ a: 2, b: 3 }`)
n.a.should == 2
n.b.should == 3
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/each_spec.rb | spec/opal/stdlib/native/each_spec.rb | # backtick_javascript: true
require 'native'
describe "Native::Object#each" do
it "enumerates on object properties" do
Native(`{ a: 2, b: 3 }`).each {|name, value|
((name == :a && value == 2) || (name == :b && value == 3)).should be_true
}
end
it "accesses the native when no block is given" do
Native(`{ a: 2, b: 3, each: function() { return 42; } }`).each.should == 42
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/exposure_spec.rb | spec/opal/stdlib/native/exposure_spec.rb | # backtick_javascript: true
require 'native'
describe 'Native exposure' do
describe Class do
describe '#native_alias' do
it 'exposes a method to javascript' do
c = Class.new do
def ruby_method
:ruby
end
native_alias :rubyMethod, :ruby_method
end
`#{c.new}.rubyMethod()`.should == :ruby
end
end
describe '#native_class' do
it 'exposes a Class on the JS global object' do
c = Class.new do
def self.name
'Pippo'
end
native_class
end
`Pippo`.should == c
end
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/date_spec.rb | spec/opal/stdlib/native/date_spec.rb | # backtick_javascript: true
require 'native'
require 'date'
describe Date do
describe '#to_n' do
it 'returns native JS date object' do
date = Date.new(1984, 1, 24)
native = date.to_n
expect(`#{native}.toDateString()`).to eq 'Tue Jan 24 1984'
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/ext_spec.rb | spec/opal/stdlib/native/ext_spec.rb | # backtick_javascript: true
require 'native'
describe Hash do
describe '#initialize' do
it "returns a hash with a nil value" do
h = Hash.new(`{a: null}`)
h[:a].should == nil
end
end
describe '#to_n' do
it "should return a js object representing hash" do
Hash.new({:a => 100, :b => 200}.to_n).should == {:a => 100, :b => 200}
end
end
end
describe "Hash#to_n" do
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/native/native_alias_spec.rb | spec/opal/stdlib/native/native_alias_spec.rb | # backtick_javascript: true
require 'native'
describe "Class#native_alias" do
it "exposes a method to javascript without the '$' prefix" do
klass = Class.new {
def a
2
end
native_alias :a, :a
}
instance = klass.new
`instance.a()`.should == 2
end
it "raises if the aliased method isn't defined" do
Class.new do
lambda {
native_alias :a, :not_a_method
}.should raise_error(
NameError,
%r{undefined method `not_a_method' for class `#<Class:0x\w+>'}
)
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/logger/logger_spec.rb | spec/opal/stdlib/logger/logger_spec.rb | require 'logger'
require 'stringio'
# Our implementation of Logger only supports StringIO pipes.
# Since we can't portably write a log file, nothing in rubyspec will run.
describe Logger do
before do
@pipe = StringIO.new
@logger = Logger.new @pipe
end
describe "level" do
it "should set the level to DEBUG by default" do
@logger.level.should == Logger::Severity::DEBUG
end
it "should allow the level to be changed using an integer of a known level" do
@logger.level = Logger::Severity::INFO
@logger.level.should == Logger::Severity::INFO
end
it "should allow the level to be changed to an arbitrary integer value" do
@logger.level = 1000
@logger.level.should == 1000
end
it "should allow the level to be set using a case-insensitive level name" do
@logger.level = 'WaRn'
@logger.level.should == Logger::Severity::WARN
end
it "should raise an ArgumentError if the level is set to an unknown name" do
lambda { @logger.level = 'foobar' }.should raise_error(ArgumentError)
end
it "should report when debug level is enabled" do
@logger.debug?.should == true
end
it "should report when debug level is not enabled" do
@logger.level = Logger::Severity::DEBUG + 1
@logger.debug?.should == false
end
it "should report when info level is enabled" do
@logger.level = Logger::Severity::INFO
@logger.info?.should == true
end
it "should report when debug level is not enabled" do
@logger.level = Logger::Severity::INFO + 1
@logger.info?.should == false
end
it "should report when warn level is enabled" do
@logger.level = Logger::Severity::WARN
@logger.warn?.should == true
end
it "should report when warn level is not enabled" do
@logger.level = Logger::Severity::WARN + 1
@logger.warn?.should == false
end
it "should report when error level is enabled" do
@logger.level = Logger::Severity::ERROR
@logger.error?.should == true
end
it "should report when error level is not enabled" do
@logger.level = Logger::Severity::ERROR + 1
@logger.error?.should == false
end
it "should report when fatal level is enabled" do
@logger.level = Logger::Severity::FATAL
@logger.fatal?.should == true
end
it "should report when fatal level is not enabled" do
@logger.level = Logger::Severity::FATAL + 1
@logger.fatal?.should == false
end
end
describe "add" do
it "should not add a message to the log output if level is not enabled" do
@logger.level = Logger::Severity::INFO
@logger.add(Logger::Severity::DEBUG, 'message').should == true
@pipe.string.should == ''
end
it "should add a message to the log output if level is enabled" do
@logger.add(Logger::Severity::DEBUG, 'message').should == true
@pipe.string.should_not == ''
end
it "should coerce severity to UNKNOWN if falsy" do
@logger.level = Logger::Severity::UNKNOWN
@logger.add(nil, 'message').should == true
@pipe.string.should_not == ''
end
it "should format message using default formatter" do
@logger.add(Logger::Severity::DEBUG, 'message', 'program').should == true
@pipe.string.should =~ /^D, \[.+?\] +DEBUG -- program: message\n/
end
it "should log debug message if debug level is enabled" do
@logger.debug('message').should == true
@pipe.string.should =~ /^D, .*: message\n/
end
it "should not log debug message if debug level is not enabled" do
@logger.level = Logger::Severity::DEBUG + 1
@logger.debug('message').should == true
@pipe.string.should == ''
end
it "should log info message if info level is enabled" do
@logger.level = Logger::Severity::INFO
@logger.info('message').should == true
@pipe.string.should =~ /^I, .*: message\n/
end
it "should not log info message if info level is not enabled" do
@logger.level = Logger::Severity::INFO + 1
@logger.info('message').should == true
@pipe.string.should == ''
end
it "should log error message if info level is enabled" do
@logger.level = Logger::Severity::ERROR
@logger.error('message').should == true
@pipe.string.should =~ /^E, .*: message\n/
end
it "should not log error message if error level is not enabled" do
@logger.level = Logger::Severity::ERROR + 1
@logger.error('message').should == true
@pipe.string.should == ''
end
it "should log fatal message if fatal level is enabled" do
@logger.level = Logger::Severity::FATAL
@logger.fatal('message').should == true
@pipe.string.should =~ /^F, .*: message\n/
end
it "should not log fatal message if fatal level is not enabled" do
@logger.level = Logger::Severity::FATAL + 1
@logger.fatal('message').should == true
@pipe.string.should == ''
end
it "should log unknown message if unknown level is enabled" do
@logger.level = Logger::Severity::UNKNOWN
@logger.unknown('message').should == true
@pipe.string.should =~ /^U, .*: message\n/
end
it "should not log unknown message if unknown level is not enabled" do
@logger.level = Logger::Severity::UNKNOWN + 1
@logger.unknown('message').should == true
@pipe.string.should == ''
end
it "should use level name ANY in message if level is not known" do
@logger.add(1000, 'message', 'program').should == true
@pipe.string.should =~ /^A, \[.+?\] +ANY -- program: message\n/
end
it "should use message from block passed to add if block is given" do
@logger.add(Logger::Severity::DEBUG, nil, 'program') { 'message' }.should == true
@pipe.string.should include(' -- program: message')
end
it "should only require severity argument when calling add" do
@logger.add(Logger::Severity::DEBUG).should == true
@pipe.string.should include('DEBUG -- : nil')
end
it "should not require any arguments when calling level method" do
@logger.debug.should == true
@pipe.string.should include('DEBUG -- : nil')
end
end
describe "progname" do
it "should set progname to nil by default" do
@logger.progname.should be_nil
end
it "should leave progname blank in message by default" do
@logger.add(Logger::Severity::DEBUG, 'message').should == true
@pipe.string.should include(' DEBUG -- : message')
end
it "should allow the progname to be set" do
@logger.progname = 'program'
@logger.progname.should == 'program'
end
it "should use the progname from the logger in the message" do
@logger.progname = 'program'
@logger.add(Logger::Severity::DEBUG, 'message').should == true
@pipe.string.should include(' DEBUG -- program: message')
end
it "should allow the progname to be overridden when using add to log a message" do
@logger.progname = 'program'
@logger.add(Logger::Severity::DEBUG, 'message', 'app').should == true
@pipe.string.should include(' DEBUG -- app: message')
end
it "should allow the progname to be overridden when using block form of debug method" do
@logger.progname = 'program'
@logger.debug('app') { 'message' }.should == true
@pipe.string.should include(' DEBUG -- app: message')
end
it "should allow the progname to be overridden when using block form of info method" do
@logger.level = Logger::Severity::INFO
@logger.progname = 'program'
@logger.info('app') { 'message' }.should == true
@pipe.string.should include(' INFO -- app: message')
end
it "should allow the progname to be overridden when using block form of warn method" do
@logger.level = Logger::Severity::WARN
@logger.progname = 'program'
@logger.warn('app') { 'message' }.should == true
@pipe.string.should include(' WARN -- app: message')
end
it "should allow the progname to be overridden when using block form of error method" do
@logger.level = Logger::Severity::ERROR
@logger.progname = 'program'
@logger.error('app') { 'message' }.should == true
@pipe.string.should include(' ERROR -- app: message')
end
it "should allow the progname to be overridden when using block form of fatal method" do
@logger.level = Logger::Severity::FATAL
@logger.progname = 'program'
@logger.fatal('app') { 'message' }.should == true
@pipe.string.should include(' FATAL -- app: message')
end
it "should allow the progname to be overridden when using block form of unknown method" do
@logger.level = Logger::Severity::UNKNOWN
@logger.progname = 'program'
@logger.unknown('app') { 'message' }.should == true
@pipe.string.should include(' UNKNOWN -- app: message')
end
end
describe "formatter" do
it "should use the default formatter by default" do
@logger.formatter.should_not be_nil
@logger.formatter.should be_kind_of(Logger::Formatter)
end
it "should allow the formatter to be changed" do
MyFormatter = Class.new
@logger.formatter = MyFormatter.new
@logger.formatter.should be_kind_of(MyFormatter)
end
it "should invoke call method on the custom formatter to log a message" do
@logger.progname = 'app'
@logger.formatter = proc { |severity, time, progname, msg|
"#{severity} - #{time.to_i} - #{progname} - #{msg}\n"
}
@logger.debug('message').should == true
@pipe.string.should =~ /^DEBUG - \d+ - app - message\n$/
end
end
describe "message types" do
it "should allow message to be specified as a Hash" do
@logger.debug(text: 'message', context: 'account').should == true
@pipe.string.should include({ text: 'message', context: 'account' }.inspect)
end
it "should invoke inspect method to convert object message to string" do
message = { text: 'message', context: 'account' }
class << message
def inspect
"#{self[:text]} [#{self[:context]}]"
end
end
@logger.debug(message).should == true
@pipe.string.should include('message [account]')
end
it "should convert exception message to string" do
message = nil
begin
raise ArgumentError, 'message'
rescue => e
message = e
end
# Disable formatting for #full_message by making sure we are not on a tty
tty = $stderr.JS[:tty]
$stderr.JS[:tty] = false
@logger.debug(message).should == true
# Restore a tty status
$stderr.JS[:tty] = tty
@pipe.string.should =~ / message \(ArgumentError\)\n\tfrom /
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/thread/mutex_spec.rb | spec/opal/stdlib/thread/mutex_spec.rb | require 'thread'
describe Mutex do
before do
@mutex = Mutex.new
end
it "cannot be locked twice" do
@mutex.lock
lambda do
@mutex.lock
end.should raise_error(ThreadError)
end
it "reports locked? status" do
@mutex.locked?.should be_false
@mutex.lock
@mutex.locked?.should be_true
end
it "reports locked? status with try_lock" do
@mutex.try_lock.should be_true
@mutex.locked?.should be_true
@mutex.try_lock.should be_false
end
it "is locked and unlocked by synchronize" do
@mutex.synchronize do
@mutex.locked?.should be_true
end
@mutex.locked?.should be_false
end
it "will not be locked by synchronize if already locked" do
@mutex.lock
lambda do
@mutex.synchronize {}
end.should raise_error(ThreadError)
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/thread/thread_spec.rb | spec/opal/stdlib/thread/thread_spec.rb | require 'thread'
# Our implementation of Thread only supports faux thread-local variables.
# Since we can't actually create a thread, nothing in rubyspec will run.
describe Thread do
it "returns a value for current" do
Thread.current.should_not be_nil
end
it "only has current in list" do
Thread.list.should == [Thread.current]
end
it "does not allow creation of new threads" do
lambda do
Thread.new {}
end.should raise_error(NotImplementedError)
end
describe "local storage" do
before do
@current = Thread.current
@current.send(:core_initialize!)
end
it "stores fiber-local variables" do
@current[:a] = 'hello'
@current[:a].should == 'hello'
end
it "returns fiber-local keys that are assigned" do
@current[:a] = 'hello'
@current.key?(:a).should be_true
@current.keys.should === ['a']
end
it "considers fiber-local keys, as symbols or strings equal" do
@current[:a] = 1
@current['a'] = 2
@current.keys.size.should == 1
@current[:a].should == 2
end
it "implements thread-local variables" do
@current.thread_variable_set('a', 1)
@current.thread_variable_get('a').should == 1
@current.thread_variables.should == ['a']
end
it "distinguishes between fiber-local and thread-local variables" do
@current[:a] = 1
@current.thread_variables.should == []
@current.thread_variable_set(:a, 2)
@current[:a].should == 1
@current.thread_variable_get(:a).should == 2
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/thread/thread_queue_spec.rb | spec/opal/stdlib/thread/thread_queue_spec.rb | require 'thread'
describe Thread::Queue do
before do
@queue = Thread::Queue.new
end
it "is aliased as ::Queue" do
::Thread::Queue.should == ::Queue
end
it "will not allow deadlock" do
lambda do
@queue.pop
end.should raise_error(ThreadError)
end
it "pops in FIFO order" do
@queue.push(1)
@queue.push(2)
@queue.pop.should == 1
@queue.pop.should == 2
end
it "can be cleared by clear" do
@queue.push(1)
@queue.clear
@queue.size.should == 0
@queue.empty?.should be_true
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/json/parse_spec.rb | spec/opal/stdlib/json/parse_spec.rb | require 'json'
describe "JSON.parse" do
it "parses null into nil" do
JSON.parse("null").should be_nil
end
it "parses true into true" do
JSON.parse("true").should be_true
end
it "parses false into false" do
JSON.parse("false").should be_false
end
it "parses numbers into numbers" do
JSON.parse("42").should == 42
JSON.parse("3.142").should == 3.142
end
it "parses arrays into ruby arrays" do
JSON.parse("[]").should == []
JSON.parse("[1, 2, 3]").should == [1, 2, 3]
JSON.parse("[[1, 2, 3], [4, 5]]").should == [[1, 2, 3], [4, 5]]
JSON.parse("[null, true, false]").should == [nil, true, false]
end
it "parses object literals into ruby hashes" do
JSON.parse("{}").should == {}
JSON.parse('{"a": "b"}').should == {"a" => "b"}
JSON.parse('{"a": null, "b": 10, "c": [true, false]}').should == {"a" => nil, "b" => 10, "c" => [true, false]}
end
it "raises ParserError for invalid JSON" do
lambda { JSON.parse("invalid_json") }.should raise_error(JSON::ParserError)
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/json/ext_spec.rb | spec/opal/stdlib/json/ext_spec.rb | require 'json'
describe "Hash#to_json" do
it "returns a string of all key and value pairs" do
{}.to_json.should == "{}"
{"a" => 1, "b" => 2}.to_json.should == '{"a":1,"b":2}'
hash = {"a" => 1, "b" => false, "c" => nil, "d" => true}
JSON.parse(hash.to_json).should == hash
end
end
describe "Array#to_json" do
it "returns a string of all array elements converted to json" do
[].to_json.should == "[]"
[1, 2, 3].to_json.should == "[1,2,3]"
[true, nil, false, "3", 42].to_json.should == '[true,null,false,"3",42]'
end
end
describe "Boolean#to_json" do
it "returns 'true' when true" do
true.to_json.should == "true"
end
it "returns 'false' when false" do
false.to_json.should == "false"
end
end
describe "Kernel#to_json" do
it "returns an escaped #to_s of the receiver" do
self.to_json.should be_kind_of(String)
end
end
describe "NilClass#to_json" do
it "returns 'null'" do
nil.to_json.should == "null"
end
end
describe "String#to_json" do
it "returns an escaped string" do
"foo".to_json.should == "\"foo\""
"bar\nbaz".to_json.should == "\"bar\\nbaz\""
end
end
describe "Numeric#to_json" do
it "returns a string representing the number" do
42.to_json.should == "42"
3.142.to_json.should == "3.142"
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/strscan/scan_spec.rb | spec/opal/stdlib/strscan/scan_spec.rb | require 'strscan'
describe "StringScanner#scan" do
context "when the regex has multiple alternatives" do
it "still anchors to the beginning of the remaining text" do
# regression test; see GH issue 1074
scanner = StringScanner.new("10\nb = `2E-16`")
scanner.scan(/[\d_]+\.[\d_]+\b|[\d_]+(\.[\d_]+)?[eE][-+]?[\d_]+\b/).should be_nil
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/template/paths_spec.rb | spec/opal/stdlib/template/paths_spec.rb | require 'spec_helper'
require 'template'
describe Template do
describe ".paths" do
it "should be an array of registered templates" do
Template.paths.should be_kind_of(Array)
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/promise/value_spec.rb | spec/opal/stdlib/promise/value_spec.rb | require 'promise'
describe 'Promise.value' do
it 'resolves the promise with the given value' do
Promise.value(23).value.should == 23
end
it 'marks the promise as realized' do
Promise.value(23).realized?.should be_true
end
it 'marks the promise as resolved' do
Promise.value(23).resolved?.should be_true
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/promise/always_spec.rb | spec/opal/stdlib/promise/always_spec.rb | require 'promise'
describe 'Promise#always' do
it 'calls the block when it was resolved' do
x = 42
Promise.value(23).then { |v| x = v }.always { |v| x = 2 }
x.should == 2
end
it 'calls the block when it was rejected' do
x = 42
Promise.error(23).rescue { |v| x = v }.always { |v| x = 2 }
x.should == 2
end
it 'acts as resolved' do
x = 42
Promise.error(23).rescue { |v| x = v }.always { x = 2 }.then { x = 3 }
x.should == 3
end
it 'can be called multiple times on resolved promises' do
p = Promise.value(2)
x = 1
p.then { x += 1 }
p.fail { x += 2 }
p.always { x += 3 }
x.should == 5
end
it 'can be called multiple times on rejected promises' do
p = Promise.error(2)
x = 1
p.then { x += 1 }
p.fail { x += 2 }
p.always { x += 3 }
x.should == 6
end
it 'raises with always! if a promise has already been chained' do
p = Promise.new
p.then! {}
proc { p.always! {} }.should raise_error(ArgumentError)
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/promise/rescue_spec.rb | spec/opal/stdlib/promise/rescue_spec.rb | require 'promise'
describe 'Promise#rescue' do
it 'calls the block when the promise has already been rejected' do
x = 42
Promise.error(23).rescue { |v| x = v }
x.should == 23
end
it 'calls the block when the promise is rejected' do
a = Promise.new
x = 42
a.rescue { |v| x = v }
a.reject(23)
x.should == 23
end
it 'does not call then blocks when the promise is rejected' do
x = 42
y = 23
Promise.error(23).then { y = 42 }.rescue { |v| x = v }
x.should == 23
y.should == 23
end
it 'does not call subsequent rescue blocks' do
x = 42
Promise.error(23).rescue { |v| x = v }.rescue { x = 42 }
x.should == 23
end
it 'can be called multiple times on the same promise' do
p = Promise.error(2)
x = 1
p.then { x += 1 }
p.rescue { x += 3 }
p.rescue { x += 3 }
x.should == 7
end
it 'raises with rescue! if a promise has already been chained' do
p = Promise.new
p.then! {}
proc { p.rescue! {} }.should raise_error(ArgumentError)
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/promise/then_spec.rb | spec/opal/stdlib/promise/then_spec.rb | require 'promise'
describe 'Promise#then' do
it 'calls the block when the promise has already been resolved' do
x = 42
Promise.value(23).then { |v| x = v }
x.should == 23
end
it 'calls the block when the promise is resolved' do
a = Promise.new
x = 42
a.then { |v| x = v }
a.resolve(23)
x.should == 23
end
it 'works with multiple chains' do
x = 42
Promise.value(2).then { |v| v * 2 }.then { |v| v * 4 }.then { |v| x = v }
x.should == 16
end
it 'works when a block returns a promise' do
a = Promise.new
b = Promise.new
x = 42
a.then { b }.then { |v| x = v }
a.resolve(42)
b.resolve(23)
x.should == 23
end
it 'sends raised exceptions as rejections' do
x = nil
Promise.value(2).then { raise "hue" }.rescue { |v| x = v }
x.should be_kind_of(RuntimeError)
end
it 'sends raised exceptions inside rescue blocks as next errors' do
x = nil
Promise.value(2).then { raise "hue" }.rescue { raise "omg" }.rescue { |v| x = v }
x.should be_kind_of(RuntimeError)
end
it 'allows then to be called multiple times' do
p = Promise.value(2)
x = 1
p.then { x += 1 }
p.then { x += 1 }
x.should == 3
end
it 'raises with then! if a promise has already been chained' do
p = Promise.new
p.then! {}
proc { p.then! {} }.should raise_error(ArgumentError)
end
it 'should pass a delayed falsy value' do
p = Promise.new.resolve(5).then { nil }
p.then do |value|
expect(value).to eq(nil)
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/promise/when_spec.rb | spec/opal/stdlib/promise/when_spec.rb | require 'promise'
describe 'Promise.when' do
it 'calls the block with all promises results' do
a = Promise.new
b = Promise.new
x = 42
Promise.when(a, b).then {|y, z|
x = y + z
}
a.resolve(1)
b.resolve(2)
x.should == 3
end
it 'can be built lazily' do
a = Promise.new
b = Promise.value(3)
x = 42
Promise.when(a).and(b).then {|c, d|
x = c + d
}
a.resolve(2)
x.should == 5
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/promise/trace_spec.rb | spec/opal/stdlib/promise/trace_spec.rb | require 'promise'
describe 'Promise#trace' do
it 'calls the block with all the previous results' do
x = 42
Promise.value(1).then { 2 }.then { 3 }.trace {|a, b, c|
x = a + b + c
}
x.should == 6
end
it 'calls the then after the trace' do
x = 42
Promise.value(1).then { 2 }.then { 3 }.trace {|a, b, c|
a + b + c
}.then { |v| x = v }
x.should == 6
end
it 'includes the first value' do
x = 42
Promise.value(1).trace { |a| x = a }
x.should == 1
end
it 'works after a when' do
x = 42
Promise.value(1).then {
Promise.when Promise.value(2), Promise.value(3)
}.trace {|a, b|
x = a + b[0] + b[1]
}
x.should == 6
end
it 'raises with trace! if a promise has already been chained' do
p = Promise.new
p.then! {}
proc { p.trace! {} }.should raise_error(ArgumentError)
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/promise/error_spec.rb | spec/opal/stdlib/promise/error_spec.rb | require 'promise'
describe 'Promise.error' do
it 'rejects the promise with the given error' do
Promise.error(23).error.should == 23
end
it 'marks the promise as realized' do
Promise.error(23).realized?.should be_true
end
it 'marks the promise as rejected' do
Promise.error(23).rejected?.should be_true
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/stdlib/erb/erb_spec.rb | spec/opal/stdlib/erb/erb_spec.rb | require 'erb'
require File.expand_path('../simple', __FILE__)
require File.expand_path('../quoted', __FILE__)
require File.expand_path('../inline_block', __FILE__)
describe "ERB files" do
before :each do
@simple = Template['opal/stdlib/erb/simple']
@quoted = Template['opal/stdlib/erb/quoted']
@inline_block = Template['opal/stdlib/erb/inline_block']
end
it "should be defined by their filename on Template namespace" do
@simple.should be_kind_of(Template)
end
it "calling the block with a context should render the block" do
@some_data = "hello"
@simple.render(self).should == "<div>hello</div>\n"
end
it "should accept quotes in strings" do
@name = "adam"
@quoted.render(self).should == "<div class=\"foo\">hello there adam</div>\n"
end
it "should be able to handle inline blocks" do
@inline_block.should be_kind_of(Template)
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/language/predefined_spec.rb | spec/opal/language/predefined_spec.rb | require 'spec_helper'
describe "Predefined global $!" do
it "should be set to the new exception after a throwing rescue" do
outer = StandardError.new 'outer'
inner = StandardError.new 'inner'
begin
begin
raise outer
rescue
$!.should == outer
raise inner
end
rescue
$!.should == inner
end
$!.should == nil
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/language/yield_spec.rb | spec/opal/language/yield_spec.rb | require 'spec_helper'
fixture = Class.new do
def single
yield 1
yield 2
end
def multiple
yield 1, 2
yield 3, 4
end
end
describe "The yield call" do
before :each do
ScratchPad.record []
@y = fixture.new
end
describe "taking a single argument" do
it "can yield to a lambda with return" do
lambda = -> i {
ScratchPad << i
return
}
@y.single(&lambda)
ScratchPad.recorded.should == [1, 2]
end
end
describe "taking multiple arguments" do
it "can yield to a lambda with return" do
lambda = -> i, j {
ScratchPad << i
ScratchPad << j
return
}
@y.multiple(&lambda)
ScratchPad.recorded.should == [1, 2, 3, 4]
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/compiler/irb_spec.rb | spec/opal/compiler/irb_spec.rb | require 'spec_helper'
require 'native'
describe Opal::Compiler do
describe "irb parser option" do
it "creates Opal.irb_vars if it does not exist" do
$global["Opal"].irb_vars = nil
eval_js compile("0;nil", :irb => true)
($global["Opal"].irb_vars == nil).should be_false
end
it "does not create Opal.irb_vars if :irb option not passed" do
$global["Opal"].irb_vars = nil
eval_js compile("0;nil")
($global["Opal"].irb_vars == nil).should be_true
end
it "sets each s(:lasgn) in the top level onto irb_vars" do
eval_js compile("foo = 42", :irb => true)
$global["Opal"].irb_vars.foo.should == 42
end
it "gets each s(:lvar) in the top level from irb_vars" do
eval_js compile("foo = 3.142; bar = foo", :irb => true)
$global["Opal"].irb_vars.bar.should == 3.142
end
it "persists local vars between parses" do
eval_js compile("foo = 'hello world'", :irb => true)
eval_js compile("bar = foo.upcase", :irb => true)
$global["Opal"].irb_vars.bar.should == "HELLO WORLD"
end
it "can reference an outer variable" do
eval_js("var a = 10;" + compile("a", :irb => true)).should == 10
end
it "can still call top level methods" do
eval_js(compile("to_s", :irb => true)).should == "main"
end
def compile *args
Opal::Compiler.new(*args).compile
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/compiler/unicode_spec.rb | spec/opal/compiler/unicode_spec.rb | require 'spec_helper'
require 'opal-parser'
describe Opal::Compiler do
describe "unicode support" do
it 'can compile code containing Unicode characters' do
-> { Opal::Compiler.new("'こんにちは'; p 1").compile }.should_not raise_error
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/support/guard_platform.rb | spec/support/guard_platform.rb | class PlatformGuard < SpecGuard
HOST_OS = ENV['OPAL_PLATFORM_NAME']
POINTER_SIZE = ENV['OPAL_POINTER_SIZE'] || WORD_SIZE
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/support/rewriters_helper.rb | spec/support/rewriters_helper.rb | module RewritersHelper
module Common
def s(type, *children)
::Opal::AST::Node.new(type, children)
end
def parse(source)
buffer = Opal::Parser::SourceBuffer.new('(eval)')
buffer.source = source
parser = Opal::Parser.default_parser
parser.parse(buffer)
end
# Parse, but drop the :top node
def ast_of(source)
parse(source).children.first
end
end
module DSL
def use_only_described_rewriter!
around(:each) do |e|
Opal::Rewriter.disable(except: described_class) { e.run }
end
end
end
include Common
def self.included(klass)
klass.extend(Common)
klass.extend(DSL)
end
def rewriter
described_class.new
end
def rewritten(ast = input)
rewriter.process(ast)
end
alias rewrite rewritten
alias processed rewritten
def expect_rewritten(ast)
expect(rewritten(ast))
end
def expect_no_rewriting_for(ast)
expect_rewritten(ast).to eq(ast)
end
def parse_without_rewriting(source)
Opal::Rewriter.disable { parse(source) }
end
end
RSpec.shared_examples 'it rewrites source-to-source' do |from_source, to_source|
it "rewrites source #{from_source} to source #{to_source}" do
rewritten = parse(from_source)
expected = parse(to_source)
expect(rewritten).to eq(expected)
end
end
RSpec.shared_examples 'it rewrites source-to-AST' do |from_source, to_ast|
it "rewrites source #{from_source} to AST #{to_ast}" do
rewritten = parse(from_source).children.first
expect(rewritten).to eq(to_ast)
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/support/match_helpers.rb | spec/support/match_helpers.rb | module MatchHelpers
class MatchMatcher
def initialize(expected)
fail "Expected #{expected} to be a Regexp!" unless expected.is_a?(Regexp)
@expected = expected
end
def matches?(actual)
@actual = actual
@expected.match(@actual)
end
def failure_message
["Expected #{@actual.inspect} (#{@actual.class})",
"to match #{@expected}"]
end
def negative_failure_message
["Expected #{@actual.inspect} (#{@actual.class})",
"not to match #{@expected}"]
end
end
class EndWithHelper
def initialize(expected)
@expected = expected
end
def matches?(actual)
@actual = actual
@actual.end_with?(@expected)
end
def failure_message
["Expected #{@actual.inspect} (#{@actual.class})",
"to end with #{@expected}"]
end
def negative_failure_message
["Expected #{@actual.inspect} (#{@actual.class})",
"not to end with #{@expected}"]
end
end
end
if !defined? RSpec
class Object
def match(expected)
MatchHelpers::MatchMatcher.new(expected)
end
def end_with(expected)
MatchHelpers::EndWithHelper.new(expected)
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/support/source_map_helper.rb | spec/support/source_map_helper.rb | module SourceMapHelper
extend self
# Just for debugging purposes
def inspect_source(source)
puts source_with_lines(source)
end
# Just for debugging purposes
def source_with_lines(source)
source.split("\n", -1).map.with_index { |line, index| "#{(index).to_s.rjust(3)} | #{line}" }.join("\n")
end
def fragment(line: nil, column: nil, source_map_name: nil, code: '', sexp_type: nil)
double('Fragment', line: line, column: column, source_map_name: source_map_name, code: code, sexp_type: sexp_type)
end
SourcePosition = Struct.new(:line, :column, :file) do
def inspect
"#<SourcePosition line:#{line} column:#{column} file:#{file.inspect}>"
end
alias_method :to_s, :inspect
def in_source(source)
source.split("\n", -1)[line].to_s[column..-1]
end
def self.absolutize_mappings(relative_mappings)
reference_segment = [0, 0, 0, 0, 0]
relative_mappings.map do |relative_mapping|
# Reference: [generated_column, source_index, original_line, original_column, map_name_index]
reference_segment[0] = 0 # reset the generated_column at each new line
relative_mapping.map do |relative_segment|
segment = []
segment[0] = relative_segment[0].to_int + reference_segment[0].to_int
segment[1] = relative_segment[1].to_int + (reference_segment[1] || 0).to_int if relative_segment[1]
segment[2] = relative_segment[2].to_int + (reference_segment[2] || 0).to_int if relative_segment[2]
segment[3] = relative_segment[3].to_int + (reference_segment[3] || 0).to_int if relative_segment[3]
segment[4] = relative_segment[4].to_int + (reference_segment[4] || 0).to_int if relative_segment[4]
reference_segment = segment
segment
end
end
end
def find_section_in_map_index(index_map)
sections = index_map.to_h[:sections]
section, _section_index = sections.each.with_index.find do |map, index|
next_map = sections[index + 1] or next true # if there's no next map the current one is good
(
line > map[:offset][:line] || (line == map[:offset][:line] && column >= map[:offset][:column])
) && (
line < next_map[:offset][:line] || (line == next_map[:offset][:line] && column < map[:offset][:column])
)
end
section or raise "no map found for #{inspect} among available sections: #{sections.map { |s| s[:offset] }}"
end
def mapped_with(map)
case map
when Opal::SourceMap::Index
offset_section = find_section_in_map_index(map)
offset = offset_section[:offset] || raise(offset_section.inspect)
offset_line = line - offset[:line]
offset_column = line.zero? ? (column - offset[:column]) : column
offset_position = self.class.new(offset_line, offset_column, offset_section[:map][:sources].first)
offset_position.mapped_with_file_map(offset_section[:map])
when Opal::SourceMap::File
mapped_with_file_map(map.to_h)
else raise "unknown map type: #{map.inspect}"
end
end
def mapped_with_file_map(map_to_h)
relative_mappings = Opal::SourceMap::VLQ.decode_mappings(map_to_h[:mappings])
absolute_mappings = SourcePosition.absolutize_mappings(relative_mappings)
mappings_line = absolute_mappings[line] or raise(
"can't find a mapping for #{inspect} in the available #{absolute_mappings.size} absolute mappings: #{absolute_mappings.inspect}"
)
# keep all segments with a column from the required position on
code_before_segment_strategy = -> segments {
segments.select do |segment|
segment[0] >= column
end.sort_by do |segment|
segment[0] - column # sort by the distance from the required position
end.first
}
code_after_segment_strategy = -> segments {
segments.select do |segment|
column >= segment[0]
end.sort_by do |segment|
column - segment[0] # sort by the distance from the required position
end.first
}
absolute_segments = absolute_mappings[line] or raise
matched_segment = code_before_segment_strategy[absolute_segments] || code_after_segment_strategy[absolute_segments]
raise "can't find a matching segment for #{inspect} in #{absolute_mappings[line]}" unless matched_segment
source_index = matched_segment[1]
original_source = map_to_h[:sources][source_index]
original_line = matched_segment[2]
original_column = matched_segment[3]
self.class.new(original_line, original_column, original_source)
end
def original_source(map)
map_to_h = map.to_h
matching_source = -> map_data { map_data[:sourcesContent].first if map_data[:sources] == [file] }
(map_to_h[:sections] || [{offset: {}, map: map_to_h}]).map { |section| matching_source[section[:map]] }.compact.first or
raise "can't find a source for #{file.inspect} in #{map_to_h.to_json}"
end
def self.find_code(code, source:)
line_contents, line = source.split("\n", -1).to_enum.with_index.find do |contents, index|
contents.include? code
end
return nil if line_contents.nil?
column = line_contents.index(code)
new(line, column)
end
end
RSpec::Matchers.define :be_at_line_and_column do |line, column, source:|
expected_position = SourcePosition.new(line, column)
match do |code|
actual_position = SourcePosition.find_code(code, source: source)
actual_position == expected_position
end
failure_message do |code|
actual_position = SourcePosition.find_code(code, source: source)
actual_code = expected_position.in_source(source)
"expected #{code.inspect} to be at #{expected_position}, " +
"instead #{actual_code.inspect} was found at the expected position, while code was found at #{actual_position}"
end
end
RSpec::Matchers.define :be_mapped_to_line_and_column do |line, column, source:, map:, file: nil|
expected_position = SourcePosition.new(line, column, file)
match do |code|
actual_position = SourcePosition.find_code(code, source: source).mapped_with(map)
actual_position == expected_position
end
failure_message do |code|
code_position = SourcePosition.find_code(code, source: source)
actual_position = code_position.mapped_with(map)
expected_source = expected_position.original_source(map)
expected_code = expected_position.in_source(expected_source)
actual_source = actual_position.original_source(map)
actual_code = actual_position.in_source(actual_source)
if Opal::SourceMap::Index === map
actual_section = actual_position.find_section_in_map_index(map)
expected_section = expected_position.find_section_in_map_index(map)
map.to_h[:sections].each { |s| p s[:offset] }
actual_offset = " (offset: #{actual_section[:offset]})"
expected_offset = " (offset: #{expected_section[:offset]})"
end
"expected #{code.inspect} at #{code_position.inspect} to be mapped to #{expected_position.inspect}" +
"\n\nEXPECTED #{expected_code.inspect} at #{expected_position}#{expected_offset}:\n"+
source_with_lines(expected_source) +
"\n\nACTUAL #{actual_code.inspect} at #{actual_position}#{actual_offset}:\n"+
source_with_lines(actual_source) +
"\n"
end
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/support/mspec_rspec_adapter.rb | spec/support/mspec_rspec_adapter.rb | module MSpecRSpecAdapter
def expect(object)
MSpecRSpecAdapterShould.new(object)
end
def eq(expected)
MSpecRSpecAdapterEq.new(expected)
end
class MSpecRSpecAdapterEq < Struct.new(:object)
end
class MSpecRSpecAdapterShould < Struct.new(:object)
def to(expectation)
apply_expectation(:should, expectation)
end
def apply_expectation(type, expectation)
if MSpecRSpecAdapterEq === expectation
object.send(type) == expectation.object
else
object.send(type, expectation)
end
end
def not_to(expectation)
apply_expectation(:should_not, expectation)
end
alias to_not not_to
end
end
include MSpecRSpecAdapter unless defined? RSpec
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/mspec-opal/formatters.rb | spec/mspec-opal/formatters.rb | # backtick_javascript: true
class BaseOpalFormatter
def initialize(out=nil)
@exception = @failure = false
@exceptions = []
@count = 0
@examples = 0
@current_state = nil
end
def register
MSpec.register :exception, self
MSpec.register :before, self
MSpec.register :after, self
MSpec.register :start, self
MSpec.register :finish, self
MSpec.register :abort, self
MSpec.register :enter, self
end
def red(str)
`console.error(str)`
end
def green(str)
`console.info(str)`
end
def cyan(str)
`console.info(str)`
end
def log(str)
`console.log(str)`
end
def exception?
@exception
end
def failure?
@failure
end
def enter(describe); end
def before(state = nil)
@current_state = state
@failure = @exception = false
end
def exception(exception)
@count += 1
@failure = @exception ? @failure && exception.failure? : exception.failure?
@exception = true
@exceptions << exception
end
def after(state = nil)
@current_state = nil
@examples += 1
end
def start
@start_time = Time.now.to_f
end
def finish
time = Time.now.to_f - @start_time
if @exceptions.empty?
log "\nFinished"
green "#{@examples} examples, #{@count} failures (time taken: #{time})\n"
finish_with_code 0
else
log "\nFailures:"
@exceptions.each_with_index do |exception, idx|
log "\n #{idx + 1}. #{exception.description}"
red "\n #{exception.message}"
log "\n #{`#{exception.exception}.stack`}\n"
end
log "\nFinished"
red "#{@examples} examples, #{@count} failures (time taken: #{time})"
log "\n\nFilters for failed examples:\n\n"
@exceptions.map do |exception|
["#{exception.describe} #{exception.it}", exception.message.tr("\n", " ")]
end.sort.each do |(description, message)|
red "fails #{description.inspect}"
cyan " # #{message}\n"
end
log "\n"
finish_with_code(1)
end
end
def finish_with_code(code)
exit(code)
end
end
class BrowserFormatter < BaseOpalFormatter
def initialize(*args, &block)
$passed = 0
$failed = 0
$errored = 0
super
end
def print_example(state)
unless exception?
$passed += 1
else
if failure?
$failed += 1
else
$errored += 1
end
end
end
end
class ColoredDottedFormatter < BaseOpalFormatter
def red(str)
print "\e[31m"+str+"\e[0m"
end
def green(str)
print "\e[32m"+str+"\e[0m"
end
def cyan(str)
print "\e[36m"+str+"\e[0m"
end
def log(str)
puts str
end
def after(state)
super
print_example(state)
end
def print_example(state)
unless exception?
green('.')
else
red(failure? ? 'F' : 'E')
end
end
def finish_with_code(code)
exit(code)
end
end
class NodeJSFormatter < ColoredDottedFormatter
def red(str)
`process.stdout.write("\u001b[31m"+#{str}+"\u001b[0m")`
end
def green(str)
`process.stdout.write("\u001b[32m"+#{str}+"\u001b[0m")`
end
def cyan(str)
`process.stdout.write("\u001b[36m"+#{str}+"\u001b[0m")`
end
end
class NodeJSDocFormatter < NodeJSFormatter
def before(example)
print example.description
end
def print_example(state)
(@exception && state) ? red(" ✗\n") : green(" ✓\n")
end
end
module InvertedFormatter
def initialize(out=nil)
super
@actually_passing = []
end
def register
MSpec.register :before, self
MSpec.register :exception, self
MSpec.register :after, self
MSpec.register :finish, self
end
def after(state=nil)
@actually_passing << @current_state unless exception?
super
end
def finish
puts "\n\nExpected #{@actually_passing.size} examples to fail:\n"
@actually_passing.each_with_index do |example, idx|
puts " #{idx + 1}) #{example.description.inspect}"
end
puts "\n"
end
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/mspec-opal/runner.rb | spec/mspec-opal/runner.rb | # backtick_javascript: true
require 'mspec-opal/formatters'
class OSpecFilter
def self.main
@main ||= self.new
end
def initialize
@filters = Set.new
@seen = Set.new
end
def register
if ENV['INVERT_RUNNING_MODE']
MSpec.register :include, self
else
MSpec.register :exclude, self
end
end
def ===(description)
@seen << description
@filters.include?(description)
end
def register_filters(description, block)
instance_eval(&block)
end
def fails(description)
@filters << description
end
def fails_badly(description)
if ENV['INVERT_RUNNING_MODE']
warn "WARNING: FAILS BADLY: Ignoring filter to avoid blocking the suite: #{description.inspect}"
else
@filters << description
end
end
def unused_filters_message(list: false)
unused = @filters - @seen
return if unused.size == 0
if list
puts
puts "Unused filters:"
unused.each {|u| puts " fails #{u.inspect}"}
puts
else
warn "\nThere are #{unused.size} unused filters, re-run with ENV['LIST_UNUSED_FILTERS'] = true to list them\n\n"
end
end
end
class Object
def opal_filter(description, &block)
OSpecFilter.main.register_filters(description, block)
end
alias opal_unsupported_filter opal_filter
end
# MSpec relies on File.readable? to do method detection on backtraces
class File
def self.readable?(path)
false
end
end
class OSpecFormatter
def self.main
@main ||= self.new
end
def default_formatter
formatters = {
'browser' => BrowserFormatter,
'server' => BrowserFormatter,
'chrome' => DottedFormatter,
'firefox' => DottedFormatter,
'safari' => DottedFormatter,
'bun' => NodeJSFormatter,
'deno' => NodeJSFormatter,
'node' => NodeJSFormatter,
'nodejs' => NodeJSFormatter,
'gjs' => ColoredDottedFormatter,
'quickjs' => ColoredDottedFormatter,
'nodedoc' => NodeJSDocFormatter,
'nodejsdoc' => NodeJSDocFormatter,
'dotted' => DottedFormatter
}
formatter = formatters.fetch(ENV['FORMATTER']) do
warn "Using the default 'dotted' formatter, set the FORMATTER env var to select a different formatter (was: #{ENV['FORMATTER'].inspect}, options: #{formatters.keys.join(", ")})"
DottedFormatter
end
if ENV['INVERT_RUNNING_MODE'] && !ENV['PATTERN']
formatter = Class.new(formatter)
formatter.include InvertedFormatter
end
formatter
end
def register(formatter_class = default_formatter)
formatter_class.new.register
end
end
class OpalBM
def self.main
@main ||= self.new
end
def register(repeat, bm_filepath)
`self.bm = {}`
`self.bm_filepath = bm_filepath`
MSpec.repeat = repeat
MSpec.register :before, self
MSpec.register :after, self
MSpec.register :finish, self
end
def before(state = nil)
%x{
if (self.bm && !self.bm.hasOwnProperty(state.description)) {
self.bm[state.description] = {started: Date.now()};
}
}
end
def after(state = nil)
%x{
if (self.bm) {
self.bm[state.description].stopped = Date.now();
}
}
end
def finish
%x{
var obj = self.bm, key, val, report = '';
if (obj) {
for (key in obj) {
if (obj.hasOwnProperty(key)) {
val = obj[key];
report += key.replace(/\s/g, '_') + ' ' + ((val.stopped - val.started) / 1000) + '\n';
}
}
require('fs').writeFileSync(self.bm_filepath, report);
}
}
end
end
module OutputSilencer
def silence_stdout
original_stdout = $stdout
new_stdout = IO.new(1, 'w')
new_stdout.write_proc = ->s{}
begin
$stdout = new_stdout
yield
ensure
$stdout = original_stdout
end
end
end
OSpecFormatter.main.register
OSpecFilter.main.register
MSpec.enable_feature :encoding
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/pack_unpack.rb | spec/filters/bugs/pack_unpack.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "String#unpack" do
fails "String#unpack with format 'A' decodes into raw (ascii) string values" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "String#unpack with format 'H' should make strings with US_ASCII encoding" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "String#unpack with format 'Q' adds nil for each element requested beyond the end of the String" # Expected [7523094288207668000, nil, nil] to be computed by "abcdefgh".unpack from "Q3" (computed [7523094288207667000, nil, nil] instead)
fails "String#unpack with format 'Q' decodes one long for a single format character" # Expected [7523094288207667000] == [7523094288207668000] to be truthy but was false
fails "String#unpack with format 'Q' decodes the number of longs requested by the count modifier" # Expected [7523094283929477000, 7378418357791582000] == [7523094283929478000, 7378418357791582000] to be truthy but was false
fails "String#unpack with format 'Q' decodes two longs for two format characters" # Expected [7233738012216484000, 7233733596956420000] == [7233738012216485000, 7233733596956420000] to be truthy but was false
fails "String#unpack with format 'Q' ignores NULL bytes between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'Q' ignores spaces between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '<' decodes one long for a single format character" # Expected [7523094288207667000] == [7523094288207668000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '<' decodes the number of longs requested by the count modifier" # Expected [7523094283929477000, 7378418357791582000] == [7523094283929478000, 7378418357791582000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '<' decodes two longs for two format characters" # Expected [7233738012216484000, 7233733596956420000] == [7233738012216485000, 7233733596956420000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '<' ignores NULL bytes between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '<' ignores spaces between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '>' decodes one long for a single format character" # Expected [7523094288207667000] == [7523094288207668000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '>' decodes the number of longs requested by the count modifier" # Expected [7523094283929477000, 7378418357791582000] == [7523094283929478000, 7378418357791582000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '>' decodes two longs for two format characters" # Expected [7233738012216484000, 7233733596956420000] == [7233738012216485000, 7233733596956420000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '>' ignores NULL bytes between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'Q' with modifier '>' ignores spaces between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'U' decodes UTF-8 max codepoints" # Expected [65536] to be computed by "𐀀".unpack from "U" (computed [55296, 56320] instead)
fails "String#unpack with format 'U' does not decode any items for directives exceeding the input string size" # Exception: Cannot read properties of undefined (reading '$hash')
fails "String#unpack with format 'a' decodes into raw (ascii) string values" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "String#unpack with format 'b' decodes into US-ASCII string values" # Expected "UTF-8" == "US-ASCII" to be truthy but was false
fails "String#unpack with format 'h' should make strings with US_ASCII encoding" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "String#unpack with format 'm' produces binary strings" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "String#unpack with format 'q' adds nil for each element requested beyond the end of the String" # Expected [7523094288207668000, nil, nil] to be computed by "abcdefgh".unpack from "q3" (computed [7523094288207667000, nil, nil] instead)
fails "String#unpack with format 'q' decodes a long with most significant bit set as a negative number" # Expected [-71870673923813380] == [-71870673923814400] to be truthy but was false
fails "String#unpack with format 'q' decodes one long for a single format character" # Expected [7523094288207667000] == [7523094288207668000] to be truthy but was false
fails "String#unpack with format 'q' decodes the number of longs requested by the count modifier" # Expected [7523094283929477000, 7378418357791582000] == [7523094283929478000, 7378418357791582000] to be truthy but was false
fails "String#unpack with format 'q' decodes two longs for two format characters" # Expected [7233738012216484000, 7233733596956420000] == [7233738012216485000, 7233733596956420000] to be truthy but was false
fails "String#unpack with format 'q' ignores NULL bytes between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'q' ignores spaces between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '<' decodes a long with most significant bit set as a negative number" # Expected [-71870673923813380] == [-71870673923814400] to be truthy but was false
fails "String#unpack with format 'q' with modifier '<' decodes one long for a single format character" # Expected [7523094288207667000] == [7523094288207668000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '<' decodes the number of longs requested by the count modifier" # Expected [7523094283929477000, 7378418357791582000] == [7523094283929478000, 7378418357791582000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '<' decodes two longs for two format characters" # Expected [7233738012216484000, 7233733596956420000] == [7233738012216485000, 7233733596956420000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '<' ignores NULL bytes between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '<' ignores spaces between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '>' decodes a long with most significant bit set as a negative number" # Expected [-71870673923813380] == [-71870673923814400] to be truthy but was false
fails "String#unpack with format 'q' with modifier '>' decodes one long for a single format character" # Expected [7523094288207667000] == [7523094288207668000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '>' decodes the number of longs requested by the count modifier" # Expected [7523094283929477000, 7378418357791582000] == [7523094283929478000, 7378418357791582000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '>' decodes two longs for two format characters" # Expected [7233738012216484000, 7233733596956420000] == [7233738012216485000, 7233733596956420000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '>' ignores NULL bytes between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'q' with modifier '>' ignores spaces between directives" # Expected [7523094288207667000, 7233738012216484000] == [7523094288207668000, 7233738012216485000] to be truthy but was false
fails "String#unpack with format 'u' decodes into raw (ascii) string values" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
end
opal_filter "Array#pack" do
fails "Array#pack with format 'A' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
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)
fails "Array#pack with format 'C' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
fails "Array#pack with format 'L' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
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
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)
fails "Array#pack with format 'L' with modifier '>' and '!' encodes all remaining elements when passed the '*' modifier" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '!' encodes the least significant 32 bits of a negative number" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '!' encodes the least significant 32 bits of a positive number" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '!' encodes the number of array elements specified by the count modifier" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '!' ignores NULL bytes between directives" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '!' ignores spaces between directives" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
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
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)
fails "Array#pack with format 'L' with modifier '>' and '_' encodes all remaining elements when passed the '*' modifier" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '_' encodes the least significant 32 bits of a negative number" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '_' encodes the least significant 32 bits of a positive number" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '_' encodes the number of array elements specified by the count modifier" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '_' ignores NULL bytes between directives" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' and '_' ignores spaces between directives" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' 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
fails "Array#pack with format 'L' with modifier '>' encodes a Float truncated as an Integer" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' encodes all remaining elements when passed the '*' modifier" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' encodes the least significant 32 bits of a negative number" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' encodes the least significant 32 bits of a positive number" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' encodes the number of array elements specified by the count modifier" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' ignores NULL bytes between directives" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'L' with modifier '>' ignores spaces between directives" # RuntimeError: Unsupported pack directive "L>" (no chunk reader defined)
fails "Array#pack with format 'U' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
fails "Array#pack with format 'U' encodes values larger than UTF-8 max codepoints" # RangeError: value out of range
fails "Array#pack with format 'U' raises a TypeError if #to_int does not return an Integer" # Expected TypeError but no exception was raised ("\u0005" was returned)
fails "Array#pack with format 'a' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
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)
fails "Array#pack with format 'c' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
fails "Array#pack with format 'l' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
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
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)
fails "Array#pack with format 'l' with modifier '>' and '!' encodes all remaining elements when passed the '*' modifier" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '!' encodes the least significant 32 bits of a negative number" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '!' encodes the least significant 32 bits of a positive number" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '!' encodes the number of array elements specified by the count modifier" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '!' ignores NULL bytes between directives" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '!' ignores spaces between directives" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
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
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)
fails "Array#pack with format 'l' with modifier '>' and '_' encodes all remaining elements when passed the '*' modifier" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '_' encodes the least significant 32 bits of a negative number" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '_' encodes the least significant 32 bits of a positive number" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '_' encodes the number of array elements specified by the count modifier" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '_' ignores NULL bytes between directives" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' and '_' ignores spaces between directives" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' 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
fails "Array#pack with format 'l' with modifier '>' encodes a Float truncated as an Integer" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' encodes all remaining elements when passed the '*' modifier" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' encodes the least significant 32 bits of a negative number" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' encodes the least significant 32 bits of a positive number" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' encodes the number of array elements specified by the count modifier" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' ignores NULL bytes between directives" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'l' with modifier '>' ignores spaces between directives" # RuntimeError: Unsupported pack directive "l>" (no chunk reader defined)
fails "Array#pack with format 'u' appends a newline to the end of the encoded string" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' calls #to_str to coerce the directives string" # RuntimeError: Unsupported pack directive "x" (no chunk reader defined)
fails "Array#pack with format 'u' calls #to_str to convert an object to a String" # Mock 'pack m string' expected to receive to_str("any_args") exactly 1 times but received it 0 times
fails "Array#pack with format 'u' emits a newline after complete groups of count / 3 input characters when passed a count modifier" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' encodes 1, 2, or 3 characters in 4 output characters (uuencoding)" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' encodes all ascii characters" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' encodes an empty string as an empty string" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' encodes one element per directive" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' ignores whitespace in the format string" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' implicitly has a count of 45 when passed '*', 0, 1, 2 or no count modifier" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' prepends the length of each segment of the input string as the first character (+32) in each line of the output" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' raises a TypeError if #to_str does not return a String" # Expected TypeError but got: RuntimeError (Unsupported pack directive "u" (no chunk reader defined))
fails "Array#pack with format 'u' raises a TypeError if passed an Integer" # Expected TypeError but got: RuntimeError (Unsupported pack directive "u" (no chunk reader defined))
fails "Array#pack with format 'u' raises a TypeError if passed nil" # Expected TypeError but got: RuntimeError (Unsupported pack directive "u" (no chunk reader defined))
fails "Array#pack with format 'u' raises an ArgumentError if there are fewer elements than the format requires" # Expected ArgumentError but got: RuntimeError (Unsupported pack directive "u" (no chunk reader defined))
fails "Array#pack with format 'u' sets the output string to US-ASCII encoding" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/proc.rb | spec/filters/bugs/proc.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Proc" do
fails "Proc#<< composition is a lambda when parameter is lambda" # Expected #<Proc:0x58f9a>.lambda? to be truthy but was false
fails "Proc#<< does not try to coerce argument with #to_proc" # Expected TypeError (callable object is expected) but no exception was raised (#<Proc:0x58f4c> was returned)
fails "Proc#<< raises TypeError if passed not callable object" # Expected TypeError (callable object is expected) but no exception was raised (#<Proc:0x58f74> was returned)
fails "Proc#== is a public method" # Expected Proc to have public instance method '==' but it does not
fails "Proc#== returns true if other is a dup of the original" # Expected false to be true
fails "Proc#=== can call its block argument declared with a block argument" # Expected 6 == 10 to be truthy but was false
fails "Proc#=== on a Proc created with Kernel#lambda or Kernel#proc ignores excess arguments when self is a proc" # ArgumentError: expected kwargs
fails "Proc#=== yields to the block given at declaration and not to the block argument" # Expected 3 == 7 to be truthy but was false
fails "Proc#>> composition is a lambda when self is lambda" # Expected #<Proc:0x5903a>.lambda? to be truthy but was false
fails "Proc#>> does not try to coerce argument with #to_proc" # Expected TypeError (callable object is expected) but no exception was raised (#<Proc:0x58fe8> was returned)
fails "Proc#>> raises TypeError if passed not callable object" # Expected TypeError (callable object is expected) but no exception was raised (#<Proc:0x59010> was returned)
fails "Proc#[] can call its block argument declared with a block argument" # Expected 6 == 10 to be truthy but was false
fails "Proc#[] yields to the block given at declaration and not to the block argument" # Expected 3 == 7 to be truthy but was false
fails "Proc#arity for instances created with proc { || } returns positive values for definition \n @a = proc { |(a, (*b, c)), d=1| }\n @b = proc { |a, (*b, c), d, (*e), (*), **k| }" # Expected -2 == 1 to be truthy but was false
fails "Proc#arity for instances created with proc { || } returns positive values for definition \n @a = proc { |a, b=1| }\n @b = proc { |a, b, c=1, d=2| }" # Expected -2 == 1 to be truthy but was false
fails "Proc#arity for instances created with proc { || } returns zero for definition \n @a = proc { |**k, &l| }\n @b = proc { |a: 1, b: 2, **k| }" # Expected -1 == 0 to be truthy but was false
fails "Proc#arity for instances created with proc { || } returns zero for definition \n @a = proc { |a: 1| }\n @b = proc { |a: 1, b: 2| }" # Expected -1 == 0 to be truthy but was false
fails "Proc#arity for instances created with proc { || } returns zero for definition \n @a = proc { |a=1, b: 2| }\n @b = proc { |a=1, b: 2| }" # Expected -1 == 0 to be truthy but was false
fails "Proc#arity for instances created with proc { || } returns zero for definition \n @a = proc { |a=1| }\n @b = proc { |a=1, b=2| }" # Expected -1 == 0 to be truthy but was false
fails "Proc#binding returns the binding associated with self" # RuntimeError: Evaluation on a Proc#binding is not supported
fails "Proc#call can call its block argument declared with a block argument" # Expected 6 == 10 to be truthy but was false
fails "Proc#call on a Proc created with Kernel#lambda or Kernel#proc ignores excess arguments when self is a proc" # ArgumentError: expected kwargs
fails "Proc#call yields to the block given at declaration and not to the block argument" # Expected 3 == 7 to be truthy but was false
fails "Proc#clone returns an instance of subclass" # Expected Proc == #<Class:0x71d98> to be truthy but was false
fails "Proc#curry with arity argument returns Procs with arities of -1 regardless of the value of _arity_" # ArgumentError: wrong number of arguments (3 for 1)
fails "Proc#curry with arity argument returns a Proc if called on a lambda that requires fewer than _arity_ arguments but may take more" # ArgumentError: wrong number of arguments (4 for 5)
fails "Proc#dup returns an instance of subclass" # Expected Proc == #<Class:0x8f364> to be truthy but was false
fails "Proc#eql? is a public method" # Expected Proc to have public instance method 'eql?' but it does not
fails "Proc#eql? returns true if other is a dup of the original" # Expected false to be true
fails "Proc#inspect for a proc created with Proc.new has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#inspect for a proc created with Proc.new returns a description including file and line number" # Expected "#<Proc:0x122d8>" =~ /^#<Proc:([^ ]*?) ruby\/core\/proc\/shared\/to_s\.rb:4>$/ to be truthy but was nil
fails "Proc#inspect for a proc created with Symbol#to_proc has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#inspect for a proc created with Symbol#to_proc returns a description including '(&:symbol)'" # Expected "#<Proc:0x12484>".include? "(&:foobar)" to be truthy but was false
fails "Proc#inspect for a proc created with UnboundMethod#to_proc has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#inspect for a proc created with UnboundMethod#to_proc returns a description including '(lambda)' and optionally including file and line number" # Expected "#<Proc:0x1241a>" =~ /^#<Proc:([^ ]*?) \(lambda\)>$/ to be truthy but was nil
fails "Proc#inspect for a proc created with lambda has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#inspect for a proc created with lambda returns a description including '(lambda)' and including file and line number" # Expected "#<Proc:0x12342>" =~ /^#<Proc:([^ ]*?) ruby\/core\/proc\/shared\/to_s\.rb:14 \(lambda\)>$/ to be truthy but was nil
fails "Proc#inspect for a proc created with proc has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#inspect for a proc created with proc returns a description including file and line number" # Expected "#<Proc:0x123ac>" =~ /^#<Proc:([^ ]*?) ruby\/core\/proc\/shared\/to_s\.rb:24>$/ to be truthy but was nil
fails "Proc#lambda? is preserved when passing a Proc with & to the lambda keyword" # Expected true to be false
fails "Proc#lambda? is preserved when passing a Proc with & to the proc keyword" # Expected false to be true
fails "Proc#ruby2_keywords applies to the underlying method and applies across duplication" # Expected false == true to be truthy but was false
fails "Proc#ruby2_keywords marks the final hash argument as keyword hash" # Expected false == true to be truthy but was false
fails "Proc#ruby2_keywords prints warning when a proc accepts keyword splat" # Expected warning to match: /Skipping set of ruby2_keywords flag for/ but got: ""
fails "Proc#ruby2_keywords prints warning when a proc accepts keywords" # Expected warning to match: /Skipping set of ruby2_keywords flag for/ but got: ""
fails "Proc#ruby2_keywords prints warning when a proc does not accept argument splat" # Expected warning to match: /Skipping set of ruby2_keywords flag for/ but got: ""
fails "Proc#source_location returns an Array" # Expected nil (NilClass) to be an instance of Array
fails "Proc#source_location returns the same value for a proc-ified method as the method reports" # Expected ["ruby/core/proc/fixtures/source_location.rb", 3] == nil to be truthy but was false
fails "Proc#source_location sets the first value to the path of the file in which the proc was defined" # Expected "ruby/core/proc/fixtures/source_location.rb" == "./ruby/core/proc/fixtures/source_location.rb" to be truthy but was false
fails "Proc#source_location sets the last value to an Integer representing the line on which the proc was defined" # NoMethodError: undefined method `last' for nil
fails "Proc#source_location works for eval with a given line" # Expected nil == ["foo", 100] to be truthy but was false
fails "Proc#to_s for a proc created with Proc.new has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#to_s for a proc created with Proc.new returns a description including file and line number" # Expected "#<Proc:0x5813e>" =~ /^#<Proc:([^ ]*?) ruby\/core\/proc\/shared\/to_s\.rb:4>$/ to be truthy but was nil
fails "Proc#to_s for a proc created with Symbol#to_proc has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#to_s for a proc created with Symbol#to_proc returns a description including '(&:symbol)'" # Expected "#<Proc:0x582ea>".include? "(&:foobar)" to be truthy but was false
fails "Proc#to_s for a proc created with UnboundMethod#to_proc has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#to_s for a proc created with UnboundMethod#to_proc returns a description including '(lambda)' and optionally including file and line number" # Expected "#<Proc:0x58280>" =~ /^#<Proc:([^ ]*?) \(lambda\)>$/ to be truthy but was nil
fails "Proc#to_s for a proc created with lambda has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#to_s for a proc created with lambda returns a description including '(lambda)' and including file and line number" # Expected "#<Proc:0x581a8>" =~ /^#<Proc:([^ ]*?) ruby\/core\/proc\/shared\/to_s\.rb:14 \(lambda\)>$/ to be truthy but was nil
fails "Proc#to_s for a proc created with proc has a binary encoding" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Proc#to_s for a proc created with proc returns a description including file and line number" # Expected "#<Proc:0x58212>" =~ /^#<Proc:([^ ]*?) ruby\/core\/proc\/shared\/to_s\.rb:24>$/ to be truthy but was nil
fails "Proc#yield can call its block argument declared with a block argument" # Expected 6 == 10 to be truthy but was false
fails "Proc#yield on a Proc created with Kernel#lambda or Kernel#proc ignores excess arguments when self is a proc" # ArgumentError: expected kwargs
fails "Proc#yield yields to the block given at declaration and not to the block argument" # Expected 3 == 7 to be truthy but was false
fails "Proc.allocate raises a TypeError" # Expected TypeError but no exception was raised (#<Proc:0x38dee> was returned)
fails "Proc.new with a block argument called indirectly from a subclass returns the passed proc created from a block" # Expected Proc == ProcSpecs::MyProc to be truthy but was false
fails "Proc.new with a block argument called indirectly from a subclass returns the passed proc created from a method" # Expected Proc == ProcSpecs::MyProc to be truthy but was false
fails "Proc.new with a block argument called indirectly from a subclass returns the passed proc created from a symbol" # Expected Proc == ProcSpecs::MyProc to be truthy but was false
fails "Proc.new with an associated block called on a subclass of Proc returns an instance of the subclass" # Expected Proc == #<Class:0x3fc14> to be truthy but was false
fails "Proc.new with an associated block called on a subclass of Proc that does not 'super' in 'initialize' still constructs a functional proc" # NoMethodError: undefined method `ok' for #<Proc:0x3fc56>
fails "Proc.new with an associated block called on a subclass of Proc using a reified block parameter returns an instance of the subclass" # Expected Proc == #<Class:0x3fc3e> to be truthy but was false
fails "Proc.new with an associated block calls initialize on the Proc object" # ArgumentError: [MyProc2.new] wrong number of arguments (given 2, expected 0)
fails "Proc.new with an associated block returns a subclass of Proc" # Expected #<Proc:0x3fbfc> (Proc) to be kind of ProcSpecs::MyProc
fails "Proc.new without a block raises an ArgumentError when passed no block" # Expected ArgumentError (tried to create Proc object without a block) but got: ArgumentError (tried to create a Proc object without a block)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/main.rb | spec/filters/bugs/main.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "main" do
fails "main#include in a file loaded with wrapping includes the given Module in the load wrapper" # ArgumentError: [MSpecEnv#load] wrong number of arguments (given 2, expected 1)
fails "main#private raises a NameError when at least one of given method names is undefined" # Expected NameError but no exception was raised (["main_public_method", "main_undefined_method"] was returned)
fails "main#private when multiple arguments are passed sets the visibility of the given methods to private" # Expected Object to have private method 'main_public_method' but it does not
fails "main#private when single argument is passed and is an array sets the visibility of the given methods to private" # Expected Object to have private method 'main_public_method' but it does not
fails "main#private when single argument is passed and it is not an array sets the visibility of the given methods to private" # Expected Object to have private method 'main_public_method' but it does not
fails "main#public raises a NameError when given an undefined name" # Expected NameError but no exception was raised ("main_undefined_method" was returned)
fails "main.ruby2_keywords is the same as Object.ruby2_keywords" # Expected main to have private method 'ruby2_keywords' but it does not
fails "main.using does not propagate refinements of new modules added after it is called" # Expected "quux" == "bar" to be truthy but was false
fails "main.using raises error when called from method in wrapped script" # Expected RuntimeError but got: ArgumentError ([MSpecEnv#load] wrong number of arguments (given 2, expected 1))
fails "main.using raises error when called on toplevel from module" # Expected RuntimeError but got: ArgumentError ([MSpecEnv#load] wrong number of arguments (given 2, expected 1))
fails "main.using requires one Module argument" # Expected TypeError but no exception was raised (main was returned)
fails "main.using uses refinements from the given module for method calls in the target file" # LoadError: cannot load such file -- ruby/core/main/fixtures/string_refinement_user
fails "main.using uses refinements from the given module only in the target file" # LoadError: cannot load such file -- ruby/core/main/fixtures/string_refinement_user
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/language.rb | spec/filters/bugs/language.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "language" do
fails "$LOAD_PATH.resolve_feature_path return nil if feature cannot be found" # NoMethodError: undefined method `resolve_feature_path' for []
fails "$LOAD_PATH.resolve_feature_path returns what will be loaded without actual loading, .rb file" # NoMethodError: undefined method `resolve_feature_path' for []
fails "$LOAD_PATH.resolve_feature_path returns what will be loaded without actual loading, .so file" # NoMethodError: undefined method `resolve_feature_path' for []
fails "A Proc taking |*a, **kw| arguments does not autosplat keyword arguments" # Expected [[1], {"a"=>1}] == [[[1, {"a"=>1}]], {}] to be truthy but was false
fails "A Symbol literal raises an EncodingError at parse time when Symbol with invalid bytes" # Expected EncodingError (invalid symbol in encoding UTF-8 :"\xC3") but no exception was raised ("Ã" was returned)
fails "A block yielded a single Array assigns elements to mixed argument types" # Expected [1, 2, [], 3, 2, {"x"=>9}] == [1, 2, [3], {"x"=>9}, 2, {}] to be truthy but was false
fails "A block yielded a single Array does not call #to_hash on final argument to get keyword arguments and does not autosplat" # ArgumentError: expected kwargs
fails "A block yielded a single Array does not call #to_hash on the argument when optional argument and keyword argument accepted and does not autosplat" # ArgumentError: expected kwargs
fails "A block yielded a single Array does not call #to_hash on the last element if keyword arguments are present" # ArgumentError: expected kwargs
fails "A block yielded a single Array does not call #to_hash on the last element when there are more arguments than parameters" # ArgumentError: expected kwargs
fails "A block yielded a single Array does not treat final Hash as keyword arguments and does not autosplat" # Expected [nil, {"a"=>10}] == [[{"a"=>10}], {}] to be truthy but was false
fails "A block yielded a single Array does not treat hashes with string keys as keyword arguments and does not autosplat" # Expected [nil, {"a"=>10}] == [[{"a"=>10}], {}] to be truthy but was false
fails "A block yielded a single Array when non-symbol keys are in a keyword arguments Hash does not separate non-symbol keys and symbol keys and does not autosplat" # Expected [nil, {"a"=>10, "b"=>2}] == [[{"a"=>10, "b"=>2}], {}] to be truthy but was false
fails "A block yielded a single Object receives the object if it does not respond to #respond_to?" # NoMethodError: undefined method `respond_to?' for #<BasicObject:0x551e>
fails "A class definition extending an object (sclass) can use return to cause the enclosing method to return" # Expected "outer" == "inner" to be truthy but was false
fails "A class definition raises TypeError if any constant qualifying the class is not a Module" # Expected TypeError but no exception was raised (nil was returned)
fails "A class definition raises TypeError if the constant qualifying the class is nil" # Expected TypeError but no exception was raised (nil was returned)
fails "A class definition raises a TypeError if inheriting from a metaclass" # Expected TypeError but no exception was raised (nil was returned)
fails "A lambda expression 'lambda { ... }' assigns variables from parameters for definition '@a = lambda { |*, **k| k }'" # ArgumentError: expected kwargs
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 }" # ArgumentError: `block in <main>': wrong number of arguments (given 2, expected 1)
fails "A lambda expression 'lambda { ... }' requires a block" # Expected ArgumentError but got: Exception (Cannot add property $$is_lambda, object is not extensible)
fails "A lambda expression 'lambda { ... }' with an implicit block raises ArgumentError" # Expected ArgumentError (/tried to create Proc object without a block/) but got: Exception (Cannot add property $$is_lambda, object is not extensible)
fails "A lambda literal -> () { } assigns variables from parameters for definition '@a = -> (*, **k) { k }'" # ArgumentError: expected kwargs
fails "A method assigns local variables from method parameters for definition 'def m() end'" # ArgumentError: [SpecEvaluate#m] wrong number of arguments (given 1, expected 0)
fails "A method assigns local variables from method parameters for definition 'def m(*a) a end'" # Expected [{}] == [] to be truthy but was false
fails "A method assigns local variables from method parameters for definition 'def m(a, **) a end'" # Expected ArgumentError but no exception was raised ({"a"=>1, "b"=>2} was returned)
fails "A method assigns local variables from method parameters for definition 'def m(a, **k) [a, k] end'" # Expected ArgumentError but no exception was raised ([{"a"=>1, "b"=>2}, {}] was returned)
fails "A method assigns local variables from method parameters for definition 'def m(a, **nil); a end;'" # Expected ArgumentError but no exception was raised ({"a"=>1} was returned)
fails "A method assigns local variables from method parameters for definition 'def m(a, b: 1) [a, b] end'" # Expected ArgumentError but no exception was raised ([{"a"=>1, "b"=>2}, 1] was returned)
fails "A method assigns local variables from method parameters for definition 'def m(a:) a end'" # Expected ArgumentError but no exception was raised (1 was returned)
fails "A method assigns local variables from method parameters for definition 'def m(a:, **k) [a, k] end'" # Expected [1, {"b"=>2}] == [1, {"a"=>1, "b"=>2}] to be truthy but was false
fails "A method assigns local variables from method parameters for definition 'def m(a:, b: 1) [a, b] end'" # Expected ArgumentError but no exception was raised ([1, 2] was returned)
fails "A method assigns local variables from method parameters for definition 'def m(a:, b:) [a, b] end'" # Expected ArgumentError but no exception was raised ([1, 2] was returned)
fails "A method assigns local variables from method parameters for definition 'def m(a=1, b: 2) [a, b] end'" # Expected ArgumentError but no exception was raised ([1, 2] was returned)
fails "A method assigns local variables from method parameters for definition 'def m(a=1, b:) [a, b] end'" # Expected ArgumentError but no exception was raised ([1, 2] was returned)
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" # Expected [1, nil, nil, 2, nil, {"foo"=>"bar"}] == [1, 2, nil, {"foo"=>"bar"}, nil, {}] to be truthy but was false
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" # Expected ["a", {}, false] == ["a", {"key"=>"value"}, false] to be truthy but was false
fails "A method definition in an eval creates a class method" # NoMethodError: undefined method `an_eval_class_method' for DefSpecNestedB
fails "A method definition in an eval creates an instance method" # NoMethodError: undefined method `an_eval_instance_method' for #<DefSpecNested:0x108f2>
fails "A method raises ArgumentError if passing hash as keyword arguments for definition 'def m(a: nil); a; end'" # Expected ArgumentError but no exception was raised (1 was returned)
fails "A method when passing an empty keyword splat to a method that does not accept keywords for definition 'def m(*a); a; end'" # Expected [{}] == [] to be truthy but was false
fails "A method when passing an empty keyword splat to a method that does not accept keywords for definition 'def m(a); a; end'" # Expected ArgumentError but no exception was raised (nil was returned)
fails "A nested method definition creates a class method when evaluated in a class method" # NoMethodError: undefined method `a_class_method' for DefSpecNested
fails "A nested method definition creates a method in the surrounding context when evaluated in a def expr.method" # Expected DefSpecNested to have instance method 'inherited_method' but it does not
fails "A nested method definition creates an instance method inside Class.new" # NoMethodError: undefined method `new_def' for #<#<Class:0x10642>:0x10640>
fails "A nested method definition creates an instance method when evaluated in an instance method" # NoMethodError: undefined method `an_instance_method' for #<DefSpecNested:0x1064c>
fails "A number literal can be a decimal literal with trailing 'r' to represent a Rational" # Expected (5404319552844595/18014398509481984) == (3/10) to be truthy but was false
fails "A number literal can be a float literal with trailing 'r' to represent a Rational" # Expected (5030569068109113/288230376151711740) == (136353847812057/7812500000000000) to be truthy but was false
fails "A singleton class raises a TypeError for symbols" # Expected TypeError but no exception was raised (#<Class:#<String:0x9093e>> was returned)
fails "A singleton method definition can be declared for a global variable" # TypeError: can't define singleton
fails "A singleton method definition raises FrozenError with the correct class name" # Expected "can't modify frozen Class: #<Class:#<Object:0x10574>>".start_with? "can't modify frozen object" to be truthy but was false
fails "Accessing a class variable raises a RuntimeError when a class variable is overtaken in an ancestor class" # Expected RuntimeError (/class variable @@cvar_overtaken of .+ is overtaken by .+/) but no exception was raised ("subclass" was returned)
fails "Accessing a class variable raises a RuntimeError when accessed from the toplevel scope (not in some module or class)" # Expected RuntimeError (class variable access from toplevel) but got: NameError (uninitialized class variable @@cvar_toplevel1 in MSpecEnv)
fails "Allowed characters allows non-ASCII lowercased characters at the beginning" # Expected nil == 1 to be truthy but was false
fails "Allowed characters allows not ASCII upcased characters at the beginning" # NameError: wrong constant name ἍBB
fails "Allowed characters parses a non-ASCII upcased character as a constant identifier" # Expected SyntaxError (/dynamic constant assignment/) but no exception was raised ("test" was returned)
fails "An Exception reaching the top level kills all threads and fibers, ensure clauses are only run for threads current fibers, not for suspended fibers with ensure on non-root fiber" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x29a62>
fails "An Exception reaching the top level kills all threads and fibers, ensure clauses are only run for threads current fibers, not for suspended fibers with ensure on the root fiber" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x29a62>
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"] == ["begin", "ensure"] to be truthy but was false
fails "An ensure block inside a begin block is executed even when a symbol is thrown in it's corresponding begin block" # Expected ["begin", "rescue", "ensure"] == ["begin", "ensure"] to be truthy but was false
fails "An ensure block inside a class is executed even when a symbol is thrown" # Expected ["class", "rescue", "ensure"] == ["class", "ensure"] to be truthy but was false
fails "An instance method definition with a splat requires the presence of any arguments that precede the *" # Expected ArgumentError (wrong number of arguments (given 1, expected 2+)) but got: ArgumentError ([MSpecEnv#foo] wrong number of arguments (given 1, expected -3))
fails "An instance method raises FrozenError with the correct class name" # Expected "can't modify frozen Module: #<Module:0x103d8>".start_with? "can't modify frozen module" to be truthy but was false
fails "An instance method raises an error with too few arguments" # Expected ArgumentError (wrong number of arguments (given 1, expected 2)) but got: ArgumentError ([MSpecEnv#foo] wrong number of arguments (given 1, expected 2))
fails "An instance method raises an error with too many arguments" # Expected ArgumentError (wrong number of arguments (given 2, expected 1)) but got: ArgumentError ([MSpecEnv#foo] wrong number of arguments (given 2, expected 1))
fails "An instance method with a default argument evaluates the default when required arguments precede it" # Expected ArgumentError (wrong number of arguments (given 0, expected 1..2)) but got: ArgumentError ([MSpecEnv#foo] wrong number of arguments (given 0, expected -2))
fails "An instance method with a default argument prefers to assign to a default argument before a splat argument" # Expected ArgumentError (wrong number of arguments (given 0, expected 1+)) but got: ArgumentError ([MSpecEnv#foo] wrong number of arguments (given 0, expected -2))
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
fails "Evaluation order during assignment with multiple assignment can be used to swap variables with nested method calls" # Expected #<VariablesSpecs::EvalOrder::Node:0x95bdc @right= #<VariablesSpecs::EvalOrder::Node:0x95bd8 @left=#<VariablesSpecs::EvalOrder::Node:0x95bdc ...>>> == #<VariablesSpecs::EvalOrder::Node:0x95bd8 @left= #<VariablesSpecs::EvalOrder::Node:0x95bdc @right=#<VariablesSpecs::EvalOrder::Node:0x95bd8 ...>>> to be truthy but was false
fails "Evaluation order during assignment with multiple assignment evaluates from left to right, receivers first then methods" # Expected ["a", "b", "foo", "foo[]=", "bar", "bar.baz="] == ["foo", "bar", "a", "b", "foo[]=", "bar.baz="] to be truthy but was false
fails "Evaluation order during assignment with single assignment evaluates from left to right" # Expected ["a", "foo", "foo[]="] == ["foo", "a", "foo[]="] to be truthy but was false
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)
fails "Execution variable $: default $LOAD_PATH entries until sitelibdir included have @gem_prelude_index set" # Expected [].include? nil to be truthy but was false
fails "Execution variable $: is initialized to an array of strings" # Expected false == true to be truthy but was false
fails "Execution variable $: is read-only" # Expected NameError but no exception was raised ([] was returned)
fails "Execution variable $: is the same object as $LOAD_PATH and $-I" # Expected 688882 == 4 to be truthy but was false
fails "Global variable $-a is read-only" # Expected NameError but no exception was raised (true was returned)
fails "Global variable $-d is an alias of $DEBUG" # Expected nil to be true
fails "Global variable $-l is read-only" # Expected NameError but no exception was raised (true was returned)
fails "Global variable $-p is read-only" # Expected NameError but no exception was raised (true was returned)
fails "Global variable $-v is an alias of $VERBOSE" # Expected nil to be true
fails "Global variable $-w is an alias of $VERBOSE" # Expected nil to be true
fails "Global variable $0 is the path given as the main script and the same as __FILE__" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0xa7382 @old_stdout=#<IO:0xa @fd=1 @flags="w" @eof=false @closed="read" @write_proc=#<Proc:0xaa7e6> @tty=true> @verbose=nil @dollar_slash="\n" @dollar_dash_zero=nil @dollar_backslash=nil @debug=false @method=nil @object=nil @orig_program_name=nil>
fails "Global variable $0 raises a TypeError when not given an object that can be coerced to a String" # Expected TypeError but no exception was raised (nil was returned)
fails "Global variable $< is read-only" # Expected NameError but no exception was raised (nil was returned)
fails "Global variable $? is read-only" # Expected NameError but no exception was raised (nil was returned)
fails "Global variable $? is thread-local" # NoMethodError: undefined method `system' for #<MSpecEnv:0xa7382 @old_stdout=#<IO:0xa @fd=1 @flags="w" @eof=false @closed="read" @write_proc=#<Proc:0xaa7e6> @tty=true> @verbose=nil @dollar_slash="\n" @dollar_dash_zero=nil @dollar_backslash=nil>
fails "Global variable $FILENAME is read-only" # Expected NameError but no exception was raised ("-" was returned)
fails "Global variable $VERBOSE converts truthy values to true" # Expected 1 to be true
fails "Global variable $\" is an alias for $LOADED_FEATURES" # Expected [] to be identical to ["corelib/runtime", "opal", "opal/base", "corelib/helpers", "corelib/module", ...]
fails "Global variable $\" is read-only" # Expected NameError but no exception was raised ([] was returned)
fails "Hash literal checks duplicated float keys on initialization" # Expected warning to match: /key 1.0 is duplicated|duplicated key/ but got: ""
fails "Hash literal checks duplicated keys on initialization" # Expected warning to match: /key 1000 is duplicated|duplicated key/ but got: ""
fails "Hash literal expands a BasicObject using ** into the containing Hash literal initialization" # NoMethodError: undefined method `respond_to?' for #<BasicObject:0xab798>
fails "Hash literal raises an EncodingError at parse time when Symbol key with invalid bytes and 'key: value' syntax used" # Expected EncodingError (invalid symbol in encoding UTF-8 :"\xC3") but no exception was raised ({"Ã"=>1} was returned)
fails "Hash literal raises an EncodingError at parse time when Symbol key with invalid bytes" # Expected EncodingError (invalid symbol in encoding UTF-8 :"\xC3") but no exception was raised ({"Ã"=>1} was returned)
fails "Heredoc string allow HEREDOC with <<\"identifier\", interpolated" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "Heredoc string allows HEREDOC with <<'identifier', no interpolation" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "Heredoc string allows HEREDOC with <<-'identifier', allowing to indent identifier, no interpolation" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "Heredoc string allows HEREDOC with <<-\"identifier\", allowing to indent identifier, interpolated" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "Heredoc string allows HEREDOC with <<-identifier, allowing to indent identifier, interpolated" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "Heredoc string allows HEREDOC with <<identifier, interpolated" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "Inside 'endless' method definitions allows method calls without parenthesis" # NoMethodError: undefined method `concat' for "Hi, "
fails "Instance variables global variable when global variable is uninitialized warns about accessing uninitialized global variable in verbose mode" # Expected warning to match: /warning: global variable `\$specs_uninitialized_global_variable' not initialized/ but got: ""
fails "Instantiating a singleton class raises a TypeError when allocate is called" # Expected TypeError but no exception was raised (#<Object:0x90a56> was returned)
fails "Instantiating a singleton class raises a TypeError when new is called" # Expected TypeError but no exception was raised (#<Object:0x90a74> was returned)
fails "Interrupt shows the backtrace and has a signaled exit status" # NoMethodError: undefined method `popen' for IO
fails "Keyword arguments are now separated from positional arguments when the method takes a ** parameter does not convert a positional Hash to keyword arguments" # Expected ArgumentError (wrong number of arguments (given 4, expected 3)) but no exception was raised (42 was returned)
fails "Keyword arguments are now separated from positional arguments when the method takes a key: parameter when it's called with a positional Hash and no ** raises ArgumentError" # Expected ArgumentError (wrong number of arguments (given 4, expected 3)) but no exception was raised (42 was returned)
fails "Keyword arguments are separated from positional arguments" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments delegation does not work with (*args)" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments delegation works with (*args, **kwargs)" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments delegation works with (...)" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments delegation works with -> (*args, **kwargs) {}" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments delegation works with call(*ruby2_keyword_args)" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments delegation works with proc { |*args, **kwargs| }" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments delegation works with super(*ruby2_keyword_args)" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments delegation works with yield(*ruby2_keyword_args)" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments delegation works with zsuper" # Expected [[], {}] == [[{}], {}] to be truthy but was false
fails "Keyword arguments empty kwargs are treated as if they were not passed when calling a method" # Expected [{}] == [] to be truthy but was false
fails "Keyword arguments empty kwargs are treated as if they were not passed when yielding to a block" # Expected [{}] == [] to be truthy but was false
fails "Keyword arguments extra keywords are not allowed without **kwrest" # Expected ArgumentError (unknown keyword: :kw2) but no exception was raised ([] was returned)
fails "Keyword arguments handle * and ** at the same call site" # Expected [{}] == [] to be truthy but was false
fails "Keyword arguments raises ArgumentError exception when required keyword argument is not passed" # Expected ArgumentError (/missing keyword: :c/) but got: ArgumentError (missing keyword: c)
fails "Keyword arguments raises ArgumentError for missing keyword arguments even if there are extra ones" # Expected ArgumentError (/missing keyword: :a/) but got: ArgumentError (missing keyword: a)
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:0x913b2>::DOES_NOT_EXIST)
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:0x913aa>::DOES_NOT_EXIST)
fails "Literal Ranges creates a simple range as an object literal" # Expected 1..3.equal? 1..3 to be truthy but was false
fails "Literal Regexps caches the Regexp object" # Expected /foo/ to be identical to /foo/
fails "Literal Regexps supports (?# )" # Exception: Invalid regular expression: /foo(?#comment)bar/: Invalid group
fails "Literal Regexps supports (?> ) (embedded subexpression)" # Exception: Invalid regular expression: /(?>foo)(?>bar)/: Invalid group
fails "Literal Regexps supports \\g (named backreference)" # Expected [] == ["foo1barfoo2", "foo2"] to be truthy but was false
fails "Literal Regexps supports character class composition" # Expected [] == ["def"] to be truthy but was false
fails "Literal Regexps supports conditional regular expressions with named capture groups" # Exception: Invalid regular expression: /^(?<word>foo)?(?(<word>)(T)|(F))$/: Invalid group
fails "Literal Regexps supports conditional regular expressions with positional capture groups" # Exception: Invalid regular expression: /^(foo)?(?(1)(T)|(F))$/: Invalid group
fails "Literal Regexps supports possessive quantifiers" # Exception: Invalid regular expression: /fooA++bar/: Nothing to repeat
fails "Literal Regexps throws SyntaxError for malformed literals" # Expected SyntaxError but got: Exception (Invalid regular expression: /(/: Unterminated group)
fails "Local variable shadowing does not warn in verbose mode" # Expected nil == [3, 3, 3] to be truthy but was false
fails "Magic comments in a loaded file are case-insensitive" # LoadError: cannot load such file -- ruby/language/fixtures/case_magic_comment
fails "Magic comments in a loaded file are optional" # LoadError: cannot load such file -- ruby/language/fixtures/no_magic_comment
fails "Magic comments in a loaded file can be after the shebang" # LoadError: cannot load such file -- ruby/language/fixtures/shebang_magic_comment
fails "Magic comments in a loaded file can take Emacs style" # LoadError: cannot load such file -- ruby/language/fixtures/emacs_magic_comment
fails "Magic comments in a loaded file can take vim style" # LoadError: cannot load such file -- ruby/language/fixtures/vim_magic_comment
fails "Magic comments in a loaded file determine __ENCODING__" # LoadError: cannot load such file -- ruby/language/fixtures/magic_comment
fails "Magic comments in a loaded file do not cause bytes to be mangled by passing them through the wrong encoding" # LoadError: cannot load such file -- ruby/language/fixtures/bytes_magic_comment
fails "Magic comments in a loaded file must be at the first line" # LoadError: cannot load such file -- ruby/language/fixtures/second_line_magic_comment
fails "Magic comments in a loaded file must be the first token of the line" # LoadError: cannot load such file -- ruby/language/fixtures/second_token_magic_comment
fails "Magic comments in a required file are case-insensitive" # NameError: uninitialized constant Encoding::Big5
fails "Magic comments in a required file are optional" # Expected nil == "UTF-8" to be truthy but was false
fails "Magic comments in a required file can be after the shebang" # NameError: uninitialized constant Encoding::Big5
fails "Magic comments in a required file can take Emacs style" # NameError: uninitialized constant Encoding::Big5
fails "Magic comments in a required file can take vim style" # NameError: uninitialized constant Encoding::Big5
fails "Magic comments in a required file determine __ENCODING__" # NameError: uninitialized constant Encoding::Big5
fails "Magic comments in a required file do not cause bytes to be mangled by passing them through the wrong encoding" # Expected nil == "[167, 65, 166, 110]" to be truthy but was false
fails "Magic comments in a required file must be at the first line" # Expected nil == "UTF-8" to be truthy but was false
fails "Magic comments in a required file must be the first token of the line" # Expected nil == "UTF-8" to be truthy but was false
fails "Magic comments in an -e argument are case-insensitive" # ArgumentError: unknown encoding name - locale
fails "Magic comments in an -e argument are optional" # ArgumentError: unknown encoding name - locale
fails "Magic comments in an -e argument can be after the shebang" # ArgumentError: unknown encoding name - locale
fails "Magic comments in an -e argument can take Emacs style" # ArgumentError: unknown encoding name - locale
fails "Magic comments in an -e argument can take vim style" # ArgumentError: unknown encoding name - locale
fails "Magic comments in an -e argument determine __ENCODING__" # ArgumentError: unknown encoding name - locale
fails "Magic comments in an -e argument do not cause bytes to be mangled by passing them through the wrong encoding" # ArgumentError: unknown encoding name - locale
fails "Magic comments in an -e argument must be at the first line" # ArgumentError: unknown encoding name - locale
fails "Magic comments in an -e argument must be the first token of the line" # ArgumentError: unknown encoding name - locale
fails "Magic comments in an eval are case-insensitive" # NoMethodError: undefined method `read' for File
fails "Magic comments in an eval are optional" # NoMethodError: undefined method `read' for File
fails "Magic comments in an eval can be after the shebang" # NoMethodError: undefined method `read' for File
fails "Magic comments in an eval can take Emacs style" # NoMethodError: undefined method `read' for File
fails "Magic comments in an eval can take vim style" # NoMethodError: undefined method `read' for File
fails "Magic comments in an eval determine __ENCODING__" # NoMethodError: undefined method `read' for File
fails "Magic comments in an eval do not cause bytes to be mangled by passing them through the wrong encoding" # NoMethodError: undefined method `read' for File
fails "Magic comments in an eval must be at the first line" # NoMethodError: undefined method `read' for File
fails "Magic comments in an eval must be the first token of the line" # NoMethodError: undefined method `read' for File
fails "Magic comments in stdin are case-insensitive" # ArgumentError: unknown encoding name - locale
fails "Magic comments in stdin are optional" # ArgumentError: unknown encoding name - locale
fails "Magic comments in stdin can be after the shebang" # ArgumentError: unknown encoding name - locale
fails "Magic comments in stdin can take Emacs style" # ArgumentError: unknown encoding name - locale
fails "Magic comments in stdin can take vim style" # ArgumentError: unknown encoding name - locale
fails "Magic comments in stdin determine __ENCODING__" # ArgumentError: unknown encoding name - locale
fails "Magic comments in stdin do not cause bytes to be mangled by passing them through the wrong encoding" # ArgumentError: unknown encoding name - locale
fails "Magic comments in stdin must be at the first line" # ArgumentError: unknown encoding name - locale
fails "Magic comments in stdin must be the first token of the line" # ArgumentError: unknown encoding name - locale
fails "Magic comments in the main file are case-insensitive" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7f626 @method="UTF8" @object=#<Proc:0x7f6de> @default=#<Encoding:UTF-8>>
fails "Magic comments in the main file are optional" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7f626 @method="UTF8" @object=#<Proc:0x7f6de> @default=#<Encoding:UTF-8>>
fails "Magic comments in the main file can be after the shebang" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7f626 @method="UTF8" @object=#<Proc:0x7f6de> @default=#<Encoding:UTF-8>>
fails "Magic comments in the main file can take Emacs style" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7f626 @method="UTF8" @object=#<Proc:0x7f6de> @default=#<Encoding:UTF-8>>
fails "Magic comments in the main file can take vim style" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7f626 @method="UTF8" @object=#<Proc:0x7f6de> @default=#<Encoding:UTF-8>>
fails "Magic comments in the main file determine __ENCODING__" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7f626 @method="UTF8" @object=#<Proc:0x7f6de> @default=#<Encoding:UTF-8>>
fails "Magic comments in the main file do not cause bytes to be mangled by passing them through the wrong encoding" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7f626 @method="UTF8" @object=#<Proc:0x7f6de> @default=#<Encoding:UTF-8>>
fails "Magic comments in the main file must be at the first line" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7f626 @method="UTF8" @object=#<Proc:0x7f6de> @default=#<Encoding:UTF-8>>
fails "Magic comments in the main file must be the first token of the line" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x7f626 @method="UTF8" @object=#<Proc:0x7f6de> @default=#<Encoding:UTF-8>>
fails "NoMethodError#message calls receiver.inspect only when calling Exception#message" # Expected ["inspect_called"] == [] to be truthy but was false
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:0x91b82>)
fails "Operators * / % are left-associative" # Expected 1 == 1 to be falsy but was true
fails "Operators <=> == === != =~ !~ have higher precedence than &&" # Expected false == false to be falsy but was true
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | true |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/io.rb | spec/filters/bugs/io.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "IO" do
fails "IO::EAGAINWaitReadable combines Errno::EAGAIN and IO::WaitReadable" # NameError: uninitialized constant IO::EAGAINWaitReadable
fails "IO::EAGAINWaitReadable is the same as IO::EWOULDBLOCKWaitReadable if Errno::EAGAIN is the same as Errno::EWOULDBLOCK" # NameError: uninitialized constant Errno::EAGAIN
fails "IO::EAGAINWaitWritable combines Errno::EAGAIN and IO::WaitWritable" # NameError: uninitialized constant IO::EAGAINWaitWritable
fails "IO::EAGAINWaitWritable is the same as IO::EWOULDBLOCKWaitWritable if Errno::EAGAIN is the same as Errno::EWOULDBLOCK" # NameError: uninitialized constant Errno::EAGAIN
fails "IO::EWOULDBLOCKWaitReadable combines Errno::EWOULDBLOCK and IO::WaitReadable" # NameError: uninitialized constant IO::EWOULDBLOCKWaitReadable
fails "IO::EWOULDBLOCKWaitWritable combines Errno::EWOULDBLOCK and IO::WaitWritable" # NameError: uninitialized constant IO::EWOULDBLOCKWaitWritable
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/range.rb | spec/filters/bugs/range.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Range" do
fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers accepts (+/-)Float::INFINITY from the block" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns a boundary element if appropriate" # Expected nil == 2.9999999999999996 to be truthy but was false
fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0 (small numbers)" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers works with infinity bounds" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with Float values with a block returning true or false returns a boundary element if appropriate" # Expected nil == 2.9999999999999996 to be truthy but was false
fails "Range#bsearch with Float values with a block returning true or false returns minimum element if the block returns true for every element" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning true or false returns nil if the block returns false for every element" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning true or false returns nil if the block returns nil for every element" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning true or false returns the smallest element for which block returns true" # TypeError: can't iterate from Float
fails "Range#bsearch with Float values with a block returning true or false works with infinity bounds" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers accepts (+/-)Float::INFINITY from the block" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers works with infinity bounds" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning true or false returns nil if the block returns nil for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning true or false returns nil if the block returns true for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning true or false returns the smallest element for which block returns true" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Float values with a block returning true or false works with infinity bounds" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers accepts Float::INFINITY from the block" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with beginless ranges and Integer values with a block returning true or false returns the smallest element for which block returns true" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers accepts (+/-)Float::INFINITY from the block" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers works with infinity bounds" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns minimum element if the block returns true for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns nil if the block returns false for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns nil if the block returns nil for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns the smallest element for which block returns true" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Float values with a block returning true or false works with infinity bounds" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers accepts -Float::INFINITY from the block" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Integer values with a block returning true or false returns minimum element if the block returns true for every element" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#bsearch with endless ranges and Integer values with a block returning true or false returns the smallest element for which block returns true" # NotImplementedError: Can't #bsearch an infinite range
fails "Range#cover? range argument honors exclusion of right boundary (:exclude_end option)" # Expected true to be false
fails "Range#eql? returns false if the endpoints are not eql?" # Expected 0..1 not to have same value or type as 0..1
fails "Range#first raises a TypeError if #to_int does not return an Integer" # Expected TypeError but no exception was raised ([2] was returned)
fails "Range#frozen? is true for Range.new" # Expected 1..2.frozen? to be truthy but was false
fails "Range#frozen? is true for literal ranges" # Expected 1..2.frozen? to be truthy but was false
fails "Range#include? does not include U+9995 in the range U+0999..U+9999" # Expected true to be false
fails "Range#initialize raises a FrozenError if called on an already initialized Range" # Expected FrozenError but got: NameError ('initialize' called twice)
fails "Range#inspect works for nil ... nil ranges" # Expected ".." == "nil..nil" to be truthy but was false
fails "Range#last raises a TypeError if #to_int does not return an Integer" # Expected TypeError but no exception was raised ([3] was returned)
fails "Range#max given a block calls #> and #< on the return value of the block" # Mock 'obj' expected to receive >("any_args") exactly 2 times but received it 0 times
fails "Range#max given a block raises RangeError when called with custom comparison method on an beginless range" # Expected RangeError but got: TypeError (can't iterate from NilClass)
fails "Range#max raises TypeError when called on a Time...Time(excluded end point)" # Expected TypeError but no exception was raised (1670387451200 was returned)
fails "Range#max raises TypeError when called on an exclusive range and a non Integer value" # Expected TypeError but no exception was raised (907.1111 was returned)
fails "Range#max raises for an exclusive beginless range" # Expected TypeError (cannot exclude end value with non Integer begin value) but no exception was raised (0 was returned)
fails "Range#max returns the maximum value in the range when called with no arguments" # Expected NaN == "e" to be truthy but was false
fails "Range#min given a block calls #> and #< on the return value of the block" # Mock 'obj' expected to receive >("any_args") exactly 2 times but received it 0 times
fails "Range#minmax on an exclusive range raises TypeError if the end value is not an integer" # Expected TypeError (cannot exclude non Integer end value) but got: TypeError (can't iterate from Float)
fails "Range#minmax on an exclusive range should raise RangeError on a beginless range" # Expected RangeError (/cannot get the maximum of beginless range with custom comparison method|cannot get the minimum of beginless range/) but got: TypeError (can't iterate from NilClass)
fails "Range#minmax on an exclusive range should raise RangeError on an endless range" # Mock 'x': method <=> called with unexpected arguments (nil)
fails "Range#minmax on an inclusive range raises RangeError or ArgumentError on a beginless range" # Expected ArgumentError (comparison of NilClass with MockObject failed) but got: TypeError (can't iterate from NilClass)
fails "Range#minmax on an inclusive range should raise RangeError on an endless range without iterating the range" # Mock 'x': method <=> called with unexpected arguments (nil)
fails "Range#minmax on an inclusive range should return the minimum and maximum values for a non-numeric range without iterating the range" # Mock 'x' expected to receive succ("any_args") exactly 0 times but received it 1 times
fails "Range#minmax on an inclusive range should return the minimum and maximum values for a numeric range without iterating the range" # TypeError: can't iterate from Float
fails "Range#step when no block is given returned Enumerator size raises a TypeError if #to_int does not return an Integer" # Expected TypeError but no exception was raised (((1..2).step(#<MockObject:0x61a92>)) was returned)
fails "Range#step when no block is given returned Enumerator size raises a TypeError if step does not respond to #to_int" # Expected TypeError but got: ArgumentError (no implicit conversion of MockObject into Integer)
fails "Range#step when no block is given returned Enumerator size returns the range size when there's no step_size" # Expected 9 == 10 to be truthy but was false
fails "Range#step with an endless range and Float values yields Float values incremented by a Float step" # Expected [-1, 0] to have same value and type as [-1, -0.5, 0, 0.5]
fails "Range#step with an endless range and Integer values yields Float values incremented by a Float step" # Expected [-2, 1] to have same value and type as [-2, -0.5, 1]
fails "Range#step with exclusive end and String values raises a TypeError when passed a Float step" # Expected TypeError but no exception was raised ("A"..."G" was returned)
fails "Range#step with inclusive end and Float values returns Float values of 'step * n + begin <= end'" # Expected [1, 2.8, 4.6, 6.4, 1, 2.3, 3.6, 4.9, 6.2, 7.5, 8.8, 10.1, 11.4] to have same value and type as [1, 2.8, 4.6, 6.4, 1, 2.3, 3.6, 4.9, 6.2, 7.5, 8.8, 10.1, 11.4, 12.7]
fails "Range#step with inclusive end and String values raises a TypeError when passed a Float step" # Expected TypeError but no exception was raised ("A".."G" was returned)
fails "Range#to_a throws an exception for endless ranges" # Expected RangeError but got: TypeError (cannot convert endless range to an array)
fails "Range#to_a works with Ranges of 64-bit integers" # Expected [256, 257] == [1099511627776, 1099511627777] to be truthy but was false
fails "Range#to_s can show beginless ranges" # Expected "...1" == "...1.0" to be truthy but was false
fails "Range#to_s can show endless ranges" # Expected "1..." == "1.0..." to be truthy but was false
fails "Range.new beginless/endless range creates a frozen range if the class is Range.class" # Expected 1..2.frozen? to be truthy but was false
fails_badly "Range#min given a block raises RangeError when called with custom comparison method on an endless range" # Expected RangeError but got: Opal::SyntaxError (undefined method `type' for nil)
fails_badly "Range#minmax on an exclusive range should return the minimum and maximum values for a numeric range without iterating the range"
fails_badly "Range#step with an endless range and String values raises a TypeError when passed a Float step" # Expected TypeError but got: Opal::SyntaxError (undefined method `type' for nil)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/unboundmethod.rb | spec/filters/bugs/unboundmethod.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "UnboundMethod" do
fails "UnboundMethod#== considers methods through aliasing and visibility change equal" # Expected #<Method: Class#new (defined in Class in <internal:corelib/class.rb>:40)> == #<Method: Class#n (defined in #<Class:> in <internal:corelib/class.rb>:40)> to be truthy but was false
fails "UnboundMethod#== considers methods through aliasing equal" # Expected #<Method: Class#new (defined in Class in <internal:corelib/class.rb>:40)> == #<Method: Class#n (defined in #<Class:> in <internal:corelib/class.rb>:40)> to be truthy but was false
fails "UnboundMethod#== considers methods through visibility change equal" # Expected #<Method: Class#new (defined in Class in <internal:corelib/class.rb>:40)> == #<Method: Class#new (defined in Class in <internal:corelib/class.rb>:40)> to be truthy but was false
fails "UnboundMethod#== returns false if same method but extracted from two different subclasses" # Expected false == true to be truthy but was false
fails "UnboundMethod#== returns true if both are aliases for a third method" # Expected false == true to be truthy but was false
fails "UnboundMethod#== returns true if either is an alias for the other" # Expected false == true to be truthy but was false
fails "UnboundMethod#== returns true if methods are the same but added from an included Module" # Expected false == true to be truthy but was false
fails "UnboundMethod#== returns true if objects refer to the same method" # Expected false == true to be truthy but was false
fails "UnboundMethod#== returns true if same method but one extracted from a subclass" # Expected false == true to be truthy but was false
fails "UnboundMethod#== returns true if same method is extracted from the same subclass" # Expected false == true to be truthy but was false
fails "UnboundMethod#arity for a Method generated by respond_to_missing? returns -1" # Mock 'method arity respond_to_missing' expected to receive respond_to_missing?("any_args") exactly 1 times but received it 0 times
fails "UnboundMethod#bind the returned Method is equal to the one directly returned by obj.method" # Expected #<Method: UnboundMethodSpecs::Methods#foo (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:30)> == #<Method: UnboundMethodSpecs::Methods#foo (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:30)> to be truthy but was false
fails "UnboundMethod#clone returns a copy of the UnboundMethod" # Expected false == true to be truthy but was false
fails "UnboundMethod#hash equals a hash of the same method in the superclass" # Expected 13816 == 13814 to be truthy but was false
fails "UnboundMethod#hash returns the same value for builtin methods that are eql?" # Expected 13858 == 13860 to be truthy but was false
fails "UnboundMethod#hash returns the same value for user methods that are eql?" # Expected 13902 == 13904 to be truthy but was false
fails "UnboundMethod#inspect returns a String including all details" # Expected "#<UnboundMethod: UnboundMethodSpecs::Methods#from_mod (defined in UnboundMethodSpecs::Mod in ruby/core/unboundmethod/fixtures/classes.rb:24)>".start_with? "#<UnboundMethod: UnboundMethodSpecs::Methods(UnboundMethodSpecs::Mod)#from_mod" to be truthy but was false
fails "UnboundMethod#original_name returns the name of the method" # NoMethodError: undefined method `original_name' for #<UnboundMethod: String#upcase (defined in String in <internal:corelib/string.rb>:1685)>
fails "UnboundMethod#original_name returns the original name even when aliased twice" # NoMethodError: undefined method `original_name' for #<UnboundMethod: UnboundMethodSpecs::Methods#foo (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:30)>
fails "UnboundMethod#original_name returns the original name" # NoMethodError: undefined method `original_name' for #<UnboundMethod: UnboundMethodSpecs::Methods#foo (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:30)>
fails "UnboundMethod#source_location sets the first value to the path of the file in which the method was defined" # Expected "ruby/core/unboundmethod/fixtures/classes.rb" == "./ruby/core/unboundmethod/fixtures/classes.rb" to be truthy but was false
fails "UnboundMethod#source_location works for eval with a given line" # Expected ["(eval)", 0] == ["foo", 100] to be truthy but was false
fails "UnboundMethod#super_method after aliasing an inherited method returns the expected super_method" # NoMethodError: undefined method `super_method' for #<UnboundMethod: MethodSpecs::InheritedMethods::C#meow (defined in MethodSpecs::InheritedMethods::C in ruby/core/method/fixtures/classes.rb:233)>
fails "UnboundMethod#super_method after changing an inherited methods visibility returns the expected super_method" # NoMethodError: undefined method `super_method' for #<UnboundMethod: MethodSpecs::InheritedMethods::C#derp (defined in MethodSpecs::InheritedMethods::B in ruby/core/method/fixtures/classes.rb:233)>
fails "UnboundMethod#super_method returns nil when the parent's method is removed" # NoMethodError: undefined method `super_method' for #<UnboundMethod: #<Class:0x4b228>#foo (defined in #<Class:0x4b228> in ruby/core/unboundmethod/super_method_spec.rb:21)>
fails "UnboundMethod#super_method returns nil when there's no super method in the parent" # NoMethodError: undefined method `super_method' for #<UnboundMethod: Kernel#method (defined in Kernel in <internal:corelib/kernel.rb>:32)>
fails "UnboundMethod#super_method returns the method that would be called by super in the method" # NoMethodError: undefined method `super_method' for #<UnboundMethod: UnboundMethodSpecs::C#overridden (defined in UnboundMethodSpecs::C in ruby/core/unboundmethod/fixtures/classes.rb:91)>
fails "UnboundMethod#to_s does not show the defining module if it is the same as the origin" # Expected "#<UnboundMethod:0x10a0c>".start_with? "#<UnboundMethod: UnboundMethodSpecs::A#baz" to be truthy but was false
fails "UnboundMethod#to_s returns a String including all details" # Expected "#<UnboundMethod:0x10a92>".start_with? "#<UnboundMethod: UnboundMethodSpecs::Methods(UnboundMethodSpecs::Mod)#from_mod" to be truthy but was false
fails "UnboundMethod#to_s the String shows the method name, Module defined in and Module extracted from" # Expected "#<UnboundMethod:0x10a48>" =~ /\bfrom_mod\b/ to be truthy but was nil
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/struct.rb | spec/filters/bugs/struct.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Struct" do
fails "Struct#dig returns the value by the index" # Expected nil == "one" to be truthy but was false
fails "Struct#hash returns different hashes for structs with different values when using keyword_init: true" # NameError: wrong constant name 1 non symbol member
fails "Struct#initialize can be initialized with keyword arguments" # Expected "3.2" == {"version"=>"3.2", "platform"=>"OS"} to be truthy but was false
fails "Struct#inspect does not call #name method when struct is anonymous" # Expected "#<struct #<Class:0x55d36> a=\"\">" == "#<struct a=\"\">" to be truthy but was false
fails "Struct#to_h with block converts [key, value] pairs returned by the block to a hash" # Expected {"Ford"=>"", "Ranger"=>"", ""=>""} == {"make"=>"ford", "model"=>"ranger", "year"=>""} to be truthy but was false
fails "Struct#to_s does not call #name method when struct is anonymous" # Expected "#<struct #<Class:0x29fd6> a=\"\">" == "#<struct a=\"\">" to be truthy but was false
fails "Struct#values_at supports mixing of names and indices" # TypeError: no implicit conversion of String into Integer
fails "Struct#values_at when passed a list of Integers returns nil value for any integer that is out of range" # Exception: Cannot read properties of undefined (reading '$$is_array')
fails "Struct#values_at when passed an integer Range fills with nil values for range elements larger than the captured values number" # Exception: Cannot read properties of undefined (reading '$$is_array')
fails "Struct#values_at when passed an integer Range fills with nil values for range elements larger than the structure" # IndexError: offset 3 too large for struct(size:3)
fails "Struct#values_at when passed an integer Range raises RangeError if any element of the range is negative and out of range" # Expected RangeError (-4..3 out of range) but got: IndexError (offset -4 too small for struct(size:3))
fails "Struct#values_at when passed an integer Range returns an empty Array when Range is empty" # Exception: Cannot read properties of undefined (reading '$$is_number')
fails "Struct#values_at when passed an integer Range supports endless Range" # TypeError: cannot convert endless range to an array
fails "Struct#values_at when passed names slices captures with the given String names" # TypeError: no implicit conversion of String into Integer
fails "Struct#values_at when passed names slices captures with the given names" # TypeError: no implicit conversion of String into Integer
fails "Struct.new keyword_init: true option raises when there is a duplicate member" # Expected ArgumentError (duplicate member: foo) but no exception was raised (#<Class:0x76a42> was returned)
fails "Struct.new raises ArgumentError when there is a duplicate member" # Expected ArgumentError (duplicate member: foo) but no exception was raised (#<Class:0x769fa> was returned)
fails "StructClass#keyword_init? returns nil for a struct that did not explicitly specify keyword_init" # Expected false to be nil
fails "StructClass#keyword_init? returns true for any truthy value, not just for true" # Expected 1 to be true
fails_badly "Struct#hash returns different hashes for different struct classes" # A failure in Chromium that once passes, other times it doesn't, most probably related to some kind of undeterminism.
fails_badly "Struct#hash returns different hashes for structs with different values" # Ditto
fails_badly "Struct#values_at when passed an integer Range supports beginningless Range" # TypeError: cannot convert endless range to an array
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/basicobject.rb | spec/filters/bugs/basicobject.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "BasicObject" do
fails "BasicObject raises NoMethodError for nonexistent methods after #method_missing is removed" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0xb5dc8>
fails "BasicObject#initialize does not accept arguments" # NoMethodError: undefined method `class' for #<BasicObject:0x99f0>
fails "BasicObject#instance_eval class variables lookup does not have access to class variables in the receiver class when called with a String" # Expected NameError (/uninitialized class variable @@cvar/) but no exception was raised ("value_defined_in_receiver_scope" was returned)
fails "BasicObject#instance_eval class variables lookup gets class variables in the caller class when called with a String" # Expected "value_defined_in_receiver_scope" == "value_defined_in_caller_scope" to be truthy but was false
fails "BasicObject#instance_eval class variables lookup sets class variables in the caller class when called with a String" # NameError: uninitialized class variable @@cvar in BasicObjectSpecs::InstEval::CVar::Set::CallerScope
fails "BasicObject#instance_eval constants lookup when a String given looks in the caller class next" # Expected "ReceiverParent" == "Caller" to be truthy but was false
fails "BasicObject#instance_eval constants lookup when a String given looks in the caller outer scopes next" # Expected "ReceiverParent" == "CallerScope" to be truthy but was false
fails "BasicObject#instance_eval constants lookup when a String given looks in the receiver singleton class first" # Expected "Receiver" == "singleton_class" to be truthy but was false
fails "BasicObject#instance_eval converts filename argument with #to_str method" # Expected "<internal" == "file.rb" to be truthy but was false
fails "BasicObject#instance_eval converts lineno argument with #to_int method" # Expected "corelib/kernel.rb>" == "15" to be truthy but was false
fails "BasicObject#instance_eval converts string argument with #to_str method" # NoMethodError: undefined method `encoding' for #<Object:0x72810>
fails "BasicObject#instance_eval evaluates string with given filename and linenumber" # Expected ["<internal", "corelib/kernel.rb>"] == ["a_file", "10"] to be truthy but was false
fails "BasicObject#instance_eval evaluates string with given filename and negative linenumber" # Expected ["<internal", "corelib/kernel.rb>"] == ["b_file", "-98"] to be truthy but was false
fails "BasicObject#instance_eval has access to the caller's local variables" # Expected nil == "value" to be truthy but was false
fails "BasicObject#instance_eval raises ArgumentError if returned value is not Integer" # Expected TypeError (/can't convert Object to Integer/) but got: RuntimeError ()
fails "BasicObject#instance_eval raises ArgumentError if returned value is not String" # Expected TypeError (/can't convert Object to String/) but got: NoMethodError (undefined method `encoding' for #<Object:0x72a4a>)
fails "BasicObject#instance_eval raises TypeError for frozen objects when tries to set receiver's instance variables" # Expected FrozenError (can't modify frozen NilClass: nil) but no exception was raised (42 was returned)
fails "BasicObject#instance_eval raises an ArgumentError when a block and normal arguments are given" # Expected ArgumentError (wrong number of arguments (given 2, expected 0)) but got: ArgumentError (wrong number of arguments (2 for 0))
fails "BasicObject#instance_eval raises an ArgumentError when more than 3 arguments are given" # Expected ArgumentError (wrong number of arguments (given 4, expected 1..3)) but got: ArgumentError (wrong number of arguments (0 for 1..3))
fails "BasicObject#instance_eval raises an ArgumentError when no arguments and no block are given" # Expected ArgumentError (wrong number of arguments (given 0, expected 1..3)) but got: ArgumentError (wrong number of arguments (0 for 1..3))
fails "BasicObject#instance_exec raises a LocalJumpError unless given a block" # Expected LocalJumpError but got: ArgumentError (no block given)
fails "BasicObject#method_missing for an instance sets the receiver of the raised NoMethodError" # No behavior expectation was found in the example
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
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)
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)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/stringio.rb | spec/filters/bugs/stringio.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "StringIO" do
fails "StringIO#each when passed chomp returns each line with removed separator when called without block" # Expected ["a b \n" + "c d e|", "1 2 3 4 5\n" + "|", "the end"] == ["a b \n" + "c d e", "1 2 3 4 5\n", "the end"] to be truthy but was false
fails "StringIO#each when passed chomp yields each line with removed separator to the passed block" # Expected ["a b \n" + "c d e|", "1 2 3 4 5\n" + "|", "the end"] == ["a b \n" + "c d e", "1 2 3 4 5\n", "the end"] to be truthy but was false
fails "StringIO#each when passed limit returns the data read until the limit is met" # NoMethodError: undefined method `[]' for nil
fails "StringIO#each_line when passed limit returns the data read until the limit is met" # NoMethodError: undefined method `[]' for nil
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/refinement.rb | spec/filters/bugs/refinement.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "refinement" do
fails "Refinement#import_methods doesn't import any methods if one of the arguments is not a module" # Expected TypeError but got: NoMethodError (undefined method `import_methods' for #<refinement:String@#<Module:0x42ca2>>)
fails "Refinement#import_methods doesn't import methods from included/prepended modules" # NoMethodError: undefined method `import_methods' for #<refinement:String@#<Module:0x42cb0>>
fails "Refinement#import_methods doesn't import module's class methods" # NoMethodError: undefined method `import_methods' for #<refinement:String@#<Module:0x42cbc>>
fails "Refinement#import_methods imports methods from module so that methods can see each other" # NoMethodError: undefined method `import_methods' for #<refinement:String@#<Module:0x42cb6>>
fails "Refinement#import_methods imports methods from multiple modules so that methods see other's module's methods" # NoMethodError: undefined method `import_methods' for #<refinement:String@#<Module:0x42caa>>
fails "Refinement#import_methods imports module methods with super" # NoMethodError: undefined method `import_methods' for #<refinement:#<Class:0x42c8c>@#<Module:0x42c90>>
fails "Refinement#import_methods warns if a module includes/prepends some other module" # NoMethodError: undefined method `import_methods' for #<refinement:String@#<Module:0x42c9a>>
fails "Refinement#import_methods when methods are defined in Ruby code imports a method defined in the last module if method with same name is defined in multiple modules" # NoMethodError: undefined method `import_methods' for #<refinement:String@#<Module:0x42cd2>>
fails "Refinement#import_methods when methods are defined in Ruby code imports methods from multiple modules" # NoMethodError: undefined method `import_methods' for #<refinement:String@#<Module:0x42ccc>>
fails "Refinement#import_methods when methods are defined in Ruby code imports methods" # NoMethodError: undefined method `import_methods' for #<refinement:String@#<Module:0x42ce2>>
fails "Refinement#import_methods when methods are defined in Ruby code still imports methods of modules listed before a module that contains method not defined in Ruby" # Expected ArgumentError but got: NoMethodError (undefined method `import_methods' for #<refinement:String@#<Module:0x42cc4>>)
fails "Refinement#import_methods when methods are defined in Ruby code throws an exception when argument is not a module" # Expected TypeError (wrong argument type Class (expected Module)) but got: NoMethodError (undefined method `import_methods' for #<refinement:String@#<Module:0x42cda>>)
fails "Refinement#import_methods when methods are not defined in Ruby code raises ArgumentError when importing methods from C extension" # Expected ArgumentError (/Can't import method which is not defined with Ruby code: Zlib#*/) but got: NameError (uninitialized constant Zlib)
fails "Refinement#import_methods when methods are not defined in Ruby code raises ArgumentError" # Expected ArgumentError but got: NoMethodError (undefined method `import_methods' for #<refinement:String@#<Module:0x42cf0>>)
fails "Refinement#include raises a TypeError" # Expected TypeError (Refinement#include has been removed) but no exception was raised (#<refinement:String@#<Module:0x43ea8>> was returned)
fails "Refinement#prepend raises a TypeError" # Expected TypeError (Refinement#prepend has been removed) but no exception was raised (#<refinement:String@#<Module:0x2ee12>> was returned)
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/method.rb | spec/filters/bugs/method.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Method" do
fails "Method#<< does not try to coerce argument with #to_proc" # Expected TypeError (callable object is expected) but no exception was raised (#<Proc:0x3c64> was returned)
fails "Method#<< raises TypeError if passed not callable object" # Expected TypeError (callable object is expected) but no exception was raised (#<Proc:0x3ca0> was returned)
fails "Method#== missing methods returns true for the same method missing" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#== returns true if a method was defined using the other one" # Expected false to be true
fails "Method#== returns true if methods are the same" # Expected false to be true
fails "Method#== returns true if the two core methods are aliases" # Expected false to be true
fails "Method#== returns true on aliased methods" # Expected false to be true
fails "Method#=== for a Method generated by respond_to_missing? does not call the original method name even if it now exists" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#=== for a Method generated by respond_to_missing? invokes method_missing dynamically" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#=== for a Method generated by respond_to_missing? invokes method_missing with the method name and the specified arguments" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#=== for a Method generated by respond_to_missing? invokes method_missing with the specified arguments and returns the result" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#>> composition is a lambda" # Expected #<Proc:0x3d52>.lambda? to be truthy but was false
fails "Method#>> does not try to coerce argument with #to_proc" # Expected TypeError (callable object is expected) but no exception was raised (#<Proc:0x3cee> was returned)
fails "Method#>> raises TypeError if passed not callable object" # Expected TypeError (callable object is expected) but no exception was raised (#<Proc:0x3d2a> was returned)
fails "Method#[] for a Method generated by respond_to_missing? does not call the original method name even if it now exists" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#[] for a Method generated by respond_to_missing? invokes method_missing dynamically" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#[] for a Method generated by respond_to_missing? invokes method_missing with the method name and the specified arguments" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#[] for a Method generated by respond_to_missing? invokes method_missing with the specified arguments and returns the result" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#arity for a Method generated by respond_to_missing? returns -1" # Mock 'method arity respond_to_missing' expected to receive respond_to_missing?("any_args") exactly 1 times but received it 0 times
fails "Method#call for a Method generated by respond_to_missing? does not call the original method name even if it now exists" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#call for a Method generated by respond_to_missing? invokes method_missing dynamically" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#call for a Method generated by respond_to_missing? invokes method_missing with the method name and the specified arguments" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#call for a Method generated by respond_to_missing? invokes method_missing with the specified arguments and returns the result" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#clone returns a copy of the method" # Expected #<Method: MethodSpecs::Methods#foo (defined in MethodSpecs::Methods in ruby/core/method/fixtures/classes.rb:24)> == #<Method: MethodSpecs::Methods#foo (defined in MethodSpecs::Methods in ruby/core/method/fixtures/classes.rb:24)> to be truthy but was false
fails "Method#curry with optional arity argument raises ArgumentError when the method requires less arguments than the given arity" # Expected ArgumentError but no exception was raised (#<Proc:0x7c68a> was returned)
fails "Method#curry with optional arity argument raises ArgumentError when the method requires more arguments than the given arity" # Expected ArgumentError but no exception was raised (#<Proc:0x7c66a> was returned)
fails "Method#define_method when passed a Proc object and a method is defined inside defines the nested method in the default definee where the Proc was created" # Expected #<#<Class:0x51aa0>:0x51a9c> NOT to have method 'nested_method_in_proc_for_define_method' but it does
fails "Method#eql? missing methods returns true for the same method missing" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#eql? returns true if a method was defined using the other one" # Expected false to be true
fails "Method#eql? returns true if methods are the same" # Expected false to be true
fails "Method#eql? returns true if the two core methods are aliases" # Expected false to be true
fails "Method#eql? returns true on aliased methods" # Expected false to be true
fails "Method#hash returns the same value for builtin methods that are eql?" # Expected 282998 == 283002 to be truthy but was false
fails "Method#hash returns the same value for user methods that are eql?" # Expected 283044 == 283048 to be truthy but was false
fails "Method#inspect returns a String containing method arguments" # Expected "#<Method: MethodSpecs::Methods#zero (defined in MethodSpecs::Methods in ruby/core/method/fixtures/classes.rb:49)>".include? "()" to be truthy but was false
fails "Method#inspect returns a String containing the Module containing the method if object has a singleton class but method is not defined in the singleton class" # Expected "#<Method: MethodSpecs::MySub#bar (defined in MethodSpecs::MyMod in ruby/core/method/fixtures/classes.rb:105)>".start_with? "#<Method: MethodSpecs::MySub(MethodSpecs::MyMod)#bar" to be truthy but was false
fails "Method#inspect returns a String containing the singleton class if method is defined in the singleton class" # Expected "#<Method: MethodSpecs::MySub#bar (defined in #<Class:#<MethodSpecs::MySub:0x50826>> in ruby/core/method/shared/to_s.rb:74)>".start_with? "#<Method: #<MethodSpecs::MySub:0xXXXXXX>.bar" to be truthy but was false
fails "Method#inspect returns a String including all details" # Expected "#<Method: MethodSpecs::MySub#bar (defined in MethodSpecs::MyMod in ruby/core/method/fixtures/classes.rb:105)>".start_with? "#<Method: MethodSpecs::MySub(MethodSpecs::MyMod)#bar" to be truthy but was false
fails "Method#inspect shows the metaclass and the owner for a Module instance method retrieved from a class" # Expected "#<Method: Class#include (defined in Module in <internal:corelib/module.rb>:464)>".start_with? "#<Method: #<Class:String>(Module)#include" to be truthy but was false
fails "Method#name for a Method generated by respond_to_missing? returns the name passed to respond_to_missing?" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#original_name returns the name of the method" # NoMethodError: undefined method `original_name' for #<Method: String#upcase (defined in String in <internal:corelib/string.rb>:1685)>
fails "Method#original_name returns the original name even when aliased twice" # NoMethodError: undefined method `original_name' for #<Method: MethodSpecs::Methods#foo (defined in MethodSpecs::Methods in ruby/core/method/fixtures/classes.rb:24)>
fails "Method#original_name returns the original name when aliased" # NoMethodError: undefined method `original_name' for #<Method: MethodSpecs::Methods#foo (defined in MethodSpecs::Methods in ruby/core/method/fixtures/classes.rb:24)>
fails "Method#owner for a Method generated by respond_to_missing? returns the owner of the method" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#parameters returns [[:req]] for each parameter for core methods with fixed-length argument lists" # Expected [["req", "other"]] == [["req"]] to be truthy but was false
fails "Method#parameters returns [[:rest]] for a Method generated by respond_to_missing?" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#parameters returns [[:rest]] for core methods with variable-length argument lists" # NameError: undefined method `delete!' for class `String'
fails "Method#parameters returns [[:rest]] or [[:opt]] for core methods with optional arguments" # Expected [[["rest"]], [["opt"]]] to include [["opt", "count"]]
fails "Method#receiver for a Method generated by respond_to_missing? returns the receiver of the method" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#source_location for a Method generated by respond_to_missing? returns nil" # NameError: undefined method `handled_via_method_missing' for class `MethodSpecs::Methods'
fails "Method#source_location sets the first value to the path of the file in which the method was defined" # Expected "ruby/core/method/fixtures/classes.rb" == "./ruby/core/method/fixtures/classes.rb" to be truthy but was false
fails "Method#source_location works for eval with a given line" # Expected ["(eval)", 0] == ["foo", 100] to be truthy but was false
fails "Method#super_method after aliasing an inherited method returns the expected super_method" # NoMethodError: undefined method `super_method' for #<Method: MethodSpecs::InheritedMethods::C#meow (defined in MethodSpecs::InheritedMethods::C in ruby/core/method/fixtures/classes.rb:233)>
fails "Method#super_method after changing an inherited methods visibility returns the expected super_method" # NoMethodError: undefined method `super_method' for #<Method: MethodSpecs::InheritedMethods::C#derp (defined in MethodSpecs::InheritedMethods::B in ruby/core/method/fixtures/classes.rb:233)>
fails "Method#super_method returns nil when the parent's method is removed" # NoMethodError: undefined method `super_method' for #<Method: #<Class:0x50682>#overridden (defined in #<Class:0x50682> in ruby/core/method/super_method_spec.rb:36)>
fails "Method#super_method returns nil when there's no super method in the parent" # NoMethodError: undefined method `super_method' for #<Method: Object#method (defined in Kernel in <internal:corelib/kernel.rb>:32)>
fails "Method#super_method returns the method that would be called by super in the method" # NoMethodError: undefined method `super_method' for #<Method: MethodSpecs::C#overridden (defined in MethodSpecs::OverrideAgain in ruby/core/method/fixtures/classes.rb:135)>
fails "Method#to_proc returns a proc that can be used by define_method" # Exception: Cannot create property '$$meta' on string 'test'
fails "Method#to_proc returns a proc that can receive a block" # LocalJumpError: no block given
fails "Method#to_proc returns a proc whose binding has the same receiver as the method" # Expected #<MethodSpecs::Methods:0x6f2d6> == nil to be truthy but was false
fails "Method#to_s does not show the defining module if it is the same as the receiver class" # Expected "#<Method:0x458aa>".start_with? "#<Method: MethodSpecs::A#baz" to be truthy but was false
fails "Method#to_s returns a String containing method arguments" # Expected "#<Method:0x4583e>".include? "()" to be truthy but was false
fails "Method#to_s returns a String containing the Module containing the method if object has a singleton class but method is not defined in the singleton class" # Expected "#<Method:0x45952>".start_with? "#<Method: MethodSpecs::MySub(MethodSpecs::MyMod)#bar" to be truthy but was false
fails "Method#to_s returns a String containing the Module the method is defined in" # Expected "#<Method:0x45870>" =~ /MethodSpecs::MyMod/ to be truthy but was nil
fails "Method#to_s returns a String containing the Module the method is referenced from" # Expected "#<Method:0x4590e>" =~ /MethodSpecs::MySub/ to be truthy but was nil
fails "Method#to_s returns a String containing the method name" # Expected "#<Method:0x45804>" =~ /\#bar/ to be truthy but was nil
fails "Method#to_s returns a String containing the singleton class if method is defined in the singleton class" # Expected "#<Method:0x45988>".start_with? "#<Method: #<MethodSpecs::MySub:0xXXXXXX>.bar" to be truthy but was false
fails "Method#to_s returns a String including all details" # Expected "#<Method:0x458dc>".start_with? "#<Method: MethodSpecs::MySub(MethodSpecs::MyMod)#bar" to be truthy but was false
fails "Method#to_s shows the metaclass and the owner for a Module instance method retrieved from a class" # Expected "#<Method: Class#include (defined in Module in <internal:corelib/module.rb>:464)>".start_with? "#<Method: #<Class:String>(Module)#include" to be truthy but was false
fails "Method#unbind keeps the origin singleton class if there is one" # Expected "#<UnboundMethod: Object#foo (defined in #<Class:#<Object:0x30684>> in ruby/core/method/unbind_spec.rb:37)>".start_with? "#<UnboundMethod: #<Class:#<Object:0x30684>>#foo" to be truthy but was false
fails "Method#unbind rebinding UnboundMethod to Method's obj produces exactly equivalent Methods" # Expected #<Method: MethodSpecs::Methods#foo (defined in MethodSpecs::Methods in ruby/core/method/fixtures/classes.rb:24)> == #<Method: MethodSpecs::Methods#foo (defined in MethodSpecs::Methods in ruby/core/method/fixtures/classes.rb:24)> to be truthy but was false
fails_badly "Method#define_method when passed a block behaves exactly like a lambda for break" # Exception: unexpected break
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/math.rb | spec/filters/bugs/math.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Math" do
fails "Math.ldexp returns correct value that closes to the max value of double type" # Expected Infinity == 9.207889385574391e+307 to be truthy but was false
fails "Math.log2 returns the natural logarithm of the argument" # Expected Infinity == 10001 to be truthy but was false
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/array.rb | spec/filters/bugs/array.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Array" do
fails "Array#== compares with an equivalent Array-like object using #to_ary" # Expected false to be true
fails "Array#== returns true for [NaN] == [NaN] because Array#== first checks with #equal? and NaN.equal?(NaN) is true" # Expected [NaN] == [NaN] to be truthy but was false
fails "Array#[] can be sliced with Enumerator::ArithmeticSequence has endless range with start outside of array's bounds" # Expected [] == nil to be truthy but was false
fails "Array#[] can be sliced with Enumerator::ArithmeticSequence has range with bounds outside of array" # Expected RangeError but no exception was raised ([0, 2, 4] was returned)
fails "Array#[] raises TypeError if to_int returns non-integer" # Expected TypeError but no exception was raised ([1, 2, 3, 4] was returned)
fails "Array#[] raises a RangeError if passed a range with a bound that is too large" # Expected RangeError but no exception was raised (nil was returned)
fails "Array#[] raises a type error if a range is passed with a length" # Expected TypeError but no exception was raised ([2, 3] was returned)
fails "Array#all? ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
fails "Array#any? when given a pattern argument ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
fails "Array#drop raises a TypeError when the passed argument isn't an integer and #to_int returns non-Integer" # Expected TypeError but no exception was raised ([1, 2] was returned)
fails "Array#fill with (filler, index, length) raises a TypeError when the length is not numeric" # Expected TypeError (/no implicit conversion of Symbol into Integer/) but got: TypeError (no implicit conversion of String into Integer)
fails "Array#fill with (filler, range) works with endless ranges" # Expected [1, 2, 3, 4] == [1, 2, 3, "x"] to be truthy but was false
fails "Array#filter returns a new array of elements for which block is true" # Expected [1] == [1, 4, 6] to be truthy but was false
fails "Array#flatten does not call #to_ary on elements beyond the given level" # Mock '1' expected to receive to_ary("any_args") exactly 0 times but received it 1 times
fails "Array#flatten performs respond_to? and method_missing-aware checks when coercing elements to array" # NoMethodError: undefined method `respond_to?' for #<BasicObject:0x2698>
fails "Array#flatten with a non-Array object in the Array calls #method_missing if defined" # Expected [#<MockObject:0x2730 @name="Array#flatten", @null=nil>] == [1, 2, 3] to be truthy but was false
fails "Array#initialize with no arguments does not use the given block" # Expected warning to match: /ruby\/core\/array\/initialize_spec.rb:57: warning: given block not used/ but got: ""
fails "Array#inspect does not call #to_str on the object returned from #to_s when it is not a String" # Exception: Cannot convert object to primitive value
fails "Array#intersect? tries to convert the passed argument to an Array using #to_ary" # Expected false == true to be truthy but was false
fails "Array#none? ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
fails "Array#one? ignores the block if there is an argument" # Expected warning to match: /given block not used/ but got: ""
fails "Array#pack with format 'A' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
fails "Array#pack with format 'A' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
fails "Array#pack with format 'C' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
fails "Array#pack with format 'C' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
fails "Array#pack with format 'L' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
fails "Array#pack with format 'L' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
fails "Array#pack with format 'U' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
fails "Array#pack with format 'U' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
fails "Array#pack with format 'a' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
fails "Array#pack with format 'a' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
fails "Array#pack with format 'c' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
fails "Array#pack with format 'c' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
fails "Array#pack with format 'l' ignores comments in the format string" # RuntimeError: Unsupported pack directive "m" (no chunk reader defined)
fails "Array#pack with format 'l' warns that a directive is unknown" # Expected warning to match: /unknown pack directive 'R'/ but got: ""
fails "Array#pack with format 'u' calls #to_str to convert an Object to a String" # Mock 'pack u string' expected to receive to_str("any_args") exactly 1 times but received it 0 times
fails "Array#pack with format 'u' ignores comments in the format string" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' warns that a directive is unknown" # RuntimeError: Unsupported pack directive "u" (no chunk reader defined)
fails "Array#pack with format 'u' will not implicitly convert a number to a string" # Expected TypeError but got: RuntimeError (Unsupported pack directive "u" (no chunk reader defined))
fails "Array#partition returns in the left array values for which the block evaluates to true" # Expected [[0], [1, 2, 3, 4, 5]] == [[0, 1, 2], [3, 4, 5]] to be truthy but was false
fails "Array#product returns converted arguments using :method_missing" # TypeError: no implicit conversion of ArraySpecs::ArrayMethodMissing into Array
fails "Array#rassoc calls elem == obj on the second element of each contained array" # Expected [1, "foobar"] == [2, #<MockObject:0x4a6b4 @name="foobar", @null=nil>] to be truthy but was false
fails "Array#rassoc does not check the last element in each contained but specifically the second" # Expected [1, "foobar", #<MockObject:0x4a37e @name="foobar", @null=nil>] == [2, #<MockObject:0x4a37e @name="foobar", @null=nil>, 1] to be truthy but was false
fails "Array#sample returns nil for an empty array when called without n and a Random is given" # ArgumentError: invalid argument - 0
fails "Array#select returns a new array of elements for which block is true" # Expected [1] == [1, 4, 6] to be truthy but was false
fails "Array#shuffle! matches CRuby with random:" # Expected [7, 4, 5, 0, 3, 9, 2, 8, 10, 1, 6] == [2, 6, 8, 5, 7, 10, 3, 1, 0, 4, 9] to be truthy but was false
fails "Array#shuffle! matches CRuby with srand" # Expected ["d", "j", "g", "f", "i", "e", "c", "k", "b", "h", "a"] == ["a", "e", "f", "h", "i", "j", "d", "b", "g", "k", "c"] to be truthy but was false
fails "Array#slice can be sliced with Enumerator::ArithmeticSequence has endless range with start outside of array's bounds" # Expected [] == nil to be truthy but was false
fails "Array#slice can be sliced with Enumerator::ArithmeticSequence has range with bounds outside of array" # Expected RangeError but no exception was raised ([0, 2, 4] was returned)
fails "Array#slice raises TypeError if to_int returns non-integer" # Expected TypeError but no exception was raised ([1, 2, 3, 4] was returned)
fails "Array#slice raises a RangeError if passed a range with a bound that is too large" # Expected RangeError but no exception was raised (nil was returned)
fails "Array#slice raises a type error if a range is passed with a length" # Expected TypeError but no exception was raised ([2, 3] was returned)
fails "Array#sum calls + on the init value" # NoMethodError: undefined method `-' for #<MockObject:0x7f7c2 @name="b" @null=nil>
fails "Array#to_s does not call #to_str on the object returned from #to_s when it is not a String" # Exception: Cannot convert object to primitive value
fails "Array#zip raises TypeError when some argument isn't Array and doesn't respond to #to_ary and #to_enum" # Expected TypeError (wrong argument type Object (must respond to :each)) but got: NoMethodError (undefined method `each' for #<Object:0x6273e>)
fails "Array.new with no arguments does not use the given block" # Expected warning to match: /warning: given block not used/ but got: ""
fails "Array.try_convert sends #to_ary to the argument and raises TypeError if it's not a kind of Array" # Expected TypeError (can't convert MockObject to Array (MockObject#to_ary gives Object)) but got: TypeError (can't convert MockObject into Array (MockObject#to_ary gives Object))
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/set.rb | spec/filters/bugs/set.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Set" do
fails "Set#& raises an ArgumentError when passed a non-Enumerable" # Expected ArgumentError but got: NoMethodError (undefined method `&' for #<Set: {a,b,c}>)
fails "Set#& returns a new Set containing only elements shared by self and the passed Enumerable" # NoMethodError: undefined method `&' for #<Set: {a,b,c}>
fails "Set#<=> returns +1 if the set is a proper superset of other set" # Expected nil == 1 to be truthy but was false
fails "Set#<=> returns -1 if the set is a proper subset of the other set" # Expected nil == -1 to be truthy but was false
fails "Set#== does not depend on the order of nested Sets" # Expected #<Set: {#<Set:0xb8280>,#<Set:0xb8282>,#<Set:0xb8284>}> == #<Set: {#<Set:0xb828a>,#<Set:0xb828c>,#<Set:0xb828e>}> to be truthy but was false
fails "Set#== returns true when the passed Object is a Set and self and the Object contain the same elements" # Expected #<Set: {1,2,3}> == #<Set: {1,2,3}> to be falsy but was true
fails "Set#=== is an alias for include?" # Expected #<Method: Set#=== (defined in Kernel in <internal:corelib/kernel.rb>:13)> == #<Method: Set#include? (defined in Set in ./set.rb:161)> to be truthy but was false
fails "Set#=== member equality is checked using both #hash and #eql?" # Expected false == true to be truthy but was false
fails "Set#=== returns true when self contains the passed Object" # Expected false to be true
fails "Set#^ raises an ArgumentError when passed a non-Enumerable" # Expected ArgumentError but got: NoMethodError (undefined method `^' for #<Set: {1,2,3,4}>)
fails "Set#^ returns a new Set containing elements that are not in both self and the passed Enumerable" # NoMethodError: undefined method `^' for #<Set: {1,2,3,4}>
fails "Set#compare_by_identity compares its members by identity" # Expected ["a", "b"] == ["a", "b", "b"] to be truthy but was false
fails "Set#compare_by_identity is not equal to set what does not compare by identity" # Expected #<Set: {1,2}> == #<Set: {1,2}> to be falsy but was true
fails "Set#compare_by_identity regards #clone'd objects as having different identities" # Expected ["a"] == ["a", "a"] to be truthy but was false
fails "Set#compare_by_identity regards #dup'd objects as having different identities" # Expected ["a"] == ["a", "a"] to be truthy but was false
fails "Set#divide divides self into a set of subsets based on the blocks return values" # NoMethodError: undefined method `divide' for #<Set: {one,two,three,four,five}>
fails "Set#divide returns an enumerator when not passed a block" # NoMethodError: undefined method `divide' for #<Set: {1,2,3,4}>
fails "Set#divide when passed a block with an arity of 2 divides self into a set of subsets based on the blocks return values" # NoMethodError: undefined method `divide' for #<Set: {1,3,4,6,9,10,11}>
fails "Set#divide when passed a block with an arity of 2 returns an enumerator when not passed a block" # NoMethodError: undefined method `divide' for #<Set: {1,2,3,4}>
fails "Set#divide when passed a block with an arity of 2 yields each two Object to the block" # NoMethodError: undefined method `divide' for #<Set: {1,2}>
fails "Set#divide when passed a block with an arity of > 2 only uses the first element if the arity = -1" # NoMethodError: undefined method `divide' for #<Set: {one,two,three,four,five}>
fails "Set#divide when passed a block with an arity of > 2 only uses the first element if the arity > 2" # NoMethodError: undefined method `divide' for #<Set: {one,two,three,four,five}>
fails "Set#divide yields each Object to the block" # NoMethodError: undefined method `divide' for #<Set: {one,two,three,four,five}>
fails "Set#flatten raises an ArgumentError when self is recursive" # Expected ArgumentError but got: NoMethodError (undefined method `flatten' for #<Set: {#<Set:0xb7b90>}>)
fails "Set#flatten returns a copy of self with each included Set flattened" # NoMethodError: undefined method `flatten' for #<Set: {1,2,#<Set:0xb7b9c>,9,10}>
fails "Set#flatten when Set contains a Set-like object returns a copy of self with each included Set-like object flattened" # NoMethodError: undefined method `flatten' for #<Set: {#<SetSpecs::SetLike:0xb7ba2>}>
fails "Set#flatten! flattens self" # NoMethodError: undefined method `flatten!' for #<Set: {1,2,#<Set:0xb7bc8>,9,10}>
fails "Set#flatten! raises an ArgumentError when self is recursive" # Expected ArgumentError but got: NoMethodError (undefined method `flatten!' for #<Set: {#<Set:0xb7bb6>}>)
fails "Set#flatten! returns nil when self was not modified" # NoMethodError: undefined method `flatten!' for #<Set: {1,2,3,4}>
fails "Set#flatten! returns self when self was modified" # NoMethodError: undefined method `flatten!' for #<Set: {1,2,#<Set:0xb7bbe>}>
fails "Set#flatten! when Set contains a Set-like object flattens self, including Set-like objects" # NoMethodError: undefined method `flatten!' for #<Set: {#<SetSpecs::SetLike:0xb7bd2>}>
fails "Set#flatten_merge flattens the passed Set and merges it into self" # NoMethodError: undefined method `flatten_merge' for #<Set: {1,2}>
fails "Set#flatten_merge raises an ArgumentError when trying to flatten a recursive Set" # Expected ArgumentError but got: NoMethodError (undefined method `flatten_merge' for #<Set: {1,2,3}>)
fails "Set#hash is static" # Expected 752958 == 752962 to be truthy but was false
fails "Set#initialize uses #each on the provided Enumerable if it does not respond to #each_entry" # ArgumentError: value must be enumerable
fails "Set#initialize uses #each_entry on the provided Enumerable" # ArgumentError: value must be enumerable
fails "Set#initialize_clone does not freeze the new Set when called from clone(freeze: false)" # FrozenError: can't modify frozen Hash: {1=>true, 2=>true}
fails "Set#inspect correctly handles cyclic-references" # Expected "#<Set: {#<Set:0x2e8c>}>" to include "#<Set: {...}>"
fails "Set#inspect does include the elements of the set" # Expected "#<Set: {1}>" == "#<Set: {\"1\"}>" to be truthy but was false
fails "Set#inspect puts spaces between the elements" # Expected "#<Set: {1,2}>" to include "\", \""
fails "Set#intersection raises an ArgumentError when passed a non-Enumerable" # Expected ArgumentError but got: NoMethodError (undefined method `intersection' for #<Set: {a,b,c}>)
fails "Set#intersection returns a new Set containing only elements shared by self and the passed Enumerable" # NoMethodError: undefined method `intersection' for #<Set: {a,b,c}>
fails "Set#join calls #to_a to convert the Set in to an Array" # NoMethodError: undefined method `join' for #<Set: {a,b,c}>
fails "Set#join does not separate elements when the passed separator is nil" # NoMethodError: undefined method `join' for #<Set: {a,b,c}>
fails "Set#join returns a new string formed by joining elements after conversion" # NoMethodError: undefined method `join' for #<Set: {a,b,c}>
fails "Set#join returns a string formed by concatenating each element separated by the separator" # NoMethodError: undefined method `join' for #<Set: {a,b,c}>
fails "Set#join returns an empty string if the Set is empty" # NoMethodError: undefined method `join' for #<Set: {}>
fails "Set#merge raises an ArgumentError when passed a non-Enumerable" # Expected ArgumentError but got: NoMethodError (undefined method `each' for 1)
fails "Set#pretty_print_cycle passes the 'pretty print' representation of a self-referencing Set to the pretty print writer" # Mock 'PrettyPrint' expected to receive text("#<Set: {...}>") exactly 1 times but received it 0 times
fails "Set#to_s correctly handles cyclic-references" # Expected "#<Set:0xb920e>" to include "#<Set: {...}>"
fails "Set#to_s does include the elements of the set" # Expected "#<Set:0xb9246>" == "#<Set: {\"1\"}>" to be truthy but was false
fails "Set#to_s is an alias of inspect" # Expected #<Method: Set#to_s (defined in Kernel in <internal:corelib/kernel.rb>:768)> == #<Method: Set#inspect (defined in Set in ./set.rb:36)> to be truthy but was false
fails "Set#to_s puts spaces between the elements" # Expected "#<Set:0xb9274>" to include "\", \""
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/time.rb | spec/filters/bugs/time.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Time" do
fails "Time#+ zone is a timezone object preserves time zone" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time#- tracks microseconds from a Rational" # Expected 0 == 123456 to be truthy but was false
fails "Time#- zone is a timezone object preserves time zone" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time#ceil ceils to 0 decimal places with an explicit argument" # NoMethodError: undefined method `ceil' for 2010-03-30 05:43:25 UTC
fails "Time#ceil ceils to 2 decimal places with an explicit argument" # NoMethodError: undefined method `ceil' for 2010-03-30 05:43:25 UTC
fails "Time#ceil ceils to 4 decimal places with an explicit argument" # NoMethodError: undefined method `ceil' for 2010-03-30 05:43:25 UTC
fails "Time#ceil ceils to 7 decimal places with an explicit argument" # NoMethodError: undefined method `ceil' for 2010-03-30 05:43:25 UTC
fails "Time#ceil copies own timezone to the returning value" # NoMethodError: undefined method `ceil' for 2010-03-30 05:43:25 UTC
fails "Time#ceil defaults to ceiling to 0 places" # NoMethodError: undefined method `ceil' for 2010-03-30 05:43:25 UTC
fails "Time#ceil returns an instance of Time, even if #ceil is called on a subclass" # Expected Time to be identical to #<Class:0xa40e6>
fails "Time#deconstruct_keys ignores non-Symbol keys" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200
fails "Time#deconstruct_keys ignores not existing Symbol keys" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200
fails "Time#deconstruct_keys it raises error when argument is neither nil nor array" # Expected TypeError (wrong argument type Integer (expected Array or nil)) but got: NoMethodError (undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200)
fails "Time#deconstruct_keys requires one argument" # Expected ArgumentError but got: NoMethodError (undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200)
fails "Time#deconstruct_keys returns only specified keys" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:39:00 UTC
fails "Time#deconstruct_keys returns whole hash for nil as an argument" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:30:00 UTC
fails "Time#deconstruct_keys returns {} when passed []" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200
fails "Time#dup returns a clone of Time instance" # NoMethodError: undefined method `now' for #<Module:0x133b8>
fails "Time#floor copies own timezone to the returning value" # NoMethodError: undefined method `floor' for 2010-03-30 05:43:25 UTC
fails "Time#floor defaults to flooring to 0 places" # NoMethodError: undefined method `floor' for 2010-03-30 05:43:25 UTC
fails "Time#floor floors to 0 decimal places with an explicit argument" # NoMethodError: undefined method `floor' for 2010-03-30 05:43:25 UTC
fails "Time#floor floors to 7 decimal places with an explicit argument" # NoMethodError: undefined method `floor' for 2010-03-30 05:43:25 UTC
fails "Time#floor returns an instance of Time, even if #floor is called on a subclass" # Expected Time to be identical to #<Class:0x10b74>
fails "Time#getlocal raises ArgumentError if the String argument is not in an ASCII-compatible encoding" # Expected ArgumentError but got: NoMethodError (undefined method `getlocal' for 2022-12-07 05:21:15 +0100)
fails "Time#getlocal with a timezone argument accepts timezone argument that must have #local_to_utc and #utc_to_local methods" # Expected to not get Exception but got: NoMethodError (undefined method `getlocal' for 2000-01-01 12:00:00 UTC)
fails "Time#getlocal with a timezone argument does not raise exception if timezone does not implement #local_to_utc method" # Expected to not get Exception but got: NoMethodError (undefined method `getlocal' for 2000-01-01 12:00:00 UTC)
fails "Time#getlocal with a timezone argument raises TypeError if timezone does not implement #utc_to_local method" # Expected TypeError (/can't convert \w+ into an exact number/) but got: NoMethodError (undefined method `getlocal' for 2000-01-01 12:00:00 UTC)
fails "Time#getlocal with a timezone argument returns a Time in the timezone" # NoMethodError: undefined method `getlocal' for 2000-01-01 12:00:00 UTC
fails "Time#getlocal with a timezone argument subject's class implements .find_timezone method calls .find_timezone to build a time object if passed zone name as a timezone argument" # NoMethodError: undefined method `getlocal' for 2000-01-01 12:00:00 UTC
fails "Time#getlocal with a timezone argument subject's class implements .find_timezone method does not call .find_timezone if passed any not string/numeric/timezone timezone argument" # Expected TypeError (/can't convert \w+ into an exact number/) but got: NoMethodError (undefined method `getlocal' for 2000-01-01 12:00:00 UTC)
fails "Time#gmtime converts self to UTC, modifying the receiver" # Expected 2007-01-09 05:00:00 UTC == 2007-01-09 12:00:00 UTC to be truthy but was false
fails "Time#inspect omits trailing zeros from microseconds" # Expected "2007-11-01 15:25:00 UTC" == "2007-11-01 15:25:00.1 UTC" to be truthy but was false
fails "Time#inspect preserves microseconds" # Expected "2007-11-01 15:25:00 UTC" == "2007-11-01 15:25:00.123456 UTC" to be truthy but was false
fails "Time#inspect preserves nanoseconds" # Expected "2007-11-01 15:25:00 UTC" == "2007-11-01 15:25:00.123456789 UTC" to be truthy but was false
fails "Time#inspect uses the correct time zone with microseconds" # NoMethodError: undefined method `localtime' for 2000-01-01 00:00:00 UTC
fails "Time#inspect uses the correct time zone without microseconds" # NoMethodError: undefined method `localtime' for 2000-01-01 00:00:00 UTC
fails "Time#localtime on a frozen time raises a FrozenError if the time has a different time zone" # Expected FrozenError but got: NoMethodError (undefined method `localtime' for 2007-01-09 12:00:00 UTC)
fails "Time#localtime raises ArgumentError if the String argument is not in an ASCII-compatible encoding" # Expected ArgumentError but got: NoMethodError (undefined method `localtime' for 2022-12-07 05:21:43 +0100)
fails "Time#localtime returns a Time with a UTC offset specified as A-Z military zone" # NoMethodError: undefined method `localtime' for 2007-01-09 12:00:00 +0100
fails "Time#localtime returns a Time with a UTC offset specified as UTC" # NoMethodError: undefined method `localtime' for 2007-01-09 12:00:00 +0100
fails "Time#nsec returns a positive value for dates before the epoch" # NoMethodError: undefined method `nsec' for 1969-11-12 13:18:57 UTC
fails "Time#round copies own timezone to the returning value" # NoMethodError: undefined method `round' for 2010-03-30 05:43:25 UTC
fails "Time#round defaults to rounding to 0 places" # NoMethodError: undefined method `round' for 2010-03-30 05:43:25 UTC
fails "Time#round returns an instance of Time, even if #round is called on a subclass" # Expected Time to be identical to #<Class:0x5990a>
fails "Time#round rounds to 0 decimal places with an explicit argument" # NoMethodError: undefined method `round' for 2010-03-30 05:43:25 UTC
fails "Time#round rounds to 7 decimal places with an explicit argument" # NoMethodError: undefined method `round' for 2010-03-30 05:43:25 UTC
fails "Time#strftime applies '-' flag to UTC time" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: Z
fails "Time#strftime rounds an offset to the nearest second when formatting with %z" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time#strftime should be able to print the commercial year with leading zeroes" # Expected "200" == "0200" to be truthy but was false
fails "Time#strftime should be able to print the commercial year with only two digits" # TypeError: no implicit conversion of Range into Integer
fails "Time#strftime should be able to show default Logger format" # Expected "2001-12-03T04:05:06.000000 " == "2001-12-03T04:05:06.100000 " to be truthy but was false
fails "Time#strftime should be able to show the commercial week day" # Expected "1" == "7" to be truthy but was false
fails "Time#strftime should be able to show the number of seconds since the unix epoch" # Expected "1104534000" == "1104537600" to be truthy but was false
fails "Time#strftime should be able to show the timezone of the date with a : separator" # Expected "-0000" == "+0000" to be truthy but was false
fails "Time#strftime should be able to show the week number with the week starting on Sunday (%U) and Monday (%W)" # Expected "%U" == "14" to be truthy but was false
fails "Time#strftime supports RFC 3339 UTC for unknown offset local time, -0000, as %-z" # Expected "-0000" == "+0000" to be truthy but was false
fails "Time#strftime with %N formats the microseconds of the second with %6N" # Expected "000000" == "042000" to be truthy but was false
fails "Time#strftime with %N formats the milliseconds of the second with %3N" # Expected "000" == "050" to be truthy but was false
fails "Time#strftime with %N formats the nanoseconds of the second with %9N" # Expected "000000000" == "001234000" to be truthy but was false
fails "Time#strftime with %N formats the nanoseconds of the second with %N" # Expected "000000000" == "001234560" to be truthy but was false
fails "Time#strftime with %N formats the picoseconds of the second with %12N" # Expected "000000000000" == "999999999999" to be truthy but was false
fails "Time#strftime works correctly with width, _ and 0 flags, and :" # Expected "-0000" == " -000" to be truthy but was false
fails "Time#subsec returns 0 as an Integer for a Time with a whole number of seconds" # NoMethodError: undefined method `subsec' for 1970-01-01 01:01:40 +0100
fails "Time#to_date yields accurate julian date for Julian-Gregorian gap value" # Expected 2299170 == 2299160 to be truthy but was false
fails "Time#to_date yields accurate julian date for ambiguous pre-Gregorian reform value" # Expected 2299160 == 2299150 to be truthy but was false
fails "Time#to_date yields accurate julian date for post-Gregorian reform value" # Expected 2299171 == 2299161 to be truthy but was false
fails "Time#to_date yields same julian day regardless of UTC time value" # Expected 2299171 == 2299161 to be truthy but was false
fails "Time#to_date yields same julian day regardless of local time or zone" # Expected 2299171 == 2299161 to be truthy but was false
fails "Time#to_f returns the float number of seconds + usecs since the epoch" # Expected 100 == 100.0001 to be truthy but was false
fails "Time#to_i rounds fractional seconds toward zero" # Expected -315619200 == -315619199 to be truthy but was false
fails "Time#tv_sec rounds fractional seconds toward zero" # Expected -315619200 == -315619199 to be truthy but was false
fails "Time#usec returns a positive value for dates before the epoch" # Expected 0 == 404240 to be truthy but was false
fails "Time#utc converts self to UTC, modifying the receiver" # Expected 2007-01-09 05:00:00 UTC == 2007-01-09 12:00:00 UTC to be truthy but was false
fails "Time#utc? does not treat time with +00:00 offset as UTC" # Expected true == false to be truthy but was false
fails "Time#utc? does not treat time with 0 offset as UTC" # Expected true == false to be truthy but was false
fails "Time#utc? does treat time with 'UTC' offset as UTC" # NoMethodError: undefined method `localtime' for 2023-09-20 22:52:11 +0200
fails "Time#utc? does treat time with -00:00 offset as UTC" # NoMethodError: undefined method `localtime' for 2023-09-20 22:52:11 +0200
fails "Time#utc? does treat time with Z offset as UTC" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: Z
fails "Time#zone Encoding.default_internal is set returns an ASCII string" # NoMethodError: undefined method `default_internal' for Encoding
fails "Time#zone defaults to UTC when bad zones given" # Expected 3600 == 0 to be truthy but was false
fails "Time#zone returns UTC when called on a UTC time" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: Z
fails "Time.at :in keyword argument could be UTC offset as a 'UTC' String" # TypeError: no implicit conversion of Hash into Integer
fails "Time.at :in keyword argument could be UTC offset as a String in '+HH:MM or '-HH:MM' format" # TypeError: no implicit conversion of Hash into Integer
fails "Time.at :in keyword argument could be UTC offset as a military zone A-Z" # TypeError: no implicit conversion of Hash into Integer
fails "Time.at :in keyword argument could be UTC offset as a number of seconds" # TypeError: no implicit conversion of Hash into Integer
fails "Time.at :in keyword argument could be a timezone object" # TypeError: no implicit conversion of Hash into Integer
fails "Time.at :in keyword argument raises ArgumentError if format is invalid" # Expected ArgumentError but got: TypeError (no implicit conversion of Hash into Integer)
fails "Time.at passed Numeric passed BigDecimal doesn't round input value" # NoMethodError: undefined method `to_i' for 1.1
fails "Time.at passed Numeric passed Rational returns Time with correct microseconds" # Expected 0 == 539759 to be truthy but was false
fails "Time.at passed Numeric passed Rational returns Time with correct nanoseconds" # Expected 0 == 539759 to be truthy but was false
fails "Time.at passed Numeric roundtrips a Rational produced by #to_r" # NoMethodError: undefined method `to_r' for 2022-12-07 05:21:14 +0100
fails "Time.at passed [Time, Numeric, format] :microsecond format treats second argument as microseconds" # ArgumentError: [Time.at] wrong number of arguments (given 3, expected -2)
fails "Time.at passed [Time, Numeric, format] :millisecond format treats second argument as milliseconds" # ArgumentError: [Time.at] wrong number of arguments (given 3, expected -2)
fails "Time.at passed [Time, Numeric, format] :nanosecond format treats second argument as nanoseconds" # ArgumentError: [Time.at] wrong number of arguments (given 3, expected -2)
fails "Time.at passed [Time, Numeric, format] :nsec format treats second argument as nanoseconds" # ArgumentError: [Time.at] wrong number of arguments (given 3, expected -2)
fails "Time.at passed [Time, Numeric, format] :usec format treats second argument as microseconds" # ArgumentError: [Time.at] wrong number of arguments (given 3, expected -2)
fails "Time.at passed [Time, Numeric, format] supports Float second argument" # ArgumentError: [Time.at] wrong number of arguments (given 3, expected -2)
fails "Time.at passed non-Time, non-Numeric with an argument that responds to #to_r needs for the argument to respond to #to_int too" # Mock 'rational-but-no-to_int' expected to receive to_r("any_args") exactly 1 times but received it 0 times
fails "Time.gm handles fractional usec close to rounding limit" # NoMethodError: undefined method `nsec' for 2000-01-01 12:30:00 UTC
fails "Time.gm raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 UTC was returned)
fails "Time.gm raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
fails "Time.gm raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
fails "Time.httpdate parses RFC-2616 strings" # NoMethodError: undefined method `httpdate' for Time
fails "Time.local raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 +0100 was returned)
fails "Time.local raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
fails "Time.local raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
fails "Time.local uses the 'CET' timezone with TZ=Europe/Amsterdam in 1970" # Expected [0, 0, 0, 16, 5, 1970, 6, 136, false, "Central European Standard Time"] == [0, 0, 0, 16, 5, 1970, 6, 136, false, "CET"] to be truthy but was false
fails "Time.mktime raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 +0100 was returned)
fails "Time.mktime raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
fails "Time.mktime raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
fails "Time.mktime uses the 'CET' timezone with TZ=Europe/Amsterdam in 1970" # Expected [0, 0, 0, 16, 5, 1970, 6, 136, false, "Central European Standard Time"] == [0, 0, 0, 16, 5, 1970, 6, 136, false, "CET"] to be truthy but was false
fails "Time.new has at least microsecond precision" # NoMethodError: undefined method `nsec' for 2022-12-07 05:20:59 +0100
fails "Time.new raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
fails "Time.new raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
fails "Time.new uses the 'CET' timezone with TZ=Europe/Amsterdam in 1970" # Expected [0, 0, 0, 16, 5, 1970, 6, 136, false, "Central European Standard Time"] == [0, 0, 0, 16, 5, 1970, 6, 136, false, "CET"] to be truthy but was false
fails "Time.new uses the local timezone" # Expected 3600 == -28800 to be truthy but was false
fails "Time.new with a timezone argument #name method cannot marshal Time if #name method isn't implemented" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument #name method uses the optional #name method for marshaling" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument :in keyword argument allows omitting minor arguments" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument :in keyword argument converts to a provided timezone if all the positional arguments are omitted" # TypeError: no implicit conversion of Hash into Integer
fails "Time.new with a timezone argument :in keyword argument could be UTC offset as a String in '+HH:MM or '-HH:MM' format" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument :in keyword argument could be UTC offset as a number of seconds" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument :in keyword argument could be a timezone object" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument :in keyword argument raises ArgumentError if two offset arguments are given" # Expected ArgumentError (timezone argument given as positional and keyword arguments) but got: ArgumentError ([Time.new] wrong number of arguments (given 8, expected -1))
fails "Time.new with a timezone argument :in keyword argument returns a Time with UTC offset specified as a single letter military timezone" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument Time-like argument of #utc_to_local and #local_to_utc methods has attribute values the same as a Time object in UTC" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument Time-like argument of #utc_to_local and #local_to_utc methods implements subset of Time methods" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument Time.new with a String argument accepts precision keyword argument and truncates specified digits of sub-second part" # NoMethodError: undefined method `subsec' for 2021-01-01 00:00:00 +0100
fails "Time.new with a timezone argument Time.new with a String argument converts precision keyword argument into Integer if is not nil" # TypeError: no implicit conversion of Hash into Integer
fails "Time.new with a timezone argument Time.new with a String argument parses an ISO-8601 like format" # Expected 2020-01-01 00:00:00 +0100 == 2020-12-24 15:56:17 UTC to be truthy but was false
fails "Time.new with a timezone argument Time.new with a String argument raise TypeError is can't convert precision keyword argument into Integer" # Expected TypeError (no implicit conversion from string) but got: TypeError (no implicit conversion of Hash into Integer)
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if String argument is not in the supported format" # Expected ArgumentError (year must be 4 or more digits: 021) but no exception was raised (21-01-01 00:00:00 +0124 was returned)
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if date/time parts values are not valid" # Expected ArgumentError (mon out of range) but no exception was raised (2020-01-01 00:00:00 +0100 was returned)
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if part of time string is missing" # Expected ArgumentError (missing sec part: 00:56 ) but no exception was raised (2020-01-01 00:00:00 +0100 was returned)
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if string has not ascii-compatible encoding" # Expected ArgumentError (time string should have ASCII compatible encoding) but no exception was raised (2021-01-01 00:00:00 +0100 was returned)
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if subsecond is missing after dot" # Expected ArgumentError (subsecond expected after dot: 00:56:17. ) but no exception was raised (2020-01-01 00:00:00 +0100 was returned)
fails "Time.new with a timezone argument Time.new with a String argument returns Time in timezone specified in the String argument even if the in keyword argument provided" # TypeError: no implicit conversion of Hash into Integer
fails "Time.new with a timezone argument Time.new with a String argument returns Time in timezone specified in the String argument" # Expected "2021-01-01 00:00:00 +0100" == "2021-12-25 00:00:00 +0500" to be truthy but was false
fails "Time.new with a timezone argument Time.new with a String argument returns Time in timezone specified with in keyword argument if timezone isn't provided in the String argument" # TypeError: no implicit conversion of Hash into Integer
fails "Time.new with a timezone argument accepts timezone argument that must have #local_to_utc and #utc_to_local methods" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
fails "Time.new with a timezone argument does not raise exception if timezone does not implement #utc_to_local method" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
fails "Time.new with a timezone argument raises TypeError if timezone does not implement #local_to_utc method" # Expected TypeError (/can't convert \w+ into an exact number/) but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could be Time instance" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could be Time subclass instance" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could be any object with #to_i method" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could have any #zone and #utc_offset because they are ignored" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods leads to raising Argument error if difference between argument and result is too large" # Expected ArgumentError (utc_offset out of range) but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
fails "Time.new with a timezone argument returns a Time in the timezone" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument subject's class implements .find_timezone method calls .find_timezone to build a time object at loading marshaled data" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a timezone argument subject's class implements .find_timezone method calls .find_timezone to build a time object if passed zone name as a timezone argument" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: Asia/Colombo
fails "Time.new with a timezone argument subject's class implements .find_timezone method does not call .find_timezone if passed any not string/numeric/timezone timezone argument" # Expected TypeError (/can't convert \w+ into an exact number/) but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
fails "Time.new with a timezone argument the #abbr method is used by '%Z' in #strftime" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
fails "Time.new with a utc_offset argument raises ArgumentError if the String argument is not in an ASCII-compatible encoding" # Expected ArgumentError but no exception was raised (2000-01-01 00:00:00 -0410.000000000000028 was returned)
fails "Time.new with a utc_offset argument raises ArgumentError if the string argument is J" # Expected ArgumentError ("+HH:MM", "-HH:MM", "UTC" or "A".."I","K".."Z" expected for utc_offset: J) but got: ArgumentError ("+HH:MM", "-HH:MM", "UTC" expected for utc_offset: J)
fails "Time.new with a utc_offset argument raises ArgumentError if the utc_offset argument is greater than or equal to 10e9" # Expected ArgumentError but no exception was raised (2000-01-01 00:00:00 +27777746.66666666418314 was returned)
fails "Time.new with a utc_offset argument returns a Time with UTC offset specified as a single letter military timezone" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: A
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HH" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: +05
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HH:MM:SS" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: +05:30:37
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HHMM" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: +0530
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HHMMSS" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: +053037
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as -HH" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: -05
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as -HHMM" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: -0530
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as -HHMMSS" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: -053037
fails "Time.now :in keyword argument could be UTC offset as a String in '+HH:MM or '-HH:MM' format" # ArgumentError: [Time.now] wrong number of arguments (given 1, expected 0)
fails "Time.now :in keyword argument could be UTC offset as a number of seconds" # ArgumentError: [Time.now] wrong number of arguments (given 1, expected 0)
fails "Time.now :in keyword argument could be a timezone object" # ArgumentError: [Time.now] wrong number of arguments (given 1, expected 0)
fails "Time.now :in keyword argument returns a Time with UTC offset specified as a single letter military timezone" # ArgumentError: [Time.now] wrong number of arguments (given 1, expected 0)
fails "Time.now has at least microsecond precision" # NoMethodError: undefined method `nsec' for 2022-12-07 05:21:38 +0100
fails "Time.now uses the local timezone" # Expected 3600 == -28800 to be truthy but was false
fails "Time.rfc2822 parses RFC-2822 strings" # NoMethodError: undefined method `rfc2822' for Time
fails "Time.rfc2822 parses RFC-822 strings" # NoMethodError: undefined method `rfc2822' for Time
fails "Time.rfc822 parses RFC-2822 strings" # NoMethodError: undefined method `rfc2822' for Time
fails "Time.rfc822 parses RFC-822 strings" # NoMethodError: undefined method `rfc2822' for Time
fails "Time.utc handles fractional usec close to rounding limit" # NoMethodError: undefined method `nsec' for 2000-01-01 12:30:00 UTC
fails "Time.utc raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 UTC was returned)
fails "Time.utc raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
fails "Time.utc raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
fails "Time.xmlschema parses ISO-8601 strings" # NoMethodError: undefined method `xmlschema' for Time
fails_badly "Marshal.load for a Time keeps the local zone" # Expected "Fiji Standard Time" == "Fiji Summer Time" to be truthy but was false
fails_badly "Time#dst? dst? returns whether time is during daylight saving time" # Expected false == true to be truthy but was false
fails_badly "Time#isdst dst? returns whether time is during daylight saving time" # Expected false == true to be truthy but was false
fails_badly "Time#strftime with %z formats a local time with positive UTC offset as '+HHMM'" # Expected "+0900" == "+0100" to be truthy but was false
fails_badly "Time#yday returns an integer representing the day of the year, 1..366" # Expected 117 == 116 to be truthy but was false
fails_badly "Time.new with a timezone argument Time.new with a String argument returns Time in local timezone if not provided in the String argument" # Expected "Fiji Summer Time" == "Fiji Standard Time" to be truthy but was false
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/file.rb | spec/filters/bugs/file.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "File" do
fails "File.absolute_path accepts a second argument of a directory from which to resolve the path" # Expected "./ruby/core/file/ruby/core/file/absolute_path_spec.rb" == "ruby/core/file/absolute_path_spec.rb" to be truthy but was false
fails "File.absolute_path does not expand '~user' to a home directory." # Expected "./ruby/core/file/~user" == "ruby/core/file/~user" to be truthy but was false
fails "File.absolute_path resolves paths relative to the current working directory" # Expected "./ruby/core/file/hello.txt" == "ruby/core/file/hello.txt" to be truthy but was false
fails "File.absolute_path? calls #to_path on its argument" # Mock 'path' expected to receive to_path("any_args") exactly 1 times but received it 0 times
fails "File.absolute_path? does not expand '~' to a home directory." # NoMethodError: undefined method `absolute_path?' for File
fails "File.absolute_path? does not expand '~user' to a home directory." # NoMethodError: undefined method `absolute_path?' for File
fails "File.absolute_path? returns false if it's a relative path" # NoMethodError: undefined method `absolute_path?' for File
fails "File.absolute_path? returns false if it's a tricky relative path" # NoMethodError: undefined method `absolute_path?' for File
fails "File.absolute_path? returns true if it's an absolute pathname" # NoMethodError: undefined method `absolute_path?' for File
fails "File.absolute_path? takes into consideration the platform's root" # NoMethodError: undefined method `absolute_path?' for File
fails "File.dirname when level is passed calls #to_int if passed not numeric value" # NoMethodError: undefined method `<' for #<Object:0x56914>
fails "File.dirname when level is passed raises ArgumentError if the level is negative" # Expected ArgumentError (negative level: -1) but got: ArgumentError (level can't be negative)
fails "File.expand_path accepts objects that have a #to_path method" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path converts a pathname to an absolute pathname" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path converts a pathname to an absolute pathname, Ruby-Talk:18512" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path converts a pathname to an absolute pathname, using a complete path" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path does not expand ~ENV['USER'] when it's not at the start" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path does not modify a HOME string argument" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path does not modify the string argument" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path does not replace multiple '/' at the beginning of the path" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path expand path with" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path expand_path for common unix path gives a full path" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path expands ../foo with ~/dir as base dir to /path/to/user/home/foo" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path expands /./dir to /dir" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path expands a path when the default external encoding is BINARY" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path expands a path with multi-byte characters" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path expands ~ENV['USER'] to the user's home directory" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path expands ~ENV['USER']/a to a in the user's home directory" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path keeps trailing dots on absolute pathname" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path raises a TypeError if not passed a String type" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path raises an ArgumentError if the path is not valid" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path raises an Encoding::CompatibilityError if the external encoding is not compatible" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path replaces multiple '/' with a single '/'" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path returns a String in the same encoding as the argument" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path returns a String when passed a String subclass" # ArgumentError: [Dir.home] wrong number of arguments (given 1, expected 0)
fails "File.expand_path when HOME is not set raises an ArgumentError when passed '~' if HOME == ''" # Expected ArgumentError but no exception was raised ("/" was returned)
fails "File.expand_path with a non-absolute HOME raises an ArgumentError" # Expected ArgumentError (non-absolute home) but no exception was raised ("non-absolute" was returned)
fails "File.extname for a filename ending with a dot returns '.'" # Expected "" == "." to be truthy but was false
fails "File.join calls #to_path" # Expected TypeError but got: NoMethodError (undefined method `empty?' for #<MockObject:0x32afc @name="x" @null=nil>)
fails "File.join calls #to_str" # Expected TypeError but got: NoMethodError (undefined method `empty?' for #<MockObject:0x32af2 @name="x" @null=nil>)
fails "File.join inserts the separator in between empty strings and arrays" # Expected "/" == "" to be truthy but was false
fails "File.join raises a TypeError exception when args are nil" # Expected TypeError but got: NoMethodError (undefined method `empty?' for nil)
fails "File.join raises errors for null bytes" # Expected ArgumentError but no exception was raised ("\u0000x/metadata.gz" was returned)
fails "File.join returns a duplicate string when given a single argument" # Expected "usr" not to be identical to "usr"
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/float.rb | spec/filters/bugs/float.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Float" do
fails "Float constant MAX is 1.7976931348623157e+308" # Exception: Maximum call stack size exceeded
fails "Float constant MIN is 2.2250738585072014e-308" # Expected 5e-324 == (1/4.49423283715579e+307) to be truthy but was false
fails "Float#<=> raises TypeError when #coerce misbehaves" # Expected TypeError (coerce must return [x, y]) but no exception was raised (nil was returned)
fails "Float#<=> returns 0 when self is Infinity and other other is infinite?=1" # Expected nil == 0 to be truthy but was false
fails "Float#<=> returns 1 when self is Infinity and other is infinite?=-1" # Expected nil == 1 to be truthy but was false
fails "Float#<=> returns 1 when self is Infinity and other is infinite?=nil (which means finite)" # Expected nil == 1 to be truthy but was false
fails "Float#<=> returns the correct result when one side is infinite" # Expected 0 == 1 to be truthy but was false
fails "Float#divmod returns an [quotient, modulus] from dividing self by other" # Expected 0 to be within 18446744073709552000 +/- 0.00004
fails "Float#inspect emits a trailing '.0' for a whole number" # Expected "50" == "50.0" to be truthy but was false
fails "Float#inspect emits a trailing '.0' for the mantissa in e format" # Expected "100000000000000000000" == "1.0e+20" to be truthy but was false
fails "Float#inspect encoding returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
fails "Float#inspect encoding returns a String in US-ASCII encoding when Encoding.default_internal is not nil" # NoMethodError: undefined method `default_internal' for Encoding
fails "Float#inspect matches random examples in all ranges" # Expected "4.9247416523566613e-8" == "4.9247416523566613e-08" to be truthy but was false
fails "Float#inspect matches random examples in human ranges" # Expected "174" == "174.0" to be truthy but was false
fails "Float#inspect matches random values from divisions" # Expected "0" == "0.0" to be truthy but was false
fails "Float#inspect returns '0.0' for 0.0" # Expected "0" == "0.0" to be truthy but was false
fails "Float#inspect uses e format for a negative value with fractional part having 6 significant figures" # Expected "-0.00001" == "-1.0e-05" to be truthy but was false
fails "Float#inspect uses e format for a negative value with whole part having 17 significant figures" # Expected "-1000000000000000" == "-1.0e+15" to be truthy but was false
fails "Float#inspect uses e format for a negative value with whole part having 18 significant figures" # Expected "-10000000000000000" == "-1.0e+16" to be truthy but was false
fails "Float#inspect uses e format for a positive value with fractional part having 6 significant figures" # Expected "0.00001" == "1.0e-05" to be truthy but was false
fails "Float#inspect uses e format for a positive value with whole part having 17 significant figures" # Expected "1000000000000000" == "1.0e+15" to be truthy but was false
fails "Float#inspect uses e format for a positive value with whole part having 18 significant figures" # Expected "10000000000000000" == "1.0e+16" to be truthy but was false
fails "Float#inspect uses non-e format for a negative value with whole part having 15 significant figures" # Expected "-10000000000000" == "-10000000000000.0" to be truthy but was false
fails "Float#inspect uses non-e format for a negative value with whole part having 16 significant figures" # Expected "-100000000000000" == "-100000000000000.0" to be truthy but was false
fails "Float#inspect uses non-e format for a positive value with whole part having 15 significant figures" # Expected "10000000000000" == "10000000000000.0" to be truthy but was false
fails "Float#inspect uses non-e format for a positive value with whole part having 16 significant figures" # Expected "100000000000000" == "100000000000000.0" to be truthy but was false
fails "Float#negative? on negative zero returns false" # Expected true to be false
fails "Float#rationalize returns self as a simplified Rational with no argument" # Expected (3547048656689661/1048576) == (4806858197361/1421) to be truthy but was false
fails "Float#round does not lose precision during the rounding process" # ArgumentError: [Number#round] wrong number of arguments (given 2, expected -1)
fails "Float#round preserves cases where neighbouring floating pointer number increase the decimal places" # ArgumentError: [Number#round] wrong number of arguments (given 2, expected -1)
fails "Float#round raise for a non-existent round mode" # Expected ArgumentError (invalid rounding mode: nonsense) but got: TypeError (no implicit conversion of Hash into Integer)
fails "Float#round raises FloatDomainError for exceptional values with a half option" # Expected FloatDomainError but got: TypeError (no implicit conversion of Hash into Integer)
fails "Float#round returns big values rounded to nearest" # Expected 0 to have same value and type as 300000000000000000000
fails "Float#round returns different rounded values depending on the half option" # TypeError: no implicit conversion of Hash into Integer
fails "Float#round rounds self to an optionally given precision with a half option" # ArgumentError: [Number#round] wrong number of arguments (given 2, expected -1)
fails "Float#round when 0.0 is given returns 0 for 0 or undefined ndigits" # TypeError: no implicit conversion of Hash into Integer
fails "Float#round when 0.0 is given returns self for positive ndigits" # Expected "0" == "0.0" to be truthy but was false
fails "Float#to_i raises a FloatDomainError for NaN" # Expected FloatDomainError but no exception was raised (NaN was returned)
fails "Float#to_int raises a FloatDomainError for NaN" # Expected FloatDomainError but no exception was raised (NaN was returned)
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
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
fails "Float#to_s matches random examples in all ranges" # Expected "4.9247416523566613e-8" == "4.9247416523566613e-08" to be truthy but was false
fails "Float#to_s matches random examples in human ranges" # Expected "174" == "174.0" to be truthy but was false
fails "Float#to_s matches random values from divisions" # Expected "0" == "0.0" to be truthy but was false
fails "Float#to_s uses e format for a negative value with fractional part having 6 significant figures" # Expected "-0.00001" == "-1.0e-05" to be truthy but was false
fails "Float#to_s uses e format for a negative value with whole part having 17 significant figures" # Expected "-1000000000000000" == "-1.0e+15" to be truthy but was false
fails "Float#to_s uses e format for a negative value with whole part having 18 significant figures" # Expected "-10000000000000000" == "-1.0e+16" to be truthy but was false
fails "Float#to_s uses e format for a positive value with fractional part having 6 significant figures" # Expected "0.00001" == "1.0e-05" to be truthy but was false
fails "Float#to_s uses e format for a positive value with whole part having 17 significant figures" # Expected "1000000000000000" == "1.0e+15" to be truthy but was false
fails "Float#to_s uses e format for a positive value with whole part having 18 significant figures" # Expected "10000000000000000" == "1.0e+16" to be truthy but was false
fails "Float#to_s uses non-e format for a negative value with whole part having 15 significant figures" # Expected "-10000000000000" == "-10000000000000.0" to be truthy but was false
fails "Float#to_s uses non-e format for a negative value with whole part having 16 significant figures" # Expected "-100000000000000" == "-100000000000000.0" to be truthy but was false
fails "Float#to_s uses non-e format for a positive value with whole part having 15 significant figures" # Expected "10000000000000" == "10000000000000.0" to be truthy but was false
fails "Float#to_s uses non-e format for a positive value with whole part having 16 significant figures" # Expected "100000000000000" == "100000000000000.0" to be truthy but was false
fails "Float#truncate raises a FloatDomainError for NaN" # Expected FloatDomainError but no exception was raised (NaN was returned)
fails "Float#truncate returns self truncated to an Integer" # Expected -1 to have same value and type as 0
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/warnings.rb | spec/filters/bugs/warnings.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "warnings" do
fails "Array#join when $, is not nil warns" # Expected warning to match: /warning: \$, is set to non-nil value/ but got: ""
fails "Constant resolution within methods with dynamically assigned constants returns the updated value when a constant is reassigned" # Expected warning to match: /already initialized constant/ but got: ""
fails "Hash#fetch gives precedence to the default block over the default argument when passed both" # Expected warning to match: /block supersedes default value argument/ but got: ""
fails "Literal (A::X) constant resolution with dynamically assigned constants returns the updated value when a constant is reassigned" # Expected warning to match: /already initialized constant/ but got: ""
fails "Literal Regexps matches against $_ (last input) in a conditional if no explicit matchee provided" # Expected warning to match: /regex literal in condition/ but got: ""
fails "Module#const_get with dynamically assigned constants returns the updated value of a constant" # Expected warning to match: /already initialized constant/ but got: ""
fails "Pattern matching warning when one-line form does not warn about pattern matching is experimental feature" # NameError: uninitialized constant Warning
fails "Predefined global $, warns if assigned non-nil" # Expected warning to match: /warning: `\$,' is deprecated/ but got: ""
fails "Predefined global $; warns if assigned non-nil" # Expected warning to match: /warning: `\$;' is deprecated/ but got: ""
fails "Regexp.new given a Regexp does not honour options given as additional arguments" # Expected warning to match: /flags ignored/ but got: ""
fails "Struct.new overwrites previously defined constants with string as first argument" # Expected warning to match: /constant/ but got: ""
fails "The for expression allows a constant as an iterator name" # Expected warning to match: /already initialized constant/ but got: ""
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/binding.rb | spec/filters/bugs/binding.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Binding" do
fails "Binding#clone is a shallow copy of the Binding object" # NoMethodError: undefined method `a' for #<BindingSpecs::Demo:0x3aa86 @secret=99>
fails "Binding#clone returns a copy of the Binding object" # NoMethodError: undefined method `a' for #<BindingSpecs::Demo:0x3ac2e @secret=99>
fails "Binding#dup is a shallow copy of the Binding object" # NoMethodError: undefined method `a' for #<BindingSpecs::Demo:0x336ac @secret=99>
fails "Binding#dup returns a copy of the Binding object" # NoMethodError: undefined method `a' for #<BindingSpecs::Demo:0x33854 @secret=99>
fails "Binding#eval behaves like Kernel.eval(..., self)" # NoMethodError: undefined method `a' for #<BindingSpecs::Demo:0x4e62 @secret=10>
fails "Binding#eval does not leak variables to cloned bindings" # Expected [] == ["x"] to be truthy but was false
fails "Binding#eval reflects refinements activated in the binding scope" # NoMethodError: undefined method `foo' for "bar"
fails "Binding#eval starts with a __LINE__ from the third argument if passed" # Expected 1 == 88 to be truthy but was false
fails "Binding#eval starts with line 1 if the Binding is created with #send" # RuntimeError: Opal doesn't support dynamic calls to binding
fails "Binding#eval with __method__ returns the method where the Binding was created" # Expected nil == "get_binding_and_method" to be truthy but was false
fails "Binding#eval with __method__ returns the method where the Binding was created, ignoring #send" # RuntimeError: Opal doesn't support dynamic calls to binding
fails "Binding#irb creates an IRB session with the binding in scope" # NoMethodError: undefined method `popen' for IO
fails "Binding#local_variable_defined? allows usage of an object responding to #to_str as the variable name" # Expected false == true to be truthy but was false
fails "Binding#local_variable_defined? returns true when a local variable is defined using Binding#local_variable_set" # Expected false == true to be truthy but was false
fails "Binding#local_variable_defined? returns true when a local variable is defined using eval()" # Expected false == true to be truthy but was false
fails "Binding#local_variable_get gets a local variable defined using eval()" # NameError: local variable `number' is not defined for #<Binding:0x47730 @jseval=#<Proc:0x47806> @scope_variables=["bind"] @receiver=#<MSpecEnv:0x4770a> @source_location=["ruby/core/binding/local_variable_get_spec.rb", 40]>
fails "Binding#local_variable_set adds nonexistent variables to the binding's eval scope" # Expected [] == ["foo"] to be truthy but was false
fails "Binding#local_variable_set raises a NameError on global access" # Expected NameError but no exception was raised ("" was returned)
fails "Binding#local_variable_set raises a NameError on special variable access" # Expected NameError but got: Exception (Unexpected token '~')
fails "Binding#local_variable_set sets a local variable using an object responding to #to_str as the variable name" # Exception: Invalid or unexpected token
fails "Binding#local_variables includes local variables defined after calling binding.local_variables" # Expected [] == ["a", "b"] to be truthy but was false
fails "Binding#local_variables includes local variables of inherited scopes and eval'ed context" # Expected ["c"] == ["c", "a", "b", "p"] to be truthy but was false
fails "Binding#local_variables includes new variables defined in the binding" # Expected ["b"] == ["a", "b"] to be truthy but was false
fails "Binding#source_location works for eval with a given line" # Expected ["foo", 1] == ["foo", 100] to be truthy but was false
fails "Proc#binding returns a Binding instance" # RuntimeError: Evaluation on a Proc#binding is not supported
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/encoding.rb | spec/filters/bugs/encoding.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Encoding" do
fails "File.basename returns the basename with the same encoding as the original" # NameError: uninitialized constant Encoding::Windows_1250
fails "Hash literal does not change encoding of literal string keys during creation" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "Integer#to_s bignum returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
fails "Integer#to_s bignum returns a String in US-ASCII encoding when Encoding.default_internal is not nil" # NoMethodError: undefined method `default_internal' for Encoding
fails "Integer#to_s bignum when given no base returns self converted to a String using base 10" # NoMethodError: undefined method `default_internal' for Encoding
fails "Integer#to_s fixnum returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
fails "Integer#to_s fixnum returns a String in US-ASCII encoding when Encoding.default_internal is not nil" # NoMethodError: undefined method `default_internal' for Encoding
fails "Kernel#sprintf returns a String in the same encoding as the format String if compatible" # NameError: uninitialized constant Encoding::KOI8_U
fails "Marshal.dump when passed an IO calls binmode when it's defined" # ArgumentError: [Marshal.dump] wrong number of arguments (given 2, expected 1)
fails "Marshal.dump with a String dumps a String in another encoding" # Expected "\x04\b\"\x0Fm\x00ö\x00h\x00r\x00e\x00" == "\x04\bI\"\x0Fm\x00ö\x00h\x00r\x00e\x00\x06:\rencoding\"\rUTF-16LE" to be truthy but was false
fails "Marshal.dump with a String dumps a US-ASCII String" # Expected "\x04\b\"\babc" == "\x04\bI\"\babc\x06:\x06EF" to be truthy but was false
fails "Marshal.dump with a String dumps a UTF-8 String" # Expected "\x04\b\"\vmöhre" == "\x04\bI\"\vmöhre\x06:\x06ET" to be truthy but was false
fails "Marshal.dump with a String dumps multiple strings using symlinks for the :E (encoding) symbol" # Expected "\x04\b[\a\"\x00@\x06" == "\x04\b[\aI\"\x00\x06:\x06EFI\"\x00\x06;\x00T" to be truthy but was false
fails "Marshal.load for a String loads a String in another encoding" # NameError: 'encoding' is not allowed as an instance variable name
fails "Marshal.load for a String loads a US-ASCII String" # Expected #<Encoding:UTF-8> to be identical to #<Encoding:US-ASCII>
fails "MatchData#post_match sets an empty result to the encoding of the source String" # Expected #<Encoding:UTF-8> to be identical to #<Encoding:ISO-8859-1>
fails "MatchData#post_match sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
fails "MatchData#pre_match sets an empty result to the encoding of the source String" # Expected #<Encoding:UTF-8> to be identical to #<Encoding:ISO-8859-1>
fails "MatchData#pre_match sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
fails "Predefined global $& sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
fails "Predefined global $' sets an empty result to the encoding of the source String" # Expected #<Encoding:UTF-8> to be identical to #<Encoding:ISO-8859-1>
fails "Predefined global $' sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
fails "Predefined global $+ sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
fails "Predefined global $` sets an empty result to the encoding of the source String" # Expected #<Encoding:UTF-8> to be identical to #<Encoding:ISO-8859-1>
fails "Predefined global $` sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
fails "Predefined globals $1..N sets the encoding to the encoding of the source String" # NameError: uninitialized constant Encoding::EUC_JP
fails "Regexp#match with [string, position] when given a negative position raises an ArgumentError for an invalid encoding" # Expected ArgumentError but no exception was raised (nil was returned)
fails "Regexp#match with [string, position] when given a positive position raises an ArgumentError for an invalid encoding" # Expected ArgumentError but no exception was raised (#<MatchData "ell" 1:"e" 2:"l"> was returned)
fails "Ruby String interpolation raises an Encoding::CompatibilityError if the Encodings are not compatible" # Expected CompatibilityError but no exception was raised ("あ ÿ" was returned)
fails "Source files encoded in UTF-16 BE with a BOM are invalid because they contain an invalid UTF-8 sequence before the encoding comment" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x49e4c>
fails "Source files encoded in UTF-16 BE without a BOM are parsed as empty because they contain a NUL byte before the encoding comment" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x49e4c>
fails "Source files encoded in UTF-16 LE with a BOM are invalid because they contain an invalid UTF-8 sequence before the encoding comment" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x49e4c>
fails "Source files encoded in UTF-8 with a BOM can be parsed" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x49e4c>
fails "Source files encoded in UTF-8 without a BOM can be parsed" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x49e4c>
fails "String#% output's encoding negotiates a compatible encoding if necessary" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
fails "String#* raises an ArgumentError if the length of the resulting string doesn't fit into a long" # Expected ArgumentError but got: RangeError (multiply count must not overflow maximum string size)
fails "String#[]= with String index encodes the String in an encoding compatible with the replacement" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with String index raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#[]= with String index replaces characters with a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with String index replaces multibyte characters with characters" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with String index replaces multibyte characters with multibyte characters" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Range index deletes a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Range index encodes the String in an encoding compatible with the replacement" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Range index inserts a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Range index raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#[]= with a Range index replaces characters with a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Range index replaces multibyte characters by negative indexes" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Range index replaces multibyte characters with characters" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Range index replaces multibyte characters with multibyte characters" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Regexp index encodes the String in an encoding compatible with the replacement" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Regexp index raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#[]= with a Regexp index replaces characters with a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Regexp index replaces multibyte characters with characters" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
fails "String#[]= with a Regexp index replaces multibyte characters with multibyte characters" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
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.
fails "String#ascii_only? returns false when concatenating an ASCII and non-ASCII String" # NoMethodError: undefined method `concat' for ""
fails "String#ascii_only? returns false when replacing an ASCII String with a non-ASCII String" # NoMethodError: undefined method `replace' for ""
fails "String#b returns new string without modifying self" # Expected "こんちには" not to be identical to "こんちには"
fails "String#byteslice on on non ASCII strings returns byteslice of unicode strings" # Expected nil == "\x81" to be truthy but was false
fails "String#center with length, padding with width, pattern raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#center with length, padding with width, pattern returns a String in the compatible encoding" # NameError: uninitialized constant Encoding::IBM437
fails "String#chars returns a different character if the String is transcoded" # ArgumentError: unknown encoding name - iso-8859-15
fails "String#chars uses the String's encoding to determine what characters it contains" # Expected ["�"] == ["𤭢"] to be truthy but was false
fails "String#chr returns a copy of self" # Expected "e" not to be identical to "e"
fails "String#codepoints round-trips to the original String using Integer#chr" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
fails "String#each_char returns a different character if the String is transcoded" # ArgumentError: unknown encoding name - iso-8859-15
fails "String#each_char uses the String's encoding to determine what characters it contains" # Expected ["�"] == ["𤭢"] to be truthy but was false
fails "String#each_codepoint round-trips to the original String using Integer#chr" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
fails "String#encode given the xml: :attr option replaces all instances of '&' with '&'" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :attr option replaces all instances of '<' with '<'" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :attr option replaces all instances of '>' with '>'" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :attr option replaces all instances of '\"' with '"'" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :attr option replaces undefined characters with their upper-case hexadecimal numeric character references" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :attr option surrounds the encoded text with double-quotes" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :text option does not replace '\"'" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :text option replaces all instances of '&' with '&'" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :text option replaces all instances of '<' with '<'" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :text option replaces all instances of '>' with '>'" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode given the xml: :text option replaces undefined characters with their upper-case hexadecimal numeric character references" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed no options raises an Encoding::ConverterNotFoundError when no conversion is possible" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed no options returns a copy for a ASCII-only String when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed no options returns a copy when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed no options transcodes a 7-bit String despite no generic converting being available" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed no options transcodes to Encoding.default_internal when set" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options calls #to_hash to convert the object" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options does not process transcoding options if not transcoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options normalizes newlines" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options raises an Encoding::ConverterNotFoundError when no conversion is possible despite 'invalid: :replace, undef: :replace'" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options replaces invalid characters when replacing Emacs-Mule encoded strings" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options replaces invalid encoding in source using a specified replacement even when a fallback is given" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options replaces invalid encoding in source using replace even when fallback is given as proc" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options replaces invalid encoding in source with a specified replacement" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options replaces invalid encoding in source with default replacement" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options replaces undefined encoding in destination using a fallback proc" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options replaces undefined encoding in destination with a specified replacement even if a fallback is given" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options replaces undefined encoding in destination with a specified replacement" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options replaces undefined encoding in destination with default replacement" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options returns a copy when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed options transcodes to Encoding.default_internal when set" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to encoding accepts a String argument" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to encoding calls #to_str to convert the object to an Encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to encoding raises an Encoding::ConverterNotFoundError for an invalid encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to encoding raises an Encoding::ConverterNotFoundError when no conversion is possible" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to encoding returns a copy when passed the same encoding as the String" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to encoding transcodes Japanese multibyte characters" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to encoding transcodes a 7-bit String despite no generic converting being available" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to encoding transcodes to the passed encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from calls #to_str to convert the from object to an Encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from returns a copy in the destination encoding when both encodings are the same" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from returns the transcoded string" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from transcodes between the encodings ignoring the String encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from, options calls #to_hash to convert the options object" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from, options calls #to_str to convert the from object to an encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from, options calls #to_str to convert the to object to an encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from, options replaces invalid characters in the destination encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from, options replaces undefined characters in the destination encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, from, options returns a copy when both encodings are the same" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, options calls #to_hash to convert the options object" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, options replaces invalid characters in the destination encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, options replaces undefined characters in the destination encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encode when passed to, options returns a copy when the destination encoding is the same as the String encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encoding for Strings with \\u escapes is not affected by both the default internal and external encoding being set at the same time" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encoding for Strings with \\u escapes is not affected by the default external encoding" # NameError: uninitialized constant Encoding::SHIFT_JIS
fails "String#encoding for Strings with \\u escapes is not affected by the default internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encoding for Strings with \\u escapes returns US-ASCII if self is US-ASCII only" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "String#encoding for Strings with \\u escapes returns the given encoding if #encode!has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
fails "String#encoding for Strings with \\x escapes is not affected by both the default internal and external encoding being set at the same time" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encoding for Strings with \\x escapes is not affected by the default external encoding" # NameError: uninitialized constant Encoding::SHIFT_JIS
fails "String#encoding for Strings with \\x escapes is not affected by the default internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encoding for Strings with \\x escapes returns US-ASCII if self is US-ASCII only" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "String#encoding for Strings with \\x escapes returns the given encoding if #encode!has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
fails "String#encoding for Strings with \\x escapes returns the given encoding if #force_encoding has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
fails "String#encoding for Strings with \\x escapes returns the source encoding when an escape creates a byte with the 8th bit set if the source encoding isn't US-ASCII" # NameError: uninitialized constant Encoding::ISO8859_9
fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII only, despite the default encodings being different" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII only, despite the default external encoding being different" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII only, despite the default internal and external encodings being different" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII only, despite the default internal encoding being different" # NoMethodError: undefined method `default_internal' for Encoding
fails "String#encoding for US-ASCII Strings returns US-ASCII if self is US-ASCII" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
fails "String#encoding returns the given encoding if #encode!has been called" # NameError: uninitialized constant Encoding::SHIFT_JIS
fails "String#force_encoding does not transcode self" # Expected "é" == "é" to be falsy but was true
fails "String#force_encoding sets the encoding even if the String contents are invalid in that encoding" # ArgumentError: unknown encoding name - euc-jp
fails "String#index with Regexp raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#index with String raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#insert with index, other inserts a character into a multibyte encoded string" # NoMethodError: undefined method `insert' for "ありがとう"
fails "String#insert with index, other raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#insert with index, other returns a String in the compatible encoding" # NoMethodError: undefined method `insert' for ""
fails "String#length returns the length of the new self after encoding is changed" # Expected 4 == 12 to be truthy but was false
fails "String#ljust with length, padding with width, pattern raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#ord raises an ArgumentError if called on an empty String" # Exception: Cannot read properties of undefined (reading '$pretty_inspect')
fails "String#rindex with Regexp raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#rjust with length, padding with width, pattern raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
fails "String#size returns the length of the new self after encoding is changed" # Expected 4 == 12 to be truthy but was false
fails "String#valid_encoding? returns false if a valid String had an invalid character appended to it" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
fails "String#valid_encoding? returns false if self contains a character invalid in the associated encoding" # Expected true to be false
fails "String#valid_encoding? returns true for all encodings self is valid in" # Expected true to be false
fails "String#valid_encoding? returns true if an invalid string is appended another invalid one but both make a valid string" # Expected true to be false
fails "The predefined global constant ARGV contains Strings encoded in locale Encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDERR has nil for the external encoding despite Encoding.default_external being changed" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDERR has nil for the external encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDERR has nil for the internal encoding despite Encoding.default_internal being changed" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDERR has nil for the internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDERR has the encodings set by #set_encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDIN has nil for the internal encoding despite Encoding.default_internal being changed" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDIN has nil for the internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDIN has the encodings set by #set_encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDIN has the same external encoding as Encoding.default_external when that encoding is changed" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDIN has the same external encoding as Encoding.default_external" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDIN retains the encoding set by #set_encoding when Encoding.default_external is changed" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDOUT has nil for the external encoding despite Encoding.default_external being changed" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDOUT has nil for the external encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDOUT has nil for the internal encoding despite Encoding.default_internal being changed" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDOUT has nil for the internal encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "The predefined global constant STDOUT has the encodings set by #set_encoding" # NoMethodError: undefined method `default_internal' for Encoding
fails "Time#inspect returns a US-ASCII encoded string" # Expected #<Encoding:UTF-8> to be identical to #<Encoding:US-ASCII>
fails "Time#to_s returns a US-ASCII encoded string" # Expected #<Encoding:UTF-8> to be identical to #<Encoding:US-ASCII>
end
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | false |
opal/opal | https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/filters/bugs/kernel.rb | spec/filters/bugs/kernel.rb | # NOTE: run bin/format-filters after changing this file
opal_filter "Kernel" do
fails "Kernel#=== does not call #object_id nor #equal? but still returns true for #== or #=== on the same object" # Mock '#<Object:0x2514>' expected to receive object_id("any_args") exactly 0 times but received it 2 times
fails "Kernel#Float for hexadecimal literals with binary exponent allows embedded _ in a number on either side of the P" # ArgumentError: invalid value for Float(): "0x1_0P10"
fails "Kernel#Float for hexadecimal literals with binary exponent allows embedded _ in a number on either side of the p" # ArgumentError: invalid value for Float(): "0x1_0p10"
fails "Kernel#Float for hexadecimal literals with binary exponent allows hexadecimal points on the left side of the 'P'" # ArgumentError: invalid value for Float(): "0x1.8P0"
fails "Kernel#Float for hexadecimal literals with binary exponent allows hexadecimal points on the left side of the 'p'" # ArgumentError: invalid value for Float(): "0x1.8p0"
fails "Kernel#Float for hexadecimal literals with binary exponent interprets the exponent (on the right of 'P') in decimal" # ArgumentError: invalid value for Float(): "0x1P10"
fails "Kernel#Float for hexadecimal literals with binary exponent interprets the exponent (on the right of 'p') in decimal" # ArgumentError: invalid value for Float(): "0x1p10"
fails "Kernel#Float for hexadecimal literals with binary exponent interprets the fractional part (on the left side of 'P') in hexadecimal" # ArgumentError: invalid value for Float(): "0x10P0"
fails "Kernel#Float for hexadecimal literals with binary exponent interprets the fractional part (on the left side of 'p') in hexadecimal" # ArgumentError: invalid value for Float(): "0x10p0"
fails "Kernel#Float for hexadecimal literals with binary exponent returns 0 for '0x1P-10000'" # ArgumentError: invalid value for Float(): "0x1P-10000"
fails "Kernel#Float for hexadecimal literals with binary exponent returns 0 for '0x1p-10000'" # ArgumentError: invalid value for Float(): "0x1p-10000"
fails "Kernel#Float for hexadecimal literals with binary exponent returns Infinity for '0x1P10000'" # ArgumentError: invalid value for Float(): "0x1P10000"
fails "Kernel#Float for hexadecimal literals with binary exponent returns Infinity for '0x1p10000'" # ArgumentError: invalid value for Float(): "0x1p10000"
fails "Kernel#Pathname returns same argument when called with a pathname argument" # Expected #<Pathname:0xb23c2 @path="foo">.equal? #<Pathname:0xb23c4 @path="foo"> to be truthy but was false
fails "Kernel#String calls #to_s if #respond_to?(:to_s) returns true" # TypeError: no implicit conversion of MockObject into String
fails "Kernel#String raises a TypeError if #to_s is not defined, even though #respond_to?(:to_s) returns true" # Expected TypeError but got: NoMethodError (undefined method `to_s' for #<Object:0x2961a>)
fails "Kernel#__dir__ returns the expanded path of the directory when used in the main script" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x2b0e6>
fails "Kernel#__dir__ when used in eval with top level binding returns nil" # Expected "." == nil to be truthy but was false
fails "Kernel#autoload calls main.require(path) to load the file" # Expected NameError but got: LoadError (cannot load such file -- main_autoload_not_exist)
fails "Kernel#autoload can autoload in instance_eval" # NoMethodError: undefined method `autoload' for #<Object:0x4b3d2>
fails "Kernel#autoload inside a Class.new method body should define on the new anonymous class" # NoMethodError: undefined method `autoload' for #<#<Class:0x4b3ee>:0x4b3ec>
fails "Kernel#autoload is a private method" # Expected Kernel to have private instance method 'autoload' but it does not
fails "Kernel#autoload when Object is frozen raises a FrozenError before defining the constant" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x4b3b4 @loaded_features=["corelib/runtime", "opal", "opal/base"...]>
fails "Kernel#autoload? is a private method" # Expected Kernel to have private instance method 'autoload?' but it does not
fails "Kernel#autoload? returns nil if no file has been registered for a constant" # NoMethodError: undefined method `autoload?' for #<MSpecEnv:0x4b3b4 @loaded_features=["corelib/runtime", "opal", "opal/base"...]>
fails "Kernel#autoload? returns the name of the file that will be autoloaded" # NoMethodError: undefined method `autoload?' for #<MSpecEnv:0x4b3b4 @loaded_features=["corelib/runtime", "opal", "opal/base"...]>
fails "Kernel#caller includes core library methods defined in Ruby" # Expected "<internal:corelib/kernel.rb>:829:5:in `send2'".end_with? "in `tap'" to be truthy but was false
fails "Kernel#caller is a private method" # Expected Kernel to have private instance method 'caller' but it does not
fails "Kernel#caller returns an Array of caller locations using a custom offset" # Expected "ruby/core/kernel/fixtures/caller.rb:4:7:in `locations'" =~ /runner\/mspec.rb/ to be truthy but was nil
fails "Kernel#caller returns an Array of caller locations using a range" # Expected 0 == 1 to be truthy but was false
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:0xafc18>
fails "Kernel#caller returns the locations as String instances" # Expected "ruby/core/kernel/fixtures/caller.rb:4:7:in `locations'" to include "ruby/core/kernel/caller_spec.rb:32:in"
fails "Kernel#caller works with beginless ranges" # Expected nil == ["<internal:corelib/basic_object.rb>:125:1:in `instance_exec'", "mspec/runner/mspec.rb:116:11:in `protect'", "mspec/runner/context.rb:176:39:in `$$17'", "<internal:corelib/enumerable.rb>:27:16:in `$$3'"] to be truthy but was false
fails "Kernel#caller works with endless ranges" # Expected [] == ["<internal:corelib/basic_object.rb>:125:1:in `instance_exec'", "mspec/runner/mspec.rb:116:11:in `protect'", "mspec/runner/context.rb:176:39:in `$$17'", "<internal:corelib/enumerable.rb>:27:16:in `$$3'", "<internal:corelib/array.rb>:983:1:in `each'", "<internal:corelib/enumerable.rb>:26:7:in `Enumerable_all$ques$1'", "mspec/runner/context.rb:176:18:in `protect'", "mspec/runner/context.rb:212:26:in `$$21'", "mspec/runner/mspec.rb:284:7:in `repeat'", "mspec/runner/context.rb:204:16:in `$$20'", "<internal:corelib/array.rb>:983:1:in `each'", "mspec/runner/context.rb:203:18:in `process'", "mspec/runner/mspec.rb:55:10:in `describe'", "mspec/runner/object.rb:11:10:in `describe'", "ruby/core/kernel/caller_spec.rb:4:1:in `Opal.modules.ruby/core/kernel/caller_spec'", "<internal:corelib/kernel.rb>:535:6:in `load'", "mspec/runner/mspec.rb:99:42:in `instance_exec'", "<internal:corelib/basic_object.rb>:125:1:in `instance_exec'", "mspec/runner/mspec.rb:116:11:in `protect'", "mspec/runner/mspec.rb:99:7:in `$$1'", "<internal:corelib/array.rb>:983:1:in `each'", "mspec/runner/mspec.rb:90:12:in `each_file'", "mspec/runner/mspec.rb:95:5:in `files'", "mspec/runner/mspec.rb:63:5:in `process'", "tmp/mspec_nodejs.rb:3887:6:in `undefined'", "tmp/mspec_nodejs.rb:1:1:in `null'", "node:internal/modules/cjs/loader:1105:14:in `Module._compile'", "node:internal/modules/cjs/loader:1159:10:in `Module._extensions..js'", "node:internal/modules/cjs/loader:981:32:in `Module.load'", "node:internal/modules/cjs/loader:822:12:in `Module._load'", "node:internal/modules/run_main:77:12:in `executeUserEntryPoint'", "node:internal/main/run_main_module:17:47:in `undefined'"] to be truthy but was false
fails "Kernel#class returns the class of the object" # Expected Number to be identical to Integer
fails "Kernel#clone replaces a singleton object's metaclass with a new copy with the same superclass" # NoMethodError: undefined method `singleton_methods' for #<#<Class:0x5537a>:0x55378>
fails "Kernel#clone uses the internal allocator and does not call #allocate" # RuntimeError: allocate should not be called
fails "Kernel#dup uses the internal allocator and does not call #allocate" # RuntimeError: allocate should not be called
fails "Kernel#eval allows a binding to be captured inside an eval" # NoMethodError: undefined method `w' for #<MSpecEnv:0x4be5a>
fails "Kernel#eval allows creating a new class in a binding" # RuntimeError: Evaluation on a Proc#binding is not supported
fails "Kernel#eval can be aliased" # NoMethodError: undefined method `+' for nil
fails "Kernel#eval does not make Proc locals visible to evaluated code" # Expected NameError but got: RuntimeError (Evaluation on a Proc#binding is not supported)
fails "Kernel#eval does not share locals across eval scopes" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x4be5a>
fails "Kernel#eval doesn't accept a Proc object as a binding" # Expected TypeError but got: NoMethodError (undefined method `js_eval' for #<Proc:0x4c92e>)
fails "Kernel#eval evaluates string with given filename and negative linenumber" # Expected "unexpected token $end" =~ /speccing.rb:-100:.+/ to be truthy but was nil
fails "Kernel#eval includes file and line information in syntax error" # Expected "unexpected token $end" =~ /speccing.rb:1:.+/ to be truthy but was nil
fails "Kernel#eval raises a LocalJumpError if there is no lambda-style closure in the chain" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x4be5a>
fails "Kernel#eval returns from the method calling #eval when evaluating 'return' in BEGIN" # SyntaxError: Unsupported sexp: preexe
fails "Kernel#eval unwinds through a Proc-style closure and returns from a lambda-style closure in the closure chain" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x4be5a>
fails "Kernel#eval updates a local in a scope above a surrounding block scope" # Expected 1 == 2 to be truthy but was false
fails "Kernel#eval updates a local in a scope above when modified in a nested block scope" # NoMethodError: undefined method `es' for #<MSpecEnv:0x4be5a>
fails "Kernel#eval updates a local in a surrounding block scope" # Expected 1 == 2 to be truthy but was false
fails "Kernel#eval updates a local in an enclosing scope" # Expected 1 == 2 to be truthy but was false
fails "Kernel#eval uses the same scope for local variables when given the same binding" # NoMethodError: undefined method `a' for #<MSpecEnv:0x4be5a>
fails "Kernel#eval with a magic encoding comment allows a magic encoding comment and a frozen_string_literal magic comment on the same line in emacs style" # Expected ["A", "CoercedObject"] to include "Vπsame_line"
fails "Kernel#eval with a magic encoding comment allows a magic encoding comment and a subsequent frozen_string_literal magic comment" # Expected ["A", "CoercedObject"] to include "Vπstring"
fails "Kernel#eval with a magic encoding comment allows a shebang line and some spaces before the magic encoding comment" # Expected ["A", "CoercedObject"] to include "Vπshebang_spaces"
fails "Kernel#eval with a magic encoding comment allows a shebang line before the magic encoding comment" # Expected ["A", "CoercedObject"] to include "Vπshebang"
fails "Kernel#eval with a magic encoding comment allows an emacs-style magic comment encoding" # Expected ["A", "CoercedObject"] to include "Vπemacs"
fails "Kernel#eval with a magic encoding comment allows spaces before the magic encoding comment" # Expected ["A", "CoercedObject"] to include "Vπspaces"
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: ""
fails "Kernel#eval with a magic encoding comment ignores the magic encoding comment if it is after a frozen_string_literal magic comment" # Expected ["A", "CoercedObject"] to include "Vπfrozen_first"
fails "Kernel#eval with a magic encoding comment uses the magic comment encoding for parsing constants" # Expected ["A", "CoercedObject"] to include "Vπ"
fails "Kernel#eval with refinements activates refinements from the binding" # NoMethodError: undefined method `foo' for #<EvalSpecs::A:0x4f966>
fails "Kernel#eval with refinements activates refinements from the eval scope" # NoMethodError: undefined method `foo' for #<EvalSpecs::A:0x4fa98>
fails "Kernel#extend does not calls append_features on arguments metaclass" # Expected true == false to be truthy but was false
fails "Kernel#fail accepts an Object with an exception method returning an Exception" # Expected StandardError (...) but got: TypeError (exception class/object expected)
fails "Kernel#initialize_copy does nothing if the argument is the same as the receiver" # Expected nil.equal? #<Object:0x3cb42> to be truthy but was false
fails "Kernel#initialize_copy raises FrozenError if the receiver is frozen" # Expected FrozenError but no exception was raised (nil was returned)
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)
fails "Kernel#initialize_copy returns self" # Expected nil.equal? #<Object:0x66548> to be truthy but was false
fails "Kernel#inspect returns a String for an object without #class method" # NoMethodError: undefined method `class' for #<Object:0x42c12>
fails "Kernel#instance_variable_set on frozen objects accepts unicode instance variable names" # NameError: '@💙' is not allowed as an instance variable name
fails "Kernel#instance_variable_set on frozen objects raises for frozen objects" # Expected NameError but got: FrozenError (can't modify frozen NilClass: )
fails "Kernel#instance_variables immediate values returns the correct array if an instance variable is added" # Expected RuntimeError but got: Exception (Cannot create property 'test' on number '0')
fails "Kernel#is_a? does not take into account `class` method overriding" # TypeError: can't define singleton
fails "Kernel#kind_of? does not take into account `class` method overriding" # TypeError: can't define singleton
fails "Kernel#local_variables is accessible from bindings" # Expected [] to include "a"
fails "Kernel#method converts the given name to a String using #to_str calls #to_str to convert the given name to a String" # Mock 'method-name' expected to receive to_str("any_args") exactly 1 times but received it 0 times
fails "Kernel#method converts the given name to a String using #to_str raises a NoMethodError if the given argument raises a NoMethodError during type coercion to a String" # Expected NoMethodError but got: NameError (undefined method `#<MockObject:0x9e5a6>' for class `Class')
fails "Kernel#method converts the given name to a String using #to_str raises a TypeError if the given name can't be converted to a String" # Expected TypeError but got: NameError (undefined method `' for class `Class')
fails "Kernel#method will see an alias of the original method as == when in a derived class" # Expected #<Method: KernelSpecs::B#aliased_pub_method (defined in KernelSpecs::B in ruby/core/kernel/fixtures/classes.rb:164)> == #<Method: KernelSpecs::B#pub_method (defined in KernelSpecs::A in ruby/core/kernel/fixtures/classes.rb:164)> to be truthy but was false
fails "Kernel#methods does not return private singleton methods defined in 'class << self'" # Expected ["ichi", "san", "shi", "roku", "shichi", "hachi", "juu", "juu_ichi", "juu_ni"] not to include "shichi"
fails "Kernel#object_id returns a different value for two Bignum literals" # Expected 4e+100 == 4e+100 to be falsy but was true
fails "Kernel#object_id returns a different value for two String literals" # Expected "hello" == "hello" to be falsy but was true
fails "Kernel#p flushes output if receiver is a File" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x498ec @rs_f="\n" @rs_b=nil @rs_c=nil>
fails "Kernel#p is not affected by setting $\\, $/ or $," # NoMethodError: undefined method `tmp' for #<OutputToFDMatcher:0x49902 @to=#<IO:0xa @fd=1 @flags="w" @eof=false @closed="both" @write_proc=#<Proc:0x40474> @tty=true> @expected="Next time, Gadget, NEXT TIME!\n" @to_name="STDOUT">
fails "Kernel#pp lazily loads the 'pp' library and delegates the call to that library" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x572a>
fails "Kernel#print prints $_ when no arguments are given" # Expected: $stdout: "foo" got: $stdout: ""
fails "Kernel#public_method changes the method called for super on a target aliased method" # NoMethodError: undefined method `public_method' for #<#<Class:0x5a558>:0x5a556>
fails "Kernel#public_method raises a NameError if we only repond_to_missing? method, true" # Expected NameError but no exception was raised ("Done public_method(handled_privately)" was returned)
fails "Kernel#public_method returns a method object for a valid method" # NoMethodError: undefined method `public_method' for #<KernelSpecs::Foo:0x5a56c>
fails "Kernel#public_method returns a method object for a valid singleton method" # NoMethodError: undefined method `public_method' for KernelSpecs::Foo
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
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
fails "Kernel#public_methods returns a list of names without protected accessible methods in the object" # Expected ["hachi", "ichi", "juu", "juu_ichi", "juu_ni", "roku", "san", "shi", "shichi"] not to include "juu_ichi"
fails "Kernel#public_methods when passed false returns a list of public methods in without its ancestors" # Expected ["f_pub", "f_pro", "f_pri"] == ["f_pub"] to be truthy but was false
fails "Kernel#public_methods when passed nil returns a list of public methods in without its ancestors" # Expected ["f_pub", "f_pro", "f_pri"] == ["f_pub"] to be truthy but was false
fails "Kernel#public_send includes `public_send` in the backtrace when passed a single incorrect argument" # Expected "method=\"public_send\" @object=nil> is not a symbol nor a string:in `TypeError: #<MSpecEnv:0x5399c '".include? "`public_send'" to be truthy but was false
fails "Kernel#public_send includes `public_send` in the backtrace when passed not enough arguments" # Expected "<internal:corelib/runtime.js>:1546:5:in `Opal.ac'".include? "`public_send'" to be truthy but was false
fails "Kernel#puts delegates to $stdout.puts" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x561c0 @name=nil @stdout=#<IO:0xa @fd=1 @flags="w" @eof=false @closed="both" @write_proc=#<Proc:0x40474> @tty=true>>
fails "Kernel#raise accepts a cause keyword argument that overrides the last exception" # Expected #<RuntimeError: first raise> == #<StandardError: StandardError> to be truthy but was false
fails "Kernel#raise accepts a cause keyword argument that sets the cause" # Expected nil == #<StandardError: StandardError> to be truthy but was false
fails "Kernel#raise passes no arguments to the constructor when given only an exception class" # Expected #<Class:0x5390e> but got: ArgumentError ([#initialize] wrong number of arguments (given 1, expected 0))
fails "Kernel#raise raises an ArgumentError when only cause is given" # Expected ArgumentError but got: TypeError (exception class/object expected)
fails "Kernel#raise re-raises a previously rescued exception without overwriting the backtrace" # Expected "<internal:corelib/kernel.rb>:612:37:in `raise'" to include "ruby/shared/kernel/raise.rb:130:"
fails "Kernel#rand is a private method" # Expected Kernel to have private instance method 'rand' but it does not
fails "Kernel#rand is random on boot" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0x19c2a>
fails "Kernel#rand supports custom object types" # Expected "NaN#<struct KernelSpecs::CustomRangeInteger value=1>" (String) to be an instance of KernelSpecs::CustomRangeInteger
fails "Kernel#remove_instance_variable raises a FrozenError if self is frozen" # Expected FrozenError but got: NameError (instance variable @foo not defined)
fails "Kernel#remove_instance_variable raises for frozen objects" # Expected FrozenError but got: NameError (instance variable @foo not defined)
fails "Kernel#respond_to? throws a type error if argument can't be coerced into a Symbol" # Expected TypeError (/is not a symbol nor a string/) but no exception was raised (false was returned)
fails "Kernel#respond_to_missing? causes #respond_to? to return false if called and returning nil" # Expected nil to be false
fails "Kernel#respond_to_missing? causes #respond_to? to return true if called and not returning false" # Expected "glark" to be true
fails "Kernel#singleton_class for an IO object with a replaced singleton class looks up singleton methods from the fresh singleton class after an object instance got a new one" # NoMethodError: undefined method `reopen' for #<File:0x6c204 @fd="ruby/core/kernel/singleton_class_spec.rb" @flags="r" @eof=false @closed="write">
fails "Kernel#singleton_class raises TypeError for Symbol" # Expected TypeError but no exception was raised (#<Class:#<String:0x53aaa>> was returned)
fails "Kernel#singleton_class raises TypeError for a frozen deduplicated String" # Expected TypeError (can't define singleton) but no exception was raised (#<Class:#<String:0x6c200>> was returned)
fails "Kernel#singleton_class returns a frozen singleton class if object is frozen" # Expected false to be true
fails "Kernel#singleton_method find a method defined on the singleton class" # NoMethodError: undefined method `singleton_method' for #<Object:0x4540a>
fails "Kernel#singleton_method only looks at singleton methods and not at methods in the class" # Expected NoMethodError == NameError to be truthy but was false
fails "Kernel#singleton_method raises a NameError if there is no such method" # Expected NoMethodError == NameError to be truthy but was false
fails "Kernel#singleton_method returns a Method which can be called" # NoMethodError: undefined method `singleton_method' for #<Object:0x453d6>
fails "Kernel#singleton_methods when not passed an argument does not return any included methods for a class including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::D
fails "Kernel#singleton_methods when not passed an argument does not return any included methods for a module including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::N
fails "Kernel#singleton_methods when not passed an argument does not return private singleton methods for an object extended with a module including a module" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x47396 @name="Object extended, included" @null=nil>
fails "Kernel#singleton_methods when not passed an argument for a module does not return methods in a module prepended to Module itself" # NoMethodError: undefined method `singleton_methods' for SingletonMethodsSpecs::SelfExtending
fails "Kernel#singleton_methods when not passed an argument returns a unique list for a subclass including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::C
fails "Kernel#singleton_methods when not passed an argument returns a unique list for a subclass" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::B
fails "Kernel#singleton_methods when not passed an argument returns a unique list for an object extended with a module" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x473b6 @name="Object extended" @null=nil>
fails "Kernel#singleton_methods when not passed an argument returns an empty Array for an object with no singleton methods" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x4739a @name="Object with no singleton methods" @null=nil>
fails "Kernel#singleton_methods when not passed an argument returns the names of class methods for a class" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::A
fails "Kernel#singleton_methods when not passed an argument returns the names of inherited singleton methods for a class extended with a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::P
fails "Kernel#singleton_methods when not passed an argument returns the names of inherited singleton methods for a subclass including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::C
fails "Kernel#singleton_methods when not passed an argument returns the names of inherited singleton methods for a subclass of a class including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::E
fails "Kernel#singleton_methods when not passed an argument returns the names of inherited singleton methods for a subclass of a class that includes a module, where the subclass also includes a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::F
fails "Kernel#singleton_methods when not passed an argument returns the names of inherited singleton methods for a subclass" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::B
fails "Kernel#singleton_methods when not passed an argument returns the names of module methods for a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::M
fails "Kernel#singleton_methods when not passed an argument returns the names of singleton methods for an object extended with a module including a module" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x473ca @name="Object extended, included" @null=nil>
fails "Kernel#singleton_methods when not passed an argument returns the names of singleton methods for an object extended with a module" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x473c6 @name="Object extended" @null=nil>
fails "Kernel#singleton_methods when not passed an argument returns the names of singleton methods for an object extended with two modules" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x473ae @name="Object extended twice" @null=nil>
fails "Kernel#singleton_methods when not passed an argument returns the names of singleton methods for an object" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x473a2 @name="Object with singleton methods" @null=nil>
fails "Kernel#singleton_methods when passed false does not return any included methods for a class including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::D
fails "Kernel#singleton_methods when passed false does not return any included methods for a module including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::N
fails "Kernel#singleton_methods when passed false does not return names of inherited singleton methods for a subclass" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::B
fails "Kernel#singleton_methods when passed false does not return private singleton methods for an object extended with a module including a module" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x47450 @name="Object extended, included" @null=nil>
fails "Kernel#singleton_methods when passed false does not return the names of inherited singleton methods for a class extended with a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::P
fails "Kernel#singleton_methods when passed false for a module does not return methods in a module prepended to Module itself" # NoMethodError: undefined method `singleton_methods' for SingletonMethodsSpecs::SelfExtending
fails "Kernel#singleton_methods when passed false returns an empty Array for an object extended with a module including a module" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x4742c @name="Object extended, included" @null=nil>
fails "Kernel#singleton_methods when passed false returns an empty Array for an object extended with a module" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x4744c @name="Object extended" @null=nil>
fails "Kernel#singleton_methods when passed false returns an empty Array for an object extended with two modules" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x47428 @name="Object extended twice" @null=nil>
fails "Kernel#singleton_methods when passed false returns an empty Array for an object with no singleton methods" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x47446 @name="Object with no singleton methods" @null=nil>
fails "Kernel#singleton_methods when passed false returns the names of class methods for a class" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::A
fails "Kernel#singleton_methods when passed false returns the names of module methods for a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::M
fails "Kernel#singleton_methods when passed false returns the names of singleton methods for an object" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x47436 @name="Object with singleton methods" @null=nil>
fails "Kernel#singleton_methods when passed false returns the names of singleton methods of the subclass" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::B
fails "Kernel#singleton_methods when passed true does not return any included methods for a class including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::D
fails "Kernel#singleton_methods when passed true does not return any included methods for a module including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::N
fails "Kernel#singleton_methods when passed true does not return private singleton methods for an object extended with a module including a module" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x473e8 @name="Object extended, included" @null=nil>
fails "Kernel#singleton_methods when passed true for a module does not return methods in a module prepended to Module itself" # NoMethodError: undefined method `singleton_methods' for SingletonMethodsSpecs::SelfExtending
fails "Kernel#singleton_methods when passed true returns a unique list for a subclass including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::C
fails "Kernel#singleton_methods when passed true returns a unique list for a subclass" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::B
fails "Kernel#singleton_methods when passed true returns a unique list for an object extended with a module" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x47406 @name="Object extended" @null=nil>
fails "Kernel#singleton_methods when passed true returns an empty Array for an object with no singleton methods" # NoMethodError: undefined method `singleton_methods' for #<MockObject:0x473f8 @name="Object with no singleton methods" @null=nil>
fails "Kernel#singleton_methods when passed true returns the names of class methods for a class" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::A
fails "Kernel#singleton_methods when passed true returns the names of inherited singleton methods for a class extended with a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::P
fails "Kernel#singleton_methods when passed true returns the names of inherited singleton methods for a subclass including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::C
fails "Kernel#singleton_methods when passed true returns the names of inherited singleton methods for a subclass of a class including a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::E
fails "Kernel#singleton_methods when passed true returns the names of inherited singleton methods for a subclass of a class that includes a module, where the subclass also includes a module" # NoMethodError: undefined method `singleton_methods' for ReflectSpecs::F
| ruby | MIT | b4e228990534515b83cd509a9297beca59bf8733 | 2026-01-04T15:44:44.154940Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.