Project

General

Profile

Feature #8956 » hash-test.rb

adamdunson (Addie Drake), 09/26/2013 11:54 PM

 
require 'pp'

puts "Testing: no commas (new syntax)"
some_hash = {
:foo => 'bar'
:bar => 'foo'
:baz => {
:foo => 'bar' + 'baz'
:bar => 'foo'
:qux => 'quux'
:corge => 'grault'
}
}
PP.pp some_hash

puts
puts "Testing: no commas (new syntax) as argument"
PP.pp ({
:foo => 'bar'
:bar => 'foo'
:baz => {
:foo => 'bar' + 'baz'
:bar => 'foo'
:qux => 'quux'
:corge => 'grault'
}
})

puts
puts "Testing: no commas (new syntax) as argument"
PP.pp ({
:foo => 'bar'
:bar => 'foo'
:baz => {
:foo => 'bar' + 'baz'
:bar => 'foo'
:qux => 'quux'
:corge => 'grault'
}
})

puts
puts "Testing: commas (old syntax)"
some_hash = {
:foo => 'bar',
:bar => 'foo',
:baz => {
:foo => 'bar' + 'baz',
:bar => 'foo',
:qux => 'quux',
:corge => 'grault'
}
}
PP.pp some_hash

puts
puts "Testing: mixed commas (old syntax) and no commas (new syntax)"
some_hash = {
:foo => 'bar'
:bar => 'foo',
:baz => {
:foo => 'bar' + 'baz',
:bar => 'foo', :qux => 'quux',
:corge => 'grault'
},
}
PP.pp some_hash
(2-2/7)