diff options
Diffstat (limited to 'spec/ruby')
143 files changed, 328 insertions, 146 deletions
diff --git a/spec/ruby/.rubocop.yml b/spec/ruby/.rubocop.yml index cec5309dc8..c544fa5fd0 100644 --- a/spec/ruby/.rubocop.yml +++ b/spec/ruby/.rubocop.yml @@ -10,6 +10,11 @@ AllCops: Layout/TrailingWhitespace: Enabled: true +Layout/TrailingBlankLines: + Enabled: true + Exclude: + - library/coverage/fixtures/some_class.rb + Lint: Enabled: true diff --git a/spec/ruby/.rubocop_todo.yml b/spec/ruby/.rubocop_todo.yml index 9484078c8e..289471dde6 100644 --- a/spec/ruby/.rubocop_todo.yml +++ b/spec/ruby/.rubocop_todo.yml @@ -87,12 +87,10 @@ Lint/MultipleCompare: # Offense count: 12 Lint/ParenthesesAsGroupedExpression: Exclude: - - 'command_line/rubyopt_spec.rb' - 'core/string/fixtures/freeze_magic_comment.rb' - 'language/block_spec.rb' - 'language/fixtures/send.rb' - 'language/method_spec.rb' - - 'library/socket/socket/getaddrinfo_spec.rb' # Offense count: 1 # Cop supports --auto-correct. diff --git a/spec/ruby/command_line/rubylib_spec.rb b/spec/ruby/command_line/rubylib_spec.rb new file mode 100644 index 0000000000..93184f446d --- /dev/null +++ b/spec/ruby/command_line/rubylib_spec.rb @@ -0,0 +1,67 @@ +require_relative '../spec_helper' + +describe "The RUBYLIB environment variable" do + before :each do + @rubylib, ENV["RUBYLIB"] = ENV["RUBYLIB"], nil + end + + after :each do + ENV["RUBYLIB"] = @rubylib + end + + it "adds a directory to $LOAD_PATH" do + dir = tmp("rubylib/incl") + ENV["RUBYLIB"] = dir + paths = ruby_exe("puts $LOAD_PATH").lines.map(&:chomp) + paths.should include(dir) + end + + it "adds a colon-separated list of directories to $LOAD_PATH" do + dir1, dir2 = tmp("rubylib/incl1"), tmp("rubylib/incl2") + ENV["RUBYLIB"] = "#{dir1}:#{dir2}" + paths = ruby_exe("puts $LOAD_PATH").lines.map(&:chomp) + paths.should include(dir1) + paths.should include(dir2) + paths.index(dir1).should < paths.index(dir2) + end + + it "adds the directory at the front of $LOAD_PATH" do + dir = tmp("rubylib/incl_front") + ENV["RUBYLIB"] = dir + paths = ruby_exe("puts $LOAD_PATH").lines.map(&:chomp) + if PlatformGuard.implementation? :ruby + # In a MRI checkout, $PWD and some extra -I entries end up as + # the first entries in $LOAD_PATH. So just assert that it's not last. + idx = paths.index(dir) + idx.should < paths.size-1 + else + paths[0].should == dir + end + end + + it "adds the directory after directories added by -I" do + dash_i_dir = tmp("dash_I_include") + rubylib_dir = tmp("rubylib_include") + ENV["RUBYLIB"] = rubylib_dir + paths = ruby_exe("puts $LOAD_PATH", options: "-I #{dash_i_dir}").lines.map(&:chomp) + paths.should include(dash_i_dir) + paths.should include(rubylib_dir) + paths.index(dash_i_dir).should < paths.index(rubylib_dir) + end + + it "adds the directory after directories added by -I within RUBYOPT" do + rubyopt_dir = tmp("rubyopt_include") + rubylib_dir = tmp("rubylib_include") + ENV["RUBYLIB"] = rubylib_dir + paths = ruby_exe("puts $LOAD_PATH", env: { "RUBYOPT" => "-I#{rubyopt_dir}" }).lines.map(&:chomp) + paths.should include(rubyopt_dir) + paths.should include(rubylib_dir) + paths.index(rubyopt_dir).should < paths.index(rubylib_dir) + end + + it "keeps spaces in the value" do + ENV["RUBYLIB"] = " rubylib/incl " + out = ruby_exe("puts $LOAD_PATH") + out.should include(" rubylib/incl ") + end +end diff --git a/spec/ruby/command_line/rubyopt_spec.rb b/spec/ruby/command_line/rubyopt_spec.rb index 81a57f97c3..50f5d5d0a8 100644 --- a/spec/ruby/command_line/rubyopt_spec.rb +++ b/spec/ruby/command_line/rubyopt_spec.rb @@ -1,11 +1,11 @@ require_relative '../spec_helper' describe "Processing RUBYOPT" do - before (:each) do + before :each do @rubyopt, ENV["RUBYOPT"] = ENV["RUBYOPT"], nil end - after (:each) do + after :each do ENV["RUBYOPT"] = @rubyopt end diff --git a/spec/ruby/core/class/inherited_spec.rb b/spec/ruby/core/class/inherited_spec.rb index 0ec0d84f6e..fb7fb8e75a 100644 --- a/spec/ruby/core/class/inherited_spec.rb +++ b/spec/ruby/core/class/inherited_spec.rb @@ -99,4 +99,3 @@ describe "Class.inherited" do end end - diff --git a/spec/ruby/core/enumerable/zip_spec.rb b/spec/ruby/core/enumerable/zip_spec.rb index d5a059bc5d..1212911697 100644 --- a/spec/ruby/core/enumerable/zip_spec.rb +++ b/spec/ruby/core/enumerable/zip_spec.rb @@ -39,4 +39,3 @@ describe "Enumerable#zip" do end end - diff --git a/spec/ruby/core/env/shared/key.rb b/spec/ruby/core/env/shared/key.rb index 5e6c21840f..c40a56093e 100644 --- a/spec/ruby/core/env/shared/key.rb +++ b/spec/ruby/core/env/shared/key.rb @@ -11,5 +11,3 @@ describe :env_key, shared: true do ENV.send(@method, "should_never_be_set").should be_nil end end - - diff --git a/spec/ruby/core/exception/uncaught_throw_error_spec.rb b/spec/ruby/core/exception/uncaught_throw_error_spec.rb index f4300441a5..57f391d755 100644 --- a/spec/ruby/core/exception/uncaught_throw_error_spec.rb +++ b/spec/ruby/core/exception/uncaught_throw_error_spec.rb @@ -16,4 +16,3 @@ describe "UncaughtThrowError#tag" do end end end - diff --git a/spec/ruby/core/float/shared/arithmetic_exception_in_coerce.rb b/spec/ruby/core/float/shared/arithmetic_exception_in_coerce.rb index 71b540f752..19a02572d8 100644 --- a/spec/ruby/core/float/shared/arithmetic_exception_in_coerce.rb +++ b/spec/ruby/core/float/shared/arithmetic_exception_in_coerce.rb @@ -31,4 +31,3 @@ describe :float_arithmetic_exception_in_coerce, shared: true do end end end - diff --git a/spec/ruby/core/float/shared/comparison_exception_in_coerce.rb b/spec/ruby/core/float/shared/comparison_exception_in_coerce.rb index 6d6f14da30..f8ded53644 100644 --- a/spec/ruby/core/float/shared/comparison_exception_in_coerce.rb +++ b/spec/ruby/core/float/shared/comparison_exception_in_coerce.rb @@ -33,4 +33,3 @@ describe :float_comparison_exception_in_coerce, shared: true do end end end - diff --git a/spec/ruby/core/hash/clone_spec.rb b/spec/ruby/core/hash/clone_spec.rb index bb726e3ec4..6c96fc0c67 100644 --- a/spec/ruby/core/hash/clone_spec.rb +++ b/spec/ruby/core/hash/clone_spec.rb @@ -10,4 +10,3 @@ describe "Hash#clone" do clone.should_not equal hash end end - diff --git a/spec/ruby/core/hash/has_key_spec.rb b/spec/ruby/core/hash/has_key_spec.rb index 55f17d9ccb..4af53579e5 100644 --- a/spec/ruby/core/hash/has_key_spec.rb +++ b/spec/ruby/core/hash/has_key_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/key' describe "Hash#has_key?" do it_behaves_like :hash_key_p, :has_key? end - diff --git a/spec/ruby/core/hash/has_value_spec.rb b/spec/ruby/core/hash/has_value_spec.rb index 72663d0806..39f1627fd3 100644 --- a/spec/ruby/core/hash/has_value_spec.rb +++ b/spec/ruby/core/hash/has_value_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/value' describe "Hash#has_value?" do it_behaves_like :hash_value_p, :has_value? end - diff --git a/spec/ruby/core/hash/value_spec.rb b/spec/ruby/core/hash/value_spec.rb index f8cb72bb4a..0ab16a5d1b 100644 --- a/spec/ruby/core/hash/value_spec.rb +++ b/spec/ruby/core/hash/value_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/value' describe "Hash#value?" do it_behaves_like :hash_value_p, :value? end - diff --git a/spec/ruby/core/integer/abs_spec.rb b/spec/ruby/core/integer/abs_spec.rb index 7509a83a7e..c40356db12 100644 --- a/spec/ruby/core/integer/abs_spec.rb +++ b/spec/ruby/core/integer/abs_spec.rb @@ -4,4 +4,3 @@ require_relative 'shared/abs' describe "Integer#abs" do it_behaves_like :integer_abs, :abs end - diff --git a/spec/ruby/core/integer/divide_spec.rb b/spec/ruby/core/integer/divide_spec.rb index 6fe509b62c..2d49307628 100644 --- a/spec/ruby/core/integer/divide_spec.rb +++ b/spec/ruby/core/integer/divide_spec.rb @@ -93,4 +93,3 @@ describe "Integer#/" do end end end - diff --git a/spec/ruby/core/integer/equal_value_spec.rb b/spec/ruby/core/integer/equal_value_spec.rb index b527f16b1e..67a73713af 100644 --- a/spec/ruby/core/integer/equal_value_spec.rb +++ b/spec/ruby/core/integer/equal_value_spec.rb @@ -4,4 +4,3 @@ require_relative 'shared/equal' describe "Integer#==" do it_behaves_like :integer_equal, :== end - diff --git a/spec/ruby/core/integer/gt_spec.rb b/spec/ruby/core/integer/gt_spec.rb index 2a3488cb49..14c51c9acc 100644 --- a/spec/ruby/core/integer/gt_spec.rb +++ b/spec/ruby/core/integer/gt_spec.rb @@ -47,4 +47,3 @@ describe "Integer#>" do end end end - diff --git a/spec/ruby/core/integer/gte_spec.rb b/spec/ruby/core/integer/gte_spec.rb index ce379a07e3..3d5c48faa5 100644 --- a/spec/ruby/core/integer/gte_spec.rb +++ b/spec/ruby/core/integer/gte_spec.rb @@ -47,4 +47,3 @@ describe "Integer#>=" do end end end - diff --git a/spec/ruby/core/integer/lt_spec.rb b/spec/ruby/core/integer/lt_spec.rb index f687e0381f..a33a297d8b 100644 --- a/spec/ruby/core/integer/lt_spec.rb +++ b/spec/ruby/core/integer/lt_spec.rb @@ -49,4 +49,3 @@ describe "Integer#<" do end end end - diff --git a/spec/ruby/core/integer/lte_spec.rb b/spec/ruby/core/integer/lte_spec.rb index f9fc417640..1d3ecea2ac 100644 --- a/spec/ruby/core/integer/lte_spec.rb +++ b/spec/ruby/core/integer/lte_spec.rb @@ -52,4 +52,3 @@ describe "Integer#<=" do end end end - diff --git a/spec/ruby/core/integer/magnitude_spec.rb b/spec/ruby/core/integer/magnitude_spec.rb index 8820c83891..48cf1a8534 100644 --- a/spec/ruby/core/integer/magnitude_spec.rb +++ b/spec/ruby/core/integer/magnitude_spec.rb @@ -4,4 +4,3 @@ require_relative 'shared/abs' describe "Integer#magnitude" do it_behaves_like :integer_abs, :magnitude end - diff --git a/spec/ruby/core/integer/minus_spec.rb b/spec/ruby/core/integer/minus_spec.rb index ff933b974f..84db427172 100644 --- a/spec/ruby/core/integer/minus_spec.rb +++ b/spec/ruby/core/integer/minus_spec.rb @@ -47,4 +47,3 @@ describe "Integer#-" do end end end - diff --git a/spec/ruby/core/integer/multiply_spec.rb b/spec/ruby/core/integer/multiply_spec.rb index 68e7dd8fae..1683b0c96e 100644 --- a/spec/ruby/core/integer/multiply_spec.rb +++ b/spec/ruby/core/integer/multiply_spec.rb @@ -49,4 +49,3 @@ describe "Integer#*" do end end end - diff --git a/spec/ruby/core/integer/plus_spec.rb b/spec/ruby/core/integer/plus_spec.rb index d41077450d..2880840bc1 100644 --- a/spec/ruby/core/integer/plus_spec.rb +++ b/spec/ruby/core/integer/plus_spec.rb @@ -47,4 +47,3 @@ describe "Integer#+" do end end end - diff --git a/spec/ruby/core/io/pos_spec.rb b/spec/ruby/core/io/pos_spec.rb index ca0a761c8f..e6cda2643d 100644 --- a/spec/ruby/core/io/pos_spec.rb +++ b/spec/ruby/core/io/pos_spec.rb @@ -9,4 +9,3 @@ end describe "IO#pos=" do it_behaves_like :io_set_pos, :pos= end - diff --git a/spec/ruby/core/io/print_spec.rb b/spec/ruby/core/io/print_spec.rb index a4a069361e..0dd48344ce 100644 --- a/spec/ruby/core/io/print_spec.rb +++ b/spec/ruby/core/io/print_spec.rb @@ -51,4 +51,3 @@ describe IO, "#print" do lambda { IOSpecs.closed_io.print("stuff") }.should raise_error(IOError) end end - diff --git a/spec/ruby/core/io/shared/write.rb b/spec/ruby/core/io/shared/write.rb index 9490a848d7..bca96da81c 100644 --- a/spec/ruby/core/io/shared/write.rb +++ b/spec/ruby/core/io/shared/write.rb @@ -69,4 +69,25 @@ describe :io_write, shared: true do lambda { IOSpecs.closed_io.send(@method, "hello") }.should raise_error(IOError) end + describe "on a pipe" do + before :each do + @r, @w = IO.pipe + end + + after :each do + @r.close + @w.close + end + + it "writes the given String to the pipe" do + @w.send(@method, "foo") + @w.close + @r.read.should == "foo" + end + + it "raises Errno::EPIPE if the read end is closed" do + @r.close + -> { @w.send(@method, "foo") }.should raise_error(Errno::EPIPE, "Broken pipe") + end + end end diff --git a/spec/ruby/core/kernel/eql_spec.rb b/spec/ruby/core/kernel/eql_spec.rb index 83185b824a..e62a601a79 100644 --- a/spec/ruby/core/kernel/eql_spec.rb +++ b/spec/ruby/core/kernel/eql_spec.rb @@ -8,4 +8,3 @@ describe "Kernel#eql?" do it_behaves_like :object_equal, :eql? end - diff --git a/spec/ruby/core/kernel/eval_spec.rb b/spec/ruby/core/kernel/eval_spec.rb index ad06af7b05..fbae8ff3c7 100644 --- a/spec/ruby/core/kernel/eval_spec.rb +++ b/spec/ruby/core/kernel/eval_spec.rb @@ -213,4 +213,132 @@ describe "Kernel#eval" do code = fixture __FILE__, "eval_return_without_lambda.rb" ruby_exe(code).chomp.should == "a,b,c,e,LocalJumpError,f" end + + describe "with a magic encoding comment" do + it "uses the magic comment encoding for the encoding of literal strings" do + code = "# encoding: UTF-8\n'é'.encoding".b + code.encoding.should == Encoding::BINARY + eval(code).should == Encoding::UTF_8 + end + + it "uses the magic comment encoding for parsing constants" do + code = <<CODE.b +# encoding: UTF-8 +class EvalSpecs + Vπ = 3.14 +end +CODE + code.encoding.should == Encoding::BINARY + eval(code) + EvalSpecs.constants(false).should include(:"Vπ") + EvalSpecs::Vπ.should == 3.14 + end + + it "allows an emacs-style magic comment encoding" do + code = <<CODE.b +# -*- encoding: UTF-8 -*- +class EvalSpecs +Vπemacs = 3.14 +end +CODE + code.encoding.should == Encoding::BINARY + eval(code) + EvalSpecs.constants(false).should include(:"Vπemacs") + EvalSpecs::Vπemacs.should == 3.14 + end + + it "allows spaces before the magic encoding comment" do + code = <<CODE.b +\t \t # encoding: UTF-8 +class EvalSpecs + Vπspaces = 3.14 +end +CODE + code.encoding.should == Encoding::BINARY + eval(code) + EvalSpecs.constants(false).should include(:"Vπspaces") + EvalSpecs::Vπspaces.should == 3.14 + end + + it "allows a shebang line before the magic encoding comment" do + code = <<CODE.b +#!/usr/bin/env ruby +# encoding: UTF-8 +class EvalSpecs + Vπshebang = 3.14 +end +CODE + code.encoding.should == Encoding::BINARY + eval(code) + EvalSpecs.constants(false).should include(:"Vπshebang") + EvalSpecs::Vπshebang.should == 3.14 + end + + it "allows a shebang line and some spaces before the magic encoding comment" do + code = <<CODE.b +#!/usr/bin/env ruby + # encoding: UTF-8 +class EvalSpecs + Vπshebang_spaces = 3.14 +end +CODE + code.encoding.should == Encoding::BINARY + eval(code) + EvalSpecs.constants(false).should include(:"Vπshebang_spaces") + EvalSpecs::Vπshebang_spaces.should == 3.14 + end + + it "allows a magic encoding comment and a subsequent frozen_string_literal magic comment" do + # Make sure frozen_string_literal is not default true + eval("'foo'".b).frozen?.should be_false + + code = <<CODE.b +# encoding: UTF-8 +# frozen_string_literal: true +class EvalSpecs + Vπstring = "frozen" +end +CODE + code.encoding.should == Encoding::BINARY + eval(code) + EvalSpecs.constants(false).should include(:"Vπstring") + EvalSpecs::Vπstring.should == "frozen" + EvalSpecs::Vπstring.encoding.should == Encoding::UTF_8 + EvalSpecs::Vπstring.frozen?.should be_true + end + + it "allows a magic encoding comment and a frozen_string_literal magic comment on the same line in emacs style" do + code = <<CODE.b +# -*- encoding: UTF-8; frozen_string_literal: true -*- +class EvalSpecs +Vπsame_line = "frozen" +end +CODE + code.encoding.should == Encoding::BINARY + eval(code) + EvalSpecs.constants(false).should include(:"Vπsame_line") + EvalSpecs::Vπsame_line.should == "frozen" + EvalSpecs::Vπsame_line.encoding.should == Encoding::UTF_8 + EvalSpecs::Vπsame_line.frozen?.should be_true + end + + it "ignores the magic encoding comment if it is after a frozen_string_literal magic comment" do + code = <<CODE.b +# frozen_string_literal: true +# encoding: UTF-8 +class EvalSpecs + Vπfrozen_first = "frozen" +end +CODE + code.encoding.should == Encoding::BINARY + eval(code) + EvalSpecs.constants(false).should_not include(:"Vπfrozen_first") + binary_constant = "Vπfrozen_first".b.to_sym + EvalSpecs.constants(false).should include(binary_constant) + value = EvalSpecs.const_get(binary_constant) + value.should == "frozen" + value.encoding.should == Encoding::BINARY + value.frozen?.should be_true + end + end end diff --git a/spec/ruby/core/kernel/lambda_spec.rb b/spec/ruby/core/kernel/lambda_spec.rb index b27a88e85a..52f340dde5 100644 --- a/spec/ruby/core/kernel/lambda_spec.rb +++ b/spec/ruby/core/kernel/lambda_spec.rb @@ -83,4 +83,3 @@ describe "Kernel.lambda" do KernelSpecs::Lambda.new.outer.should == :good end end - diff --git a/spec/ruby/core/kernel/printf_spec.rb b/spec/ruby/core/kernel/printf_spec.rb index 53ee6419c6..ca88082694 100644 --- a/spec/ruby/core/kernel/printf_spec.rb +++ b/spec/ruby/core/kernel/printf_spec.rb @@ -58,4 +58,3 @@ describe "Kernel.printf" do end end end - diff --git a/spec/ruby/core/module/protected_spec.rb b/spec/ruby/core/module/protected_spec.rb index c2c7ab083d..985e4621c5 100644 --- a/spec/ruby/core/module/protected_spec.rb +++ b/spec/ruby/core/module/protected_spec.rb @@ -53,4 +53,3 @@ describe "Module#protected" do end.should raise_error(NameError) end end - diff --git a/spec/ruby/core/string/clone_spec.rb b/spec/ruby/core/string/clone_spec.rb index 6259cf89ef..f8d40423f0 100644 --- a/spec/ruby/core/string/clone_spec.rb +++ b/spec/ruby/core/string/clone_spec.rb @@ -55,4 +55,3 @@ describe "String#clone" do clone.should == "string" end end - diff --git a/spec/ruby/core/string/percent_spec.rb b/spec/ruby/core/string/percent_spec.rb index 2ddcab7907..e701def344 100644 --- a/spec/ruby/core/string/percent_spec.rb +++ b/spec/ruby/core/string/percent_spec.rb @@ -11,4 +11,3 @@ describe "String#%" do format % args } end - diff --git a/spec/ruby/core/systemexit/initialize_spec.rb b/spec/ruby/core/systemexit/initialize_spec.rb index 3156ff52c1..2cebaa7993 100644 --- a/spec/ruby/core/systemexit/initialize_spec.rb +++ b/spec/ruby/core/systemexit/initialize_spec.rb @@ -24,4 +24,3 @@ describe "SystemExit#initialize" do s.status.should == 0 end end - diff --git a/spec/ruby/core/thread/run_spec.rb b/spec/ruby/core/thread/run_spec.rb index 2472269df8..f86f793489 100644 --- a/spec/ruby/core/thread/run_spec.rb +++ b/spec/ruby/core/thread/run_spec.rb @@ -6,4 +6,3 @@ require_relative 'shared/wakeup' describe "Thread#run" do it_behaves_like :thread_wakeup, :run end - diff --git a/spec/ruby/core/time/_dump_spec.rb b/spec/ruby/core/time/_dump_spec.rb index 04afec0879..6941a1531f 100644 --- a/spec/ruby/core/time/_dump_spec.rb +++ b/spec/ruby/core/time/_dump_spec.rb @@ -53,4 +53,3 @@ describe "Time#_dump" do t.send(:_dump).should == "\364\001\031\200\313\000\020\004" end end - diff --git a/spec/ruby/core/tracepoint/callee_id_spec.rb b/spec/ruby/core/tracepoint/callee_id_spec.rb index be441bdef0..39a7413648 100644 --- a/spec/ruby/core/tracepoint/callee_id_spec.rb +++ b/spec/ruby/core/tracepoint/callee_id_spec.rb @@ -17,4 +17,3 @@ ruby_version_is '2.4' do end end end - diff --git a/spec/ruby/language/fixtures/metaclass.rb b/spec/ruby/language/fixtures/metaclass.rb index a1990b9225..a8f837e701 100644 --- a/spec/ruby/language/fixtures/metaclass.rb +++ b/spec/ruby/language/fixtures/metaclass.rb @@ -31,4 +31,3 @@ module MetaClassSpecs class D < C; end end - diff --git a/spec/ruby/library/bigdecimal/finite_spec.rb b/spec/ruby/library/bigdecimal/finite_spec.rb index c7358b51a5..6685d589b6 100644 --- a/spec/ruby/library/bigdecimal/finite_spec.rb +++ b/spec/ruby/library/bigdecimal/finite_spec.rb @@ -32,4 +32,3 @@ describe "BigDecimal#finite?" do end end end - diff --git a/spec/ruby/library/bigdecimal/precs_spec.rb b/spec/ruby/library/bigdecimal/precs_spec.rb index b9745c67dd..f9320f2b9e 100644 --- a/spec/ruby/library/bigdecimal/precs_spec.rb +++ b/spec/ruby/library/bigdecimal/precs_spec.rb @@ -46,4 +46,3 @@ describe "BigDecimal#precs" do end end end - diff --git a/spec/ruby/library/bigdecimal/quo_spec.rb b/spec/ruby/library/bigdecimal/quo_spec.rb index 2034d9a0c2..a5c5651778 100644 --- a/spec/ruby/library/bigdecimal/quo_spec.rb +++ b/spec/ruby/library/bigdecimal/quo_spec.rb @@ -10,4 +10,3 @@ describe "BigDecimal#quo" do BigDecimal("NaN").quo(BigDecimal("1")).nan?.should == true end end - diff --git a/spec/ruby/library/bigdecimal/sign_spec.rb b/spec/ruby/library/bigdecimal/sign_spec.rb index 719888dca1..ae2c28e9fd 100644 --- a/spec/ruby/library/bigdecimal/sign_spec.rb +++ b/spec/ruby/library/bigdecimal/sign_spec.rb @@ -44,4 +44,3 @@ describe "BigDecimal#sign" do end end - diff --git a/spec/ruby/library/bigdecimal/split_spec.rb b/spec/ruby/library/bigdecimal/split_spec.rb index 108c135769..f9b4bab5f7 100644 --- a/spec/ruby/library/bigdecimal/split_spec.rb +++ b/spec/ruby/library/bigdecimal/split_spec.rb @@ -84,5 +84,3 @@ describe "BigDecimal#split" do end end - - diff --git a/spec/ruby/library/bigdecimal/to_f_spec.rb b/spec/ruby/library/bigdecimal/to_f_spec.rb index 5924bd554c..1cc25d5c40 100644 --- a/spec/ruby/library/bigdecimal/to_f_spec.rb +++ b/spec/ruby/library/bigdecimal/to_f_spec.rb @@ -52,4 +52,3 @@ describe "BigDecimal#to_f" do @zero_neg.to_f.to_s.should == "-0.0" end end - diff --git a/spec/ruby/library/bigdecimal/to_s_spec.rb b/spec/ruby/library/bigdecimal/to_s_spec.rb index 86ae1e61f6..acc2e943f0 100644 --- a/spec/ruby/library/bigdecimal/to_s_spec.rb +++ b/spec/ruby/library/bigdecimal/to_s_spec.rb @@ -70,4 +70,3 @@ describe "BigDecimal#to_s" do end end - diff --git a/spec/ruby/library/bigdecimal/uplus_spec.rb b/spec/ruby/library/bigdecimal/uplus_spec.rb index 6f287e57ce..77483046b7 100644 --- a/spec/ruby/library/bigdecimal/uplus_spec.rb +++ b/spec/ruby/library/bigdecimal/uplus_spec.rb @@ -15,6 +15,3 @@ describe "BigDecimal#+@" do fifth.send(:+@).should == fifth end end - - - diff --git a/spec/ruby/library/bigdecimal/zero_spec.rb b/spec/ruby/library/bigdecimal/zero_spec.rb index 2240897a3b..c5d3acb8c3 100644 --- a/spec/ruby/library/bigdecimal/zero_spec.rb +++ b/spec/ruby/library/bigdecimal/zero_spec.rb @@ -25,4 +25,3 @@ describe "BigDecimal#zero?" do end end - diff --git a/spec/ruby/library/date/commercial_spec.rb b/spec/ruby/library/date/commercial_spec.rb index dcb28706e2..d7fc34d74a 100644 --- a/spec/ruby/library/date/commercial_spec.rb +++ b/spec/ruby/library/date/commercial_spec.rb @@ -15,4 +15,3 @@ end # 17 18 19 20 21 22 23 # 24 25 26 27 28 29 30 # 31 - diff --git a/spec/ruby/library/date/gregorian_leap_spec.rb b/spec/ruby/library/date/gregorian_leap_spec.rb index f758cd0c64..c3d25cf90f 100644 --- a/spec/ruby/library/date/gregorian_leap_spec.rb +++ b/spec/ruby/library/date/gregorian_leap_spec.rb @@ -13,4 +13,3 @@ describe "Date#gregorian_leap?" do Date.gregorian_leap?(2002).should be_false end end - diff --git a/spec/ruby/library/date/ordinal_spec.rb b/spec/ruby/library/date/ordinal_spec.rb index 3177f3ae94..ec490fd49c 100644 --- a/spec/ruby/library/date/ordinal_spec.rb +++ b/spec/ruby/library/date/ordinal_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/ordinal' describe "Date.ordinal" do it_behaves_like :date_ordinal, :ordinal end - diff --git a/spec/ruby/library/date/valid_civil_spec.rb b/spec/ruby/library/date/valid_civil_spec.rb index 13646acebc..00f2c57205 100644 --- a/spec/ruby/library/date/valid_civil_spec.rb +++ b/spec/ruby/library/date/valid_civil_spec.rb @@ -7,4 +7,3 @@ describe "Date#valid_civil?" do it_behaves_like :date_valid_civil?, :valid_civil? end - diff --git a/spec/ruby/library/date/valid_commercial_spec.rb b/spec/ruby/library/date/valid_commercial_spec.rb index 8e33f81cbc..7e96782b6b 100644 --- a/spec/ruby/library/date/valid_commercial_spec.rb +++ b/spec/ruby/library/date/valid_commercial_spec.rb @@ -6,5 +6,3 @@ describe "Date#valid_commercial?" do it_behaves_like :date_valid_commercial?, :valid_commercial? end - - diff --git a/spec/ruby/library/date/valid_jd_spec.rb b/spec/ruby/library/date/valid_jd_spec.rb index 6ab128b2cb..aecaaabcf4 100644 --- a/spec/ruby/library/date/valid_jd_spec.rb +++ b/spec/ruby/library/date/valid_jd_spec.rb @@ -7,4 +7,3 @@ describe "Date.valid_jd?" do it_behaves_like :date_valid_jd?, :valid_jd? end - diff --git a/spec/ruby/library/date/valid_ordinal_spec.rb b/spec/ruby/library/date/valid_ordinal_spec.rb index e1374504e4..58d548c704 100644 --- a/spec/ruby/library/date/valid_ordinal_spec.rb +++ b/spec/ruby/library/date/valid_ordinal_spec.rb @@ -7,4 +7,3 @@ describe "Date.valid_ordinal?" do it_behaves_like :date_valid_ordinal?, :valid_ordinal? end - diff --git a/spec/ruby/library/digest/md5/block_length_spec.rb b/spec/ruby/library/digest/md5/block_length_spec.rb index 1f64859747..14fb050abd 100644 --- a/spec/ruby/library/digest/md5/block_length_spec.rb +++ b/spec/ruby/library/digest/md5/block_length_spec.rb @@ -9,4 +9,3 @@ describe "Digest::MD5#block_length" do end end - diff --git a/spec/ruby/library/digest/md5/digest_length_spec.rb b/spec/ruby/library/digest/md5/digest_length_spec.rb index 4d87716707..47e071e329 100644 --- a/spec/ruby/library/digest/md5/digest_length_spec.rb +++ b/spec/ruby/library/digest/md5/digest_length_spec.rb @@ -9,4 +9,3 @@ describe "Digest::MD5#digest_length" do end end - diff --git a/spec/ruby/library/digest/md5/equal_spec.rb b/spec/ruby/library/digest/md5/equal_spec.rb index 48b19cc7db..b0e36564cd 100644 --- a/spec/ruby/library/digest/md5/equal_spec.rb +++ b/spec/ruby/library/digest/md5/equal_spec.rb @@ -35,4 +35,3 @@ describe "Digest::MD5#==" do end end - diff --git a/spec/ruby/library/digest/md5/inspect_spec.rb b/spec/ruby/library/digest/md5/inspect_spec.rb index 37cfef7903..decc86fba5 100644 --- a/spec/ruby/library/digest/md5/inspect_spec.rb +++ b/spec/ruby/library/digest/md5/inspect_spec.rb @@ -9,4 +9,3 @@ describe "Digest::MD5#inspect" do end end - diff --git a/spec/ruby/library/digest/md5/length_spec.rb b/spec/ruby/library/digest/md5/length_spec.rb index cc63102306..b05b2a20fd 100644 --- a/spec/ruby/library/digest/md5/length_spec.rb +++ b/spec/ruby/library/digest/md5/length_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/length' describe "Digest::MD5#length" do it_behaves_like :md5_length, :length end - diff --git a/spec/ruby/library/digest/md5/reset_spec.rb b/spec/ruby/library/digest/md5/reset_spec.rb index 67f96650a3..c937844f38 100644 --- a/spec/ruby/library/digest/md5/reset_spec.rb +++ b/spec/ruby/library/digest/md5/reset_spec.rb @@ -12,4 +12,3 @@ describe "Digest::MD5#reset" do end end - diff --git a/spec/ruby/library/digest/md5/size_spec.rb b/spec/ruby/library/digest/md5/size_spec.rb index 1f5f501d01..22e3272d36 100644 --- a/spec/ruby/library/digest/md5/size_spec.rb +++ b/spec/ruby/library/digest/md5/size_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/length' describe "Digest::MD5#size" do it_behaves_like :md5_length, :size end - diff --git a/spec/ruby/library/digest/sha256/block_length_spec.rb b/spec/ruby/library/digest/sha256/block_length_spec.rb index e5298bf810..1e29e832cf 100644 --- a/spec/ruby/library/digest/sha256/block_length_spec.rb +++ b/spec/ruby/library/digest/sha256/block_length_spec.rb @@ -9,4 +9,3 @@ describe "Digest::SHA256#block_length" do end end - diff --git a/spec/ruby/library/digest/sha256/digest_length_spec.rb b/spec/ruby/library/digest/sha256/digest_length_spec.rb index e24b57dccf..b5c8958e84 100644 --- a/spec/ruby/library/digest/sha256/digest_length_spec.rb +++ b/spec/ruby/library/digest/sha256/digest_length_spec.rb @@ -9,4 +9,3 @@ describe "Digest::SHA256#digest_length" do end end - diff --git a/spec/ruby/library/digest/sha256/equal_spec.rb b/spec/ruby/library/digest/sha256/equal_spec.rb index 4b587d16e0..84662aa068 100644 --- a/spec/ruby/library/digest/sha256/equal_spec.rb +++ b/spec/ruby/library/digest/sha256/equal_spec.rb @@ -34,4 +34,3 @@ describe "Digest::SHA256#==" do end end - diff --git a/spec/ruby/library/digest/sha256/inspect_spec.rb b/spec/ruby/library/digest/sha256/inspect_spec.rb index 3c50706f15..ed606e4517 100644 --- a/spec/ruby/library/digest/sha256/inspect_spec.rb +++ b/spec/ruby/library/digest/sha256/inspect_spec.rb @@ -9,4 +9,3 @@ describe "Digest::SHA256#inspect" do end end - diff --git a/spec/ruby/library/digest/sha256/length_spec.rb b/spec/ruby/library/digest/sha256/length_spec.rb index 100715f361..181ac564ad 100644 --- a/spec/ruby/library/digest/sha256/length_spec.rb +++ b/spec/ruby/library/digest/sha256/length_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/length' describe "Digest::SHA256#length" do it_behaves_like :sha256_length, :length end - diff --git a/spec/ruby/library/digest/sha256/reset_spec.rb b/spec/ruby/library/digest/sha256/reset_spec.rb index da065c8fb6..f0eb4faea6 100644 --- a/spec/ruby/library/digest/sha256/reset_spec.rb +++ b/spec/ruby/library/digest/sha256/reset_spec.rb @@ -12,4 +12,3 @@ describe "Digest::SHA256#reset" do end end - diff --git a/spec/ruby/library/digest/sha256/size_spec.rb b/spec/ruby/library/digest/sha256/size_spec.rb index 0bfbf13aee..1028263342 100644 --- a/spec/ruby/library/digest/sha256/size_spec.rb +++ b/spec/ruby/library/digest/sha256/size_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/length' describe "Digest::SHA256#size" do it_behaves_like :sha256_length, :size end - diff --git a/spec/ruby/library/digest/sha384/block_length_spec.rb b/spec/ruby/library/digest/sha384/block_length_spec.rb index a257825966..dff645ffb9 100644 --- a/spec/ruby/library/digest/sha384/block_length_spec.rb +++ b/spec/ruby/library/digest/sha384/block_length_spec.rb @@ -9,4 +9,3 @@ describe "Digest::SHA384#block_length" do end end - diff --git a/spec/ruby/library/digest/sha384/digest_length_spec.rb b/spec/ruby/library/digest/sha384/digest_length_spec.rb index be0f041f6a..4067dd34af 100644 --- a/spec/ruby/library/digest/sha384/digest_length_spec.rb +++ b/spec/ruby/library/digest/sha384/digest_length_spec.rb @@ -9,4 +9,3 @@ describe "Digest::SHA384#digest_length" do end end - diff --git a/spec/ruby/library/digest/sha384/equal_spec.rb b/spec/ruby/library/digest/sha384/equal_spec.rb index 1c18f48923..5d3483d79a 100644 --- a/spec/ruby/library/digest/sha384/equal_spec.rb +++ b/spec/ruby/library/digest/sha384/equal_spec.rb @@ -34,4 +34,3 @@ describe "Digest::SHA384#==" do end end - diff --git a/spec/ruby/library/digest/sha384/inspect_spec.rb b/spec/ruby/library/digest/sha384/inspect_spec.rb index cf44d31bde..8f9f946cc5 100644 --- a/spec/ruby/library/digest/sha384/inspect_spec.rb +++ b/spec/ruby/library/digest/sha384/inspect_spec.rb @@ -9,4 +9,3 @@ describe "Digest::SHA384#inspect" do end end - diff --git a/spec/ruby/library/digest/sha384/length_spec.rb b/spec/ruby/library/digest/sha384/length_spec.rb index c1dfd10a89..33fed492ef 100644 --- a/spec/ruby/library/digest/sha384/length_spec.rb +++ b/spec/ruby/library/digest/sha384/length_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/length' describe "Digest::SHA384#length" do it_behaves_like :sha384_length, :length end - diff --git a/spec/ruby/library/digest/sha384/reset_spec.rb b/spec/ruby/library/digest/sha384/reset_spec.rb index 37eb6911a6..991b90903d 100644 --- a/spec/ruby/library/digest/sha384/reset_spec.rb +++ b/spec/ruby/library/digest/sha384/reset_spec.rb @@ -12,4 +12,3 @@ describe "Digest::SHA384#reset" do end end - diff --git a/spec/ruby/library/digest/sha384/size_spec.rb b/spec/ruby/library/digest/sha384/size_spec.rb index c8811dfa43..4c3b14f7a0 100644 --- a/spec/ruby/library/digest/sha384/size_spec.rb +++ b/spec/ruby/library/digest/sha384/size_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/length' describe "Digest::SHA384#size" do it_behaves_like :sha384_length, :size end - diff --git a/spec/ruby/library/digest/sha512/block_length_spec.rb b/spec/ruby/library/digest/sha512/block_length_spec.rb index c71d0d5b50..947af841dd 100644 --- a/spec/ruby/library/digest/sha512/block_length_spec.rb +++ b/spec/ruby/library/digest/sha512/block_length_spec.rb @@ -9,4 +9,3 @@ describe "Digest::SHA512#block_length" do end end - diff --git a/spec/ruby/library/digest/sha512/digest_length_spec.rb b/spec/ruby/library/digest/sha512/digest_length_spec.rb index 18ac66a8bd..ff5956dd75 100644 --- a/spec/ruby/library/digest/sha512/digest_length_spec.rb +++ b/spec/ruby/library/digest/sha512/digest_length_spec.rb @@ -9,4 +9,3 @@ describe "Digest::SHA512#digest_length" do end end - diff --git a/spec/ruby/library/digest/sha512/equal_spec.rb b/spec/ruby/library/digest/sha512/equal_spec.rb index 6c9502c962..5100ced6e8 100644 --- a/spec/ruby/library/digest/sha512/equal_spec.rb +++ b/spec/ruby/library/digest/sha512/equal_spec.rb @@ -34,4 +34,3 @@ describe "Digest::SHA512#==" do end end - diff --git a/spec/ruby/library/digest/sha512/inspect_spec.rb b/spec/ruby/library/digest/sha512/inspect_spec.rb index 324b8d8914..54a466043a 100644 --- a/spec/ruby/library/digest/sha512/inspect_spec.rb +++ b/spec/ruby/library/digest/sha512/inspect_spec.rb @@ -9,4 +9,3 @@ describe "Digest::SHA512#inspect" do end end - diff --git a/spec/ruby/library/digest/sha512/length_spec.rb b/spec/ruby/library/digest/sha512/length_spec.rb index 028cf21177..e9fde90577 100644 --- a/spec/ruby/library/digest/sha512/length_spec.rb +++ b/spec/ruby/library/digest/sha512/length_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/length' describe "Digest::SHA512#length" do it_behaves_like :sha512_length, :length end - diff --git a/spec/ruby/library/digest/sha512/reset_spec.rb b/spec/ruby/library/digest/sha512/reset_spec.rb index bfe02066f9..24a936d4ba 100644 --- a/spec/ruby/library/digest/sha512/reset_spec.rb +++ b/spec/ruby/library/digest/sha512/reset_spec.rb @@ -12,4 +12,3 @@ describe "Digest::SHA512#reset" do end end - diff --git a/spec/ruby/library/digest/sha512/size_spec.rb b/spec/ruby/library/digest/sha512/size_spec.rb index ff72aa5b5d..6d0acdabdb 100644 --- a/spec/ruby/library/digest/sha512/size_spec.rb +++ b/spec/ruby/library/digest/sha512/size_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/length' describe "Digest::SHA512#size" do it_behaves_like :sha512_length, :size end - diff --git a/spec/ruby/library/erb/run_spec.rb b/spec/ruby/library/erb/run_spec.rb index 4ee2c5210a..c4b82b155e 100644 --- a/spec/ruby/library/erb/run_spec.rb +++ b/spec/ruby/library/erb/run_spec.rb @@ -94,4 +94,3 @@ END }.should raise_error(NameError) end end - diff --git a/spec/ruby/library/erb/util/html_escape_spec.rb b/spec/ruby/library/erb/util/html_escape_spec.rb index c4dc8dd397..1c15fb8791 100644 --- a/spec/ruby/library/erb/util/html_escape_spec.rb +++ b/spec/ruby/library/erb/util/html_escape_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/html_escape' describe "ERB::Util.html_escape" do it_behaves_like :erb_util_html_escape, :html_escape end - diff --git a/spec/ruby/library/erb/util/u_spec.rb b/spec/ruby/library/erb/util/u_spec.rb index 437829d74a..2a08451031 100644 --- a/spec/ruby/library/erb/util/u_spec.rb +++ b/spec/ruby/library/erb/util/u_spec.rb @@ -5,4 +5,3 @@ require_relative 'shared/url_encode' describe "ERB::Util.u" do it_behaves_like :erb_util_url_encode, :u end - diff --git a/spec/ruby/library/ipaddr/ipv4_conversion_spec.rb b/spec/ruby/library/ipaddr/ipv4_conversion_spec.rb index 61f5fa3e81..9d45055d76 100644 --- a/spec/ruby/library/ipaddr/ipv4_conversion_spec.rb +++ b/spec/ruby/library/ipaddr/ipv4_conversion_spec.rb @@ -42,5 +42,3 @@ describe "IPAddr#ipv4_mapped" do end end - - diff --git a/spec/ruby/library/net/http/http/head2_spec.rb b/spec/ruby/library/net/http/http/head2_spec.rb index c8bd987eef..606798e4af 100644 --- a/spec/ruby/library/net/http/http/head2_spec.rb +++ b/spec/ruby/library/net/http/http/head2_spec.rb @@ -6,4 +6,3 @@ require_relative 'shared/request_head' describe "Net::HTTP#head2" do it_behaves_like :net_ftp_request_head, :head2 end - diff --git a/spec/ruby/library/net/http/http/post_spec.rb b/spec/ruby/library/net/http/http/post_spec.rb index d6c9154a35..c8d41b9617 100644 --- a/spec/ruby/library/net/http/http/post_spec.rb +++ b/spec/ruby/library/net/http/http/post_spec.rb @@ -74,4 +74,3 @@ describe "Net::HTTP#post" do end end end - diff --git a/spec/ruby/library/net/http/httpheader/each_capitalized_spec.rb b/spec/ruby/library/net/http/httpheader/each_capitalized_spec.rb index 49298210bb..961a2d051f 100644 --- a/spec/ruby/library/net/http/httpheader/each_capitalized_spec.rb +++ b/spec/ruby/library/net/http/httpheader/each_capitalized_spec.rb @@ -6,4 +6,3 @@ require_relative 'shared/each_capitalized' describe "Net::HTTPHeader#each_capitalized" do it_behaves_like :net_httpheader_each_capitalized, :each_capitalized end - diff --git a/spec/ruby/library/net/http/httpresponse/read_body_spec.rb b/spec/ruby/library/net/http/httpresponse/read_body_spec.rb index f1fc0f519b..500155eb5b 100644 --- a/spec/ruby/library/net/http/httpresponse/read_body_spec.rb +++ b/spec/ruby/library/net/http/httpresponse/read_body_spec.rb @@ -83,4 +83,3 @@ describe "Net::HTTPResponse#read_body" do end end end - diff --git a/spec/ruby/library/pathname/absolute_spec.rb b/spec/ruby/library/pathname/absolute_spec.rb index a754505765..dce3ae72ee 100644 --- a/spec/ruby/library/pathname/absolute_spec.rb +++ b/spec/ruby/library/pathname/absolute_spec.rb @@ -20,4 +20,3 @@ describe "Pathname#absolute?" do end end - diff --git a/spec/ruby/library/pathname/equal_value_spec.rb b/spec/ruby/library/pathname/equal_value_spec.rb index 84e8d8f7ef..92d4767e76 100644 --- a/spec/ruby/library/pathname/equal_value_spec.rb +++ b/spec/ruby/library/pathname/equal_value_spec.rb @@ -12,4 +12,3 @@ describe "Pathname#==" do end end - diff --git a/spec/ruby/library/pathname/hash_spec.rb b/spec/ruby/library/pathname/hash_spec.rb index a0bfe811f6..da1b8f4f76 100644 --- a/spec/ruby/library/pathname/hash_spec.rb +++ b/spec/ruby/library/pathname/hash_spec.rb @@ -12,4 +12,3 @@ describe "Pathname#hash" do end end - diff --git a/spec/ruby/library/pathname/parent_spec.rb b/spec/ruby/library/pathname/parent_spec.rb index 5804f88dd0..3843bb22ed 100644 --- a/spec/ruby/library/pathname/parent_spec.rb +++ b/spec/ruby/library/pathname/parent_spec.rb @@ -16,4 +16,3 @@ describe "Pathname#parent" do end end - diff --git a/spec/ruby/library/pathname/relative_spec.rb b/spec/ruby/library/pathname/relative_spec.rb index f3976fcf0d..1a08891e6c 100644 --- a/spec/ruby/library/pathname/relative_spec.rb +++ b/spec/ruby/library/pathname/relative_spec.rb @@ -20,4 +20,3 @@ describe "Pathname#relative?" do end end - diff --git a/spec/ruby/library/pathname/root_spec.rb b/spec/ruby/library/pathname/root_spec.rb index d1c2dbb6ff..5fec0ee956 100644 --- a/spec/ruby/library/pathname/root_spec.rb +++ b/spec/ruby/library/pathname/root_spec.rb @@ -24,4 +24,3 @@ describe "Pathname#root?" do end end - diff --git a/spec/ruby/library/pathname/sub_spec.rb b/spec/ruby/library/pathname/sub_spec.rb index 2fb274e790..ad2900f62b 100644 --- a/spec/ruby/library/pathname/sub_spec.rb +++ b/spec/ruby/library/pathname/sub_spec.rb @@ -13,4 +13,3 @@ describe "Pathname#sub" do end end - diff --git a/spec/ruby/library/rbconfig/rbconfig_spec.rb b/spec/ruby/library/rbconfig/rbconfig_spec.rb new file mode 100644 index 0000000000..caa557c32c --- /dev/null +++ b/spec/ruby/library/rbconfig/rbconfig_spec.rb @@ -0,0 +1,11 @@ +require_relative '../../spec_helper' +require 'rbconfig' + +describe 'RbConfig::CONFIG values' do + it 'are all strings' do + RbConfig::CONFIG.each do |k, v| + k.should be_kind_of String + v.should be_kind_of String + end + end +end diff --git a/spec/ruby/library/rexml/attribute/inspect_spec.rb b/spec/ruby/library/rexml/attribute/inspect_spec.rb index 9ab3757db8..86a437ec74 100644 --- a/spec/ruby/library/rexml/attribute/inspect_spec.rb +++ b/spec/ruby/library/rexml/attribute/inspect_spec.rb @@ -17,4 +17,3 @@ describe "REXML::Attribute#inspect" do a.inspect.should == "&&='<>'" end end - diff --git a/spec/ruby/library/rexml/attribute/to_string_spec.rb b/spec/ruby/library/rexml/attribute/to_string_spec.rb index eb93cf9969..420913afeb 100644 --- a/spec/ruby/library/rexml/attribute/to_string_spec.rb +++ b/spec/ruby/library/rexml/attribute/to_string_spec.rb @@ -12,4 +12,3 @@ describe "REXML::Attribute#to_string" do attr_ns.to_string.should == "xmlns:ns='http://uri'" end end - diff --git a/spec/ruby/library/rexml/attribute/value_spec.rb b/spec/ruby/library/rexml/attribute/value_spec.rb index 8c8c1a2a0d..7763976881 100644 --- a/spec/ruby/library/rexml/attribute/value_spec.rb +++ b/spec/ruby/library/rexml/attribute/value_spec.rb @@ -12,4 +12,3 @@ describe "REXML::Attribute#value" do attr_empty.value.should == "" end end - diff --git a/spec/ruby/library/rexml/attribute/xpath_spec.rb b/spec/ruby/library/rexml/attribute/xpath_spec.rb index 2cb44f7548..beefb036cc 100644 --- a/spec/ruby/library/rexml/attribute/xpath_spec.rb +++ b/spec/ruby/library/rexml/attribute/xpath_spec.rb @@ -17,4 +17,3 @@ describe "REXML::Attribute#xpath" do lambda { @attr.xpath }.should raise_error(Exception) end end - diff --git a/spec/ruby/library/rexml/attributes/each_attribute_spec.rb b/spec/ruby/library/rexml/attributes/each_attribute_spec.rb index c71e3c3971..e84c8dbf51 100644 --- a/spec/ruby/library/rexml/attributes/each_attribute_spec.rb +++ b/spec/ruby/library/rexml/attributes/each_attribute_spec.rb @@ -20,6 +20,3 @@ describe "REXML::Attributes#each_attribute" do attributes.last.should == ns_uri end end - - - diff --git a/spec/ruby/library/rexml/attributes/each_spec.rb b/spec/ruby/library/rexml/attributes/each_spec.rb index 49c02a3255..ed60634b90 100644 --- a/spec/ruby/library/rexml/attributes/each_spec.rb +++ b/spec/ruby/library/rexml/attributes/each_spec.rb @@ -21,5 +21,3 @@ describe "REXML::Attributes#each" do attributes.last.should == ["xmlns:ns", "http://some_uri"] end end - - diff --git a/spec/ruby/library/rexml/attributes/element_reference_spec.rb b/spec/ruby/library/rexml/attributes/element_reference_spec.rb index a961935fad..dac7952669 100644 --- a/spec/ruby/library/rexml/attributes/element_reference_spec.rb +++ b/spec/ruby/library/rexml/attributes/element_reference_spec.rb @@ -16,4 +16,3 @@ describe "REXML::Attributes#[]" do @e.attributes["chunky bacon"].should == nil end end - diff --git a/spec/ruby/library/rexml/attributes/element_set_spec.rb b/spec/ruby/library/rexml/attributes/element_set_spec.rb index 0e19fda64f..1ed94dd2a1 100644 --- a/spec/ruby/library/rexml/attributes/element_set_spec.rb +++ b/spec/ruby/library/rexml/attributes/element_set_spec.rb @@ -23,4 +23,3 @@ describe "REXML::Attributes#[]=" do @e.attributes.length.should == 0 end end - diff --git a/spec/ruby/library/rexml/attributes/to_a_spec.rb b/spec/ruby/library/rexml/attributes/to_a_spec.rb index 7fb2326dab..1fbf71b683 100644 --- a/spec/ruby/library/rexml/attributes/to_a_spec.rb +++ b/spec/ruby/library/rexml/attributes/to_a_spec.rb @@ -17,4 +17,3 @@ describe "REXML::Attributes#to_a" do REXML::Element.new("root").attributes.to_a.should == [] end end - diff --git a/spec/ruby/library/rexml/element/add_namespace_spec.rb b/spec/ruby/library/rexml/element/add_namespace_spec.rb index 0aaf790de9..77c00eec46 100644 --- a/spec/ruby/library/rexml/element/add_namespace_spec.rb +++ b/spec/ruby/library/rexml/element/add_namespace_spec.rb @@ -21,4 +21,3 @@ describe "REXML::Element#add_namespace" do @elem.namespace.should == "some_uri" end end - diff --git a/spec/ruby/library/rexml/element/document_spec.rb b/spec/ruby/library/rexml/element/document_spec.rb index 16db64eeb7..24773580f2 100644 --- a/spec/ruby/library/rexml/element/document_spec.rb +++ b/spec/ruby/library/rexml/element/document_spec.rb @@ -14,5 +14,3 @@ describe "REXML::Element#document" do REXML::Element.new("standalone").document.should be_nil end end - - diff --git a/spec/ruby/library/rexml/node/parent_spec.rb b/spec/ruby/library/rexml/node/parent_spec.rb index a2fe48390f..d88ba69657 100644 --- a/spec/ruby/library/rexml/node/parent_spec.rb +++ b/spec/ruby/library/rexml/node/parent_spec.rb @@ -18,4 +18,3 @@ describe "REXML::Node#parent?" do e.parent?.should == false end end - diff --git a/spec/ruby/library/rexml/text/indent_text_spec.rb b/spec/ruby/library/rexml/text/indent_text_spec.rb index af0954b7a2..1b0ee5ab16 100644 --- a/spec/ruby/library/rexml/text/indent_text_spec.rb +++ b/spec/ruby/library/rexml/text/indent_text_spec.rb @@ -21,4 +21,3 @@ describe "REXML::Text#indent_text" do @t.indent_text("foo", 1, "\t", false).should == "foo" end end - diff --git a/spec/ruby/library/rexml/text/new_spec.rb b/spec/ruby/library/rexml/text/new_spec.rb index c069559a19..a1fdcddf28 100644 --- a/spec/ruby/library/rexml/text/new_spec.rb +++ b/spec/ruby/library/rexml/text/new_spec.rb @@ -46,4 +46,3 @@ describe "REXML::Text.new" do t.should == "<&>" end end - diff --git a/spec/ruby/library/rexml/text/read_with_substitution_spec.rb b/spec/ruby/library/rexml/text/read_with_substitution_spec.rb index c84778d8c4..a9b4d30bc5 100644 --- a/spec/ruby/library/rexml/text/read_with_substitution_spec.rb +++ b/spec/ruby/library/rexml/text/read_with_substitution_spec.rb @@ -10,4 +10,3 @@ describe "REXML::Text.read_with_substitution" do lambda {REXML::Text.read_with_substitution("this is illegal", /illegal/)}.should raise_error(Exception) end end - diff --git a/spec/ruby/library/rexml/text/to_s_spec.rb b/spec/ruby/library/rexml/text/to_s_spec.rb index 2ee9dd0ec7..14d7399a60 100644 --- a/spec/ruby/library/rexml/text/to_s_spec.rb +++ b/spec/ruby/library/rexml/text/to_s_spec.rb @@ -15,4 +15,3 @@ describe "REXML::Text#to_s" do t.to_s.should == "& < >" end end - diff --git a/spec/ruby/library/rexml/text/wrap_spec.rb b/spec/ruby/library/rexml/text/wrap_spec.rb index d958561634..0b60fd4151 100644 --- a/spec/ruby/library/rexml/text/wrap_spec.rb +++ b/spec/ruby/library/rexml/text/wrap_spec.rb @@ -18,4 +18,3 @@ describe "REXML::Text#wrap" do @t.wrap("abc def", 3, true).should == "\nabc\ndef" end end - diff --git a/spec/ruby/library/set/case_compare_spec.rb b/spec/ruby/library/set/case_compare_spec.rb index 31a0e5676a..193006dbda 100644 --- a/spec/ruby/library/set/case_compare_spec.rb +++ b/spec/ruby/library/set/case_compare_spec.rb @@ -12,4 +12,3 @@ ruby_version_is "2.5" do end end end - diff --git a/spec/ruby/library/socket/socket/getaddrinfo_spec.rb b/spec/ruby/library/socket/socket/getaddrinfo_spec.rb index 8eee1d75e7..64183b38d0 100644 --- a/spec/ruby/library/socket/socket/getaddrinfo_spec.rb +++ b/spec/ruby/library/socket/socket/getaddrinfo_spec.rb @@ -92,7 +92,7 @@ describe "Socket#getaddrinfo" do ["AF_INET6", 9, "::", "::", Socket::AF_INET6, Socket::SOCK_STREAM, Socket::IPPROTO_TCP], ["AF_INET6", 9, "0:0:0:0:0:0:0:0", "0:0:0:0:0:0:0:0", Socket::AF_INET6, Socket::SOCK_STREAM, Socket::IPPROTO_TCP] ] - res.each { |a| expected.should include (a) } + res.each { |a| expected.should include(a) } end it "accepts empty addresses for IPv6 non-passive sockets" do diff --git a/spec/ruby/library/stringio/each_codepoint_spec.rb b/spec/ruby/library/stringio/each_codepoint_spec.rb index c2eec90581..85aa34d9d8 100644 --- a/spec/ruby/library/stringio/each_codepoint_spec.rb +++ b/spec/ruby/library/stringio/each_codepoint_spec.rb @@ -7,4 +7,3 @@ require_relative 'shared/codepoints' describe "StringIO#each_codepoint" do it_behaves_like :stringio_codepoints, :codepoints end - diff --git a/spec/ruby/library/stringio/open_spec.rb b/spec/ruby/library/stringio/open_spec.rb index be24b06a82..f8f3feabee 100644 --- a/spec/ruby/library/stringio/open_spec.rb +++ b/spec/ruby/library/stringio/open_spec.rb @@ -205,4 +205,3 @@ describe "StringIO.open when passed no arguments" do StringIO.open.string.should == "" end end - diff --git a/spec/ruby/library/stringio/printf_spec.rb b/spec/ruby/library/stringio/printf_spec.rb index 42fa98d395..3978896621 100644 --- a/spec/ruby/library/stringio/printf_spec.rb +++ b/spec/ruby/library/stringio/printf_spec.rb @@ -68,4 +68,3 @@ describe "StringIO#printf when self is not writable" do lambda { io.printf("test") }.should raise_error(IOError) end end - diff --git a/spec/ruby/library/stringio/stringio_spec.rb b/spec/ruby/library/stringio/stringio_spec.rb index c32dc6c5a2..5ef42b3390 100644 --- a/spec/ruby/library/stringio/stringio_spec.rb +++ b/spec/ruby/library/stringio/stringio_spec.rb @@ -6,4 +6,3 @@ describe "StringIO" do StringIO.should include(Enumerable) end end - diff --git a/spec/ruby/library/stringscanner/element_reference_spec.rb b/spec/ruby/library/stringscanner/element_reference_spec.rb index 351dfbc59a..c3fab16bbc 100644 --- a/spec/ruby/library/stringscanner/element_reference_spec.rb +++ b/spec/ruby/library/stringscanner/element_reference_spec.rb @@ -58,4 +58,3 @@ describe "StringScanner#[]" do @s[:day].should == "13" end end - diff --git a/spec/ruby/library/stringscanner/peek_spec.rb b/spec/ruby/library/stringscanner/peek_spec.rb index 39366e0c21..cbb5630ff9 100644 --- a/spec/ruby/library/stringscanner/peek_spec.rb +++ b/spec/ruby/library/stringscanner/peek_spec.rb @@ -5,4 +5,3 @@ require 'strscan' describe "StringScanner#peek" do it_behaves_like :strscan_peek, :peek end - diff --git a/spec/ruby/library/tempfile/open_spec.rb b/spec/ruby/library/tempfile/open_spec.rb index f9ebdce458..062d1a3fc2 100644 --- a/spec/ruby/library/tempfile/open_spec.rb +++ b/spec/ruby/library/tempfile/open_spec.rb @@ -79,4 +79,3 @@ describe "Tempfile.open when passed a block" do @tempfile.closed?.should be_true end end - diff --git a/spec/ruby/library/uri/set_component_spec.rb b/spec/ruby/library/uri/set_component_spec.rb index 38da49dbd7..71ed6af278 100644 --- a/spec/ruby/library/uri/set_component_spec.rb +++ b/spec/ruby/library/uri/set_component_spec.rb @@ -43,5 +43,3 @@ describe "URI#select" do lambda { uri.query = 'bar' }.should raise_error(URI::InvalidURIError) end end - - diff --git a/spec/ruby/library/zlib/deflate/set_dictionary_spec.rb b/spec/ruby/library/zlib/deflate/set_dictionary_spec.rb index 53ee4a2ae4..0e461229c7 100644 --- a/spec/ruby/library/zlib/deflate/set_dictionary_spec.rb +++ b/spec/ruby/library/zlib/deflate/set_dictionary_spec.rb @@ -12,4 +12,3 @@ describe "Zlib::Deflate#set_dictionary" do 2, 0, 21, 134, 3, 248].pack('C*') end end - diff --git a/spec/ruby/library/zlib/gzipfile/close_spec.rb b/spec/ruby/library/zlib/gzipfile/close_spec.rb index e26f79d004..27eb34cdd9 100644 --- a/spec/ruby/library/zlib/gzipfile/close_spec.rb +++ b/spec/ruby/library/zlib/gzipfile/close_spec.rb @@ -19,4 +19,3 @@ describe "Zlib::GzipFile#close" do io.string[10..-1].should == ([3] + Array.new(9,0)).pack('C*') end end - diff --git a/spec/ruby/library/zlib/gzipfile/closed_spec.rb b/spec/ruby/library/zlib/gzipfile/closed_spec.rb index 8c5ef9a338..b885add485 100644 --- a/spec/ruby/library/zlib/gzipfile/closed_spec.rb +++ b/spec/ruby/library/zlib/gzipfile/closed_spec.rb @@ -14,4 +14,3 @@ describe "Zlib::GzipFile#closed?" do end end end - diff --git a/spec/ruby/library/zlib/gzipfile/comment_spec.rb b/spec/ruby/library/zlib/gzipfile/comment_spec.rb index d4cf086792..7493f74f1c 100644 --- a/spec/ruby/library/zlib/gzipfile/comment_spec.rb +++ b/spec/ruby/library/zlib/gzipfile/comment_spec.rb @@ -24,4 +24,3 @@ describe "Zlib::GzipFile#comment" do end end end - diff --git a/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb index a7a0990612..cae5305355 100644 --- a/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb +++ b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb @@ -24,4 +24,3 @@ describe "Zlib::GzipFile#orig_name" do end end end - diff --git a/spec/ruby/library/zlib/gzipreader/pos_spec.rb b/spec/ruby/library/zlib/gzipreader/pos_spec.rb index 9b508de468..df7c78ad8f 100644 --- a/spec/ruby/library/zlib/gzipreader/pos_spec.rb +++ b/spec/ruby/library/zlib/gzipreader/pos_spec.rb @@ -24,4 +24,3 @@ describe "GzipReader#pos" do end end - diff --git a/spec/ruby/library/zlib/inflate/set_dictionary_spec.rb b/spec/ruby/library/zlib/inflate/set_dictionary_spec.rb index e5e347a6da..251cec44bb 100644 --- a/spec/ruby/library/zlib/inflate/set_dictionary_spec.rb +++ b/spec/ruby/library/zlib/inflate/set_dictionary_spec.rb @@ -18,4 +18,3 @@ describe "Zlib::Inflate#set_dictionary" do i.finish.should == 'abcdefghij' end end - diff --git a/spec/ruby/library/zlib/zstream/flush_next_out_spec.rb b/spec/ruby/library/zlib/zstream/flush_next_out_spec.rb index f80d8287ce..59a0622903 100644 --- a/spec/ruby/library/zlib/zstream/flush_next_out_spec.rb +++ b/spec/ruby/library/zlib/zstream/flush_next_out_spec.rb @@ -12,5 +12,3 @@ describe "Zlib::ZStream#flush_next_out" do zs.flush_next_out.should == '' end end - - diff --git a/spec/ruby/optional/capi/enumerator_spec.rb b/spec/ruby/optional/capi/enumerator_spec.rb index 42510c122d..9ed68c9063 100644 --- a/spec/ruby/optional/capi/enumerator_spec.rb +++ b/spec/ruby/optional/capi/enumerator_spec.rb @@ -36,4 +36,31 @@ describe "C-API Enumerator function" do enumerator.each {} end end + + describe "rb_enumeratorize_with_size" do + + it "enumerates the given object" do + enumerator = @s.rb_enumeratorize_with_size(@enumerable, :each) + enumerated = [] + enumerator.each { |i| enumerated << i } + enumerated.should == @enumerable + end + + it "uses the given method for enumeration" do + enumerator = @s.rb_enumeratorize_with_size(@enumerable, :awesome_each) + @enumerable.should_receive(:awesome_each) + enumerator.each {} + end + + it "passes the given arguments to the enumeration method" do + enumerator = @s.rb_enumeratorize_with_size(@enumerable, :each, :arg1, :arg2) + @enumerable.should_receive(:each).with(:arg1, :arg2) + enumerator.each {} + end + + it "uses the size function to report the size" do + enumerator = @s.rb_enumeratorize_with_size(@enumerable, :each, :arg1, :arg2) + enumerator.size.should == 7 + end + end end diff --git a/spec/ruby/optional/capi/ext/enumerator_spec.c b/spec/ruby/optional/capi/ext/enumerator_spec.c index 6b08feab52..d9e34afd96 100644 --- a/spec/ruby/optional/capi/ext/enumerator_spec.c +++ b/spec/ruby/optional/capi/ext/enumerator_spec.c @@ -13,6 +13,18 @@ VALUE enumerator_spec_rb_enumeratorize(int argc, VALUE *argv, VALUE self) { } #endif +#ifdef HAVE_RB_ENUMERATORIZE_WITH_SIZE +VALUE enumerator_spec_size_fn(VALUE obj, VALUE args, VALUE anEnum) { + return INT2NUM(7); +} + +VALUE enumerator_spec_rb_enumeratorize_with_size(int argc, VALUE *argv, VALUE self) { + VALUE obj, meth, args; + rb_scan_args(argc, argv, "2*", &obj, &meth, &args); + return rb_enumeratorize_with_size(obj, meth, (int)RARRAY_LEN(args), RARRAY_PTR(args), enumerator_spec_size_fn); +} +#endif + void Init_enumerator_spec(void) { VALUE cls; cls = rb_define_class("CApiEnumeratorSpecs", rb_cObject); @@ -20,6 +32,9 @@ void Init_enumerator_spec(void) { #ifdef HAVE_RB_ENUMERATORIZE rb_define_method(cls, "rb_enumeratorize", enumerator_spec_rb_enumeratorize, -1); #endif +#ifdef HAVE_RB_ENUMERATORIZE_WITH_SIZE + rb_define_method(cls, "rb_enumeratorize_with_size", enumerator_spec_rb_enumeratorize_with_size, -1); +#endif } #ifdef __cplusplus diff --git a/spec/ruby/optional/capi/ext/kernel_spec.c b/spec/ruby/optional/capi/ext/kernel_spec.c index 226354e18a..c87ed5e8f2 100644 --- a/spec/ruby/optional/capi/ext/kernel_spec.c +++ b/spec/ruby/optional/capi/ext/kernel_spec.c @@ -65,6 +65,12 @@ VALUE kernel_spec_rb_block_call_no_func(VALUE self, VALUE ary) { #endif +#ifdef HAVE_RB_FRAME_THIS_FUNC +VALUE kernel_spec_rb_frame_this_func(VALUE self) { + return ID2SYM(rb_frame_this_func()); +} +#endif + #ifdef HAVE_RB_ENSURE VALUE kernel_spec_rb_ensure(VALUE self, VALUE main_proc, VALUE arg, VALUE ensure_proc, VALUE arg2) { @@ -350,6 +356,11 @@ void Init_kernel_spec(void) { rb_define_method(cls, "rb_block_proc", kernel_spec_rb_block_proc, 0); #endif +#ifdef HAVE_RB_FRAME_THIS_FUNC + rb_define_method(cls, "rb_frame_this_func_test", kernel_spec_rb_frame_this_func, 0); + rb_define_method(cls, "rb_frame_this_func_test_again", kernel_spec_rb_frame_this_func, 0); +#endif + #ifdef HAVE_RB_ENSURE rb_define_method(cls, "rb_ensure", kernel_spec_rb_ensure, 4); #endif diff --git a/spec/ruby/optional/capi/ext/rubyspec.h b/spec/ruby/optional/capi/ext/rubyspec.h index 780c2ab20f..4f50450dfb 100644 --- a/spec/ruby/optional/capi/ext/rubyspec.h +++ b/spec/ruby/optional/capi/ext/rubyspec.h @@ -252,6 +252,7 @@ /* Enumerable */ #define HAVE_RB_ENUMERATORIZE 1 +#define HAVE_RB_ENUMERATORIZE_WITH_SIZE 1 /* Exception */ #define HAVE_RB_EXC_NEW 1 @@ -348,6 +349,7 @@ #define HAVE_RB_ENSURE 1 #define HAVE_RB_EVAL_STRING 1 #define HAVE_RB_EXEC_RECURSIVE 1 +#define HAVE_RB_FRAME_THIS_FUNC 1 #define HAVE_RB_F_SPRINTF 1 #define HAVE_RB_NEED_BLOCK 1 #define HAVE_RB_RAISE 1 @@ -563,6 +565,7 @@ #define HAVE_RB_VSPRINTF 1 #define HAVE_RB_STRING 1 #define HAVE_SAFE_STRING_VALUE 1 +#define HAVE_RB_STRING_VALUE_CSTR 1 /* Struct */ #define HAVE_RB_STRUCT_AREF 1 diff --git a/spec/ruby/optional/capi/ext/string_spec.c b/spec/ruby/optional/capi/ext/string_spec.c index 1b9c11a149..a6ce02b25c 100644 --- a/spec/ruby/optional/capi/ext/string_spec.c +++ b/spec/ruby/optional/capi/ext/string_spec.c @@ -497,6 +497,13 @@ static VALUE string_spec_rb_String(VALUE self, VALUE val) { } #endif +#ifdef HAVE_RB_STRING_VALUE_CSTR +static VALUE string_spec_rb_string_value_cstr(VALUE self, VALUE str) { + char *c_str = rb_string_value_cstr(&str); + return c_str ? Qtrue : Qfalse; +} +#endif + void Init_string_spec(void) { VALUE cls; cls = rb_define_class("CApiStringSpecs", rb_cObject); @@ -733,8 +740,11 @@ void Init_string_spec(void) { #ifdef HAVE_RB_STRING rb_define_method(cls, "rb_String", string_spec_rb_String, 1); #endif -} +#ifdef HAVE_RB_STRING_VALUE_CSTR + rb_define_method(cls, "rb_string_value_cstr", string_spec_rb_string_value_cstr, 1); +#endif +} #ifdef __cplusplus } #endif diff --git a/spec/ruby/optional/capi/kernel_spec.rb b/spec/ruby/optional/capi/kernel_spec.rb index 3aa3c388fa..e50ae9c4e4 100644 --- a/spec/ruby/optional/capi/kernel_spec.rb +++ b/spec/ruby/optional/capi/kernel_spec.rb @@ -55,6 +55,13 @@ describe "C-API Kernel function" do end end + describe "rb_frame_this_func" do + it "returns the name of the method called" do + @s.rb_frame_this_func_test.should == :rb_frame_this_func_test + @s.rb_frame_this_func_test_again.should == :rb_frame_this_func_test_again + end + end + describe "rb_raise" do it "raises an exception" do lambda { @s.rb_raise({}) }.should raise_error(TypeError) diff --git a/spec/ruby/optional/capi/rake_helper.rb b/spec/ruby/optional/capi/rake_helper.rb index 2b7a6ccbe3..c13f1189c5 100644 --- a/spec/ruby/optional/capi/rake_helper.rb +++ b/spec/ruby/optional/capi/rake_helper.rb @@ -20,4 +20,3 @@ task default: [output] file output => [input] do sh build_cmd end - diff --git a/spec/ruby/optional/capi/string_spec.rb b/spec/ruby/optional/capi/string_spec.rb index cc6ac2e0cb..2344dd37d7 100644 --- a/spec/ruby/optional/capi/string_spec.rb +++ b/spec/ruby/optional/capi/string_spec.rb @@ -865,4 +865,23 @@ describe "C-API String function" do @s.rb_String({"bar" => "foo"}).should == '{"bar"=>"foo"}' end end + + describe "rb_string_value_cstr" do + it "returns a non-null pointer for a simple string" do + @s.rb_string_value_cstr("Hello").should == true + end + + it "returns a non-null pointer for a UTF-16 string" do + @s.rb_string_value_cstr("Hello".encode('UTF-16BE')).should == true + end + + it "raises an error if a string contains a null" do + lambda { @s.rb_string_value_cstr("Hello\0 with a null.") }.should raise_error(ArgumentError) + end + + it "raises an error if a UTF-16 string contains a null" do + lambda { @s.rb_string_value_cstr("Hello\0 with a null.".encode('UTF-16BE')) }.should raise_error(ArgumentError) + end + + end end |