Skip to content

Commit d824b29

Browse files
committed
Add tests for sign-only scan_integer calls
See #152
1 parent 7a24464 commit d824b29

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/strscan/test_stringscanner.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,16 @@ def test_scan_integer
10011001
assert_equal(0, s.pos)
10021002
refute_predicate(s, :matched?)
10031003

1004+
s = create_string_scanner('-')
1005+
assert_nil(s.scan_integer)
1006+
assert_equal(0, s.pos)
1007+
refute_predicate(s, :matched?)
1008+
1009+
s = create_string_scanner('+')
1010+
assert_nil(s.scan_integer)
1011+
assert_equal(0, s.pos)
1012+
refute_predicate(s, :matched?)
1013+
10041014
huge_integer = '1' * 2_000
10051015
s = create_string_scanner(huge_integer)
10061016
assert_equal(huge_integer.to_i, s.scan_integer)

0 commit comments

Comments
 (0)