mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Add spec for hash syntax option
This commit is contained in:
parent
d1fe8d0de8
commit
7ddc36bde6
1 changed files with 32 additions and 0 deletions
|
@ -275,6 +275,22 @@ EOS
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "new hash syntax" do
|
||||||
|
expect(@hash.ai(:plain => true, :new_hash_syntax => true)).to eq <<-EOS.strip
|
||||||
|
{
|
||||||
|
1 => {
|
||||||
|
sym: {
|
||||||
|
"str" => {
|
||||||
|
[ 1, 2, 3 ] => {
|
||||||
|
{ k: :v } => Hash < Object
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
it "plain multiline indented" do
|
it "plain multiline indented" do
|
||||||
expect(@hash.ai(:plain => true, :indent => 1)).to eq <<-EOS.strip
|
expect(@hash.ai(:plain => true, :indent => 1)).to eq <<-EOS.strip
|
||||||
{
|
{
|
||||||
|
@ -311,6 +327,22 @@ EOS
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "colored with new hash syntax" do
|
||||||
|
expect(@hash.ai(:new_hash_syntax => true)).to eq <<-EOS.strip
|
||||||
|
{
|
||||||
|
1\e[0;37m => \e[0m{
|
||||||
|
sym\e[0;37m: \e[0m{
|
||||||
|
\"str\"\e[0;37m => \e[0m{
|
||||||
|
[ 1, 2, 3 ]\e[0;37m => \e[0m{
|
||||||
|
{ k: :v }\e[0;37m => \e[0m\e[1;33mHash < Object\e[0m
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
it "colored multiline indented" do
|
it "colored multiline indented" do
|
||||||
expect(@hash.ai(:indent => 2)).to eq <<-EOS.strip
|
expect(@hash.ai(:indent => 2)).to eq <<-EOS.strip
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue