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(1429521... | 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
... | 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 == "hel... | 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 ==... | 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 initializ... | 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|... | 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... | 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 ... | 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,... | 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"... | 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... | 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 eva... | 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 ==... | 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
... | 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
... | 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(_, **_... | 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 'repla... | 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 "e... | 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}`
... | 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
... | 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... | 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
... | 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
... | 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
... | 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 unpr... | 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 = ... | 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... | 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
... | 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
... | 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
... | 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 => ... | 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 alia... | 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 ... | 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_t... | 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.sho... | 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
@que... | 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... | 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#t... | 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_]... | 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 ... | 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... | 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.rej... | 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(2... | 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
... | 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... | 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 b... | 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_blo... | 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
... | 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 wit... | 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... | 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, bu... | 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 #{@ac... | 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
... | 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(:sho... | 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, se... | 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, se... | 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... | 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... | 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... | 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, .... | 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 E... | 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 returni... | 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:co... | 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 constan... | 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" # NoMethodEr... | 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 b... | 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 "R... | 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... | 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 Infin... | 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 [... | 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 pa... | 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... | 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
fai... | 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 "... | 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... | 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 meth... | 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" # Expect... | 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#... | 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.