From 9dc121cc577ae7a010bca7efedb79088e3cf7331 Mon Sep 17 00:00:00 2001 From: eregon Date: Wed, 27 Jun 2018 12:30:05 +0000 Subject: Update to ruby/spec@a454137 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/ruby/core/class/inherited_spec.rb | 1 - spec/ruby/core/enumerable/zip_spec.rb | 1 - spec/ruby/core/env/shared/key.rb | 2 - .../core/exception/uncaught_throw_error_spec.rb | 1 - .../float/shared/arithmetic_exception_in_coerce.rb | 1 - .../float/shared/comparison_exception_in_coerce.rb | 1 - spec/ruby/core/hash/clone_spec.rb | 1 - spec/ruby/core/hash/has_key_spec.rb | 1 - spec/ruby/core/hash/has_value_spec.rb | 1 - spec/ruby/core/hash/value_spec.rb | 1 - spec/ruby/core/integer/abs_spec.rb | 1 - spec/ruby/core/integer/divide_spec.rb | 1 - spec/ruby/core/integer/equal_value_spec.rb | 1 - spec/ruby/core/integer/gt_spec.rb | 1 - spec/ruby/core/integer/gte_spec.rb | 1 - spec/ruby/core/integer/lt_spec.rb | 1 - spec/ruby/core/integer/lte_spec.rb | 1 - spec/ruby/core/integer/magnitude_spec.rb | 1 - spec/ruby/core/integer/minus_spec.rb | 1 - spec/ruby/core/integer/multiply_spec.rb | 1 - spec/ruby/core/integer/plus_spec.rb | 1 - spec/ruby/core/io/pos_spec.rb | 1 - spec/ruby/core/io/print_spec.rb | 1 - spec/ruby/core/io/shared/write.rb | 21 ++++ spec/ruby/core/kernel/eql_spec.rb | 1 - spec/ruby/core/kernel/eval_spec.rb | 128 +++++++++++++++++++++ spec/ruby/core/kernel/lambda_spec.rb | 1 - spec/ruby/core/kernel/printf_spec.rb | 1 - spec/ruby/core/module/protected_spec.rb | 1 - spec/ruby/core/string/clone_spec.rb | 1 - spec/ruby/core/string/percent_spec.rb | 1 - spec/ruby/core/systemexit/initialize_spec.rb | 1 - spec/ruby/core/thread/run_spec.rb | 1 - spec/ruby/core/time/_dump_spec.rb | 1 - spec/ruby/core/tracepoint/callee_id_spec.rb | 1 - 35 files changed, 149 insertions(+), 34 deletions(-) (limited to 'spec/ruby/core') 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 = <