super_diff 0.9.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +65 -26
- data/lib/super_diff/active_record/differs/active_record_relation.rb +1 -2
- data/lib/super_diff/active_record/differs.rb +1 -1
- data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_model.rb +22 -18
- data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_relation.rb +14 -7
- data/lib/super_diff/active_record/object_inspection/inspection_tree_builders.rb +2 -2
- data/lib/super_diff/active_record/object_inspection.rb +1 -1
- data/lib/super_diff/active_record/operation_tree_builders/active_record_model.rb +1 -2
- data/lib/super_diff/active_record/operation_tree_builders/active_record_relation.rb +1 -2
- data/lib/super_diff/active_record/operation_tree_builders.rb +2 -2
- data/lib/super_diff/active_record/operation_tree_flatteners.rb +1 -1
- data/lib/super_diff/active_record/operation_trees.rb +1 -1
- data/lib/super_diff/active_record.rb +7 -15
- data/lib/super_diff/active_support/differs/hash_with_indifferent_access.rb +5 -6
- data/lib/super_diff/active_support/differs.rb +1 -1
- data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb +20 -11
- data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/ordered_options.rb +46 -0
- data/lib/super_diff/active_support/object_inspection/inspection_tree_builders.rb +5 -1
- data/lib/super_diff/active_support/object_inspection.rb +1 -1
- data/lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb +5 -6
- data/lib/super_diff/active_support/operation_tree_builders.rb +1 -1
- data/lib/super_diff/active_support/operation_tree_flatteners.rb +1 -1
- data/lib/super_diff/active_support/operation_trees.rb +1 -1
- data/lib/super_diff/active_support.rb +6 -10
- data/lib/super_diff/colorized_document_extensions.rb +2 -4
- data/lib/super_diff/configuration.rb +14 -8
- data/lib/super_diff/csi/color.rb +4 -4
- data/lib/super_diff/csi/colorized_document.rb +12 -16
- data/lib/super_diff/csi/document.rb +8 -19
- data/lib/super_diff/csi/eight_bit_color.rb +19 -19
- data/lib/super_diff/csi/four_bit_color.rb +82 -31
- data/lib/super_diff/csi/twenty_four_bit_color.rb +12 -11
- data/lib/super_diff/csi/uncolorized_document.rb +2 -6
- data/lib/super_diff/csi.rb +10 -14
- data/lib/super_diff/diff_formatters/collection.rb +35 -41
- data/lib/super_diff/differs/date_like.rb +15 -0
- data/lib/super_diff/differs/default_object.rb +1 -1
- data/lib/super_diff/differs/defaults.rb +2 -1
- data/lib/super_diff/differs/main.rb +2 -13
- data/lib/super_diff/differs.rb +1 -0
- data/lib/super_diff/equality_matchers/array.rb +10 -12
- data/lib/super_diff/equality_matchers/base.rb +1 -1
- data/lib/super_diff/equality_matchers/default.rb +2 -4
- data/lib/super_diff/equality_matchers/defaults.rb +1 -1
- data/lib/super_diff/equality_matchers/hash.rb +10 -12
- data/lib/super_diff/equality_matchers/multiline_string.rb +11 -13
- data/lib/super_diff/equality_matchers/primitive.rb +10 -12
- data/lib/super_diff/equality_matchers/singleline_string.rb +10 -12
- data/lib/super_diff/equality_matchers.rb +1 -1
- data/lib/super_diff/errors.rb +2 -6
- data/lib/super_diff/gem_version.rb +3 -3
- data/lib/super_diff/helpers.rb +10 -10
- data/lib/super_diff/implementation_checks.rb +2 -2
- data/lib/super_diff/line.rb +3 -3
- data/lib/super_diff/object_inspection/inspection_tree.rb +64 -73
- data/lib/super_diff/object_inspection/inspection_tree_builders/array.rb +29 -14
- data/lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb +17 -13
- data/lib/super_diff/object_inspection/inspection_tree_builders/date_like.rb +51 -0
- data/lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb +43 -27
- data/lib/super_diff/object_inspection/inspection_tree_builders/defaults.rb +2 -1
- data/lib/super_diff/object_inspection/inspection_tree_builders/hash.rb +35 -18
- data/lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb +3 -5
- data/lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb +30 -36
- data/lib/super_diff/object_inspection/inspection_tree_builders.rb +13 -9
- data/lib/super_diff/object_inspection/nodes/as_lines_when_rendering_to_lines.rb +11 -22
- data/lib/super_diff/object_inspection/nodes/as_prefix_when_rendering_to_lines.rb +1 -5
- data/lib/super_diff/object_inspection/nodes/as_prelude_when_rendering_to_lines.rb +1 -5
- data/lib/super_diff/object_inspection/nodes/as_single_line.rb +3 -7
- data/lib/super_diff/object_inspection/nodes/base.rb +9 -14
- data/lib/super_diff/object_inspection/nodes/inspection.rb +26 -34
- data/lib/super_diff/object_inspection/nodes/nesting.rb +1 -1
- data/lib/super_diff/object_inspection/nodes/only_when.rb +2 -6
- data/lib/super_diff/object_inspection/nodes/text.rb +1 -5
- data/lib/super_diff/object_inspection/nodes/when_empty.rb +2 -6
- data/lib/super_diff/object_inspection/nodes/when_non_empty.rb +2 -6
- data/lib/super_diff/object_inspection/nodes/when_rendering_to_lines.rb +1 -1
- data/lib/super_diff/object_inspection/nodes/when_rendering_to_string.rb +1 -5
- data/lib/super_diff/object_inspection/nodes.rb +7 -7
- data/lib/super_diff/object_inspection.rb +3 -3
- data/lib/super_diff/operation_tree_builders/array.rb +12 -11
- data/lib/super_diff/operation_tree_builders/base.rb +17 -15
- data/lib/super_diff/operation_tree_builders/custom_object.rb +8 -6
- data/lib/super_diff/operation_tree_builders/date_like.rb +15 -0
- data/lib/super_diff/operation_tree_builders/default_object.rb +29 -21
- data/lib/super_diff/operation_tree_builders/defaults.rb +1 -1
- data/lib/super_diff/operation_tree_builders/hash.rb +23 -24
- data/lib/super_diff/operation_tree_builders/main.rb +4 -11
- data/lib/super_diff/operation_tree_builders/multiline_string.rb +3 -3
- data/lib/super_diff/operation_tree_builders/time_like.rb +1 -11
- data/lib/super_diff/operation_tree_builders.rb +2 -1
- data/lib/super_diff/operation_tree_flatteners/base.rb +1 -5
- data/lib/super_diff/operation_tree_flatteners/collection.rb +13 -16
- data/lib/super_diff/operation_tree_flatteners/default_object.rb +1 -2
- data/lib/super_diff/operation_tree_flatteners/hash.rb +2 -10
- data/lib/super_diff/operation_tree_flatteners/multiline_string.rb +2 -1
- data/lib/super_diff/operation_tree_flatteners.rb +3 -3
- data/lib/super_diff/operation_trees/base.rb +3 -5
- data/lib/super_diff/operation_trees/default_object.rb +1 -3
- data/lib/super_diff/operations/binary_operation.rb +2 -2
- data/lib/super_diff/operations/unary_operation.rb +1 -1
- data/lib/super_diff/rails.rb +2 -1
- data/lib/super_diff/recursion_guard.rb +5 -4
- data/lib/super_diff/rspec/augmented_matcher.rb +4 -5
- data/lib/super_diff/rspec/differ.rb +6 -13
- data/lib/super_diff/rspec/differs/collection_containing_exactly.rb +3 -2
- data/lib/super_diff/rspec/differs/collection_including.rb +1 -1
- data/lib/super_diff/rspec/differs/hash_including.rb +1 -1
- data/lib/super_diff/rspec/differs.rb +3 -3
- data/lib/super_diff/rspec/matcher_text_builders/base.rb +13 -15
- data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +5 -7
- data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +3 -5
- data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +2 -10
- data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +2 -6
- data/lib/super_diff/rspec/matcher_text_builders.rb +5 -8
- data/lib/super_diff/rspec/matcher_text_template.rb +13 -16
- data/lib/super_diff/rspec/monkey_patches.rb +180 -123
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_containing_exactly.rb +14 -7
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb +21 -13
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb +35 -36
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/generic_describable_matcher.rb +19 -0
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb +21 -15
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb +11 -10
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb +11 -10
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/object_having_attributes.rb +14 -7
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/value_within.rb +10 -11
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb +13 -9
- data/lib/super_diff/rspec/object_inspection.rb +1 -1
- data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +11 -10
- data/lib/super_diff/rspec/operation_tree_builders/collection_including.rb +7 -6
- data/lib/super_diff/rspec/operation_tree_builders/hash_including.rb +11 -10
- data/lib/super_diff/rspec/operation_tree_builders/object_having_attributes.rb +22 -17
- data/lib/super_diff/rspec/operation_tree_builders.rb +4 -4
- data/lib/super_diff/rspec.rb +17 -18
- data/lib/super_diff/tiered_lines_elider.rb +87 -115
- data/lib/super_diff/tiered_lines_formatter.rb +5 -9
- data/lib/super_diff/version.rb +1 -1
- data/lib/super_diff.rb +13 -9
- data/spec/examples.txt +541 -483
- data/spec/integration/rails/active_record_spec.rb +3 -1
- data/spec/integration/rails/engines_spec.rb +25 -0
- data/spec/integration/rails/hash_with_indifferent_access_spec.rb +3 -1
- data/spec/integration/rspec/be_falsey_matcher_spec.rb +40 -35
- data/spec/integration/rspec/be_matcher_spec.rb +360 -320
- data/spec/integration/rspec/be_nil_matcher_spec.rb +38 -34
- data/spec/integration/rspec/be_predicate_matcher_spec.rb +376 -359
- data/spec/integration/rspec/be_truthy_matcher_spec.rb +38 -33
- data/spec/integration/rspec/contain_exactly_matcher_spec.rb +257 -254
- data/spec/integration/rspec/eq_matcher_spec.rb +695 -585
- data/spec/integration/rspec/generic_describable_matchers_spec.rb +177 -0
- data/spec/integration/rspec/have_attributes_matcher_spec.rb +312 -304
- data/spec/integration/rspec/have_predicate_matcher_spec.rb +291 -297
- data/spec/integration/rspec/include_matcher_spec.rb +327 -225
- data/spec/integration/rspec/magic_metadata_spec.rb +51 -0
- data/spec/integration/rspec/match_array_matcher_spec.rb +294 -291
- data/spec/integration/rspec/match_matcher_spec.rb +916 -903
- data/spec/integration/rspec/raise_error_matcher_spec.rb +1208 -449
- data/spec/integration/rspec/respond_to_matcher_spec.rb +702 -697
- data/spec/integration/rspec/third_party_matcher_spec.rb +142 -138
- data/spec/integration/rspec/unhandled_errors_spec.rb +88 -84
- data/spec/internal/log/test.log +0 -0
- data/spec/spec_helper.rb +20 -20
- data/spec/support/command_runner.rb +34 -57
- data/spec/support/integration/helpers.rb +44 -32
- data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +28 -23
- data/spec/support/integration/matchers.rb +34 -0
- data/spec/support/integration/test_programs/base.rb +17 -22
- data/spec/support/integration/test_programs/plain.rb +6 -0
- data/spec/support/integration/test_programs/rspec_active_record.rb +4 -1
- data/spec/support/integration/test_programs/rspec_active_support.rb +4 -1
- data/spec/support/integration/test_programs/rspec_rails.rb +4 -1
- data/spec/support/integration/test_programs/rspec_rails_engine.rb +20 -0
- data/spec/support/models/active_record/person.rb +6 -4
- data/spec/support/models/active_record/shipping_address.rb +9 -10
- data/spec/support/models/customer.rb +2 -4
- data/spec/support/models/player.rb +3 -6
- data/spec/support/models/shipping_address.rb +4 -13
- data/spec/support/shared_examples/active_record.rb +258 -240
- data/spec/support/shared_examples/active_support.rb +174 -51
- data/spec/support/shared_examples/elided_diffs.rb +447 -423
- data/spec/support/shared_examples/hash_with_indifferent_access.rb +500 -464
- data/spec/support/shared_examples/key.rb +123 -0
- data/spec/support/unit/helpers.rb +1 -3
- data/spec/support/unit/matchers/match_output.rb +12 -13
- data/spec/unit/active_record/object_inspection_spec.rb +222 -206
- data/spec/unit/active_support/object_inspection_spec.rb +170 -0
- data/spec/unit/equality_matchers/main_spec.rb +1049 -984
- data/spec/unit/helpers_spec.rb +14 -21
- data/spec/unit/operation_tree_flatteners/array_spec.rb +557 -524
- data/spec/unit/operation_tree_flatteners/custom_object_spec.rb +619 -601
- data/spec/unit/operation_tree_flatteners/default_object_spec.rb +619 -621
- data/spec/unit/operation_tree_flatteners/hash_spec.rb +595 -556
- data/spec/unit/operation_tree_flatteners/multiline_string_spec.rb +102 -92
- data/spec/unit/rspec/matchers/be_compared_to_spec.rb +3 -3
- data/spec/unit/rspec/matchers/be_predicate_spec.rb +3 -3
- data/spec/unit/rspec/matchers/contain_exactly_spec.rb +1 -1
- data/spec/unit/rspec/matchers/have_attributes_spec.rb +1 -1
- data/spec/unit/rspec/matchers/have_predicate_spec.rb +2 -2
- data/spec/unit/rspec/matchers/include_spec.rb +2 -2
- data/spec/unit/rspec/matchers/match_array_spec.rb +2 -2
- data/spec/unit/rspec/matchers/raise_error_spec.rb +43 -11
- data/spec/unit/rspec/matchers/respond_to_spec.rb +23 -16
- data/spec/unit/rspec/object_inspection/rspec_matcher_spec.rb +91 -0
- data/spec/unit/rspec/object_inspection_spec.rb +351 -326
- data/spec/unit/super_diff_spec.rb +1594 -1437
- data/spec/unit/tiered_lines_elider_spec.rb +3508 -3536
- data/spec/unit/tiered_lines_formatter_spec.rb +54 -116
- data/super_diff.gemspec +13 -12
- metadata +88 -75
- data/lib/super_diff/errors/no_diff_formatter_available_error.rb +0 -21
- data/lib/super_diff/errors/no_operational_sequencer_available_error.rb +0 -22
- data/spec/tmp/warnings_logger/all_warnings.txt +0 -2
@@ -4,14 +4,14 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
4
4
|
it "elides the unchanged sections, preserving <maximum> number of lines within all unchanged sections (including the elision marker)" do
|
5
5
|
as_both_colored_and_uncolored do |color_enabled|
|
6
6
|
snippet = <<~TEST.strip
|
7
|
-
|
7
|
+
actual = [
|
8
8
|
"Afghanistan",
|
9
9
|
"Aland Islands",
|
10
10
|
"Albania",
|
11
11
|
"Algeria",
|
12
12
|
"American Samoa",
|
13
13
|
"Andorra",
|
14
|
-
"
|
14
|
+
"Anguilla",
|
15
15
|
"Antarctica",
|
16
16
|
"Antigua And Barbuda",
|
17
17
|
"Argentina",
|
@@ -19,14 +19,14 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
19
19
|
"Aruba",
|
20
20
|
"Australia"
|
21
21
|
]
|
22
|
-
|
22
|
+
expected = [
|
23
23
|
"Afghanistan",
|
24
24
|
"Aland Islands",
|
25
25
|
"Albania",
|
26
26
|
"Algeria",
|
27
27
|
"American Samoa",
|
28
28
|
"Andorra",
|
29
|
-
"
|
29
|
+
"Angola",
|
30
30
|
"Antarctica",
|
31
31
|
"Antigua And Barbuda",
|
32
32
|
"Argentina",
|
@@ -36,51 +36,55 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
36
36
|
]
|
37
37
|
expect(actual).to #{matcher}(expected)
|
38
38
|
TEST
|
39
|
-
program =
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
program =
|
40
|
+
make_plain_test_program(
|
41
|
+
snippet,
|
42
|
+
color_enabled: color_enabled,
|
43
|
+
super_diff_configuration: {
|
44
|
+
diff_elision_enabled: true,
|
45
|
+
diff_elision_maximum: 3
|
46
|
+
}
|
47
|
+
)
|
47
48
|
|
48
|
-
expected_output =
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
49
|
+
expected_output =
|
50
|
+
build_expected_output(
|
51
|
+
color_enabled: color_enabled,
|
52
|
+
snippet: %|expect(actual).to #{matcher}(expected)|,
|
53
|
+
newline_before_expectation: true,
|
54
|
+
expectation:
|
55
|
+
proc do
|
56
|
+
line do
|
57
|
+
plain "Expected "
|
58
|
+
# rubocop:disable Layout/LineLength
|
59
|
+
actual %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
|
60
|
+
# rubocop:enable Layout/LineLength
|
61
|
+
end
|
59
62
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
63
|
+
line do
|
64
|
+
plain " to eq "
|
65
|
+
# rubocop:disable Layout/LineLength
|
66
|
+
expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
|
67
|
+
# rubocop:enable Layout/LineLength
|
68
|
+
end
|
69
|
+
end,
|
70
|
+
diff:
|
71
|
+
proc do
|
72
|
+
plain_line " ["
|
73
|
+
elision_marker_line " # ..."
|
74
|
+
plain_line %| "American Samoa",|
|
75
|
+
plain_line %| "Andorra",|
|
76
|
+
expected_line %|- "Angola",|
|
77
|
+
actual_line %|+ "Anguilla",|
|
78
|
+
plain_line %| "Antarctica",|
|
79
|
+
plain_line %| "Antigua And Barbuda",|
|
80
|
+
elision_marker_line " # ..."
|
81
|
+
plain_line " ]"
|
82
|
+
end
|
83
|
+
)
|
80
84
|
|
81
|
-
expect(program).
|
82
|
-
|
83
|
-
|
85
|
+
expect(program).to produce_output_when_run(expected_output).in_color(
|
86
|
+
color_enabled
|
87
|
+
)
|
84
88
|
end
|
85
89
|
end
|
86
90
|
end
|
@@ -89,14 +93,14 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
89
93
|
it "does not elide anything" do
|
90
94
|
as_both_colored_and_uncolored do |color_enabled|
|
91
95
|
snippet = <<~TEST.strip
|
92
|
-
|
96
|
+
actual = [
|
93
97
|
"Afghanistan",
|
94
98
|
"Aland Islands",
|
95
99
|
"Albania",
|
96
100
|
"Algeria",
|
97
101
|
"American Samoa",
|
98
102
|
"Andorra",
|
99
|
-
"
|
103
|
+
"Anguilla",
|
100
104
|
"Antarctica",
|
101
105
|
"Antigua And Barbuda",
|
102
106
|
"Argentina",
|
@@ -104,14 +108,14 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
104
108
|
"Aruba",
|
105
109
|
"Australia"
|
106
110
|
]
|
107
|
-
|
111
|
+
expected = [
|
108
112
|
"Afghanistan",
|
109
113
|
"Aland Islands",
|
110
114
|
"Albania",
|
111
115
|
"Algeria",
|
112
116
|
"American Samoa",
|
113
117
|
"Andorra",
|
114
|
-
"
|
118
|
+
"Angola",
|
115
119
|
"Antarctica",
|
116
120
|
"Antigua And Barbuda",
|
117
121
|
"Argentina",
|
@@ -121,57 +125,61 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
121
125
|
]
|
122
126
|
expect(actual).to #{matcher}(expected)
|
123
127
|
TEST
|
124
|
-
program =
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
128
|
+
program =
|
129
|
+
make_plain_test_program(
|
130
|
+
snippet,
|
131
|
+
color_enabled: color_enabled,
|
132
|
+
super_diff_configuration: {
|
133
|
+
diff_elision_enabled: false,
|
134
|
+
diff_elision_maximum: 3
|
135
|
+
}
|
136
|
+
)
|
132
137
|
|
133
|
-
expected_output =
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
138
|
+
expected_output =
|
139
|
+
build_expected_output(
|
140
|
+
color_enabled: color_enabled,
|
141
|
+
snippet: %|expect(actual).to #{matcher}(expected)|,
|
142
|
+
newline_before_expectation: true,
|
143
|
+
expectation:
|
144
|
+
proc do
|
145
|
+
line do
|
146
|
+
plain "Expected "
|
147
|
+
# rubocop:disable Layout/LineLength
|
148
|
+
actual %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
|
149
|
+
# rubocop:enable Layout/LineLength
|
150
|
+
end
|
144
151
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
152
|
+
line do
|
153
|
+
plain " to eq "
|
154
|
+
# rubocop:disable Layout/LineLength
|
155
|
+
expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
|
156
|
+
# rubocop:enable Layout/LineLength
|
157
|
+
end
|
158
|
+
end,
|
159
|
+
diff:
|
160
|
+
proc do
|
161
|
+
plain_line " ["
|
162
|
+
plain_line %| "Afghanistan",|
|
163
|
+
plain_line %| "Aland Islands",|
|
164
|
+
plain_line %| "Albania",|
|
165
|
+
plain_line %| "Algeria",|
|
166
|
+
plain_line %| "American Samoa",|
|
167
|
+
plain_line %| "Andorra",|
|
168
|
+
expected_line %|- "Angola",|
|
169
|
+
actual_line %|+ "Anguilla",|
|
170
|
+
plain_line %| "Antarctica",|
|
171
|
+
plain_line %| "Antigua And Barbuda",|
|
172
|
+
plain_line %| "Argentina",|
|
173
|
+
plain_line %| "Armenia",|
|
174
|
+
plain_line %| "Aruba",|
|
175
|
+
plain_line %| "Australia"|
|
176
|
+
plain_line " ]"
|
177
|
+
end
|
178
|
+
)
|
171
179
|
|
172
|
-
expect(program).
|
173
|
-
|
174
|
-
|
180
|
+
expect(program).to produce_output_when_run(expected_output).in_color(
|
181
|
+
color_enabled
|
182
|
+
)
|
175
183
|
end
|
176
184
|
end
|
177
185
|
end
|
@@ -182,8 +190,8 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
182
190
|
it "elides the unchanged sections, preserving <maximum> number of lines within all unchanged sections (including the elision marker)" do
|
183
191
|
as_both_colored_and_uncolored do |color_enabled|
|
184
192
|
snippet = <<~TEST.strip
|
185
|
-
|
186
|
-
"
|
193
|
+
actual = [
|
194
|
+
"Zambia",
|
187
195
|
"Aland Islands",
|
188
196
|
"Albania",
|
189
197
|
"Algeria",
|
@@ -196,10 +204,10 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
196
204
|
"Argentina",
|
197
205
|
"Armenia",
|
198
206
|
"Aruba",
|
199
|
-
"
|
207
|
+
"Zimbabwe"
|
200
208
|
]
|
201
|
-
|
202
|
-
"
|
209
|
+
expected = [
|
210
|
+
"Afghanistan",
|
203
211
|
"Aland Islands",
|
204
212
|
"Albania",
|
205
213
|
"Algeria",
|
@@ -212,54 +220,58 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
212
220
|
"Argentina",
|
213
221
|
"Armenia",
|
214
222
|
"Aruba",
|
215
|
-
"
|
223
|
+
"Australia"
|
216
224
|
]
|
217
225
|
expect(actual).to #{matcher}(expected)
|
218
226
|
TEST
|
219
|
-
program =
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
+
program =
|
228
|
+
make_plain_test_program(
|
229
|
+
snippet,
|
230
|
+
color_enabled: color_enabled,
|
231
|
+
super_diff_configuration: {
|
232
|
+
diff_elision_enabled: true,
|
233
|
+
diff_elision_maximum: 3
|
234
|
+
}
|
235
|
+
)
|
227
236
|
|
228
|
-
expected_output =
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
237
|
+
expected_output =
|
238
|
+
build_expected_output(
|
239
|
+
color_enabled: color_enabled,
|
240
|
+
snippet: %|expect(actual).to #{matcher}(expected)|,
|
241
|
+
newline_before_expectation: true,
|
242
|
+
expectation:
|
243
|
+
proc do
|
244
|
+
line do
|
245
|
+
plain "Expected "
|
246
|
+
# rubocop:disable Layout/LineLength
|
247
|
+
actual %|["Zambia", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Zimbabwe"]|
|
248
|
+
# rubocop:enable Layout/LineLength
|
249
|
+
end
|
239
250
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
251
|
+
line do
|
252
|
+
plain " to eq "
|
253
|
+
# rubocop:disable Layout/LineLength
|
254
|
+
expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
|
255
|
+
# rubocop:enable Layout/LineLength
|
256
|
+
end
|
257
|
+
end,
|
258
|
+
diff:
|
259
|
+
proc do
|
260
|
+
plain_line " ["
|
261
|
+
expected_line %|- "Afghanistan",|
|
262
|
+
actual_line %|+ "Zambia",|
|
263
|
+
plain_line %| "Aland Islands",|
|
264
|
+
elision_marker_line " # ..."
|
265
|
+
plain_line %| "Aruba",|
|
266
|
+
expected_line %|- "Australia"|
|
267
|
+
actual_line %|+ "Zimbabwe"|
|
268
|
+
plain_line " ]"
|
269
|
+
end
|
270
|
+
)
|
259
271
|
|
260
|
-
expect(program).
|
261
|
-
|
262
|
-
|
272
|
+
expect(program).to produce_output_when_run(expected_output).in_color(
|
273
|
+
color_enabled
|
274
|
+
)
|
263
275
|
end
|
264
276
|
end
|
265
277
|
end
|
@@ -268,8 +280,8 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
268
280
|
it "does not elide anything" do
|
269
281
|
as_both_colored_and_uncolored do |color_enabled|
|
270
282
|
snippet = <<~TEST.strip
|
271
|
-
|
272
|
-
"
|
283
|
+
actual = [
|
284
|
+
"Zambia",
|
273
285
|
"Aland Islands",
|
274
286
|
"Albania",
|
275
287
|
"Algeria",
|
@@ -282,10 +294,10 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
282
294
|
"Argentina",
|
283
295
|
"Armenia",
|
284
296
|
"Aruba",
|
285
|
-
"
|
297
|
+
"Zimbabwe"
|
286
298
|
]
|
287
|
-
|
288
|
-
"
|
299
|
+
expected = [
|
300
|
+
"Afghanistan",
|
289
301
|
"Aland Islands",
|
290
302
|
"Albania",
|
291
303
|
"Algeria",
|
@@ -298,63 +310,67 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
298
310
|
"Argentina",
|
299
311
|
"Armenia",
|
300
312
|
"Aruba",
|
301
|
-
"
|
313
|
+
"Australia"
|
302
314
|
]
|
303
315
|
expect(actual).to #{matcher}(expected)
|
304
316
|
TEST
|
305
|
-
program =
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
317
|
+
program =
|
318
|
+
make_plain_test_program(
|
319
|
+
snippet,
|
320
|
+
color_enabled: color_enabled,
|
321
|
+
super_diff_configuration: {
|
322
|
+
diff_elision_enabled: false,
|
323
|
+
diff_elision_maximum: 3
|
324
|
+
}
|
325
|
+
)
|
313
326
|
|
314
|
-
expected_output =
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
327
|
+
expected_output =
|
328
|
+
build_expected_output(
|
329
|
+
color_enabled: color_enabled,
|
330
|
+
snippet: %|expect(actual).to #{matcher}(expected)|,
|
331
|
+
newline_before_expectation: true,
|
332
|
+
expectation:
|
333
|
+
proc do
|
334
|
+
line do
|
335
|
+
plain "Expected "
|
336
|
+
# rubocop:disable Layout/LineLength
|
337
|
+
actual %|["Zambia", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Zimbabwe"]|
|
338
|
+
# rubocop:enable Layout/LineLength
|
339
|
+
end
|
325
340
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
341
|
+
line do
|
342
|
+
plain " to eq "
|
343
|
+
# rubocop:disable Layout/LineLength
|
344
|
+
expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
|
345
|
+
# rubocop:enable Layout/LineLength
|
346
|
+
end
|
347
|
+
end,
|
348
|
+
diff:
|
349
|
+
proc do
|
350
|
+
plain_line " ["
|
351
|
+
expected_line %|- "Afghanistan",|
|
352
|
+
actual_line %|+ "Zambia",|
|
353
|
+
plain_line %| "Aland Islands",|
|
354
|
+
plain_line %| "Albania",|
|
355
|
+
plain_line %| "Algeria",|
|
356
|
+
plain_line %| "American Samoa",|
|
357
|
+
plain_line %| "Andorra",|
|
358
|
+
plain_line %| "Angola",|
|
359
|
+
plain_line %| "Anguilla",|
|
360
|
+
plain_line %| "Antarctica",|
|
361
|
+
plain_line %| "Antigua And Barbuda",|
|
362
|
+
plain_line %| "Argentina",|
|
363
|
+
plain_line %| "Armenia",|
|
364
|
+
plain_line %| "Aruba",|
|
365
|
+
expected_line %|- "Australia"|
|
366
|
+
actual_line %|+ "Zimbabwe"|
|
367
|
+
plain_line " ]"
|
368
|
+
end
|
369
|
+
)
|
354
370
|
|
355
|
-
expect(program).
|
356
|
-
|
357
|
-
|
371
|
+
expect(program).to produce_output_when_run(expected_output).in_color(
|
372
|
+
color_enabled
|
373
|
+
)
|
358
374
|
end
|
359
375
|
end
|
360
376
|
end
|
@@ -367,7 +383,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
367
383
|
# totally weird
|
368
384
|
as_both_colored_and_uncolored do |color_enabled|
|
369
385
|
snippet = <<~TEST.strip
|
370
|
-
|
386
|
+
actual = [
|
371
387
|
{
|
372
388
|
"user_id": "18949452",
|
373
389
|
"user": {
|
@@ -375,6 +391,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
375
391
|
"name": "Financial Times",
|
376
392
|
"screen_name": "FT",
|
377
393
|
"location": "London",
|
394
|
+
"url": "http://t.co/dnhLQpd9BY",
|
378
395
|
"entities": {
|
379
396
|
"url": {
|
380
397
|
"urls": [
|
@@ -393,7 +410,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
393
410
|
"urls": [
|
394
411
|
{
|
395
412
|
"url": "https://t.co/5BsmLs9y1Z",
|
396
|
-
"
|
413
|
+
"display_url": "FT.com",
|
397
414
|
"indices": [
|
398
415
|
65,
|
399
416
|
88
|
@@ -402,6 +419,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
402
419
|
]
|
403
420
|
}
|
404
421
|
},
|
422
|
+
"protected": false,
|
405
423
|
"listed_count": 37009,
|
406
424
|
"created_at": "Tue Jan 13 19:28:24 +0000 2009",
|
407
425
|
"favourites_count": 38,
|
@@ -415,9 +433,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
415
433
|
"is_translator": false,
|
416
434
|
"is_translation_enabled": false,
|
417
435
|
"profile_background_color": "FFF1E0",
|
418
|
-
"
|
419
|
-
"profile_background_tile": false,
|
420
|
-
"profile_image_url": "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
|
436
|
+
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
|
421
437
|
"profile_image_url_https": "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
|
422
438
|
"profile_banner_url": "https://pbs.twimg.com/profile_banners/18949452/1581526592",
|
423
439
|
"profile_image_extensions": {
|
@@ -433,7 +449,6 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
433
449
|
"blocked_by": false,
|
434
450
|
"want_retweets": false,
|
435
451
|
"advertiser_account_type": "none",
|
436
|
-
"advertiser_account_service_levels": [],
|
437
452
|
"profile_interstitial_type": "",
|
438
453
|
"business_profile_state": "none",
|
439
454
|
"translator_type": "none",
|
@@ -448,7 +463,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
448
463
|
"token": "117"
|
449
464
|
}
|
450
465
|
]
|
451
|
-
|
466
|
+
expected = [
|
452
467
|
{
|
453
468
|
"user_id": "18949452",
|
454
469
|
"user": {
|
@@ -456,7 +471,6 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
456
471
|
"name": "Financial Times",
|
457
472
|
"screen_name": "FT",
|
458
473
|
"location": "London",
|
459
|
-
"url": "http://t.co/dnhLQpd9BY",
|
460
474
|
"entities": {
|
461
475
|
"url": {
|
462
476
|
"urls": [
|
@@ -475,7 +489,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
475
489
|
"urls": [
|
476
490
|
{
|
477
491
|
"url": "https://t.co/5BsmLs9y1Z",
|
478
|
-
"
|
492
|
+
"expanded_url": "http://FT.com",
|
479
493
|
"indices": [
|
480
494
|
65,
|
481
495
|
88
|
@@ -484,7 +498,6 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
484
498
|
]
|
485
499
|
}
|
486
500
|
},
|
487
|
-
"protected": false,
|
488
501
|
"listed_count": 37009,
|
489
502
|
"created_at": "Tue Jan 13 19:28:24 +0000 2009",
|
490
503
|
"favourites_count": 38,
|
@@ -498,7 +511,9 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
498
511
|
"is_translator": false,
|
499
512
|
"is_translation_enabled": false,
|
500
513
|
"profile_background_color": "FFF1E0",
|
501
|
-
"
|
514
|
+
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
|
515
|
+
"profile_background_tile": false,
|
516
|
+
"profile_image_url": "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
|
502
517
|
"profile_image_url_https": "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
|
503
518
|
"profile_banner_url": "https://pbs.twimg.com/profile_banners/18949452/1581526592",
|
504
519
|
"profile_image_extensions": {
|
@@ -514,6 +529,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
514
529
|
"blocked_by": false,
|
515
530
|
"want_retweets": false,
|
516
531
|
"advertiser_account_type": "none",
|
532
|
+
"advertiser_account_service_levels": [],
|
517
533
|
"profile_interstitial_type": "",
|
518
534
|
"business_profile_state": "none",
|
519
535
|
"translator_type": "none",
|
@@ -530,92 +546,96 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
530
546
|
]
|
531
547
|
expect(actual).to #{matcher}(expected)
|
532
548
|
TEST
|
533
|
-
program =
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
549
|
+
program =
|
550
|
+
make_plain_test_program(
|
551
|
+
snippet,
|
552
|
+
color_enabled: color_enabled,
|
553
|
+
super_diff_configuration: {
|
554
|
+
diff_elision_enabled: true,
|
555
|
+
diff_elision_maximum: 10
|
556
|
+
}
|
557
|
+
)
|
541
558
|
|
542
|
-
expected_output =
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
559
|
+
expected_output =
|
560
|
+
build_expected_output(
|
561
|
+
color_enabled: color_enabled,
|
562
|
+
snippet: %|expect(actual).to #{matcher}(expected)|,
|
563
|
+
newline_before_expectation: true,
|
564
|
+
expectation:
|
565
|
+
proc do
|
566
|
+
line do
|
567
|
+
plain "Expected "
|
568
|
+
# rubocop:disable Layout/LineLength
|
569
|
+
actual %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", url: "http://t.co/dnhLQpd9BY", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", display_url: "FT.com", indices: [65, 88] }] } }, protected: false, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png", profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
|
570
|
+
# rubocop:enable Layout/LineLength
|
571
|
+
end
|
553
572
|
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
573
|
+
line do
|
574
|
+
plain " to eq "
|
575
|
+
# rubocop:disable Layout/LineLength
|
576
|
+
expected %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", expanded_url: "http://FT.com", indices: [65, 88] }] } }, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_tile: false, profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", advertiser_account_service_levels: [], profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
|
577
|
+
# rubocop:enable Layout/LineLength
|
578
|
+
end
|
579
|
+
end,
|
580
|
+
diff:
|
581
|
+
proc do
|
582
|
+
plain_line " ["
|
583
|
+
plain_line " {"
|
584
|
+
plain_line %| user_id: "18949452",|
|
585
|
+
plain_line " user: {"
|
586
|
+
plain_line " id: 18949452,"
|
587
|
+
plain_line %| name: "Financial Times",|
|
588
|
+
plain_line %| screen_name: "FT",|
|
589
|
+
plain_line %| location: "London",|
|
590
|
+
actual_line %|+ url: "http://t.co/dnhLQpd9BY",|
|
591
|
+
plain_line " entities: {"
|
592
|
+
plain_line " url: {"
|
593
|
+
plain_line " urls: ["
|
594
|
+
elision_marker_line " # ..."
|
595
|
+
plain_line " ]"
|
596
|
+
plain_line " },"
|
597
|
+
plain_line " description: {"
|
598
|
+
plain_line " urls: ["
|
599
|
+
plain_line " {"
|
600
|
+
elision_marker_line " # ..."
|
601
|
+
expected_line %|- expanded_url: "http://FT.com",|
|
602
|
+
actual_line %|+ display_url: "FT.com",|
|
603
|
+
plain_line " indices: ["
|
604
|
+
plain_line " 65,"
|
605
|
+
plain_line " 88"
|
606
|
+
plain_line " ]"
|
607
|
+
plain_line " }"
|
608
|
+
plain_line " ]"
|
609
|
+
plain_line " }"
|
610
|
+
plain_line " },"
|
611
|
+
actual_line "+ protected: false,"
|
612
|
+
elision_marker_line " # ..."
|
613
|
+
expected_line %|- profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",|
|
614
|
+
expected_line "- profile_background_tile: false,"
|
615
|
+
expected_line %|- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
|
616
|
+
actual_line %|+ profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png",|
|
617
|
+
plain_line %| profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
|
618
|
+
plain_line %| profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",|
|
619
|
+
plain_line " profile_image_extensions: {"
|
620
|
+
elision_marker_line " # ..."
|
621
|
+
plain_line " },"
|
622
|
+
plain_line " profile_banner_extensions: {},"
|
623
|
+
plain_line " blocking: false,"
|
624
|
+
plain_line " blocked_by: false,"
|
625
|
+
plain_line " want_retweets: false,"
|
626
|
+
plain_line %| advertiser_account_type: "none",|
|
627
|
+
expected_line "- advertiser_account_service_levels: [],"
|
628
|
+
elision_marker_line " # ..."
|
629
|
+
plain_line " },"
|
630
|
+
plain_line %| token: "117"|
|
631
|
+
plain_line " }"
|
632
|
+
plain_line " ]"
|
633
|
+
end
|
634
|
+
)
|
615
635
|
|
616
|
-
expect(program).
|
617
|
-
|
618
|
-
|
636
|
+
expect(program).to produce_output_when_run(expected_output).in_color(
|
637
|
+
color_enabled
|
638
|
+
)
|
619
639
|
end
|
620
640
|
end
|
621
641
|
end
|
@@ -624,7 +644,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
624
644
|
it "does not elide anything" do
|
625
645
|
as_both_colored_and_uncolored do |color_enabled|
|
626
646
|
snippet = <<~TEST.strip
|
627
|
-
|
647
|
+
actual = [
|
628
648
|
{
|
629
649
|
"user_id": "18949452",
|
630
650
|
"user": {
|
@@ -632,6 +652,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
632
652
|
"name": "Financial Times",
|
633
653
|
"screen_name": "FT",
|
634
654
|
"location": "London",
|
655
|
+
"url": "http://t.co/dnhLQpd9BY",
|
635
656
|
"entities": {
|
636
657
|
"url": {
|
637
658
|
"urls": [
|
@@ -650,7 +671,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
650
671
|
"urls": [
|
651
672
|
{
|
652
673
|
"url": "https://t.co/5BsmLs9y1Z",
|
653
|
-
"
|
674
|
+
"display_url": "FT.com",
|
654
675
|
"indices": [
|
655
676
|
65,
|
656
677
|
88
|
@@ -659,6 +680,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
659
680
|
]
|
660
681
|
}
|
661
682
|
},
|
683
|
+
"protected": false,
|
662
684
|
"listed_count": 37009,
|
663
685
|
"created_at": "Tue Jan 13 19:28:24 +0000 2009",
|
664
686
|
"favourites_count": 38,
|
@@ -672,9 +694,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
672
694
|
"is_translator": false,
|
673
695
|
"is_translation_enabled": false,
|
674
696
|
"profile_background_color": "FFF1E0",
|
675
|
-
"
|
676
|
-
"profile_background_tile": false,
|
677
|
-
"profile_image_url": "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
|
697
|
+
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
|
678
698
|
"profile_image_url_https": "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
|
679
699
|
"profile_banner_url": "https://pbs.twimg.com/profile_banners/18949452/1581526592",
|
680
700
|
"profile_image_extensions": {
|
@@ -690,7 +710,6 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
690
710
|
"blocked_by": false,
|
691
711
|
"want_retweets": false,
|
692
712
|
"advertiser_account_type": "none",
|
693
|
-
"advertiser_account_service_levels": [],
|
694
713
|
"profile_interstitial_type": "",
|
695
714
|
"business_profile_state": "none",
|
696
715
|
"translator_type": "none",
|
@@ -705,7 +724,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
705
724
|
"token": "117"
|
706
725
|
}
|
707
726
|
]
|
708
|
-
|
727
|
+
expected = [
|
709
728
|
{
|
710
729
|
"user_id": "18949452",
|
711
730
|
"user": {
|
@@ -713,7 +732,6 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
713
732
|
"name": "Financial Times",
|
714
733
|
"screen_name": "FT",
|
715
734
|
"location": "London",
|
716
|
-
"url": "http://t.co/dnhLQpd9BY",
|
717
735
|
"entities": {
|
718
736
|
"url": {
|
719
737
|
"urls": [
|
@@ -732,7 +750,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
732
750
|
"urls": [
|
733
751
|
{
|
734
752
|
"url": "https://t.co/5BsmLs9y1Z",
|
735
|
-
"
|
753
|
+
"expanded_url": "http://FT.com",
|
736
754
|
"indices": [
|
737
755
|
65,
|
738
756
|
88
|
@@ -741,7 +759,6 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
741
759
|
]
|
742
760
|
}
|
743
761
|
},
|
744
|
-
"protected": false,
|
745
762
|
"listed_count": 37009,
|
746
763
|
"created_at": "Tue Jan 13 19:28:24 +0000 2009",
|
747
764
|
"favourites_count": 38,
|
@@ -755,7 +772,9 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
755
772
|
"is_translator": false,
|
756
773
|
"is_translation_enabled": false,
|
757
774
|
"profile_background_color": "FFF1E0",
|
758
|
-
"
|
775
|
+
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
|
776
|
+
"profile_background_tile": false,
|
777
|
+
"profile_image_url": "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
|
759
778
|
"profile_image_url_https": "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
|
760
779
|
"profile_banner_url": "https://pbs.twimg.com/profile_banners/18949452/1581526592",
|
761
780
|
"profile_image_extensions": {
|
@@ -771,6 +790,7 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
771
790
|
"blocked_by": false,
|
772
791
|
"want_retweets": false,
|
773
792
|
"advertiser_account_type": "none",
|
793
|
+
"advertiser_account_service_levels": [],
|
774
794
|
"profile_interstitial_type": "",
|
775
795
|
"business_profile_state": "none",
|
776
796
|
"translator_type": "none",
|
@@ -787,126 +807,130 @@ shared_examples_for "a matcher that supports elided diffs" do
|
|
787
807
|
]
|
788
808
|
expect(actual).to #{matcher}(expected)
|
789
809
|
TEST
|
790
|
-
program =
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
810
|
+
program =
|
811
|
+
make_plain_test_program(
|
812
|
+
snippet,
|
813
|
+
color_enabled: color_enabled,
|
814
|
+
super_diff_configuration: {
|
815
|
+
diff_elision_enabled: false,
|
816
|
+
diff_elision_maximum: 10
|
817
|
+
}
|
818
|
+
)
|
798
819
|
|
799
|
-
expected_output =
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
820
|
+
expected_output =
|
821
|
+
build_expected_output(
|
822
|
+
color_enabled: color_enabled,
|
823
|
+
snippet: %|expect(actual).to #{matcher}(expected)|,
|
824
|
+
newline_before_expectation: true,
|
825
|
+
expectation:
|
826
|
+
proc do
|
827
|
+
line do
|
828
|
+
plain "Expected "
|
829
|
+
# rubocop:disable Layout/LineLength
|
830
|
+
actual %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", url: "http://t.co/dnhLQpd9BY", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", display_url: "FT.com", indices: [65, 88] }] } }, protected: false, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png", profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
|
831
|
+
# rubocop:enable Layout/LineLength
|
832
|
+
end
|
810
833
|
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
834
|
+
line do
|
835
|
+
plain " to eq "
|
836
|
+
# rubocop:disable Layout/LineLength
|
837
|
+
expected %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", expanded_url: "http://FT.com", indices: [65, 88] }] } }, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_tile: false, profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", advertiser_account_service_levels: [], profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
|
838
|
+
# rubocop:enable Layout/LineLength
|
839
|
+
end
|
840
|
+
end,
|
841
|
+
diff:
|
842
|
+
proc do
|
843
|
+
plain_line " ["
|
844
|
+
plain_line " {"
|
845
|
+
plain_line %| user_id: "18949452",|
|
846
|
+
plain_line " user: {"
|
847
|
+
plain_line " id: 18949452,"
|
848
|
+
plain_line %| name: "Financial Times",|
|
849
|
+
plain_line %| screen_name: "FT",|
|
850
|
+
plain_line %| location: "London",|
|
851
|
+
actual_line %|+ url: "http://t.co/dnhLQpd9BY",|
|
852
|
+
plain_line " entities: {"
|
853
|
+
plain_line " url: {"
|
854
|
+
plain_line " urls: ["
|
855
|
+
plain_line " {"
|
856
|
+
plain_line %| url: "http://t.co/dnhLQpd9BY",|
|
857
|
+
plain_line %| expanded_url: "http://www.ft.com/",|
|
858
|
+
plain_line %| display_url: "ft.com",|
|
859
|
+
plain_line " indices: ["
|
860
|
+
plain_line " 0,"
|
861
|
+
plain_line " 22"
|
862
|
+
plain_line " ]"
|
863
|
+
plain_line " }"
|
864
|
+
plain_line " ]"
|
865
|
+
plain_line " },"
|
866
|
+
plain_line " description: {"
|
867
|
+
plain_line " urls: ["
|
868
|
+
plain_line " {"
|
869
|
+
plain_line %| url: "https://t.co/5BsmLs9y1Z",|
|
870
|
+
expected_line %|- expanded_url: "http://FT.com",|
|
871
|
+
actual_line %|+ display_url: "FT.com",|
|
872
|
+
plain_line " indices: ["
|
873
|
+
plain_line " 65,"
|
874
|
+
plain_line " 88"
|
875
|
+
plain_line " ]"
|
876
|
+
plain_line " }"
|
877
|
+
plain_line " ]"
|
878
|
+
plain_line " }"
|
879
|
+
plain_line " },"
|
880
|
+
actual_line "+ protected: false,"
|
881
|
+
plain_line " listed_count: 37009,"
|
882
|
+
plain_line %| created_at: "Tue Jan 13 19:28:24 +0000 2009",|
|
883
|
+
plain_line " favourites_count: 38,"
|
884
|
+
plain_line " utc_offset: nil,"
|
885
|
+
plain_line " time_zone: nil,"
|
886
|
+
plain_line " geo_enabled: false,"
|
887
|
+
plain_line " verified: true,"
|
888
|
+
plain_line " statuses_count: 273860,"
|
889
|
+
plain_line " media_count: 51044,"
|
890
|
+
plain_line " contributors_enabled: false,"
|
891
|
+
plain_line " is_translator: false,"
|
892
|
+
plain_line " is_translation_enabled: false,"
|
893
|
+
plain_line %| profile_background_color: "FFF1E0",|
|
894
|
+
expected_line %|- profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",|
|
895
|
+
expected_line "- profile_background_tile: false,"
|
896
|
+
expected_line %|- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
|
897
|
+
actual_line %|+ profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png",|
|
898
|
+
plain_line %| profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
|
899
|
+
plain_line %| profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",|
|
900
|
+
plain_line " profile_image_extensions: {"
|
901
|
+
plain_line " mediaStats: {"
|
902
|
+
plain_line " r: {"
|
903
|
+
plain_line " missing: nil"
|
904
|
+
plain_line " },"
|
905
|
+
plain_line " ttl: -1"
|
906
|
+
plain_line " }"
|
907
|
+
plain_line " },"
|
908
|
+
plain_line " profile_banner_extensions: {},"
|
909
|
+
plain_line " blocking: false,"
|
910
|
+
plain_line " blocked_by: false,"
|
911
|
+
plain_line " want_retweets: false,"
|
912
|
+
plain_line %| advertiser_account_type: "none",|
|
913
|
+
expected_line "- advertiser_account_service_levels: [],"
|
914
|
+
plain_line %| profile_interstitial_type: "",|
|
915
|
+
plain_line %| business_profile_state: "none",|
|
916
|
+
plain_line %| translator_type: "none",|
|
917
|
+
plain_line " followed_by: false,"
|
918
|
+
plain_line " ext: {"
|
919
|
+
plain_line " highlightedLabel: {"
|
920
|
+
plain_line " ttl: -1"
|
921
|
+
plain_line " }"
|
922
|
+
plain_line " },"
|
923
|
+
plain_line " require_some_consent: false"
|
924
|
+
plain_line " },"
|
925
|
+
plain_line %| token: "117"|
|
926
|
+
plain_line " }"
|
927
|
+
plain_line " ]"
|
928
|
+
end
|
929
|
+
)
|
906
930
|
|
907
|
-
expect(program).
|
908
|
-
|
909
|
-
|
931
|
+
expect(program).to produce_output_when_run(expected_output).in_color(
|
932
|
+
color_enabled
|
933
|
+
)
|
910
934
|
end
|
911
935
|
end
|
912
936
|
end
|