summaryrefslogtreecommitdiff
path: root/test/strscan/test_stringscanner.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/strscan/test_stringscanner.rb')
-rw-r--r--test/strscan/test_stringscanner.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/strscan/test_stringscanner.rb b/test/strscan/test_stringscanner.rb
index bc5db7900a..9fe6ad7125 100644
--- a/test/strscan/test_stringscanner.rb
+++ b/test/strscan/test_stringscanner.rb
@@ -718,4 +718,14 @@ class TestStringScanner < Test::Unit::TestCase
s.scan(/test strin/)
assert_equal('#<StringScanner 10/16 "...strin" @ "g tes...">', s.inspect)
end
+
+ def test_aref_without_regex
+ s = StringScanner.new('abc')
+ s.get_byte
+ assert_nil(s[:c])
+ assert_nil(s["c"])
+ s.getch
+ assert_nil(s[:c])
+ assert_nil(s["c"])
+ end
end