summaryrefslogtreecommitdiff
path: root/spec/rubyspec/core
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-27 21:55:02 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-27 21:55:02 +0000
commitead40959357817c0937553a45208ef748975e340 (patch)
tree307b315a455953e97bd86cf2bfdc5d53a04cf581 /spec/rubyspec/core
parent24db428785c938d401c9e582b5ea2622540222ad (diff)
Update to ruby/spec@2795010
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/core')
-rw-r--r--spec/rubyspec/core/dir/shared/delete.rb2
-rw-r--r--spec/rubyspec/core/exception/uncaught_throw_error_spec.rb19
-rw-r--r--spec/rubyspec/core/io/fixtures/classes.rb31
-rw-r--r--spec/rubyspec/core/io/fixtures/lines.txt2
-rw-r--r--spec/rubyspec/core/kernel/gets_spec.rb5
-rw-r--r--spec/rubyspec/core/kernel/system_spec.rb4
-rw-r--r--spec/rubyspec/core/kernel/test_spec.rb2
7 files changed, 44 insertions, 21 deletions
diff --git a/spec/rubyspec/core/dir/shared/delete.rb b/spec/rubyspec/core/dir/shared/delete.rb
index 72d025bc63..8db17d985f 100644
--- a/spec/rubyspec/core/dir/shared/delete.rb
+++ b/spec/rubyspec/core/dir/shared/delete.rb
@@ -41,7 +41,7 @@ describe :dir_delete, shared: true do
it "raises an Errno::ENOTDIR when trying to remove a non-directory" do
file = DirSpecs.mock_rmdir("nonempty/regular")
- open(file, "w") {}
+ touch(file)
lambda do
Dir.send @method, file
end.should raise_error(Errno::ENOTDIR)
diff --git a/spec/rubyspec/core/exception/uncaught_throw_error_spec.rb b/spec/rubyspec/core/exception/uncaught_throw_error_spec.rb
new file mode 100644
index 0000000000..3ed166af5b
--- /dev/null
+++ b/spec/rubyspec/core/exception/uncaught_throw_error_spec.rb
@@ -0,0 +1,19 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "UncaughtThrowError" do
+ it "is a subclass of ArgumentError" do
+ ArgumentError.should be_ancestor_of(UncaughtThrowError)
+ end
+end
+
+describe "UncaughtThrowError#tag" do
+ it "returns the object thrown" do
+ begin
+ throw :abc
+
+ rescue UncaughtThrowError => e
+ e.tag.should == :abc
+ end
+ end
+end
+
diff --git a/spec/rubyspec/core/io/fixtures/classes.rb b/spec/rubyspec/core/io/fixtures/classes.rb
index 5ff6f9aa72..fb431d5023 100644
--- a/spec/rubyspec/core/io/fixtures/classes.rb
+++ b/spec/rubyspec/core/io/fixtures/classes.rb
@@ -14,7 +14,7 @@ module IOSpecs
"\n",
"\n",
"Aqu\303\255 est\303\241 la l\303\255nea tres.\n",
- "Ist hier Linie vier.\n",
+ "Hier ist Zeile vier.\n",
"\n",
"Est\303\241 aqui a linha cinco.\n",
"Here is line six.\n" ]
@@ -31,8 +31,8 @@ module IOSpecs
"Aquí está",
" la línea",
" tres.\n",
- "Ist hier L",
- "inie vier.",
+ "Hier ist Z",
+ "eile vier.",
"\n",
"\n",
"Está aqui",
@@ -55,9 +55,10 @@ module IOSpecs
"está ",
"la ",
"línea ",
- "tres.\nIst ",
- "hier ",
- "Linie ",
+ "tres.\nHier",
+ " ",
+ "ist ",
+ "Zeile ",
"vier.\n\nEst",
"á ",
"aqui ",
@@ -71,37 +72,35 @@ module IOSpecs
end
def self.lines_r_separator
- [ "Voici la ligne une.\nQui \303\250 la linea due.\n\n\n" \
- "Aqu\303\255 est\303\241 la l\303\255nea tr",
- "es.\nIst hier",
- " Linie vier",
+ [ "Voici la ligne une.\nQui \303\250 la linea due.\n\n\nAqu\303\255 est\303\241 la l\303\255nea tr",
+ "es.\nHier",
+ " ist Zeile vier",
".\n\nEst\303\241 aqui a linha cinco.\nHer",
"e is line six.\n" ]
end
def self.lines_empty_separator
[ "Voici la ligne une.\nQui \303\250 la linea due.\n\n",
- "Aqu\303\255 est\303\241 la l\303\255nea tres.\nIst hier Linie vier.\n\n",
+ "Aqu\303\255 est\303\241 la l\303\255nea tres.\nHier ist Zeile vier.\n\n",
"Est\303\241 aqui a linha cinco.\nHere is line six.\n" ]
end
def self.lines_space_separator
[ "Voici ", "la ", "ligne ", "une.\nQui ",
"\303\250 ", "la ", "linea ", "due.\n\n\nAqu\303\255 ",
- "est\303\241 ", "la ", "l\303\255nea ", "tres.\nIst ",
- "hier ", "Linie ", "vier.\n\nEst\303\241 ", "aqui ", "a ",
+ "est\303\241 ", "la ", "l\303\255nea ", "tres.\nHier ",
+ "ist ", "Zeile ", "vier.\n\nEst\303\241 ", "aqui ", "a ",
"linha ", "cinco.\nHere ", "is ", "line ", "six.\n" ]
end
def self.lines_arbitrary_separator
[ "Voici la ligne une.\nQui \303\250",
- " la linea due.\n\n\nAqu\303\255 est\303\241 la l\303\255nea tres.\n" \
- "Ist hier Linie vier.\n\nEst\303\241 aqui a linha cinco.\nHere is line six.\n" ]
+ " la linea due.\n\n\nAqu\303\255 est\303\241 la l\303\255nea tres.\nHier ist Zeile vier.\n\nEst\303\241 aqui a linha cinco.\nHere is line six.\n" ]
end
def self.paragraphs
[ "Voici la ligne une.\nQui \303\250 la linea due.\n\n",
- "Aqu\303\255 est\303\241 la l\303\255nea tres.\nIst hier Linie vier.\n\n",
+ "Aqu\303\255 est\303\241 la l\303\255nea tres.\nHier ist Zeile vier.\n\n",
"Est\303\241 aqui a linha cinco.\nHere is line six.\n" ]
end
diff --git a/spec/rubyspec/core/io/fixtures/lines.txt b/spec/rubyspec/core/io/fixtures/lines.txt
index a64d8ff6bb..0959997e7b 100644
--- a/spec/rubyspec/core/io/fixtures/lines.txt
+++ b/spec/rubyspec/core/io/fixtures/lines.txt
@@ -3,7 +3,7 @@ Qui è la linea due.
Aquí está la línea tres.
-Ist hier Linie vier.
+Hier ist Zeile vier.
Está aqui a linha cinco.
Here is line six.
diff --git a/spec/rubyspec/core/kernel/gets_spec.rb b/spec/rubyspec/core/kernel/gets_spec.rb
index eb68e093ab..c775b2b7a4 100644
--- a/spec/rubyspec/core/kernel/gets_spec.rb
+++ b/spec/rubyspec/core/kernel/gets_spec.rb
@@ -5,6 +5,11 @@ describe "Kernel#gets" do
it "is a private method" do
Kernel.should have_private_instance_method(:gets)
end
+
+ it "calls ARGF.gets" do
+ ARGF.should_receive(:gets).and_return("spec")
+ gets.should == "spec"
+ end
end
describe "Kernel.gets" do
diff --git a/spec/rubyspec/core/kernel/system_spec.rb b/spec/rubyspec/core/kernel/system_spec.rb
index ccbd43cfde..aee75441a2 100644
--- a/spec/rubyspec/core/kernel/system_spec.rb
+++ b/spec/rubyspec/core/kernel/system_spec.rb
@@ -42,7 +42,7 @@ describe :kernel_system, shared: true do
@shell = ENV['SHELL']
end
- before :each do
+ after :each do
ENV['SHELL'] = @shell
end
@@ -51,7 +51,7 @@ describe :kernel_system, shared: true do
end
it "ignores SHELL env var and always uses `sh`" do
- ENV['SHELL'] = "/bin/zsh"
+ ENV['SHELL'] = "/bin/fakeshell"
lambda { @object.system("echo $0") }.should output_to_fd("sh\n")
end
end
diff --git a/spec/rubyspec/core/kernel/test_spec.rb b/spec/rubyspec/core/kernel/test_spec.rb
index 1a6e346616..43e3a963e3 100644
--- a/spec/rubyspec/core/kernel/test_spec.rb
+++ b/spec/rubyspec/core/kernel/test_spec.rb
@@ -46,7 +46,7 @@ describe "Kernel#test" do
context "writable test" do
before do
@tmp_file = tmp("file.kernel.test")
- open(@tmp_file, "w") {}
+ touch(@tmp_file)
end
after do