Skip to content

Commit 7616814

Browse files
committed
add test.
1 parent 3f16f06 commit 7616814

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/hash_inspect_test.rb

+22
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@ class Memo < Struct.new(:id); end
2121
assert_equal Trailblazer::Core::Utils.inspect("A string {with: true, and: 1} a hash"), %(A string {:with=>true, :and=>1} a hash)
2222
end
2323

24+
# it "can convert multi-line strings" do
25+
# multi_line = %(Actual contract errors: \e[33m{:title=>[\"must be filled\"], :content=>[\"must be filled\", \"size cannot be less than 8\"]}\e[0m.
26+
# --- expected
27+
# +++ actual
28+
# @@ -1 +1 @@
29+
# -{:title=>[\"is XXX\"]}
30+
# +{:title=>[\"must be filled\"], :content=>[\"must be filled\", \"size cannot be less than 8\"]}
31+
# )
32+
33+
# assert_equal Trailblazer::Core::Utils.inspect("A string {with: true, and: 1} a hash"), %(A string {:with=>true, :and=>1} a hash)
34+
# end
35+
36+
it "doesn't convert non-hashes in multi-line strings" do
37+
multi_line = %({Trailblazer::Test::Testing::Memo::Operation::Create} didn't fail, it passed.
38+
Expected: false
39+
Actual: true)
40+
41+
assert_equal Trailblazer::Core::Utils.inspect(multi_line), %({Trailblazer::Test::Testing::Memo::Operation::Create} didn't fail, it passed.
42+
Expected: false
43+
Actual: true)
44+
end
45+
2446
it "uses native {#inspect} for other classes" do
2547
assert_equal Trailblazer::Core::Utils.inspect(Struct.new(:id).new(1)), %(#<struct id=1>)
2648
end

0 commit comments

Comments
 (0)