diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-08-29 11:09:22 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-08-29 11:10:45 +0900 |
commit | d92289cd8d5cac784ae856fb777f10dbc9f91b62 (patch) | |
tree | 7d2bd38521859d94a7c9bca3ec63104225e551c9 /spec | |
parent | cd0e208963bdf9ee2fec30e83bdc8f6bc77a7b8d (diff) | |
download | ruby-d92289cd8d5cac784ae856fb777f10dbc9f91b62.tar.gz |
Revert "Remove warnings of flip-flop deprecation from tests and specs"
This reverts commit bf7a32d22079cc44eb19794e41d82b886d5d17b3.
flip-flop is no longer deprecated.
[Feature #5400]
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/command_line/dash_e_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/language/if_spec.rb | 17 | ||||
-rw-r--r-- | spec/ruby/language/precedence_spec.rb | 6 |
3 files changed, 10 insertions, 15 deletions
diff --git a/spec/ruby/command_line/dash_e_spec.rb b/spec/ruby/command_line/dash_e_spec.rb index 70ecdd5dce..9f600eb414 100644 --- a/spec/ruby/command_line/dash_e_spec.rb +++ b/spec/ruby/command_line/dash_e_spec.rb @@ -25,7 +25,7 @@ describe "The -e command line option" do describe "with -n and a Fixnum range" do before :each do - @script = "-W0 -ne 'print if %s' #{fixture(__FILE__, "conditional_range.txt")}" + @script = "-ne 'print if %s' #{fixture(__FILE__, "conditional_range.txt")}" end it "mimics an awk conditional by comparing an inclusive-end range with $." do diff --git a/spec/ruby/language/if_spec.rb b/spec/ruby/language/if_spec.rb index e2201f4626..d1d95c1607 100644 --- a/spec/ruby/language/if_spec.rb +++ b/spec/ruby/language/if_spec.rb @@ -233,22 +233,19 @@ describe "The if expression" do describe "with a boolean range ('flip-flop' operator)" do before :each do ScratchPad.record [] - @verbose = $VERBOSE - $VERBOSE = nil end after :each do ScratchPad.clear - $VERBOSE = @verbose end it "mimics an awk conditional with a single-element inclusive-end range" do - eval "10.times { |i| ScratchPad << i if (i == 4)..(i == 4) }" + 10.times { |i| ScratchPad << i if (i == 4)..(i == 4) } ScratchPad.recorded.should == [4] end it "mimics an awk conditional with a many-element inclusive-end range" do - eval "10.times { |i| ScratchPad << i if (i == 4)..(i == 7) }" + 10.times { |i| ScratchPad << i if (i == 4)..(i == 7) } ScratchPad.recorded.should == [4, 5, 6, 7] end @@ -258,12 +255,12 @@ describe "The if expression" do end it "mimics a sed conditional with a many-element exclusive-end range" do - eval "10.times { |i| ScratchPad << i if (i == 4)...(i == 5) }" + 10.times { |i| ScratchPad << i if (i == 4)...(i == 5) } ScratchPad.recorded.should == [4, 5] end it "allows combining two flip-flops" do - eval "10.times { |i| ScratchPad << i if (i == 4)...(i == 5) or (i == 7)...(i == 8) }" + 10.times { |i| ScratchPad << i if (i == 4)...(i == 5) or (i == 7)...(i == 8) } ScratchPad.recorded.should == [4, 5, 7, 8] end @@ -281,18 +278,18 @@ describe "The if expression" do it "evaluates the second conditions lazily with inclusive-end range" do collector = proc { |i| ScratchPad << i } - eval "10.times { |i| i if (i == 4)...collector[i] }" + 10.times { |i| i if (i == 4)...collector[i] } ScratchPad.recorded.should == [5] end it "evaluates the second conditions lazily with exclusive-end range" do collector = proc { |i| ScratchPad << i } - eval "10.times { |i| i if (i == 4)..collector[i] }" + 10.times { |i| i if (i == 4)..collector[i] } ScratchPad.recorded.should == [4] end it "scopes state by flip-flop" do - store_me = eval("proc { |i| ScratchPad << i if (i == 4)..(i == 7) }") + store_me = proc { |i| ScratchPad << i if (i == 4)..(i == 7) } store_me[1] store_me[4] proc { store_me[1] }.call diff --git a/spec/ruby/language/precedence_spec.rb b/spec/ruby/language/precedence_spec.rb index a911f765b0..b122577a75 100644 --- a/spec/ruby/language/precedence_spec.rb +++ b/spec/ruby/language/precedence_spec.rb @@ -301,10 +301,8 @@ describe "Operators" do from = 1 to = 2 # These are Range instances, not flip-flop - suppress_warning do - (eval("from..to") ? 3 : 4).should == 3 - (eval("from...to") ? 3 : 4).should == 3 - end + (from..to ? 3 : 4).should == 3 + (from...to ? 3 : 4).should == 3 end it "? : is right-associative" do |