diff options
Diffstat (limited to 'spec/ruby/library/stringscanner/check_spec.rb')
-rw-r--r-- | spec/ruby/library/stringscanner/check_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/library/stringscanner/check_spec.rb b/spec/ruby/library/stringscanner/check_spec.rb new file mode 100644 index 0000000000..db98197f81 --- /dev/null +++ b/spec/ruby/library/stringscanner/check_spec.rb @@ -0,0 +1,16 @@ +require File.expand_path('../../../spec_helper', __FILE__) +require 'strscan' + +describe "StringScanner#check" do + before :each do + @s = StringScanner.new("This is a test") + end + + it "returns the value that scan would return, without advancing the scan pointer" do + @s.check(/This/).should == "This" + @s.matched.should == "This" + @s.pos.should == 0 + @s.check(/is/).should == nil + @s.matched.should == nil + end +end |