Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created February 20, 2010 03:44
Show Gist options
  • Save methodmissing/309485 to your computer and use it in GitHub Desktop.
Save methodmissing/309485 to your computer and use it in GitHub Desktop.
class HashExtTest < Test::Unit::TestCase
def setup
@strings = { 'a' => 1, 'b' => 2 }
@symbols = { :a => 1, :b => 2 }
@mixed = { :a => 1, 'b' => 2 }
@fixnums = { 0 => 1, 1 => 2 }
if RUBY_VERSION < '1.9.0'
@illegal_symbols = { "\0" => 1, "" => 2, [] => 3 }
else
@illegal_symbols = { [] => 3 }
end
end
def test_symbolize_keys_preserves_keys_that_cant_be_symbolized
assert_equal @illegal_symbols, @illegal_symbols.symbolize_keys
assert_equal @illegal_symbols, @illegal_symbols.dup.symbolize_keys!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment