Freeze Random::Formatter::ALPHANUMERIC
and its elements
This commit is contained in:
parent
784bd9c42e
commit
946c823ddb
Notes:
git
2024-12-16 11:54:58 +00:00
@ -340,7 +340,7 @@ module Random::Formatter
|
||||
end
|
||||
|
||||
# The default character list for #alphanumeric.
|
||||
ALPHANUMERIC = [*'A'..'Z', *'a'..'z', *'0'..'9']
|
||||
ALPHANUMERIC = [*'A'..'Z', *'a'..'z', *'0'..'9'].map(&:freeze).freeze
|
||||
|
||||
# Generate a random alphanumeric string.
|
||||
#
|
||||
|
@ -165,6 +165,11 @@ module Random::Formatter
|
||||
def setup
|
||||
@it = Random
|
||||
end
|
||||
|
||||
def test_alphanumeric_frozen
|
||||
assert_predicate @it::Formatter::ALPHANUMERIC, :frozen?
|
||||
assert @it::Formatter::ALPHANUMERIC.all?(&:frozen?)
|
||||
end
|
||||
end
|
||||
|
||||
class TestInstanceMethods < Test::Unit::TestCase
|
||||
|
Loading…
x
Reference in New Issue
Block a user