1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/library/rbconfig/rbconfig_spec.rb
Yusuke Endoh 34b0a7be0e spec/ruby/library/rbconfig/rbconfig_spec.rb: restore "not windows" guard
https://github.com/ruby/ruby/runs/541455267
```
1)
RbConfig::CONFIG libdir/LIBRUBY_SO is the path to libruby and it exists if and only if ENABLE_SHARED FAILED
Expected File.exist? "d:/Ruby26-x64/lib/x64-msvcrt-ruby260.dll"
to be truthy but was false
D:/a/ruby/ruby/src/spec/ruby/library/rbconfig/rbconfig_spec.rb:46:in `block (3 levels) in <top (required)>'
D:/a/ruby/ruby/src/spec/ruby/library/rbconfig/rbconfig_spec.rb:4:in `<top (required)>'
```
2020-03-28 19:31:11 +09:00

64 lines
2 KiB
Ruby

require_relative '../../spec_helper'
require 'rbconfig'
describe 'RbConfig::CONFIG' do
it 'values are all strings' do
RbConfig::CONFIG.each do |k, v|
k.should be_kind_of String
v.should be_kind_of String
end
end
# These directories have no meanings before the installation.
guard -> { RbConfig::TOPDIR } do
it "['rubylibdir'] returns the directory containing Ruby standard libraries" do
rubylibdir = RbConfig::CONFIG['rubylibdir']
File.directory?(rubylibdir).should == true
File.should.exist?("#{rubylibdir}/fileutils.rb")
end
it "['archdir'] returns the directory containing standard libraries C extensions" do
archdir = RbConfig::CONFIG['archdir']
File.directory?(archdir).should == true
File.should.exist?("#{archdir}/etc.#{RbConfig::CONFIG['DLEXT']}")
end
end
it "contains no frozen strings even with --enable-frozen-string-literal" do
ruby_exe(<<-RUBY, options: '--enable-frozen-string-literal').should == "Done\n"
require 'rbconfig'
RbConfig::CONFIG.each do |k, v|
# SDKROOT excluded here to workaround the issue: https://bugs.ruby-lang.org/issues/16738
if v.frozen? && k != 'SDKROOT'
puts "\#{k} Failure"
end
end
puts 'Done'
RUBY
end
platform_is_not :windows do
guard -> {RbConfig::TOPDIR} do
it "libdir/LIBRUBY_SO is the path to libruby and it exists if and only if ENABLE_SHARED" do
libdir = RbConfig::CONFIG[RbConfig::CONFIG['libdirname'] || 'libdir']
libruby_so = "#{libdir}/#{RbConfig::CONFIG['LIBRUBY_SO']}"
case RbConfig::CONFIG['ENABLE_SHARED']
when 'yes'
File.should.exist?(libruby_so)
when 'no'
File.should_not.exist?(libruby_so)
end
end
end
end
end
describe "RbConfig::TOPDIR" do
it "either returns nil (if not installed) or the prefix" do
if RbConfig::TOPDIR
RbConfig::TOPDIR.should == RbConfig::CONFIG["prefix"]
else
RbConfig::TOPDIR.should == nil
end
end
end