summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringscanner/eos_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringscanner/eos_spec.rb')
-rw-r--r--spec/ruby/library/stringscanner/eos_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/ruby/library/stringscanner/eos_spec.rb b/spec/ruby/library/stringscanner/eos_spec.rb
new file mode 100644
index 0000000000..03c2804e5b
--- /dev/null
+++ b/spec/ruby/library/stringscanner/eos_spec.rb
@@ -0,0 +1,20 @@
+require_relative '../../spec_helper'
+require 'strscan'
+
+describe "StringScanner#eos?" do
+ before :each do
+ @s = StringScanner.new("This is a test")
+ end
+
+ it "returns true if the scan pointer is at the end of the string" do
+ @s.terminate
+ @s.should.eos?
+
+ s = StringScanner.new('')
+ s.should.eos?
+ end
+
+ it "returns false if the scan pointer is not at the end of the string" do
+ @s.should_not.eos?
+ end
+end