diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
commit | 1d15d5f08032acf1b7bceacbb450d617ff6e0931 (patch) | |
tree | a3785a79899302bc149e4a6e72f624ac27dc1f10 /spec/rubyspec/command_line | |
parent | 75bfc6440d595bf339007f4fb280fd4d743e89c1 (diff) |
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory.
[Misc #13792] [ruby-core:82287]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/command_line')
49 files changed, 0 insertions, 719 deletions
diff --git a/spec/rubyspec/command_line/dash_a_spec.rb b/spec/rubyspec/command_line/dash_a_spec.rb deleted file mode 100644 index 65f79ec208..0000000000 --- a/spec/rubyspec/command_line/dash_a_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -describe "The -a command line option" do - before :each do - @names = fixture __FILE__, "full_names.txt" - end - - it "runs the code in loop conditional on Kernel.gets()" do - ruby_exe("puts $F.last", options: "-n -a", escape: true, - args: " < #{@names}").should == - "jones\nfield\ngrey\n" - end - - it "sets $-a" do - ruby_exe("puts $-a", options: "-n -a", escape: true, - args: " < #{@names}").should == - "true\ntrue\ntrue\n" - end -end diff --git a/spec/rubyspec/command_line/dash_c_spec.rb b/spec/rubyspec/command_line/dash_c_spec.rb deleted file mode 100644 index 375d945a07..0000000000 --- a/spec/rubyspec/command_line/dash_c_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe "The -c command line option" do - it "checks syntax in given file" do - ruby_exe(nil, args: "-c #{__FILE__}").chomp.should == "Syntax OK" - end - - it "checks syntax in -e strings" do - ruby_exe(nil, args: "-c -e 'puts 1' -e 'hello world'").chomp.should == "Syntax OK" - end - - #Also needs spec for reading from STDIN -end diff --git a/spec/rubyspec/command_line/dash_d_spec.rb b/spec/rubyspec/command_line/dash_d_spec.rb deleted file mode 100644 index 009a14e16c..0000000000 --- a/spec/rubyspec/command_line/dash_d_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe "The -d command line option" do - before :each do - @script = fixture __FILE__, "debug.rb" - end - - it "sets $DEBUG to true" do - ruby_exe(@script, options: "-d", - args: "0 2> #{File::NULL}").chomp.should == "$DEBUG true" - end - - it "sets $VERBOSE to true" do - ruby_exe(@script, options: "-d", - args: "1 2> #{File::NULL}").chomp.should == "$VERBOSE true" - end - - it "sets $-d to true" do - ruby_exe(@script, options: "-d", - args: "2 2> #{File::NULL}").chomp.should == "$-d true" - end -end diff --git a/spec/rubyspec/command_line/dash_e_spec.rb b/spec/rubyspec/command_line/dash_e_spec.rb deleted file mode 100644 index 3435e78e29..0000000000 --- a/spec/rubyspec/command_line/dash_e_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe "The -e command line option" do - it "evaluates the given string" do - ruby_exe("puts 'foo'").chomp.should == "foo" - end - - it "joins multiple strings with newlines" do - ruby_exe(nil, args: %Q{-e "puts 'hello" -e "world'" 2>&1}).chomp.should == "hello\nworld" - end - - it "uses 'main' as self" do - ruby_exe("puts self", escape: false).chomp.should == "main" - end - - it "uses '-e' as file" do - ruby_exe("puts __FILE__", escape: false).chomp.should == "-e" - end - - it "uses '-e' in $0" do - system(*ruby_exe, '-e', 'exit $0 == "-e"').should == true - end - - #needs to test return => LocalJumpError - - describe "with -n and a Fixnum range" do - before :each do - @script = "-ne 'print if %s' #{fixture(__FILE__, "conditional_range.txt")}" - end - - it "mimics an awk conditional by comparing an inclusive-end range with $." do - ruby_exe(nil, args: (@script % "2..3")).should == "2\n3\n" - ruby_exe(nil, args: (@script % "2..2")).should == "2\n" - end - - it "mimics a sed conditional by comparing an exclusive-end range with $." do - ruby_exe(nil, args: (@script % "2...3")).should == "2\n3\n" - ruby_exe(nil, args: (@script % "2...2")).should == "2\n3\n4\n5\n" - end - end -end diff --git a/spec/rubyspec/command_line/dash_n_spec.rb b/spec/rubyspec/command_line/dash_n_spec.rb deleted file mode 100644 index f4dd9f1851..0000000000 --- a/spec/rubyspec/command_line/dash_n_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -describe "The -n command line option" do - before :each do - @names = fixture __FILE__, "names.txt" - end - - it "runs the code in loop conditional on Kernel.gets()" do - ruby_exe("puts $_", options: "-n", escape: true, - args: " < #{@names}").should == - "alice\nbob\njames\n" - end - - it "only evaluates BEGIN blocks once" do - ruby_exe("BEGIN { puts \"hi\" }; puts $_", options: "-n", escape: true, - args: " < #{@names}").should == - "hi\nalice\nbob\njames\n" - end - - it "only evaluates END blocks once" do - ruby_exe("puts $_; END {puts \"bye\"}", options: "-n", escape: true, - args: " < #{@names}").should == - "alice\nbob\njames\nbye\n" - end - - it "allows summing over a whole file" do - script = <<-script - BEGIN { $total = 0 } - $total += 1 - END { puts $total } - script - ruby_exe(script, options: "-n", escape: true, - args: " < #{@names}").should == - "3\n" - end -end diff --git a/spec/rubyspec/command_line/dash_p_spec.rb b/spec/rubyspec/command_line/dash_p_spec.rb deleted file mode 100644 index 67562b5bc3..0000000000 --- a/spec/rubyspec/command_line/dash_p_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -describe "The -p command line option" do - before :each do - @names = fixture __FILE__, "names.txt" - end - - it "runs the code in loop conditional on Kernel.gets() and prints $_" do - ruby_exe("$_ = $_.upcase", options: "-p", escape: true, - args: " < #{@names}").should == - "ALICE\nBOB\nJAMES\n" - end - - it "sets $-p" do - ruby_exe("$_ = $-p", options: "-p", escape: true, - args: " < #{@names}").should == - "truetruetrue" - end -end diff --git a/spec/rubyspec/command_line/dash_r_spec.rb b/spec/rubyspec/command_line/dash_r_spec.rb deleted file mode 100644 index 3d3abcf0b7..0000000000 --- a/spec/rubyspec/command_line/dash_r_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe "The -r command line option" do - before :each do - @script = fixture __FILE__, "require.rb" - @test_file = fixture __FILE__, "test_file" - end - - it "requires the specified file" do - result = ruby_exe(@script, options: "-r #{@test_file}") - result.should include(@test_file + ".rb") - end -end diff --git a/spec/rubyspec/command_line/dash_s_spec.rb b/spec/rubyspec/command_line/dash_s_spec.rb deleted file mode 100644 index 70e41208e0..0000000000 --- a/spec/rubyspec/command_line/dash_s_spec.rb +++ /dev/null @@ -1,52 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe "The -s command line option" do - describe "when using -- to stop parsing" do - it "sets the value to true without an explicit value" do - ruby_exe(nil, options: "-s -e 'p $n'", - args: "-- -n").chomp.should == "true" - end - - it "parses single letter args into globals" do - ruby_exe(nil, options: "-s -e 'puts $n'", - args: "-- -n=blah").chomp.should == "blah" - end - - it "parses long args into globals" do - ruby_exe(nil, options: "-s -e 'puts $_name'", - args: "-- --name=blah").chomp.should == "blah" - end - - it "converts extra dashes into underscores" do - ruby_exe(nil, options: "-s -e 'puts $___name__test__'", - args: "-- ----name--test--=blah").chomp.should == "blah" - end - end - - describe "when running a script" do - before :all do - @script = fixture __FILE__, "dash_s_script.rb" - end - - it "sets the value to true without an explicit value" do - ruby_exe(@script, options: "-s", - args: "-n 0").chomp.should == "true" - end - - it "parses single letter args into globals" do - ruby_exe(@script, options: "-s", - args: "-n=blah 1").chomp.should == "blah" - end - - it "parses long args into globals" do - ruby_exe(@script, options: "-s", - args: "--name=blah 2").chomp.should == "blah" - end - - it "converts extra dashes into underscores" do - ruby_exe(@script, options: "-s", - args: "----name--test--=blah 3").chomp.should == "blah" - end - - end -end diff --git a/spec/rubyspec/command_line/dash_upper_c_spec.rb b/spec/rubyspec/command_line/dash_upper_c_spec.rb deleted file mode 100644 index e8a54b01c1..0000000000 --- a/spec/rubyspec/command_line/dash_upper_c_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe 'The -C command line option' do - before :all do - @script = fixture(__FILE__, 'dash_upper_c_script.rb') - @tempdir = File.dirname(@script) - end - - it 'changes the PWD when using a file' do - output = ruby_exe(@script, options: "-C #{@tempdir}") - output.should == @tempdir - end - - it 'changes the PWD when using -e' do - output = ruby_exe(nil, options: "-C #{@tempdir} -e 'print Dir.pwd'") - output.should == @tempdir - end -end diff --git a/spec/rubyspec/command_line/dash_upper_e_spec.rb b/spec/rubyspec/command_line/dash_upper_e_spec.rb deleted file mode 100644 index 716f1304b7..0000000000 --- a/spec/rubyspec/command_line/dash_upper_e_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -describe "ruby -E" do - it "raises a RuntimeError if used with -U" do - ruby_exe("p 1", - options: '-Eascii:ascii -U', - args: '2>&1').should =~ /RuntimeError/ - end -end diff --git a/spec/rubyspec/command_line/dash_upper_f_spec.rb b/spec/rubyspec/command_line/dash_upper_f_spec.rb deleted file mode 100644 index 020968b1f9..0000000000 --- a/spec/rubyspec/command_line/dash_upper_f_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -describe "the -F command line option" do - before :each do - @passwd = fixture __FILE__, "passwd_file.txt" - end - - it "specifies the field separator pattern for -a" do - ruby_exe("puts $F[0]", options: "-naF:", escape: true, - args: " < #{@passwd}").should == - "nobody\nroot\ndaemon\n" - end -end diff --git a/spec/rubyspec/command_line/dash_upper_i_spec.rb b/spec/rubyspec/command_line/dash_upper_i_spec.rb deleted file mode 100644 index 0a00059949..0000000000 --- a/spec/rubyspec/command_line/dash_upper_i_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe "The -I command line option" do - before :each do - @script = fixture __FILE__, "loadpath.rb" - end - - it "adds the path to the load path ($:)" do - ruby_exe(@script, options: "-I fixtures").should include("fixtures") - end -end diff --git a/spec/rubyspec/command_line/dash_upper_k_spec.rb b/spec/rubyspec/command_line/dash_upper_k_spec.rb deleted file mode 100644 index 3c3b9fa4d3..0000000000 --- a/spec/rubyspec/command_line/dash_upper_k_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -describe 'The -K command line option sets __ENCODING__' do - it "to Encoding::ASCII_8BIT with -Ka" do - ruby_exe("print __ENCODING__", options: '-Ka').should == Encoding::ASCII_8BIT.to_s - end - - it "to Encoding::ASCII_8BIT with -KA" do - ruby_exe("print __ENCODING__", options: '-KA').should == Encoding::ASCII_8BIT.to_s - end - - it "to Encoding::EUC_JP with -Ke" do - ruby_exe("print __ENCODING__", options: '-Ke').should == Encoding::EUC_JP.to_s - end - - it "to Encoding::EUC_JP with -KE" do - ruby_exe("print __ENCODING__", options: '-KE').should == Encoding::EUC_JP.to_s - end - - it "to Encoding::UTF_8 with -Ku" do - ruby_exe("print __ENCODING__", options: '-Ku').should == Encoding::UTF_8.to_s - end - - it "to Encoding::UTF_8 with -KU" do - ruby_exe("print __ENCODING__", options: '-KU').should == Encoding::UTF_8.to_s - end - - it "to Encoding::Windows_31J with -Ks" do - ruby_exe("print __ENCODING__", options: '-Ks').should == Encoding::Windows_31J.to_s - end - - it "to Encoding::Windows_31J with -KS" do - ruby_exe("print __ENCODING__", options: '-KS').should == Encoding::Windows_31J.to_s - end -end diff --git a/spec/rubyspec/command_line/dash_upper_s_spec.rb b/spec/rubyspec/command_line/dash_upper_s_spec.rb deleted file mode 100644 index 2e293e9a62..0000000000 --- a/spec/rubyspec/command_line/dash_upper_s_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe 'The -S command line option' do - before :each do - @path = [ENV['PATH'], fixture(__FILE__, "bin")].join(':') - end - - platform_is_not :windows do - # On VirtualBox shared directory (vboxsf) all files are world writable - # and MRI shows warning when including world writable path in ENV['PATH']. - # This is why we are using /success$/ matching in the following cases. - - it "runs launcher found in PATH, but only code after the first /\#!.*ruby.*/-ish line in target file" do - result = ruby_exe(nil, options: '-S hybrid_launcher.sh', env: { 'PATH' => @path }, args: '2>&1') - result.should =~ /success$/ - end - - it "runs launcher found in PATH" do - result = ruby_exe(nil, options: '-S launcher.rb', env: { 'PATH' => @path }, args: '2>&1') - result.should =~ /success$/ - end - - it "runs launcher found in PATH and sets the exit status to 1 if it fails" do - result = ruby_exe(nil, options: '-S dash_s_fail', env: { 'PATH' => @path }, args: '2>&1') - result.should =~ /\bdie\b/ - $?.exitstatus.should == 1 - end - end -end diff --git a/spec/rubyspec/command_line/dash_upper_u_spec.rb b/spec/rubyspec/command_line/dash_upper_u_spec.rb deleted file mode 100644 index 6cd52a3647..0000000000 --- a/spec/rubyspec/command_line/dash_upper_u_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -describe "ruby -U" do - it "sets Encoding.default_internal to UTF-8" do - ruby_exe('print Encoding.default_internal.name', - options: '-U').should == 'UTF-8' - end - - it "does nothing different if specified multiple times" do - ruby_exe('print Encoding.default_internal.name', - options: '-U -U').should == 'UTF-8' - end - - it "is overruled by Encoding.default_internal=" do - ruby_exe('Encoding.default_internal="ascii"; print Encoding.default_internal.name', - options: '-U').should == 'US-ASCII' - end - - it "does not affect the default external encoding" do - ruby_exe('Encoding.default_external="ascii"; print Encoding.default_external.name', - options: '-U').should == 'US-ASCII' - end - - it "does not affect the source encoding" do - ruby_exe("print __ENCODING__.name", - options: '-U -KE').should == 'EUC-JP' - ruby_exe("print __ENCODING__.name", - options: '-KE -U').should == 'EUC-JP' - end - - # I assume IO redirection will break on Windows... - it "raises a RuntimeError if used with -Eext:int" do - ruby_exe("p 1", - options: '-U -Eascii:ascii', - args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError if used with -E:int" do - ruby_exe("p 1", - options: '-U -E:ascii', - args: '2>&1').should =~ /RuntimeError/ - end -end diff --git a/spec/rubyspec/command_line/dash_upper_w_spec.rb b/spec/rubyspec/command_line/dash_upper_w_spec.rb deleted file mode 100644 index 4e517a422a..0000000000 --- a/spec/rubyspec/command_line/dash_upper_w_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) -require File.expand_path('../shared/verbose', __FILE__) - -describe "The -W command line option" do - before :each do - @script = fixture __FILE__, "verbose.rb" - end - - it "with 0 sets $VERBOSE to nil" do - ruby_exe(@script, options: "-W0").chomp.should == "nil" - end - - it "with 1 sets $VERBOSE to false" do - ruby_exe(@script, options: "-W1").chomp.should == "false" - end -end - -describe "The -W command line option with 2" do - it_behaves_like :command_line_verbose, "-W2" -end diff --git a/spec/rubyspec/command_line/dash_v_spec.rb b/spec/rubyspec/command_line/dash_v_spec.rb deleted file mode 100644 index a7abd9de82..0000000000 --- a/spec/rubyspec/command_line/dash_v_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) -require File.expand_path('../shared/verbose', __FILE__) - -describe "The -v command line option" do - it_behaves_like :command_line_verbose, "-v" - - describe "when used alone" do - it "prints version and ends" do - version = ruby_exe(nil, args: '--version') - ruby_exe(nil, args: '-v').should == version - end - end -end diff --git a/spec/rubyspec/command_line/dash_w_spec.rb b/spec/rubyspec/command_line/dash_w_spec.rb deleted file mode 100644 index bb038cb10c..0000000000 --- a/spec/rubyspec/command_line/dash_w_spec.rb +++ /dev/null @@ -1,6 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) -require File.expand_path('../shared/verbose', __FILE__) - -describe "The -w command line option" do - it_behaves_like :command_line_verbose, "-w" -end diff --git a/spec/rubyspec/command_line/dash_x_spec.rb b/spec/rubyspec/command_line/dash_x_spec.rb deleted file mode 100644 index a5306b4f75..0000000000 --- a/spec/rubyspec/command_line/dash_x_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -describe "The -x command line option" do - it "runs code after the first /\#!.*ruby.*/-ish line in target file" do - embedded_ruby = fixture __FILE__, "bin/embedded_ruby.txt" - result = ruby_exe(embedded_ruby, options: '-x') - result.should == "success\n" - end - - it "fails when /\#!.*ruby.*/-ish line in target file is not found" do - bad_embedded_ruby = fixture __FILE__, "bin/bad_embedded_ruby.txt" - result = ruby_exe(bad_embedded_ruby, options: '-x', args: '2>&1') - result.should include "no Ruby script found in input" - end - - it "behaves as -x was set when non-ruby shebang is encountered on first line" do - embedded_ruby = fixture __FILE__, "bin/hybrid_launcher.sh" - result = ruby_exe(embedded_ruby) - result.should == "success\n" - end - - it "needs to be reviewed for spec completeness" -end diff --git a/spec/rubyspec/command_line/error_message_spec.rb b/spec/rubyspec/command_line/error_message_spec.rb deleted file mode 100644 index 6212452739..0000000000 --- a/spec/rubyspec/command_line/error_message_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe "The error message caused by an exception" do - it "is not printed to stdout" do - out = ruby_exe("this_does_not_exist", args: "2> #{File::NULL}") - out.chomp.empty?.should == true - - out = ruby_exe("end #syntax error", args: "2> #{File::NULL}") - out.chomp.empty?.should == true - end -end diff --git a/spec/rubyspec/command_line/fixtures/bad_syntax.rb b/spec/rubyspec/command_line/fixtures/bad_syntax.rb deleted file mode 100644 index e7b8c7a357..0000000000 --- a/spec/rubyspec/command_line/fixtures/bad_syntax.rb +++ /dev/null @@ -1 +0,0 @@ -f { diff --git a/spec/rubyspec/command_line/fixtures/bin/bad_embedded_ruby.txt b/spec/rubyspec/command_line/fixtures/bin/bad_embedded_ruby.txt deleted file mode 100644 index a2b7ad085f..0000000000 --- a/spec/rubyspec/command_line/fixtures/bin/bad_embedded_ruby.txt +++ /dev/null @@ -1,3 +0,0 @@ -@@@This line is not value Ruby -#!rub_y -puts 'success' diff --git a/spec/rubyspec/command_line/fixtures/bin/dash_s_fail b/spec/rubyspec/command_line/fixtures/bin/dash_s_fail deleted file mode 100644 index 70c1b8759c..0000000000 --- a/spec/rubyspec/command_line/fixtures/bin/dash_s_fail +++ /dev/null @@ -1 +0,0 @@ -raise 'die' diff --git a/spec/rubyspec/command_line/fixtures/bin/embedded_ruby.txt b/spec/rubyspec/command_line/fixtures/bin/embedded_ruby.txt deleted file mode 100644 index c556bf0b71..0000000000 --- a/spec/rubyspec/command_line/fixtures/bin/embedded_ruby.txt +++ /dev/null @@ -1,3 +0,0 @@ -@@@This line is not value Ruby -#!ruby -puts 'success'
\ No newline at end of file diff --git a/spec/rubyspec/command_line/fixtures/bin/hybrid_launcher.sh b/spec/rubyspec/command_line/fixtures/bin/hybrid_launcher.sh deleted file mode 100644 index 0eede2a99f..0000000000 --- a/spec/rubyspec/command_line/fixtures/bin/hybrid_launcher.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -exec somehow this file -#!ruby -puts 'success' diff --git a/spec/rubyspec/command_line/fixtures/bin/launcher.rb b/spec/rubyspec/command_line/fixtures/bin/launcher.rb deleted file mode 100644 index 92a0ee2b49..0000000000 --- a/spec/rubyspec/command_line/fixtures/bin/launcher.rb +++ /dev/null @@ -1,2 +0,0 @@ -#!ruby -puts 'success' diff --git a/spec/rubyspec/command_line/fixtures/conditional_range.txt b/spec/rubyspec/command_line/fixtures/conditional_range.txt deleted file mode 100644 index 8a1218a102..0000000000 --- a/spec/rubyspec/command_line/fixtures/conditional_range.txt +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/spec/rubyspec/command_line/fixtures/dash_s_script.rb b/spec/rubyspec/command_line/fixtures/dash_s_script.rb deleted file mode 100644 index 500eccbb84..0000000000 --- a/spec/rubyspec/command_line/fixtures/dash_s_script.rb +++ /dev/null @@ -1,12 +0,0 @@ -which = ARGV.shift.to_i - -case which -when 0 - p $n -when 1 - puts $n -when 2 - puts $_name -when 3 - puts $___name__test__ -end diff --git a/spec/rubyspec/command_line/fixtures/dash_upper_c_script.rb b/spec/rubyspec/command_line/fixtures/dash_upper_c_script.rb deleted file mode 100644 index abe244705f..0000000000 --- a/spec/rubyspec/command_line/fixtures/dash_upper_c_script.rb +++ /dev/null @@ -1 +0,0 @@ -print Dir.pwd diff --git a/spec/rubyspec/command_line/fixtures/debug.rb b/spec/rubyspec/command_line/fixtures/debug.rb deleted file mode 100644 index 2d84c5faf6..0000000000 --- a/spec/rubyspec/command_line/fixtures/debug.rb +++ /dev/null @@ -1,10 +0,0 @@ -which = ARGV.first.to_i - -case which -when 0 - puts "$DEBUG #{$DEBUG}" -when 1 - puts "$VERBOSE #{$VERBOSE}" -when 2 - puts "$-d #{$-d}" -end diff --git a/spec/rubyspec/command_line/fixtures/debug_info.rb b/spec/rubyspec/command_line/fixtures/debug_info.rb deleted file mode 100644 index ee607910c0..0000000000 --- a/spec/rubyspec/command_line/fixtures/debug_info.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true -a = 'string' -b = a -c = b -d = c -e = d -begin - a << 'new part' -rescue Exception => e - print e.message -end diff --git a/spec/rubyspec/command_line/fixtures/freeze_flag_across_files.rb b/spec/rubyspec/command_line/fixtures/freeze_flag_across_files.rb deleted file mode 100644 index b258249f3a..0000000000 --- a/spec/rubyspec/command_line/fixtures/freeze_flag_across_files.rb +++ /dev/null @@ -1,3 +0,0 @@ -require_relative 'freeze_flag_required' - -p "abc".object_id == $second_literal_id diff --git a/spec/rubyspec/command_line/fixtures/freeze_flag_across_files_diff_enc.rb b/spec/rubyspec/command_line/fixtures/freeze_flag_across_files_diff_enc.rb deleted file mode 100644 index e9f045e9ea..0000000000 --- a/spec/rubyspec/command_line/fixtures/freeze_flag_across_files_diff_enc.rb +++ /dev/null @@ -1,3 +0,0 @@ -require_relative 'freeze_flag_required_diff_enc' - -p "abc".object_id != $second_literal_id diff --git a/spec/rubyspec/command_line/fixtures/freeze_flag_one_literal.rb b/spec/rubyspec/command_line/fixtures/freeze_flag_one_literal.rb deleted file mode 100644 index 3718899d61..0000000000 --- a/spec/rubyspec/command_line/fixtures/freeze_flag_one_literal.rb +++ /dev/null @@ -1,2 +0,0 @@ -ids = Array.new(2) { "abc".object_id } -p ids.first == ids.last diff --git a/spec/rubyspec/command_line/fixtures/freeze_flag_required.rb b/spec/rubyspec/command_line/fixtures/freeze_flag_required.rb deleted file mode 100644 index e09232a5f4..0000000000 --- a/spec/rubyspec/command_line/fixtures/freeze_flag_required.rb +++ /dev/null @@ -1 +0,0 @@ -$second_literal_id = "abc".object_id diff --git a/spec/rubyspec/command_line/fixtures/freeze_flag_required_diff_enc.rb b/spec/rubyspec/command_line/fixtures/freeze_flag_required_diff_enc.rb Binary files differdeleted file mode 100644 index fa348d59e7..0000000000 --- a/spec/rubyspec/command_line/fixtures/freeze_flag_required_diff_enc.rb +++ /dev/null diff --git a/spec/rubyspec/command_line/fixtures/freeze_flag_two_literals.rb b/spec/rubyspec/command_line/fixtures/freeze_flag_two_literals.rb deleted file mode 100644 index 074092c9d9..0000000000 --- a/spec/rubyspec/command_line/fixtures/freeze_flag_two_literals.rb +++ /dev/null @@ -1 +0,0 @@ -p "abc".object_id == "abc".object_id diff --git a/spec/rubyspec/command_line/fixtures/full_names.txt b/spec/rubyspec/command_line/fixtures/full_names.txt deleted file mode 100644 index 602a20b9dd..0000000000 --- a/spec/rubyspec/command_line/fixtures/full_names.txt +++ /dev/null @@ -1,3 +0,0 @@ -alice jones -bob field -james grey diff --git a/spec/rubyspec/command_line/fixtures/loadpath.rb b/spec/rubyspec/command_line/fixtures/loadpath.rb deleted file mode 100644 index d7fdf45d46..0000000000 --- a/spec/rubyspec/command_line/fixtures/loadpath.rb +++ /dev/null @@ -1 +0,0 @@ -puts $: diff --git a/spec/rubyspec/command_line/fixtures/names.txt b/spec/rubyspec/command_line/fixtures/names.txt deleted file mode 100644 index ae4bf4c8ad..0000000000 --- a/spec/rubyspec/command_line/fixtures/names.txt +++ /dev/null @@ -1,3 +0,0 @@ -alice -bob -james diff --git a/spec/rubyspec/command_line/fixtures/passwd_file.txt b/spec/rubyspec/command_line/fixtures/passwd_file.txt deleted file mode 100644 index 08a4b23bbd..0000000000 --- a/spec/rubyspec/command_line/fixtures/passwd_file.txt +++ /dev/null @@ -1,3 +0,0 @@ -nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false -root:*:0:0:System Administrator:/var/root:/bin/sh -daemon:*:1:1:System Services:/var/root:/usr/bin/false diff --git a/spec/rubyspec/command_line/fixtures/require.rb b/spec/rubyspec/command_line/fixtures/require.rb deleted file mode 100644 index 0be7049c66..0000000000 --- a/spec/rubyspec/command_line/fixtures/require.rb +++ /dev/null @@ -1 +0,0 @@ -puts $" diff --git a/spec/rubyspec/command_line/fixtures/rubyopt.rb b/spec/rubyspec/command_line/fixtures/rubyopt.rb deleted file mode 100644 index 48d81e1bca..0000000000 --- a/spec/rubyspec/command_line/fixtures/rubyopt.rb +++ /dev/null @@ -1 +0,0 @@ -puts "rubyopt.rb required" diff --git a/spec/rubyspec/command_line/fixtures/test_file.rb b/spec/rubyspec/command_line/fixtures/test_file.rb deleted file mode 100644 index 961e3c0b0c..0000000000 --- a/spec/rubyspec/command_line/fixtures/test_file.rb +++ /dev/null @@ -1 +0,0 @@ -"test file" diff --git a/spec/rubyspec/command_line/fixtures/verbose.rb b/spec/rubyspec/command_line/fixtures/verbose.rb deleted file mode 100644 index 2aa99ed44d..0000000000 --- a/spec/rubyspec/command_line/fixtures/verbose.rb +++ /dev/null @@ -1 +0,0 @@ -puts $VERBOSE.inspect diff --git a/spec/rubyspec/command_line/frozen_strings_spec.rb b/spec/rubyspec/command_line/frozen_strings_spec.rb deleted file mode 100644 index f3ee797c78..0000000000 --- a/spec/rubyspec/command_line/frozen_strings_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -ruby_version_is "2.3" do - describe "The --enable-frozen-string-literal flag causes string literals to" do - - it "produce the same object each time" do - ruby_exe(fixture(__FILE__, "freeze_flag_one_literal.rb"), options: "--enable-frozen-string-literal").chomp.should == "true" - end - - it "produce the same object for literals with the same content" do - ruby_exe(fixture(__FILE__, "freeze_flag_two_literals.rb"), options: "--enable-frozen-string-literal").chomp.should == "true" - end - - it "produce the same object for literals with the same content in different files" do - ruby_exe(fixture(__FILE__, "freeze_flag_across_files.rb"), options: "--enable-frozen-string-literal").chomp.should == "true" - end - - it "produce different objects for literals with the same content in different files if they have different encodings" do - ruby_exe(fixture(__FILE__, "freeze_flag_across_files_diff_enc.rb"), options: "--enable-frozen-string-literal").chomp.should == "true" - end - end - - describe "The --debug flag produces" do - it "debugging info on attempted frozen string modification" do - error_str = ruby_exe(fixture(__FILE__, 'debug_info.rb'), options: '--debug', args: "2>&1") - error_str.should include("can't modify frozen String, created at ") - error_str.should include("command_line/fixtures/debug_info.rb:2") - end - end -end diff --git a/spec/rubyspec/command_line/rubyopt_spec.rb b/spec/rubyspec/command_line/rubyopt_spec.rb deleted file mode 100644 index a80cb51a94..0000000000 --- a/spec/rubyspec/command_line/rubyopt_spec.rb +++ /dev/null @@ -1,160 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe "Processing RUBYOPT" do - before (:each) do - @rubyopt, ENV["RUBYOPT"] = ENV["RUBYOPT"], nil - end - - after (:each) do - ENV["RUBYOPT"] = @rubyopt - end - - it "adds the -I path to $LOAD_PATH" do - ENV["RUBYOPT"] = "-Ioptrubyspecincl" - result = ruby_exe("puts $LOAD_PATH.grep(/byspecin/)", escape: true) - result.chomp[-15..-1].should == "optrubyspecincl" - end - - it "sets $DEBUG to true for '-d'" do - ENV["RUBYOPT"] = '-d' - command = %[puts "value of $DEBUG is \#{$DEBUG}"] - result = ruby_exe(command, escape: true, args: "2>&1") - result.should =~ /value of \$DEBUG is true/ - end - - it "prints the version number for '-v'" do - ENV["RUBYOPT"] = '-v' - ruby_exe("")[/\A.*/].should == RUBY_DESCRIPTION - end - - it "sets $VERBOSE to true for '-w'" do - ENV["RUBYOPT"] = '-w' - ruby_exe("p $VERBOSE", escape: true).chomp.should == "true" - end - - it "sets $VERBOSE to true for '-W'" do - ENV["RUBYOPT"] = '-W' - ruby_exe("p $VERBOSE", escape: true).chomp.should == "true" - end - - it "sets $VERBOSE to nil for '-W0'" do - ENV["RUBYOPT"] = '-W0' - ruby_exe("p $VERBOSE", escape: true).chomp.should == "nil" - end - - it "sets $VERBOSE to false for '-W1'" do - ENV["RUBYOPT"] = '-W1' - ruby_exe("p $VERBOSE", escape: true).chomp.should == "false" - end - - it "sets $VERBOSE to true for '-W2'" do - ENV["RUBYOPT"] = '-W2' - ruby_exe("p $VERBOSE", escape: true).chomp.should == "true" - end - - it "requires the file for '-r'" do - f = fixture __FILE__, "rubyopt" - ENV["RUBYOPT"] = "-r#{f}" - ruby_exe("0", args: '2>&1').should =~ /^rubyopt.rb required/ - end - - it "raises a RuntimeError for '-a'" do - ENV["RUBYOPT"] = '-a' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-p'" do - ENV["RUBYOPT"] = '-p' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-n'" do - ENV["RUBYOPT"] = '-n' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-y'" do - ENV["RUBYOPT"] = '-y' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-c'" do - ENV["RUBYOPT"] = '-c' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-s'" do - ENV["RUBYOPT"] = '-s' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-h'" do - ENV["RUBYOPT"] = '-h' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '--help'" do - ENV["RUBYOPT"] = '--help' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-l'" do - ENV["RUBYOPT"] = '-l' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-S'" do - ENV["RUBYOPT"] = '-S irb' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-e'" do - ENV["RUBYOPT"] = '-e0' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-i'" do - ENV["RUBYOPT"] = '-i.bak' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-x'" do - ENV["RUBYOPT"] = '-x' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-C'" do - ENV["RUBYOPT"] = '-C' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-X'" do - ENV["RUBYOPT"] = '-X.' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-F'" do - ENV["RUBYOPT"] = '-F' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '-0'" do - ENV["RUBYOPT"] = '-0' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '--copyright'" do - ENV["RUBYOPT"] = '--copyright' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '--version'" do - ENV["RUBYOPT"] = '--version' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end - - it "raises a RuntimeError for '--yydebug'" do - ENV["RUBYOPT"] = '--yydebug' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ - end -end diff --git a/spec/rubyspec/command_line/shared/verbose.rb b/spec/rubyspec/command_line/shared/verbose.rb deleted file mode 100644 index 457fe3006a..0000000000 --- a/spec/rubyspec/command_line/shared/verbose.rb +++ /dev/null @@ -1,9 +0,0 @@ -describe :command_line_verbose, shared: true do - before :each do - @script = fixture __FILE__, "verbose.rb" - end - - it "sets $VERBOSE to true" do - ruby_exe(@script, options: @method).chomp.split.last.should == "true" - end -end diff --git a/spec/rubyspec/command_line/syntax_error_spec.rb b/spec/rubyspec/command_line/syntax_error_spec.rb deleted file mode 100644 index 71cee32e23..0000000000 --- a/spec/rubyspec/command_line/syntax_error_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -describe "The interpreter" do - it "prints an error when given a file with invalid syntax" do - out = ruby_exe(fixture(__FILE__, "bad_syntax.rb"), args: "2>&1") - out.should include "syntax error" - end - - it "prints an error when given code via -e with invalid syntax" do - out = ruby_exe(nil, args: "-e 'a{' 2>&1") - out.should include "syntax error" - end -end |