|
173 | 173 | it "produces the correct failure message when used in the positive" do |
174 | 174 | as_both_colored_and_uncolored do |color_enabled| |
175 | 175 | snippet = <<~RUBY |
176 | | - expected = Time.utc(2011, 12, 13, 14, 15, 16) |
177 | | - actual = Time.utc(2011, 12, 13, 14, 15, 16, 500_000) |
178 | | - expect(expected).to eq(actual) |
| 176 | + actual = Time.utc(2011, 12, 13, 14, 15, 16) |
| 177 | + expected = Time.utc(2011, 12, 13, 14, 15, 16, 500_000) |
| 178 | + expect(actual).to eq(expected) |
179 | 179 | RUBY |
180 | 180 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
181 | 181 |
|
182 | 182 | expected_output = |
183 | 183 | build_expected_output( |
184 | 184 | color_enabled: color_enabled, |
185 | | - snippet: "expect(expected).to eq(actual)", |
| 185 | + snippet: "expect(actual).to eq(expected)", |
186 | 186 | expectation: |
187 | 187 | proc do |
188 | 188 | line do |
|
256 | 256 | it "produces the correct failure message when used in the positive" do |
257 | 257 | as_both_colored_and_uncolored do |color_enabled| |
258 | 258 | snippet = <<~RUBY |
259 | | - expected = Date.new(2023, 10, 14) |
260 | | - actual = Date.new(2023, 10, 31) |
261 | | - expect(expected).to eq(actual) |
| 259 | + actual = Date.new(2023, 10, 14) |
| 260 | + expected = Date.new(2023, 10, 31) |
| 261 | + expect(actual).to eq(expected) |
262 | 262 | RUBY |
263 | 263 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
264 | 264 |
|
265 | 265 | expected_output = |
266 | 266 | build_expected_output( |
267 | 267 | color_enabled: color_enabled, |
268 | | - snippet: "expect(expected).to eq(actual)", |
| 268 | + snippet: "expect(actual).to eq(expected)", |
269 | 269 | expectation: |
270 | 270 | proc do |
271 | 271 | line do |
|
328 | 328 | it "produces the correct failure message" do |
329 | 329 | as_both_colored_and_uncolored do |color_enabled| |
330 | 330 | snippet = <<~TEST.strip |
331 | | - expected = "Something entirely different" |
332 | 331 | actual = "This is a line\\nAnd that's another line\\n" |
| 332 | + expected = "Something entirely different" |
333 | 333 | expect(actual).to eq(expected) |
334 | 334 | TEST |
335 | 335 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
|
367 | 367 | it "produces the correct failure message" do |
368 | 368 | as_both_colored_and_uncolored do |color_enabled| |
369 | 369 | snippet = <<~TEST.strip |
370 | | - expected = "This is a line\\nAnd that's another line\\n" |
371 | 370 | actual = "Something entirely different" |
| 371 | + expected = "This is a line\\nAnd that's another line\\n" |
372 | 372 | expect(actual).to eq(expected) |
373 | 373 | TEST |
374 | 374 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
|
406 | 406 | it "produces the correct failure message when used in the positive" do |
407 | 407 | as_both_colored_and_uncolored do |color_enabled| |
408 | 408 | snippet = <<~TEST.strip |
409 | | - expected = "This is a line\\nAnd that's a line\\nAnd there's a line too\\n" |
410 | 409 | actual = "This is a line\\nSomething completely different\\nAnd there's a line too\\n" |
| 410 | + expected = "This is a line\\nAnd that's a line\\nAnd there's a line too\\n" |
411 | 411 | expect(actual).to eq(expected) |
412 | 412 | TEST |
413 | 413 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
|
481 | 481 | it "produces the correct failure message when used in the positive" do |
482 | 482 | as_both_colored_and_uncolored do |color_enabled| |
483 | 483 | snippet = <<~TEST |
484 | | - expected = [ |
485 | | - [ |
486 | | - :h1, |
487 | | - [:span, [:text, "Hello world"]], |
488 | | - { |
489 | | - class: "header", |
490 | | - data: { |
491 | | - "sticky" => true, |
492 | | - person: SuperDiff::Test::Person.new(name: "Marty", age: 60) |
493 | | - } |
494 | | - } |
495 | | - ] |
496 | | - ] |
497 | 484 | actual = [ |
498 | 485 | [ |
499 | 486 | :h2, |
|
510 | 497 | ], |
511 | 498 | :br |
512 | 499 | ] |
| 500 | + expected = [ |
| 501 | + [ |
| 502 | + :h1, |
| 503 | + [:span, [:text, "Hello world"]], |
| 504 | + { |
| 505 | + class: "header", |
| 506 | + data: { |
| 507 | + "sticky" => true, |
| 508 | + person: SuperDiff::Test::Person.new(name: "Marty", age: 60) |
| 509 | + } |
| 510 | + } |
| 511 | + ] |
| 512 | + ] |
513 | 513 | expect(actual).to eq(expected) |
514 | 514 | TEST |
515 | 515 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
|
620 | 620 | it "produces the correct failure message when used in the positive" do |
621 | 621 | as_both_colored_and_uncolored do |color_enabled| |
622 | 622 | snippet = <<~TEST.strip |
623 | | - expected = { |
| 623 | + actual = { |
624 | 624 | customer: { |
625 | | - person: SuperDiff::Test::Person.new(name: "Marty McFly", age: 17), |
| 625 | + person: SuperDiff::Test::Person.new(name: "Marty McFly, Jr.", age: 17), |
626 | 626 | shipping_address: { |
627 | | - line_1: "123 Main St.", |
| 627 | + line_1: "456 Ponderosa Ct.", |
628 | 628 | city: "Hill Valley", |
629 | 629 | state: "CA", |
630 | 630 | zip: "90382" |
|
636 | 636 | cost: 100_000, |
637 | 637 | options: ["red", "blue", "green"] |
638 | 638 | }, |
639 | | - { name: "Chevy 4x4" } |
| 639 | + { name: "Mattel Hoverboard" } |
640 | 640 | ] |
641 | 641 | } |
642 | | - actual = { |
| 642 | + expected = { |
643 | 643 | customer: { |
644 | | - person: SuperDiff::Test::Person.new(name: "Marty McFly, Jr.", age: 17), |
| 644 | + person: SuperDiff::Test::Person.new(name: "Marty McFly", age: 17), |
645 | 645 | shipping_address: { |
646 | | - line_1: "456 Ponderosa Ct.", |
| 646 | + line_1: "123 Main St.", |
647 | 647 | city: "Hill Valley", |
648 | 648 | state: "CA", |
649 | 649 | zip: "90382" |
|
655 | 655 | cost: 100_000, |
656 | 656 | options: ["red", "blue", "green"] |
657 | 657 | }, |
658 | | - { name: "Mattel Hoverboard" } |
| 658 | + { name: "Chevy 4x4" } |
659 | 659 | ] |
660 | 660 | } |
661 | 661 | expect(actual).to eq(expected) |
|
776 | 776 | it "produces the correct failure message when used in the positive" do |
777 | 777 | as_both_colored_and_uncolored do |color_enabled| |
778 | 778 | snippet = <<~TEST.strip |
779 | | - expected = SuperDiff::Test::Person.new( |
780 | | - name: "Marty", |
781 | | - age: 31, |
782 | | - ) |
783 | 779 | actual = SuperDiff::Test::Customer.new( |
784 | 780 | name: "Doc", |
785 | 781 | shipping_address: :some_shipping_address, |
786 | 782 | phone: "1234567890", |
787 | 783 | ) |
| 784 | + expected = SuperDiff::Test::Person.new( |
| 785 | + name: "Marty", |
| 786 | + age: 31, |
| 787 | + ) |
788 | 788 | expect(actual).to eq(expected) |
789 | 789 | TEST |
790 | 790 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
|
855 | 855 | it "produces the correct failure message when used in the positive" do |
856 | 856 | as_both_colored_and_uncolored do |color_enabled| |
857 | 857 | snippet = <<~TEST.strip |
858 | | - expected = SuperDiff::Test::Item.new( |
859 | | - name: "camera", |
860 | | - quantity: 3, |
861 | | - ) |
862 | 858 | actual = SuperDiff::Test::Player.new( |
863 | 859 | handle: "mcmire", |
864 | 860 | character: "Jon", |
|
867 | 863 | health: 4, |
868 | 864 | ultimate: true, |
869 | 865 | ) |
| 866 | + expected = SuperDiff::Test::Item.new( |
| 867 | + name: "camera", |
| 868 | + quantity: 3, |
| 869 | + ) |
870 | 870 | expect(actual).to eq(expected) |
871 | 871 | TEST |
872 | 872 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
|
937 | 937 | it "formats the array correctly in the diff" do |
938 | 938 | as_both_colored_and_uncolored do |color_enabled| |
939 | 939 | snippet = <<~TEST.strip |
940 | | - expected = { foo: nil } |
941 | 940 | actual = { foo: [] } |
| 941 | + expected = { foo: nil } |
942 | 942 | expect(actual).to eq(expected) |
943 | 943 | TEST |
944 | 944 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
|
978 | 978 | it "formats the hash correctly in the diff" do |
979 | 979 | as_both_colored_and_uncolored do |color_enabled| |
980 | 980 | snippet = <<~TEST.strip |
981 | | - expected = { foo: nil } |
982 | 981 | actual = { foo: {} } |
| 982 | + expected = { foo: nil } |
983 | 983 | expect(actual).to eq(expected) |
984 | 984 | TEST |
985 | 985 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
|
1019 | 1019 | it "formats the object correctly in the diff" do |
1020 | 1020 | as_both_colored_and_uncolored do |color_enabled| |
1021 | 1021 | snippet = <<~TEST.strip |
1022 | | - expected = { foo: nil } |
1023 | 1022 | actual = { foo: SuperDiff::Test::EmptyClass.new } |
| 1023 | + expected = { foo: nil } |
1024 | 1024 | expect(actual).to eq(expected) |
1025 | 1025 | TEST |
1026 | 1026 | program = make_plain_test_program(snippet, color_enabled: color_enabled) |
|
0 commit comments