summaryrefslogtreecommitdiff
path: root/test/test_securerandom.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 15:21:26 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 15:21:26 +0000
commitb867882a1c2a358bb7a46f84365c86a959d35240 (patch)
tree041ca5d0e77d08e53cd8a6c965f8ce3277fff65e /test/test_securerandom.rb
parentcd381d8acca042d969c72da64ecd2088a6000a0d (diff)
SecureRandom.alphanumeric implemented.
[ruby-core:68098] [Feature #10849] proposed by Andrew Butterfield. SecureRandom.choose and SecureRandom.graph is not included. (The implementation has SecureRandom.choose but it is private.) I feel the method name, SecureRandom.choose, doesn't represent the behavior well. The actual use cases of SecureRandom.graph is not obvious. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_securerandom.rb')
-rw-r--r--test/test_securerandom.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_securerandom.rb b/test/test_securerandom.rb
index f2cc7f553b..9b2c8a5e67 100644
--- a/test/test_securerandom.rb
+++ b/test/test_securerandom.rb
@@ -143,6 +143,13 @@ end
assert_match(/\A\h{8}-\h{4}-\h{4}-\h{4}-\h{12}\z/, uuid)
end
+ def test_alphanumeric
+ 65.times do |idx|
+ an = @it.alphanumeric
+ assert_match(/^[0-9a-zA-Z]+$/, an)
+ end
+ end
+
def protect
begin
yield