Skip to content

Commit aff25a1

Browse files
k0kubunheadius
authored andcommitted
Resurrect tests for StringScanner#rest?
that has not been obsolete. Partially reverting ruby/ruby#15049.
1 parent 5436339 commit aff25a1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

library/stringscanner/rest_spec.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,24 @@
2525
it_behaves_like :extract_range_matched, :rest
2626

2727
end
28+
29+
describe "StringScanner#rest?" do
30+
before :each do
31+
@s = StringScanner.new("This is a test")
32+
end
33+
34+
it "returns true if there is more data in the string" do
35+
@s.rest?.should be_true
36+
@s.scan(/This/)
37+
@s.rest?.should be_true
38+
end
39+
40+
it "returns false if there is no more data in the string" do
41+
@s.terminate
42+
@s.rest?.should be_false
43+
end
44+
45+
it "is the opposite of eos?" do
46+
@s.rest?.should_not == @s.eos?
47+
end
48+
end

0 commit comments

Comments
 (0)