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/test/opal/promisev2/test_then.rb
test/opal/promisev2/test_then.rb
require 'test/unit' require 'promise/v2' class TestPromiseThen < Test::Unit::TestCase def test_calls_the_block_when_the_promise_has_already_been_resolved x = 42 PromiseV2.value(23) .then { |v| x = v } .always { assert_equal(x, 23) } end def test_calls_the_block_when_the_promise_is_resolved ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/promisev2/test_always.rb
test/opal/promisev2/test_always.rb
require 'test/unit' require 'promise/v2' class TestPromiseAlways < Test::Unit::TestCase def test_calls_the_block_when_it_was_resolved x = 42 PromiseV2.value(23) .then { |v| x = v } .always { |v| x = 2 } .then { assert_equal(x, 2) } end def test_calls_the_block_when_it_was_rejected ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/opal/promisev2/test_value.rb
test/opal/promisev2/test_value.rb
require 'test/unit' require 'promise/v2' class TestPromiseValue < Test::Unit::TestCase def test_resolves_the_promise_with_the_given_value assert_equal(PromiseV2.value(23).value, 23) end def test_marks_the_promise_as_realized assert_equal(PromiseV2.value(23).realized?, true) end def test_marks_the_p...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_io.rb
test/nodejs/test_io.rb
# Copied from cruby and modified to skip unsupported syntaxes require 'test/unit' require 'nodejs' require 'nodejs/io' class TestNodejsIO < Test::Unit::TestCase def test_binread File.write('tmp/foo', 'bar') assert_equal("bar", IO.binread('tmp/foo')) end def test_binread_noexistent_should_raise_io_error...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_await.rb
test/nodejs/test_await.rb
# frozen_string_literal: true # await: true require "test/unit" class TestAwait < Test::Unit::TestCase stdheader = <<~RUBY # await: true require "await" RUBY autoawaitheader = <<~RUBY # await: *await* require "await" RUBY tests = { test_await_in_top: [<<~RUBY, 6], #{stdheader} ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_env.rb
test/nodejs/test_env.rb
require 'test/unit' require 'nodejs/env' class TestNodejsEnv < Test::Unit::TestCase def shared_test_env_has_key(method) assert_equal(false, ENV.send(method, 'should_never_be_set')) ENV['foo'] = 'bar' assert_equal(true, ENV.send(method, 'foo')) assert_equal(false, ENV.send(method, 'bar')) ENV.del...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_pathname.rb
test/nodejs/test_pathname.rb
require 'test/unit' require 'nodejs' class TestNodejsPathname < Test::Unit::TestCase def self.windows_platform? `process.platform`.start_with?('win') end def test_windows_pathname_absolute assert_equal(true, Pathname.new('c:/foo').absolute?) assert_equal(true, Pathname.new('/foo').absolute?) ass...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_error.rb
test/nodejs/test_error.rb
# backtick_javascript: true require 'test/unit' require 'nodejs' class TestNodejsError < Test::Unit::TestCase def test_should_preserve_stack raise ArgumentError.new('oops') rescue => ex backtrace_line = " from nodejs/test_error.rb:#{__LINE__ - 2}" wrapped_ex = ex.exception %(context - #{ex.message}) ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_file.rb
test/nodejs/test_file.rb
# backtick_javascript: true # Copied from cruby and modified to skip unsupported syntaxes require 'test/unit' require 'nodejs' require 'nodejs/file' class TestNodejsFile < Test::Unit::TestCase def tmpdir `require('os').tmpdir()` end def self.windows_platform? `process.platform`.start_with?('win') end...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_tracepoint_end.rb
test/nodejs/test_tracepoint_end.rb
# frozen_string_literal: true # await: *await require "test/unit" require "corelib/trace_point" class TestTracePointEnd < Test::Unit::TestCase HEADER = <<~RUBY # await: true require "await" RUBY def eval_and_await(code) eval(code).__await__ end def test_end_after_class_body_sync code = <<~...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_opal_builder.rb
test/nodejs/test_opal_builder.rb
require 'test/unit' require 'nodejs' require 'opal-builder' class TestNodejsOpalBuilder < Test::Unit::TestCase def test_should_build_simple_ruby_file builder = Opal::Builder.new builder.append_paths('.') result = builder.build('test/nodejs/fixtures/hello.rb') assert(/self\.\$puts\("Hello world"\)/.m...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_yaml.rb
test/nodejs/test_yaml.rb
require 'test/unit' require 'nodejs' require 'nodejs/yaml' class TestYAML < Test::Unit::TestCase YAMLDOC = <<~YAML --- string: hello world array: [1,2,3] YAML YAMLSTRUCT = { "string" => "hello world", "array" => [1,2,3] } def test_should_parse_yaml assert_equal(YAML.load(YAMLDOC), Y...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_file_encoding.rb
test/nodejs/test_file_encoding.rb
require 'test/unit' require 'nodejs' require 'nodejs/file' class TestNodejsFileEncoding < Test::Unit::TestCase def test_force_encoding_raw_text_to_utf8 raw_text = 'çéà' assert_equal(raw_text.encoding, Encoding::UTF_8) utf8_text = raw_text.force_encoding('utf-8') assert_equal("çéà", utf8_text) end ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_string.rb
test/nodejs/test_string.rb
# backtick_javascript: true require 'test/unit' require 'nodejs' class TestString < Test::Unit::TestCase def test_should_get_bytes assert_equal('foo'.bytesize, 3) assert_equal('foo'.each_byte.to_a, [102, 111, 111]) assert_equal('foo'.bytes, [102, 111, 111]) assert_equal('foo'.bytes, [102, 111, 111])...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/test_dir.rb
test/nodejs/test_dir.rb
# backtick_javascript: true # Copied from cruby and modified to skip unsupported syntaxes require 'test/unit' require 'nodejs' require 'nodejs/dir' class TestNodejsDir < Test::Unit::TestCase def glob_base_test_dir tmpdir + "/testing_nodejs_dir_glob_implementation_#{Time.now.to_i}" end def tmpdir `requ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/test/nodejs/fixtures/hello.rb
test/nodejs/fixtures/hello.rb
puts "Hello world"
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/spec_helper.rb
spec/spec_helper.rb
# backtick_javascript: true require 'opal' require 'set' require 'opal/platform' require 'opal-parser' require 'mspec' require 'mspec/version' require 'support/mspec_rspec_adapter' require 'support/guard_platform' require 'mspec-opal/runner' # Node v0.12 as well as Google Chrome/V8 42.0.2311.135 (64-bit) # showed to ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/string_spec.rb
spec/opal/core/string_spec.rb
# backtick_javascript: true require 'spec_helper' describe 'Encoding' do it 'supports US-ASCII' do skip if OPAL_PLATFORM == 'deno' # see filters/platform/deno "è".encoding.name.should == 'UTF-8' "è".force_encoding('ASCII').should == "\xC3\xA8" "è".force_encoding('ascii').should == "\xC3\xA8" "è"...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/exception_spec.rb
spec/opal/core/exception_spec.rb
# backtick_javascript: true require 'spec_helper' describe "Native exception" do it "handles messages for native exceptions" do exception = `new Error("native message")` exception.message.should == "native message" 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_spec.rb
spec/opal/core/module_spec.rb
module ModuleSubclassIncludedSpec class Module1 < ::Module def included(_descendant) $ScratchPad << 'A included' end end class Module2 < Module1 def included(_descendant) $ScratchPad << 'B included' end end M0 = Module.new M1 = Module1.new M2 = Module2.new end module ModuleCV...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/iterable_props_spec.rb
spec/opal/core/iterable_props_spec.rb
# backtick_javascript: true require 'spec_helper' describe 'Iterable props defined by Opal on core JS objects' do %x{ function iterableKeysOf(obj) { var result = []; for (var key in obj) { result.push(key); } return result; } } it 'is empty for numbers' do `iterabl...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime_spec.rb
spec/opal/core/runtime_spec.rb
# backtick_javascript: true require 'spec_helper' describe 'javascript access using .JS' do it 'should call javascript methods via .JS.method()' do "a1234b5678c".JS.indexOf('c').should == 10 "a1234b5678c".JS.replace(`/[0-9]/g`, '').should == 'abc' end it 'should call javascript methods via .JS.method a...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/hash_spec.rb
spec/opal/core/hash_spec.rb
# backtick_javascript: true describe 'Hash' do it 'works with object-strings with regards to deleting' do h = {`new String('a')` => 'a'} k = h.keys.first h.delete(k) h.inspect.should == '{}' end it 'compacts nil and JavaScript null and undefined values' do h = { a: nil, b: `null`, c: `undefi...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/object_id_spec.rb
spec/opal/core/object_id_spec.rb
# backtick_javascript: true require 'spec_helper' describe "Opal.uid()" do it "returns even sequential numbers in increments of 2" do %x{ var id0 = Opal.uid(), id1 = Opal.uid(), id2 = Opal.uid(), id3 = Opal.uid(), id4 = Opal.uid(); } modulo = `id0` % 2 ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/helpers_spec.rb
spec/opal/core/helpers_spec.rb
require 'spec_helper' describe Opal do context '.instance_variable_name!' do it 'does not use regular expressions on Opal level, so $` stays the same' do 'some string' =~ /string/ post_match = $` Opal.instance_variable_name!(:@ivar_name) expect($`).to eq(post_match) 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/time_spec.rb
spec/opal/core/time_spec.rb
require 'spec_helper' require 'time' # rubyspec does not have specs for these listed methods describe Time do describe '<=>' do it 'returns -1 when self is less than other' do (Time.new(2015, 1, 1) <=> Time.new(2015, 1, 2)).should == -1 end it 'returns 0 when self is equal to other' do (Time...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/boolean_spec.rb
spec/opal/core/boolean_spec.rb
require 'spec_helper' describe "TrueClass/FalseClass" do it 'correctly resolves a boolean class' do expect(true.class).to eq(TrueClass) expect(false.class).to eq(FalseClass) expect(true.class).not_to eq(false.class) end it 'correctly resolves a boolean class with #is_a?' do expect(true.is_a? Tr...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/language_spec.rb
spec/opal/core/language_spec.rb
# backtick_javascript: true require 'spec_helper' describe "generated method names" do it "does not conflict with local Ruby variables" do Class.new { value = 123 def value 456 end value.should == 123 } end it "does not conflict with local JS variables" do Class.new ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/string/to_proc_spec.rb
spec/opal/core/string/to_proc_spec.rb
require 'spec_helper' describe "Symbol#to_proc" do # bug #2417 it "correctly passes method name to #method_missing" do obj = Object.new def obj.method_missing(*args); args; end; result = :a.to_proc.call(obj, 6, 7) result.should == [:a, 6, 7] end it "correctly passes a block to #method_missing"...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/string/gsub_spec.rb
spec/opal/core/string/gsub_spec.rb
require 'spec_helper' describe 'String' do describe '#gsub' do it 'handles recursive gsub' do pass_slot_rx = /{(\d+)}/ recurse_gsub = -> text { text.gsub(pass_slot_rx) { index = $1.to_i if index == 0 recurse_gsub.call '{1}' else 'value' ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/string/subclassing_spec.rb
spec/opal/core/string/subclassing_spec.rb
require 'spec_helper' class MyStringSubclass < String attr_reader :v def initialize(s, v) super(s) @v = v end end describe "String subclassing" do it "should call initialize for subclasses" do c = MyStringSubclass.new('s', 5) [c, c.v].should == ['s', 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/string/unpack_spec.rb
spec/opal/core/string/unpack_spec.rb
require 'spec_helper' describe 'String#unpack' do it 'correctly unpacks with U* strings with latin-1 characters' do 'café'.unpack('U*').should == [99, 97, 102, 233] [99, 97, 102, 233].pack('U*').unpack('U*').should == [99, 97, 102, 233] end it 'correctly unpacks with U* strings with latin-2 characters' ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/string/each_byte_spec.rb
spec/opal/core/string/each_byte_spec.rb
require 'spec_helper' describe "String#each_byte" do it "get bytes from UTF-8 character (2 bytes)" do a = [] "ʆ".each_byte { |c| a << c } a.should == [202, 134] end it "get bytes from UTF-8 character (3 bytes)" do a = [] "ቜ".each_byte { |c| a << c } a.should == [225, 137, 156] end it ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/string/to_sym_spec.rb
spec/opal/core/string/to_sym_spec.rb
# backtick_javascript: true require 'spec_helper' describe 'String#to_sym' do it 'returns a string literal' do str = "string" sym = str.to_sym `typeof(sym)`.should == 'string' end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/string/scan_spec.rb
spec/opal/core/string/scan_spec.rb
describe 'String#scan' do it 'supports block argument destructuring' do foo = [] "/foo/:bar".scan(/:(\w+)/) { |name,| foo << name } foo.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/hash/internals_spec.rb
spec/opal/core/hash/internals_spec.rb
# backtick_javascript: true describe 'Hash' do describe 'internal implementation of string keys' do before :each do @h = {'a' => 123, 'b' => 456} end it 'stores keys directly as strings in the `Map`' do `#@h.size`.should == 2 `Array.from(#@h.keys())[0]`.should == 'a' `Array.from...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_with_dot/file 3.rb
spec/opal/core/fixtures/require_tree_with_dot/file 3.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_with_dot/index.rb
spec/opal/core/fixtures/require_tree_with_dot/index.rb
$ScratchPad << File.basename(__FILE__)+'-pre' require_tree '.' $ScratchPad << File.basename(__FILE__)+'-post'
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_with_dot/file 1.rb
spec/opal/core/fixtures/require_tree_with_dot/file 1.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_with_dot/file 2.rb
spec/opal/core/fixtures/require_tree_with_dot/file 2.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_files/file 3.rb
spec/opal/core/fixtures/require_tree_files/file 3.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_files/file 1.rb
spec/opal/core/fixtures/require_tree_files/file 1.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_files/file 4.rb
spec/opal/core/fixtures/require_tree_files/file 4.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_files/file 2.rb
spec/opal/core/fixtures/require_tree_files/file 2.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_files/file 5.rb
spec/opal/core/fixtures/require_tree_files/file 5.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_files/nested/nested 2.rb
spec/opal/core/fixtures/require_tree_files/nested/nested 2.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_files/nested/nested 1.rb
spec/opal/core/fixtures/require_tree_files/nested/nested 1.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/fixtures/require_tree_files/other/other 1.rb
spec/opal/core/fixtures/require_tree_files/other/other 1.rb
$ScratchPad << File.basename(__FILE__)
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/kernel/methods_spec.rb
spec/opal/core/kernel/methods_spec.rb
module MethodsSpecs class Issue < Object def unique_method_name end end # Trigger stub generation Issue.new.unique_method_name end describe "Kernel#methods" do it "lists methods available on an object" do Object.new.methods.include?("puts").should == true end it "lists only singleton method...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/kernel/instance_variables_spec.rb
spec/opal/core/kernel/instance_variables_spec.rb
describe "Kernel#instance_variables" do context 'for nil' do it 'returns blank array' do expect(nil.instance_variables).to eq([]) end end context 'for string' do it 'returns blank array' do expect(''.instance_variables).to eq([]) end end context 'for non-empty string' do it '...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/kernel/puts_spec.rb
spec/opal/core/kernel/puts_spec.rb
describe "IO#puts" do before :each do @before_separator = $/ @io = IO.new(123) ScratchPad.record [] def @io.write(str) ScratchPad << str end end after :each do ScratchPad.clear @io.close if @io suppress_warning {$/ = @before_separator} end it "writes just a newline when...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/kernel/require_tree_spec.rb
spec/opal/core/kernel/require_tree_spec.rb
describe 'Kernel.require_tree' do it 'loads all the files in a directory' do $ScratchPad = [] require_tree '../fixtures/require_tree_files' $ScratchPad.sort.should == ['file 1.rb', 'file 2.rb', 'file 3.rb', 'file 4.rb', 'file 5.rb', 'nested 1.rb', 'nested 2.rb', 'other 1.r...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/kernel/at_exit_spec.rb
spec/opal/core/kernel/at_exit_spec.rb
# backtick_javascript: true module KernelExit extend self attr_accessor :status, :original_proc, :proc, :out self.original_proc = `Opal.exit` self.proc = `function(status){ #{KernelExit.status = `status`} }` def out_after_exit `Opal.exit = #{proc}` exit out ensure `Opal.exit = #{original_...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/kernel/respond_to_spec.rb
spec/opal/core/kernel/respond_to_spec.rb
# backtick_javascript: true class RespondToSpecs def foo end end describe "Kernel#respond_to?" do before :each do @a = RespondToSpecs.new end it "returns false if a method exists, but is marked with a '$$stub' property" do `#{@a}.$foo.$$stub = true` @a.respond_to?(:foo).should be_false end en...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/kernel/public_methods_spec.rb
spec/opal/core/kernel/public_methods_spec.rb
module PublicMethodsSpecs class Parent def parent_method end end class Child < Parent def child_method end end end describe "Kernel#public_methods" do it "lists methods available on an object" do child = PublicMethodsSpecs::Child.new child.public_methods.include?("parent_method").sho...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/struct/dup_spec.rb
spec/opal/core/struct/dup_spec.rb
describe "Struct#dup" do it "should return another struct instance" do klass = Struct.new("Klass", :foo) a = klass.new(1) b = a.dup b.foo = 2 a.foo.should == 1 b.foo.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/enumerator/with_index_spec.rb
spec/opal/core/enumerator/with_index_spec.rb
describe "Enumerator#with_index" do it "returns the result of the previously called method" do [1, 2, 3].each.with_index { |item, index| item * 2 }.should == [1, 2, 3] [1, 2, 3].map.with_index { |item, index| item * 2 }.should == [2, 4, 6] end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/eval_spec.rb
spec/opal/core/runtime/eval_spec.rb
# backtick_javascript: true describe "Opal.eval()" do it "evaluates ruby code by compiling it to javascript and running" do `Opal['eval']("'foo'.class")`.should == String end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/exit_spec.rb
spec/opal/core/runtime/exit_spec.rb
# backtick_javascript: true describe "Exit (Kernel#exit / Opal.exit())" do it "forwards the status code to Opal.exit(status)" do received_status { Kernel.exit }.should == 0 received_status { Kernel.exit(0) }.should == 0 received_status { Kernel.exit(1) }.should == 1 received_status { Kernel.exit(2) ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/string_spec.rb
spec/opal/core/runtime/string_spec.rb
# backtick_javascript: true require 'spec_helper' describe "Runtime String helpers" do context 'Opal.str' do it 'sets the encoding boxing literal strings' do -> { `Opal.str("foo", 'UTF-8')` }.should_not raise_error end end context 'Opal.set_encoding' do it 'sets the encoding for...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/main_methods_spec.rb
spec/opal/core/runtime/main_methods_spec.rb
require 'spec_helper' $OPAL_TOP_LEVEL_OBJECT = self def self.some_main_method 3.142 end def some_top_level_method_is_defined 42 end define_method :some_other_main_method do 0.1618 end describe "Defining normal methods at the top level" do it "should define them on Object, not main" do $OPAL_TOP_LEVEL_O...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/rescue_spec.rb
spec/opal/core/runtime/rescue_spec.rb
# backtick_javascript: true describe "The rescue keyword" do context 'Opal::Raw::Error' do it 'handles raw js throws' do begin `throw { message: 'foo' }` nil rescue Opal::Raw::Error => e e.JS[:message] end.should == 'foo' end it 'handles other Opal error' do ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/truthy_spec.rb
spec/opal/core/runtime/truthy_spec.rb
# backtick_javascript: true class Boolean def self_as_an_object self end end class JsNil def <(other) `nil` end end describe "Opal truthyness" do it "should evaluate to true using js `true` as an object" do if true.self_as_an_object called = true end called.should be_true end ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/is_a_spec.rb
spec/opal/core/runtime/is_a_spec.rb
# backtick_javascript: true describe 'Opal.is_a' do describe 'Numeric/Number special cases' do [ [1, :Numeric, true], [1, :Number, true], [1, :Fixnum, true], [1, :Integer, true], [1, :Float, true], [1.2, :Numeric, true], [1.2, :Number, true], [1.2, :Fixnum, true],...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/method_missing_spec.rb
spec/opal/core/runtime/method_missing_spec.rb
# backtick_javascript: true require "spec_helper" module MethodMissingSpecs class A def method_missing(mid, *args) [mid, args] end end class B def method_missing(mid, *args, &block) [mid, block] end end end class BridgedClass < `(function NativeConstructor(){})` end describe "me...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/bridged_classes_spec.rb
spec/opal/core/runtime/bridged_classes_spec.rb
# backtick_javascript: true require 'spec_helper' %x{ var bridge_class_demo = function(){}; bridge_class_demo.prototype.$foo = function() { return "bar" }; } class TopBridgedClassDemo < `bridge_class_demo` def some_bridged_method [1, 2, 3] end def method_missing(name, *args, &block) return :catched...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/loaded_spec.rb
spec/opal/core/runtime/loaded_spec.rb
# backtick_javascript: true describe 'Opal.loaded' do before do %w[foo bar baz].each do |module_name| `delete Opal.require_table[#{module_name}]` `Opal.loaded_features.splice(Opal.loaded_features.indexOf(#{module_name}))` end end it 'it works with multiple paths' do `Opal.loaded(['bar'])...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/runtime/constants_spec.rb
spec/opal/core/runtime/constants_spec.rb
# backtick_javascript: true module RuntimeFixtures class A end class A::B module C end end module ModuleB end module ModuleA include ModuleB end end describe "Constants access via .$$ with dots (regression for #1418)" do it "allows to acces scopes on `Opal`" do `Opal.Object.$$.Run...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/enumerable/find_index_break_spec.rb
spec/opal/core/enumerable/find_index_break_spec.rb
describe "Enumerable#find_index" do it "breaks out with the proper value" do [1, 2, 3].find_index { break 42 }.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/core/enumerable/each_slice_break_spec.rb
spec/opal/core/enumerable/each_slice_break_spec.rb
describe "Enumerable#each_slice" do it "breaks out with the proper value" do [1, 2, 3].each_slice(1) { break 42 }.should == 42 [1, 2, 3].each_slice(2) { break 42 }.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/core/enumerable/one_break_spec.rb
spec/opal/core/enumerable/one_break_spec.rb
describe "Enumerable#one?" do it "breaks out with the proper value" do [1, 2, 3].one? { break 42 }.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/core/enumerable/max_by_break_spec.rb
spec/opal/core/enumerable/max_by_break_spec.rb
describe "Enumerable#max_by" do it "breaks out with the proper value" do [1, 2, 3].max_by { break 42 }.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/core/enumerable/min_break_spec.rb
spec/opal/core/enumerable/min_break_spec.rb
describe "Enumerable#min" do it "breaks out with the proper value" do [1, 2, 3].min { break 42 }.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/core/enumerable/count_break_spec.rb
spec/opal/core/enumerable/count_break_spec.rb
describe "Enumerable#count" do it "breaks out with the proper value" do [1, 2, 3].count { break 42 }.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/core/enumerable/reduce_break_spec.rb
spec/opal/core/enumerable/reduce_break_spec.rb
describe "Enumerable#reduce" do it "breaks out with the proper value" do [1, 2, 3].reduce { break 42 }.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/core/enumerable/max_break_spec.rb
spec/opal/core/enumerable/max_break_spec.rb
describe "Enumerable#max" do it "breaks out with the proper value" do [1, 2, 3].max { break 42 }.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/core/enumerable/collect_break_spec.rb
spec/opal/core/enumerable/collect_break_spec.rb
describe "Enumerable#collect" do class Test include Enumerable def each(&block) [1, 2, 3].each(&block) end end it "breaks out with the proper value" do Test.new.collect { break 42 }.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/core/enumerable/any_break_spec.rb
spec/opal/core/enumerable/any_break_spec.rb
describe "Enumerable#any?" do it "breaks out with the proper value" do [1, 2, 3].any? { break 42 }.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/core/enumerable/each_with_index_break_spec.rb
spec/opal/core/enumerable/each_with_index_break_spec.rb
describe "Enumerable#each_with_index" do it "breaks out with the proper value" do [1, 2, 3].each_with_index { break 42 }.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/core/enumerable/grep_break_spec.rb
spec/opal/core/enumerable/grep_break_spec.rb
describe "Enumerable#grep" do it "breaks out with the proper value" do [1, 2, 3].grep(1) { break 42 }.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/core/enumerable/take_while_break_spec.rb
spec/opal/core/enumerable/take_while_break_spec.rb
describe "Enumerable#take_while" do it "breaks out with the proper value" do [1, 2, 3].take_while { break 42 }.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/core/enumerable/drop_while_break_spec.rb
spec/opal/core/enumerable/drop_while_break_spec.rb
describe "Enumerable#drop_while" do it "breaks out with the proper value" do [1, 2, 3].drop_while { break 42 }.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/core/enumerable/all_break_spec.rb
spec/opal/core/enumerable/all_break_spec.rb
describe "Enumerable#all?" do it "breaks out with the proper value" do [1, 2, 3].all? { break 42 }.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/core/enumerable/find_all_break_spec.rb
spec/opal/core/enumerable/find_all_break_spec.rb
describe "Enumerable#find_all" do it "breaks out with the proper value" do [1, 2, 3].find_all { break 42 }.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/core/enumerable/none_break_spec.rb
spec/opal/core/enumerable/none_break_spec.rb
describe "Enumerable#none?" do it "breaks out with the proper value" do [1, 2, 3].none? { break 42 }.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/core/enumerable/min_by_break_spec.rb
spec/opal/core/enumerable/min_by_break_spec.rb
describe "Enumerable#min_by" do it "breaks out with the proper value" do [1, 2, 3].min_by { break 42 }.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/core/enumerable/each_with_object_break_spec.rb
spec/opal/core/enumerable/each_with_object_break_spec.rb
describe "Enumerable#each_with_object" do it "breaks out with the proper value" do [1, 2, 3].each_with_object(23) { break 42 }.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/core/enumerable/detect_break_spec.rb
spec/opal/core/enumerable/detect_break_spec.rb
describe "Enumerable#detect" do it "breaks out with the proper value" do [1, 2, 3].detect { break 42 }.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/core/regexp/match_spec.rb
spec/opal/core/regexp/match_spec.rb
# backtick_javascript: true describe 'Regexp#match' do describe 'when pos is not specified' do it 'calls .exec only once on the current object' do regexp = /test/ calls = 0 %x( regexp._exec = regexp.exec; regexp.exec = function(str) { var match = this._exec(str); ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/regexp/interpolation_spec.rb
spec/opal/core/regexp/interpolation_spec.rb
describe 'Regexp interpolation' do it 'can interpolate other regexps' do a = /a/ /#{a}/.should =~ 'aaa' /a+/.should =~ 'aaa' /#{a}+/.should =~ 'aaa' /aa/.should =~ 'aaa' /#{a}a/.should =~ 'aaa' end it 'can interpolate objects' do a = Object.new def a.to_s; 'a'; end /#{a}/.sh...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/regexp/assertions_spec.rb
spec/opal/core/regexp/assertions_spec.rb
describe 'Regexp assertions' do it 'matches the beginning of input' do /\Atext/.should =~ 'text' /\Atext/.should_not =~ 'the text' regexp = Regexp.new('\Atext') regexp.should =~ 'text' regexp.should_not =~ 'the text' end it 'matches the end of input' do /text\z/.should =~ 'the text' ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/marshal/load_spec.rb
spec/opal/core/marshal/load_spec.rb
describe "Marshal.load" do it 'loads array with instance variable' do a = Marshal.load("\x04\bI[\bi\x06i\ai\b\x06:\n@ivari\x01{") a.should == [1, 2, 3] a.instance_variable_get(:@ivar).should == 123 end it 'loads a hash with a default value (hash_def)' do hash = Marshal.load("\x04\b}\x06i\x06i\a:\...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/marshal/dump_spec.rb
spec/opal/core/marshal/dump_spec.rb
# encoding: binary require 'spec_helper' module MarshalExtension end class MarshalUserRegexp < Regexp end class UserMarshal attr_reader :data def initialize @data = 'stuff' end def marshal_dump() 'data' end def marshal_load(data) @data = data end def ==(other) self.class === other and @data == othe...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/array/union_spec.rb
spec/opal/core/array/union_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/array/include_spec.rb
spec/opal/core/array/include_spec.rb
# backtick_javascript: true describe "Array#include" do it "should respect nil values" do nileq = Object.new def nileq.==(other) nil end [nileq].should_not include("no match expected") end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/array/dup_spec.rb
spec/opal/core/array/dup_spec.rb
# backtick_javascript: true describe "Array#dup" do it "should use slice optimization" do a = Array.new `a.slice = function() { return ['sliced'] }` lambda { a.dup }.should_not raise_error a.dup.should == ['sliced'] end it "should use slice optimization on Array subclass" do subclass = Class...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/array/zip_spec.rb
spec/opal/core/array/zip_spec.rb
describe "Array#zip" do it "respects block arity" do foo = ['A', 'B'] values = [] foo.zip(foo) do | a,b | values << [a, b] end values.should == [['A', 'A'], ['B', '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/array/minus_spec.rb
spec/opal/core/array/minus_spec.rb
describe "Array#-" do it "relies on Ruby's #hash (not JavaScript's #toString) for identifying array items" do a1 = [ 123 ] a2 = ['123'] (a1 - a2).should == a1 (a2 - a1).should == a2 a1 = [ Time.at(1429521600.1) ] a2 = [ Time.at(1429521600.9) ] (a1 - a2).should == a1 (a2 - a1).should =...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/array/uniq_spec.rb
spec/opal/core/array/uniq_spec.rb
describe "Array#uniq" do it "relies on Ruby's #hash (not JavaScript's #toString) for identifying array items" do a = [ 123, '123'] a.uniq.should == a a = [ Time.at(1429521600.1), Time.at(1429521600.9) ] a.uniq.should == a a = [ Object.new, Object.new ] a.uniq.should == a a = [ 1, 2, 3, ...
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false
opal/opal
https://github.com/opal/opal/blob/b4e228990534515b83cd509a9297beca59bf8733/spec/opal/core/array/compact_spec.rb
spec/opal/core/array/compact_spec.rb
# backtick_javascript: true describe "Array#compact" do it "compacts nil and JavaScript null and undefined" do a = [1, nil, `null`, `undefined`] expect(a.size).to eq 4 expect(a.compact.size).to eq 1 a.compact! expect(a.size).to eq 1 end end
ruby
MIT
b4e228990534515b83cd509a9297beca59bf8733
2026-01-04T15:44:44.154940Z
false