aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/language
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-04 15:09:32 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-04 15:09:32 +0000
commit401b64c4e840bc8887219e9e445a64b3d5943656 (patch)
tree989b93914e9a8ee57ef3ce0bb3d2e2083470fc49 /spec/ruby/language
parent8a15857a7f283101a3923b76c71a1f05bfe58512 (diff)
downloadruby-401b64c4e840bc8887219e9e445a64b3d5943656.tar.gz
Update to ruby/spec@c1b568b
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/language')
-rw-r--r--spec/ruby/language/BEGIN_spec.rb2
-rw-r--r--spec/ruby/language/alias_spec.rb2
-rw-r--r--spec/ruby/language/and_spec.rb2
-rw-r--r--spec/ruby/language/array_spec.rb4
-rw-r--r--spec/ruby/language/block_spec.rb4
-rw-r--r--spec/ruby/language/break_spec.rb4
-rw-r--r--spec/ruby/language/case_spec.rb2
-rw-r--r--spec/ruby/language/class_spec.rb4
-rw-r--r--spec/ruby/language/class_variable_spec.rb4
-rw-r--r--spec/ruby/language/constants_spec.rb8
-rw-r--r--spec/ruby/language/def_spec.rb4
-rw-r--r--spec/ruby/language/defined_spec.rb10
-rw-r--r--spec/ruby/language/encoding_spec.rb6
-rw-r--r--spec/ruby/language/ensure_spec.rb4
-rw-r--r--spec/ruby/language/execution_spec.rb2
-rw-r--r--spec/ruby/language/file_spec.rb6
-rw-r--r--spec/ruby/language/for_spec.rb2
-rw-r--r--spec/ruby/language/hash_spec.rb8
-rw-r--r--spec/ruby/language/heredoc_spec.rb14
-rw-r--r--spec/ruby/language/if_spec.rb2
-rw-r--r--spec/ruby/language/lambda_spec.rb4
-rw-r--r--spec/ruby/language/line_spec.rb6
-rw-r--r--spec/ruby/language/loop_spec.rb2
-rw-r--r--spec/ruby/language/magic_comment_spec.rb2
-rw-r--r--spec/ruby/language/match_spec.rb4
-rw-r--r--spec/ruby/language/metaclass_spec.rb6
-rw-r--r--spec/ruby/language/method_spec.rb2
-rw-r--r--spec/ruby/language/module_spec.rb4
-rw-r--r--spec/ruby/language/next_spec.rb4
-rw-r--r--spec/ruby/language/not_spec.rb2
-rw-r--r--spec/ruby/language/numbers_spec.rb2
-rw-r--r--spec/ruby/language/optional_assignments_spec.rb2
-rw-r--r--spec/ruby/language/or_spec.rb2
-rw-r--r--spec/ruby/language/order_spec.rb2
-rw-r--r--spec/ruby/language/precedence_spec.rb21
-rw-r--r--spec/ruby/language/predefined/data_spec.rb2
-rw-r--r--spec/ruby/language/predefined/fixtures/data2.rb3
-rw-r--r--spec/ruby/language/predefined/fixtures/data3.rb3
-rw-r--r--spec/ruby/language/predefined_spec.rb2
-rw-r--r--spec/ruby/language/private_spec.rb4
-rw-r--r--spec/ruby/language/proc_spec.rb2
-rw-r--r--spec/ruby/language/redo_spec.rb2
-rw-r--r--spec/ruby/language/regexp/anchors_spec.rb4
-rw-r--r--spec/ruby/language/regexp/back-references_spec.rb4
-rw-r--r--spec/ruby/language/regexp/character_classes_spec.rb4
-rw-r--r--spec/ruby/language/regexp/encoding_spec.rb4
-rw-r--r--spec/ruby/language/regexp/escapes_spec.rb4
-rw-r--r--spec/ruby/language/regexp/grouping_spec.rb4
-rw-r--r--spec/ruby/language/regexp/interpolation_spec.rb4
-rw-r--r--spec/ruby/language/regexp/modifiers_spec.rb4
-rw-r--r--spec/ruby/language/regexp/repetition_spec.rb4
-rw-r--r--spec/ruby/language/regexp_spec.rb4
-rw-r--r--spec/ruby/language/rescue_spec.rb4
-rw-r--r--spec/ruby/language/retry_spec.rb2
-rw-r--r--spec/ruby/language/return_spec.rb4
-rw-r--r--spec/ruby/language/safe_navigator_spec.rb2
-rw-r--r--spec/ruby/language/send_spec.rb4
-rw-r--r--spec/ruby/language/singleton_class_spec.rb4
-rw-r--r--spec/ruby/language/string_spec.rb2
-rw-r--r--spec/ruby/language/super_spec.rb4
-rw-r--r--spec/ruby/language/symbol_spec.rb2
-rw-r--r--spec/ruby/language/throw_spec.rb2
-rw-r--r--spec/ruby/language/undef_spec.rb2
-rw-r--r--spec/ruby/language/unless_spec.rb2
-rw-r--r--spec/ruby/language/until_spec.rb2
-rw-r--r--spec/ruby/language/variables_spec.rb4
-rw-r--r--spec/ruby/language/while_spec.rb2
-rw-r--r--spec/ruby/language/yield_spec.rb4
68 files changed, 131 insertions, 132 deletions
diff --git a/spec/ruby/language/BEGIN_spec.rb b/spec/ruby/language/BEGIN_spec.rb
index c0784971b0..bd7112a0f0 100644
--- a/spec/ruby/language/BEGIN_spec.rb
+++ b/spec/ruby/language/BEGIN_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The BEGIN keyword" do
before :each do
diff --git a/spec/ruby/language/alias_spec.rb b/spec/ruby/language/alias_spec.rb
index e9f0050e17..04ee09f61c 100644
--- a/spec/ruby/language/alias_spec.rb
+++ b/spec/ruby/language/alias_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
class AliasObject
attr :foo
diff --git a/spec/ruby/language/and_spec.rb b/spec/ruby/language/and_spec.rb
index e084fd3cef..55a2a3103a 100644
--- a/spec/ruby/language/and_spec.rb
+++ b/spec/ruby/language/and_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The '&&' statement" do
diff --git a/spec/ruby/language/array_spec.rb b/spec/ruby/language/array_spec.rb
index c3ed8c14c5..2198d7a28b 100644
--- a/spec/ruby/language/array_spec.rb
+++ b/spec/ruby/language/array_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/array', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/array'
describe "Array literals" do
it "[] should return a new array populated with the given elements" do
diff --git a/spec/ruby/language/block_spec.rb b/spec/ruby/language/block_spec.rb
index 733e90211c..bd3c14d487 100644
--- a/spec/ruby/language/block_spec.rb
+++ b/spec/ruby/language/block_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/block', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/block'
describe "A block yielded a single" do
before :all do
diff --git a/spec/ruby/language/break_spec.rb b/spec/ruby/language/break_spec.rb
index 09e8ff3d93..8fd6cc6f05 100644
--- a/spec/ruby/language/break_spec.rb
+++ b/spec/ruby/language/break_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/break', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/break'
describe "The break statement in a block" do
before :each do
diff --git a/spec/ruby/language/case_spec.rb b/spec/ruby/language/case_spec.rb
index 212964070d..0b74efa257 100644
--- a/spec/ruby/language/case_spec.rb
+++ b/spec/ruby/language/case_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The 'case'-construct" do
it "evaluates the body of the when clause matching the case target expression" do
diff --git a/spec/ruby/language/class_spec.rb b/spec/ruby/language/class_spec.rb
index ba4af3d880..c8eba18d80 100644
--- a/spec/ruby/language/class_spec.rb
+++ b/spec/ruby/language/class_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/class', __FILE__)
+require_relative '../spec_helper'
+require_relative '../fixtures/class'
ClassSpecsNumber = 12
diff --git a/spec/ruby/language/class_variable_spec.rb b/spec/ruby/language/class_variable_spec.rb
index 463f731a93..98954023a2 100644
--- a/spec/ruby/language/class_variable_spec.rb
+++ b/spec/ruby/language/class_variable_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/class_variables', __FILE__)
+require_relative '../spec_helper'
+require_relative '../fixtures/class_variables'
describe "A class variable" do
after :each do
diff --git a/spec/ruby/language/constants_spec.rb b/spec/ruby/language/constants_spec.rb
index 1f1e254fb8..e6bb13bed2 100644
--- a/spec/ruby/language/constants_spec.rb
+++ b/spec/ruby/language/constants_spec.rb
@@ -1,7 +1,7 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/constants', __FILE__)
-require File.expand_path('../fixtures/constants_sclass', __FILE__)
-require File.expand_path('../fixtures/constant_visibility', __FILE__)
+require_relative '../spec_helper'
+require_relative '../fixtures/constants'
+require_relative 'fixtures/constants_sclass'
+require_relative 'fixtures/constant_visibility'
# Read the documentation in fixtures/constants.rb for the guidelines and
# rationale for the structure and organization of these specs.
diff --git a/spec/ruby/language/def_spec.rb b/spec/ruby/language/def_spec.rb
index c0b2efbfc7..95469546c7 100644
--- a/spec/ruby/language/def_spec.rb
+++ b/spec/ruby/language/def_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/def', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/def'
# Language-level method behaviour
describe "Redefining a method" do
diff --git a/spec/ruby/language/defined_spec.rb b/spec/ruby/language/defined_spec.rb
index fb3a241ccb..6616758011 100644
--- a/spec/ruby/language/defined_spec.rb
+++ b/spec/ruby/language/defined_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/defined', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/defined'
describe "The defined? keyword for literals" do
it "returns 'self' for self" do
@@ -763,8 +763,10 @@ describe "The defined? keyword for a scoped constant" do
end
ruby_version_is "2.5" do
- it "returns nil when a constant is defined on top-level but not on the class" do
- defined?(DefinedSpecs::Basic::String).should be_nil
+ ruby_bug "#14407", "2.5.0"..."2.5.1" do
+ it "returns nil when a constant is defined on top-level but not on the class" do
+ defined?(DefinedSpecs::Basic::String).should be_nil
+ end
end
end
diff --git a/spec/ruby/language/encoding_spec.rb b/spec/ruby/language/encoding_spec.rb
index 070fa52bba..31b403a704 100644
--- a/spec/ruby/language/encoding_spec.rb
+++ b/spec/ruby/language/encoding_spec.rb
@@ -1,7 +1,7 @@
# -*- encoding: us-ascii -*-
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/coding_us_ascii', __FILE__)
-require File.expand_path('../fixtures/coding_utf_8', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/coding_us_ascii'
+require_relative 'fixtures/coding_utf_8'
describe "The __ENCODING__ pseudo-variable" do
it "is an instance of Encoding" do
diff --git a/spec/ruby/language/ensure_spec.rb b/spec/ruby/language/ensure_spec.rb
index 1d99dcf5f2..2ba12557ef 100644
--- a/spec/ruby/language/ensure_spec.rb
+++ b/spec/ruby/language/ensure_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/ensure', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/ensure'
describe "An ensure block inside a begin block" do
before :each do
diff --git a/spec/ruby/language/execution_spec.rb b/spec/ruby/language/execution_spec.rb
index 3e6e7ff48c..4e0310946d 100644
--- a/spec/ruby/language/execution_spec.rb
+++ b/spec/ruby/language/execution_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "``" do
it "returns the output of the executed sub-process" do
diff --git a/spec/ruby/language/file_spec.rb b/spec/ruby/language/file_spec.rb
index 409400ca83..bf7175a9bc 100644
--- a/spec/ruby/language/file_spec.rb
+++ b/spec/ruby/language/file_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/code_loading', __FILE__)
-require File.expand_path('../shared/__FILE__', __FILE__)
+require_relative '../spec_helper'
+require_relative '../fixtures/code_loading'
+require_relative 'shared/__FILE__'
describe "The __FILE__ pseudo-variable" do
it "raises a SyntaxError if assigned to" do
diff --git a/spec/ruby/language/for_spec.rb b/spec/ruby/language/for_spec.rb
index c9d043fa25..b0b5fab7ec 100644
--- a/spec/ruby/language/for_spec.rb
+++ b/spec/ruby/language/for_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
# for name[, name]... in expr [do]
# body
diff --git a/spec/ruby/language/hash_spec.rb b/spec/ruby/language/hash_spec.rb
index edd9d4fbb2..475b1094ab 100644
--- a/spec/ruby/language/hash_spec.rb
+++ b/spec/ruby/language/hash_spec.rb
@@ -1,7 +1,7 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/hash_strings_ascii8bit', __FILE__)
-require File.expand_path('../fixtures/hash_strings_utf8', __FILE__)
-require File.expand_path('../fixtures/hash_strings_usascii', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/hash_strings_ascii8bit'
+require_relative 'fixtures/hash_strings_utf8'
+require_relative 'fixtures/hash_strings_usascii'
describe "Hash literal" do
it "{} should return an empty hash" do
diff --git a/spec/ruby/language/heredoc_spec.rb b/spec/ruby/language/heredoc_spec.rb
index a57a7b0bb9..1cc836063d 100644
--- a/spec/ruby/language/heredoc_spec.rb
+++ b/spec/ruby/language/heredoc_spec.rb
@@ -1,6 +1,6 @@
# -*- encoding: us-ascii -*-
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "Heredoc string" do
@@ -55,32 +55,32 @@ HERE
ruby_version_is "2.3" do
it "allows HEREDOC with <<~'identifier', allowing to indent identifier and content" do
- require File.expand_path('../fixtures/squiggly_heredoc', __FILE__)
+ require_relative 'fixtures/squiggly_heredoc'
SquigglyHeredocSpecs.message.should == "character density, n.:\n The number of very weird people in the office.\n"
end
it "trims trailing newline character for blank HEREDOC with <<~'identifier'" do
- require File.expand_path('../fixtures/squiggly_heredoc', __FILE__)
+ require_relative 'fixtures/squiggly_heredoc'
SquigglyHeredocSpecs.blank.should == ""
end
it 'allows HEREDOC with <<~identifier, interpolated' do
- require File.expand_path('../fixtures/squiggly_heredoc', __FILE__)
+ require_relative 'fixtures/squiggly_heredoc'
SquigglyHeredocSpecs.unquoted.should == "unquoted interpolated\n"
end
it 'allows HEREDOC with <<~"identifier", interpolated' do
- require File.expand_path('../fixtures/squiggly_heredoc', __FILE__)
+ require_relative 'fixtures/squiggly_heredoc'
SquigglyHeredocSpecs.doublequoted.should == "doublequoted interpolated\n"
end
it "allows HEREDOC with <<~'identifier', no interpolation" do
- require File.expand_path('../fixtures/squiggly_heredoc', __FILE__)
+ require_relative 'fixtures/squiggly_heredoc'
SquigglyHeredocSpecs.singlequoted.should == "singlequoted \#{\"interpolated\"}\n"
end
it "selects the least-indented line and removes its indentation from all the lines" do
- require File.expand_path('../fixtures/squiggly_heredoc', __FILE__)
+ require_relative 'fixtures/squiggly_heredoc'
SquigglyHeredocSpecs.least_indented_on_the_last_line.should == " a\n b\nc\n"
end
end
diff --git a/spec/ruby/language/if_spec.rb b/spec/ruby/language/if_spec.rb
index 284d852462..7f1ce8056d 100644
--- a/spec/ruby/language/if_spec.rb
+++ b/spec/ruby/language/if_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The if expression" do
ruby_version_is '2.4' do
diff --git a/spec/ruby/language/lambda_spec.rb b/spec/ruby/language/lambda_spec.rb
index 43e2d60ae3..3934a2bd91 100644
--- a/spec/ruby/language/lambda_spec.rb
+++ b/spec/ruby/language/lambda_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/classes'
describe "A lambda literal -> () { }" do
SpecEvaluate.desc = "for definition"
diff --git a/spec/ruby/language/line_spec.rb b/spec/ruby/language/line_spec.rb
index d9fd307dab..aac039a941 100644
--- a/spec/ruby/language/line_spec.rb
+++ b/spec/ruby/language/line_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/code_loading', __FILE__)
-require File.expand_path('../shared/__LINE__', __FILE__)
+require_relative '../spec_helper'
+require_relative '../fixtures/code_loading'
+require_relative 'shared/__LINE__'
describe "The __LINE__ pseudo-variable" do
it "raises a SyntaxError if assigned to" do
diff --git a/spec/ruby/language/loop_spec.rb b/spec/ruby/language/loop_spec.rb
index 4e60e0d8e6..121872a104 100644
--- a/spec/ruby/language/loop_spec.rb
+++ b/spec/ruby/language/loop_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The loop expression" do
it "repeats the given block until a break is called" do
diff --git a/spec/ruby/language/magic_comment_spec.rb b/spec/ruby/language/magic_comment_spec.rb
index 2f6e3b5c3a..3042a3f3df 100644
--- a/spec/ruby/language/magic_comment_spec.rb
+++ b/spec/ruby/language/magic_comment_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "Magic comment" do
it "is optional" do
diff --git a/spec/ruby/language/match_spec.rb b/spec/ruby/language/match_spec.rb
index 81604e94b2..36d347bd57 100644
--- a/spec/ruby/language/match_spec.rb
+++ b/spec/ruby/language/match_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/match_operators', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/match_operators'
describe "The !~ operator" do
before :each do
diff --git a/spec/ruby/language/metaclass_spec.rb b/spec/ruby/language/metaclass_spec.rb
index b3bcd9ef18..a6525a3ef2 100644
--- a/spec/ruby/language/metaclass_spec.rb
+++ b/spec/ruby/language/metaclass_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/class', __FILE__)
-require File.expand_path('../fixtures/metaclass', __FILE__)
+require_relative '../spec_helper'
+require_relative '../fixtures/class'
+require_relative 'fixtures/metaclass'
describe "self in a metaclass body (class << obj)" do
it "is TrueClass for true" do
diff --git a/spec/ruby/language/method_spec.rb b/spec/ruby/language/method_spec.rb
index ca939dbab6..b8f7ed9c2a 100644
--- a/spec/ruby/language/method_spec.rb
+++ b/spec/ruby/language/method_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "A method send" do
evaluate <<-ruby do
diff --git a/spec/ruby/language/module_spec.rb b/spec/ruby/language/module_spec.rb
index d5ca71b3b4..72d0046fb8 100644
--- a/spec/ruby/language/module_spec.rb
+++ b/spec/ruby/language/module_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/module', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/module'
describe "The module keyword" do
it "creates a new module without semicolon" do
diff --git a/spec/ruby/language/next_spec.rb b/spec/ruby/language/next_spec.rb
index 67da5224dc..e0a0265ac6 100644
--- a/spec/ruby/language/next_spec.rb
+++ b/spec/ruby/language/next_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/next', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/next'
describe "The next statement from within the block" do
before :each do
diff --git a/spec/ruby/language/not_spec.rb b/spec/ruby/language/not_spec.rb
index a0cf6b15a6..052af9b256 100644
--- a/spec/ruby/language/not_spec.rb
+++ b/spec/ruby/language/not_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The not keyword" do
it "negates a `true' value" do
diff --git a/spec/ruby/language/numbers_spec.rb b/spec/ruby/language/numbers_spec.rb
index e8c82f09a7..080c4ae6a3 100644
--- a/spec/ruby/language/numbers_spec.rb
+++ b/spec/ruby/language/numbers_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "A number literal" do
diff --git a/spec/ruby/language/optional_assignments_spec.rb b/spec/ruby/language/optional_assignments_spec.rb
index 0ab28985ed..5d539cba42 100644
--- a/spec/ruby/language/optional_assignments_spec.rb
+++ b/spec/ruby/language/optional_assignments_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe 'Optional variable assignments' do
describe 'using ||=' do
diff --git a/spec/ruby/language/or_spec.rb b/spec/ruby/language/or_spec.rb
index 150d693996..88241f39e6 100644
--- a/spec/ruby/language/or_spec.rb
+++ b/spec/ruby/language/or_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The || operator" do
it "evaluates to true if any of its operands are true" do
diff --git a/spec/ruby/language/order_spec.rb b/spec/ruby/language/order_spec.rb
index d02bf04077..d550f6b3f4 100644
--- a/spec/ruby/language/order_spec.rb
+++ b/spec/ruby/language/order_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "A method call" do
before :each do
diff --git a/spec/ruby/language/precedence_spec.rb b/spec/ruby/language/precedence_spec.rb
index 90734022ff..2dcb9975bc 100644
--- a/spec/ruby/language/precedence_spec.rb
+++ b/spec/ruby/language/precedence_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/precedence', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/precedence'
# Specifying the behavior of operators in combination could
# lead to combinatorial explosion. A better way seems to be
@@ -296,15 +296,14 @@ describe "Operators" do
lambda { eval("1...2...3") }.should raise_error(SyntaxError)
end
-# XXX: this is commented now due to a bug in compiler, which cannot
-# distinguish between range and flip-flop operator so far. zenspider is
-# currently working on a new lexer, which will be able to do that.
-# As soon as it's done, these piece should be reenabled.
-#
-# it ".. ... have higher precedence than ? :" do
-# (1..2 ? 3 : 4).should == 3
-# (1...2 ? 3 : 4).should == 3
-# end
+ it ".. ... have higher precedence than ? :" do
+ # Use variables to avoid warnings
+ from = 1
+ to = 2
+ # These are Range instances, not flip-flop
+ (from..to ? 3 : 4).should == 3
+ (from...to ? 3 : 4).should == 3
+ end
it "? : is right-associative" do
(true ? 2 : 3 ? 4 : 5).should == 2
diff --git a/spec/ruby/language/predefined/data_spec.rb b/spec/ruby/language/predefined/data_spec.rb
index f616879527..1b636967d2 100644
--- a/spec/ruby/language/predefined/data_spec.rb
+++ b/spec/ruby/language/predefined/data_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../spec_helper', __FILE__)
+require_relative '../../spec_helper'
describe "The DATA constant" do
it "exists when the main script contains __END__" do
diff --git a/spec/ruby/language/predefined/fixtures/data2.rb b/spec/ruby/language/predefined/fixtures/data2.rb
index 0f714b06d4..a764ca56d1 100644
--- a/spec/ruby/language/predefined/fixtures/data2.rb
+++ b/spec/ruby/language/predefined/fixtures/data2.rb
@@ -1,4 +1,3 @@
-
-require File.expand_path("../data4.rb", __FILE__)
+require_relative 'data4'
p Object.const_defined?(:DATA)
diff --git a/spec/ruby/language/predefined/fixtures/data3.rb b/spec/ruby/language/predefined/fixtures/data3.rb
index 6cbf63dae6..e37313c68b 100644
--- a/spec/ruby/language/predefined/fixtures/data3.rb
+++ b/spec/ruby/language/predefined/fixtures/data3.rb
@@ -1,5 +1,4 @@
-
-require File.expand_path("../data4.rb", __FILE__)
+require_relative 'data4'
puts DATA.read
diff --git a/spec/ruby/language/predefined_spec.rb b/spec/ruby/language/predefined_spec.rb
index 14f790a583..36392c7b8a 100644
--- a/spec/ruby/language/predefined_spec.rb
+++ b/spec/ruby/language/predefined_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
require 'stringio'
# The following tables are excerpted from Programming Ruby: The Pragmatic Programmer's Guide'
diff --git a/spec/ruby/language/private_spec.rb b/spec/ruby/language/private_spec.rb
index 796c0c1711..d9cfb1c3d0 100644
--- a/spec/ruby/language/private_spec.rb
+++ b/spec/ruby/language/private_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/private', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/private'
describe "The private keyword" do
it "marks following methods as being private" do
diff --git a/spec/ruby/language/proc_spec.rb b/spec/ruby/language/proc_spec.rb
index bbef318826..4026f3bcf5 100644
--- a/spec/ruby/language/proc_spec.rb
+++ b/spec/ruby/language/proc_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "A Proc" do
it "captures locals from the surrounding scope" do
diff --git a/spec/ruby/language/redo_spec.rb b/spec/ruby/language/redo_spec.rb
index 53fd30b4f2..fe1bcef0a1 100644
--- a/spec/ruby/language/redo_spec.rb
+++ b/spec/ruby/language/redo_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The redo statement" do
it "restarts block execution if used within block" do
diff --git a/spec/ruby/language/regexp/anchors_spec.rb b/spec/ruby/language/regexp/anchors_spec.rb
index c6a620a221..0129e255da 100644
--- a/spec/ruby/language/regexp/anchors_spec.rb
+++ b/spec/ruby/language/regexp/anchors_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative '../fixtures/classes'
describe "Regexps with anchors" do
it "supports ^ (line start anchor)" do
diff --git a/spec/ruby/language/regexp/back-references_spec.rb b/spec/ruby/language/regexp/back-references_spec.rb
index b4fb3b66a5..fb1e1eb594 100644
--- a/spec/ruby/language/regexp/back-references_spec.rb
+++ b/spec/ruby/language/regexp/back-references_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative '../fixtures/classes'
describe "Regexps with back-references" do
it "saves match data in the $~ pseudo-global variable" do
diff --git a/spec/ruby/language/regexp/character_classes_spec.rb b/spec/ruby/language/regexp/character_classes_spec.rb
index ce66d8e65f..a466f745ae 100644
--- a/spec/ruby/language/regexp/character_classes_spec.rb
+++ b/spec/ruby/language/regexp/character_classes_spec.rb
@@ -1,6 +1,6 @@
# coding: utf-8
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative '../fixtures/classes'
describe "Regexp with character classes" do
it "supports \\w (word character)" do
diff --git a/spec/ruby/language/regexp/encoding_spec.rb b/spec/ruby/language/regexp/encoding_spec.rb
index 1f62244a28..f9979e7ea3 100644
--- a/spec/ruby/language/regexp/encoding_spec.rb
+++ b/spec/ruby/language/regexp/encoding_spec.rb
@@ -1,6 +1,6 @@
# -*- encoding: binary -*-
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative '../fixtures/classes'
describe "Regexps with encoding modifiers" do
it "supports /e (EUC encoding)" do
diff --git a/spec/ruby/language/regexp/escapes_spec.rb b/spec/ruby/language/regexp/escapes_spec.rb
index 50ac22e51e..a4a9cb1793 100644
--- a/spec/ruby/language/regexp/escapes_spec.rb
+++ b/spec/ruby/language/regexp/escapes_spec.rb
@@ -1,6 +1,6 @@
# -*- encoding: binary -*-
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative '../fixtures/classes'
describe "Regexps with escape characters" do
it "they're supported" do
diff --git a/spec/ruby/language/regexp/grouping_spec.rb b/spec/ruby/language/regexp/grouping_spec.rb
index 443cab7ee0..61a52cba15 100644
--- a/spec/ruby/language/regexp/grouping_spec.rb
+++ b/spec/ruby/language/regexp/grouping_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative '../fixtures/classes'
describe "Regexps with grouping" do
it "support ()" do
diff --git a/spec/ruby/language/regexp/interpolation_spec.rb b/spec/ruby/language/regexp/interpolation_spec.rb
index 5536c718f1..c25a3cdb78 100644
--- a/spec/ruby/language/regexp/interpolation_spec.rb
+++ b/spec/ruby/language/regexp/interpolation_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative '../fixtures/classes'
describe "Regexps with interpolation" do
diff --git a/spec/ruby/language/regexp/modifiers_spec.rb b/spec/ruby/language/regexp/modifiers_spec.rb
index a7052a941c..65c9c24ceb 100644
--- a/spec/ruby/language/regexp/modifiers_spec.rb
+++ b/spec/ruby/language/regexp/modifiers_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative '../fixtures/classes'
describe "Regexps with modifers" do
it "supports /i (case-insensitive)" do
diff --git a/spec/ruby/language/regexp/repetition_spec.rb b/spec/ruby/language/regexp/repetition_spec.rb
index 2fc8a74a47..07004d8190 100644
--- a/spec/ruby/language/regexp/repetition_spec.rb
+++ b/spec/ruby/language/regexp/repetition_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative '../fixtures/classes'
describe "Regexps with repetition" do
it "supports * (0 or more of previous subexpression)" do
diff --git a/spec/ruby/language/regexp_spec.rb b/spec/ruby/language/regexp_spec.rb
index 684808f5ab..19f4871e6e 100644
--- a/spec/ruby/language/regexp_spec.rb
+++ b/spec/ruby/language/regexp_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/classes'
describe "Literal Regexps" do
it "matches against $_ (last input) in a conditional if no explicit matchee provided" do
diff --git a/spec/ruby/language/rescue_spec.rb b/spec/ruby/language/rescue_spec.rb
index 0dc8894740..b3de84468b 100644
--- a/spec/ruby/language/rescue_spec.rb
+++ b/spec/ruby/language/rescue_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/rescue', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/rescue'
class SpecificExampleException < StandardError
end
diff --git a/spec/ruby/language/retry_spec.rb b/spec/ruby/language/retry_spec.rb
index 96e69b763a..0b816daa5c 100644
--- a/spec/ruby/language/retry_spec.rb
+++ b/spec/ruby/language/retry_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The retry statement" do
it "re-executes the closest block" do
diff --git a/spec/ruby/language/return_spec.rb b/spec/ruby/language/return_spec.rb
index ba4bbfb5f3..0a05914545 100644
--- a/spec/ruby/language/return_spec.rb
+++ b/spec/ruby/language/return_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/return', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/return'
describe "The return keyword" do
it "returns any object directly" do
diff --git a/spec/ruby/language/safe_navigator_spec.rb b/spec/ruby/language/safe_navigator_spec.rb
index a8b29dc5a3..5783103e42 100644
--- a/spec/ruby/language/safe_navigator_spec.rb
+++ b/spec/ruby/language/safe_navigator_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path("../../spec_helper", __FILE__)
+require_relative '../spec_helper'
ruby_version_is "2.3" do
describe "Safe navigator" do
diff --git a/spec/ruby/language/send_spec.rb b/spec/ruby/language/send_spec.rb
index 15b73aac7f..a5b5ec8aa6 100644
--- a/spec/ruby/language/send_spec.rb
+++ b/spec/ruby/language/send_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/send', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/send'
# Why so many fixed arg tests? JRuby and I assume other Ruby impls have
# separate call paths for simple fixed arity methods. Testing up to five
diff --git a/spec/ruby/language/singleton_class_spec.rb b/spec/ruby/language/singleton_class_spec.rb
index 837f479440..e3a0d2870b 100644
--- a/spec/ruby/language/singleton_class_spec.rb
+++ b/spec/ruby/language/singleton_class_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/class', __FILE__)
+require_relative '../spec_helper'
+require_relative '../fixtures/class'
describe "A singleton class" do
it "is TrueClass for true" do
diff --git a/spec/ruby/language/string_spec.rb b/spec/ruby/language/string_spec.rb
index d1090e1771..98b8638f08 100644
--- a/spec/ruby/language/string_spec.rb
+++ b/spec/ruby/language/string_spec.rb
@@ -1,6 +1,6 @@
# -*- encoding: binary -*-
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
# TODO: rewrite these horrid specs. it "are..." seriously?!
diff --git a/spec/ruby/language/super_spec.rb b/spec/ruby/language/super_spec.rb
index 3d3f5d6f74..936e3164b6 100644
--- a/spec/ruby/language/super_spec.rb
+++ b/spec/ruby/language/super_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/super', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/super'
describe "The super keyword" do
it "calls the method on the calling class" do
diff --git a/spec/ruby/language/symbol_spec.rb b/spec/ruby/language/symbol_spec.rb
index 90540f7d1d..9ecb44ba87 100644
--- a/spec/ruby/language/symbol_spec.rb
+++ b/spec/ruby/language/symbol_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "A Symbol literal" do
it "is a ':' followed by any number of valid characters" do
diff --git a/spec/ruby/language/throw_spec.rb b/spec/ruby/language/throw_spec.rb
index 92f699350c..1662789da4 100644
--- a/spec/ruby/language/throw_spec.rb
+++ b/spec/ruby/language/throw_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The throw keyword" do
it "abandons processing" do
diff --git a/spec/ruby/language/undef_spec.rb b/spec/ruby/language/undef_spec.rb
index 9e788f2a09..7a333c46ef 100644
--- a/spec/ruby/language/undef_spec.rb
+++ b/spec/ruby/language/undef_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The undef keyword" do
describe "undefines a method" do
diff --git a/spec/ruby/language/unless_spec.rb b/spec/ruby/language/unless_spec.rb
index 681f0adfdd..98acdc083b 100644
--- a/spec/ruby/language/unless_spec.rb
+++ b/spec/ruby/language/unless_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The unless expression" do
it "evaluates the unless body when the expression is false" do
diff --git a/spec/ruby/language/until_spec.rb b/spec/ruby/language/until_spec.rb
index 08898644ce..ddeb5d01e4 100644
--- a/spec/ruby/language/until_spec.rb
+++ b/spec/ruby/language/until_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
# until bool-expr [do]
# body
diff --git a/spec/ruby/language/variables_spec.rb b/spec/ruby/language/variables_spec.rb
index 81ba54840a..4c4599bec4 100644
--- a/spec/ruby/language/variables_spec.rb
+++ b/spec/ruby/language/variables_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/variables', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/variables'
describe "Multiple assignment" do
context "with a single RHS value" do
diff --git a/spec/ruby/language/while_spec.rb b/spec/ruby/language/while_spec.rb
index 00e948e41f..02c52c780f 100644
--- a/spec/ruby/language/while_spec.rb
+++ b/spec/ruby/language/while_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
# while bool-expr [do]
# body
diff --git a/spec/ruby/language/yield_spec.rb b/spec/ruby/language/yield_spec.rb
index 663110cbe6..a3cf5b20d5 100644
--- a/spec/ruby/language/yield_spec.rb
+++ b/spec/ruby/language/yield_spec.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/yield', __FILE__)
+require_relative '../spec_helper'
+require_relative 'fixtures/yield'
# Note that these specs use blocks defined as { |*a| ... } to capture the
# arguments with which the block is invoked. This is slightly confusing