summaryrefslogtreecommitdiff
path: root/spec/ruby/core/argf/readchar_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/argf/readchar_spec.rb')
-rw-r--r--spec/ruby/core/argf/readchar_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/ruby/core/argf/readchar_spec.rb b/spec/ruby/core/argf/readchar_spec.rb
new file mode 100644
index 0000000000..63632721ec
--- /dev/null
+++ b/spec/ruby/core/argf/readchar_spec.rb
@@ -0,0 +1,19 @@
+require_relative '../../spec_helper'
+require_relative 'shared/getc'
+
+describe "ARGF.getc" do
+ it_behaves_like :argf_getc, :readchar
+end
+
+describe "ARGF.readchar" do
+ before :each do
+ @file1 = fixture __FILE__, "file1.txt"
+ @file2 = fixture __FILE__, "file2.txt"
+ end
+
+ it "raises EOFError when end of stream reached" do
+ argf [@file1, @file2] do
+ -> { while @argf.readchar; end }.should.raise(EOFError)
+ end
+ end
+end