blob: be767536fbc1c24f9f34a44e9a3289f830f70f2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
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
it "libdir/LIBRUBY_SO is the path to libruby and it exists if and only if ENABLE_SHARED" do
if RbConfig::CONFIG['ENABLE_SHARED'] == 'yes'
libdir = RbConfig::CONFIG['libdir']
File.should.exist?("#{libdir}/#{RbConfig::CONFIG['LIBRUBY_SO']}")
elsif RbConfig::CONFIG['ENABLE_SHARED'] == 'no'
libdir = RbConfig::CONFIG['libdir']
File.should_not.exist?("#{libdir}/#{RbConfig::CONFIG['LIBRUBY_SO']}")
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
|