Skip to content

Commit 8156769

Browse files
committed
[GR-14806] Update specs
PullRequest: truffleruby/3266
2 parents 7f6f373 + 5334048 commit 8156769

19 files changed

+103
-29
lines changed

spec/mspec/lib/mspec/guards/platform.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def self.windows?
4141
os?(:windows)
4242
end
4343

44+
def self.wasi?
45+
os?(:wasi)
46+
end
47+
4448
def self.wsl?
4549
if defined?(@wsl_p)
4650
@wsl_p

spec/mspec/lib/mspec/helpers/datetime.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def new_datetime(opts = {})
2525
end
2626

2727
def with_timezone(name, offset = nil, daylight_saving_zone = "")
28+
skip "WASI doesn't have TZ concept" if PlatformGuard.wasi?
2829
zone = name.dup
2930

3031
if offset

spec/mspec/lib/mspec/helpers/ruby_exe.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ def resolve_ruby_exe
112112
end
113113

114114
def ruby_exe(code = :not_given, opts = {})
115+
skip "WASI doesn't provide subprocess" if PlatformGuard.wasi?
116+
115117
if opts[:dir]
116118
raise "ruby_exe(..., dir: dir) is no longer supported, use Dir.chdir"
117119
end

spec/ruby/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ Every example code has a textual description, which presents several advantages:
1818

1919
The specs are written with syntax similar to RSpec 2.
2020
They are run with MSpec, the purpose-built framework for running the Ruby Spec Suite.
21-
For more information, see the [MSpec](http://github.com/ruby/mspec) project.
21+
For more information, see the [MSpec](https://github.com/ruby/mspec) project.
2222

2323
The specs describe the [language syntax](language/), the [core library](core/), the [standard library](library/), the [C API for extensions](optional/capi) and the [command line flags](command_line/).
2424
The language specs are grouped by keyword while the core and standard library specs are grouped by class and method.
2525

2626
ruby/spec is known to be tested in these implementations for every commit:
27-
* [MRI](http://rubyci.org/) on 30 platforms and 4 versions
27+
* [MRI](https://rubyci.org/) on 30 platforms and 4 versions
2828
* [JRuby](https://github.com/jruby/jruby/tree/master/spec/ruby) for both 1.7 and 9.x
2929
* [TruffleRuby](https://github.com/oracle/truffleruby/tree/master/spec/ruby)
3030
* [Opal](https://github.com/opal/opal/tree/master/spec)
@@ -70,7 +70,7 @@ Then move to it:
7070

7171
$ cd spec
7272

73-
Clone [MSpec](http://github.com/ruby/mspec):
73+
Clone [MSpec](https://github.com/ruby/mspec):
7474

7575
$ git clone https://github.com/ruby/mspec.git ../mspec
7676

@@ -152,5 +152,5 @@ This project was originally born from [Rubinius](https://github.com/rubinius/rub
152152
The revision history of these specs is available [here](https://github.com/ruby/spec/blob/2b886623/CHANGES.before-2008-05-10).
153153
These specs were later extracted to their own project, RubySpec, with a specific vision and principles.
154154
At the end of 2014, Brian Shirai, the creator of RubySpec, decided to [end RubySpec](http://rubinius.com/2014/12/31/matz-s-ruby-developers-don-t-use-rubyspec/).
155-
A couple months later, the different repositories were merged and [the project was revived](http://eregon.github.io/rubyspec/2015/07/29/rubyspec-is-reborn.html).
155+
A couple months later, the different repositories were merged and [the project was revived](https://eregon.github.io/rubyspec/2015/07/29/rubyspec-is-reborn.html).
156156
On 12 January 2016, the name was changed to "The Ruby Spec Suite" for clarity and to let the RubySpec ideology rest in peace.

spec/ruby/core/dir/home_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
end
2929
end
3030

31-
platform_is_not :windows, :solaris, :android do
31+
platform_is_not :windows, :solaris, :android, :wasi do
3232
it "returns the named user's home directory, from the user database" do
3333
Dir.home(ENV['USER']).should == `echo ~#{ENV['USER']}`.chomp
3434
end

spec/ruby/core/kernel/define_singleton_method_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,19 @@ def o.define(name)
9696
o.define(:foo) { raise "not used" }
9797
}.should raise_error(ArgumentError)
9898
end
99+
100+
it "always defines the method with public visibility" do
101+
cls = Class.new
102+
def cls.define(name, &block)
103+
private
104+
define_singleton_method(name, &block)
105+
end
106+
107+
-> {
108+
suppress_warning do
109+
cls.define(:foo) { :ok }
110+
end
111+
cls.foo.should == :ok
112+
}.should_not raise_error(NoMethodError)
113+
end
99114
end

spec/ruby/core/kernel/open_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
open(@name, "r") { |f| f.gets }.should == @content
2828
end
2929

30-
platform_is_not :windows do
30+
platform_is_not :windows, :wasi do
3131
it "opens an io when path starts with a pipe" do
3232
@io = open("|date")
3333
begin

spec/ruby/core/kernel/require_relative_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
$LOADED_FEATURES.should include(@abs_path)
208208
end
209209

210-
platform_is_not :windows do
210+
platform_is_not :windows, :wasi do
211211
describe "with symlinks" do
212212
before :each do
213213
@symlink_to_code_dir = tmp("codesymlink")

spec/ruby/core/module/ruby2_keywords_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def kwargs(**kw)
7979
after_usage.should == h
8080
after_usage.should_not.equal?(h)
8181
after_usage.should_not.equal?(marked)
82-
ruby_bug "#18625", ""..."3.2" do
82+
ruby_bug "#18625", ""..."3.3" do # might be fixed in 3.2
8383
Hash.ruby2_keywords_hash?(after_usage).should == false
8484
end
8585
Hash.ruby2_keywords_hash?(marked).should == true

spec/ruby/core/proc/parameters_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@
2020
proc {|x| }.parameters.first.first.should == :opt
2121
end
2222

23+
ruby_version_is "3.2" do
24+
it "sets the first element of each sub-Array to :req if argument would be required if a lambda if lambda keyword used" do
25+
proc {|x| }.parameters(lambda: true).first.first.should == :req
26+
proc {|y,*x| }.parameters(lambda: true).first.first.should == :req
27+
end
28+
29+
it "regards named parameters in procs as required if lambda keyword used" do
30+
proc {|x| }.parameters(lambda: true).first.first.should == :req
31+
end
32+
33+
it "regards named parameters in lambda as optional if lambda: false keyword used" do
34+
-> x { }.parameters(lambda: false).first.first.should == :opt
35+
end
36+
end
37+
2338
it "regards optional keyword parameters in procs as optional" do
2439
proc {|x: :y| }.parameters.first.first.should == :key
2540
end

0 commit comments

Comments
 (0)