super_diff 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +174 -0
- data/lib/super_diff/csi/color_helper.rb +52 -0
- data/lib/super_diff/csi/eight_bit_color.rb +131 -0
- data/lib/super_diff/csi/eight_bit_sequence.rb +27 -0
- data/lib/super_diff/csi/four_bit_color.rb +80 -0
- data/lib/super_diff/csi/four_bit_sequence.rb +24 -0
- data/lib/super_diff/csi/reset_sequence.rb +9 -0
- data/lib/super_diff/csi/sequence.rb +22 -0
- data/lib/super_diff/csi/twenty_four_bit_color.rb +41 -0
- data/lib/super_diff/csi/twenty_four_bit_sequence.rb +27 -0
- data/lib/super_diff/csi.rb +29 -0
- data/lib/super_diff/diff_formatter.rb +37 -0
- data/lib/super_diff/diff_formatters/array.rb +21 -0
- data/lib/super_diff/diff_formatters/base.rb +37 -0
- data/lib/super_diff/diff_formatters/collection.rb +107 -0
- data/lib/super_diff/diff_formatters/hash.rb +34 -0
- data/lib/super_diff/diff_formatters/multi_line_string.rb +31 -0
- data/lib/super_diff/diff_formatters/object.rb +27 -0
- data/lib/super_diff/diff_formatters.rb +5 -0
- data/lib/super_diff/differ.rb +48 -0
- data/lib/super_diff/differs/array.rb +24 -0
- data/lib/super_diff/differs/base.rb +42 -0
- data/lib/super_diff/differs/empty.rb +13 -0
- data/lib/super_diff/differs/hash.rb +24 -0
- data/lib/super_diff/differs/multi_line_string.rb +27 -0
- data/lib/super_diff/differs/object.rb +68 -0
- data/lib/super_diff/differs.rb +5 -0
- data/lib/super_diff/equality_matcher.rb +45 -0
- data/lib/super_diff/equality_matchers/array.rb +44 -0
- data/lib/super_diff/equality_matchers/base.rb +42 -0
- data/lib/super_diff/equality_matchers/hash.rb +44 -0
- data/lib/super_diff/equality_matchers/multi_line_string.rb +44 -0
- data/lib/super_diff/equality_matchers/object.rb +18 -0
- data/lib/super_diff/equality_matchers/single_line_string.rb +28 -0
- data/lib/super_diff/equality_matchers.rb +5 -0
- data/lib/super_diff/errors.rb +20 -0
- data/lib/super_diff/helpers.rb +96 -0
- data/lib/super_diff/operation_sequences/array.rb +14 -0
- data/lib/super_diff/operation_sequences/base.rb +11 -0
- data/lib/super_diff/operation_sequences/hash.rb +14 -0
- data/lib/super_diff/operation_sequences/object.rb +14 -0
- data/lib/super_diff/operational_sequencer.rb +43 -0
- data/lib/super_diff/operational_sequencers/array.rb +127 -0
- data/lib/super_diff/operational_sequencers/base.rb +97 -0
- data/lib/super_diff/operational_sequencers/hash.rb +82 -0
- data/lib/super_diff/operational_sequencers/multi_line_string.rb +85 -0
- data/lib/super_diff/operational_sequencers/object.rb +96 -0
- data/lib/super_diff/operational_sequencers.rb +5 -0
- data/lib/super_diff/operations/binary_operation.rb +47 -0
- data/lib/super_diff/operations/unary_operation.rb +25 -0
- data/lib/super_diff/rspec/differ.rb +30 -0
- data/lib/super_diff/rspec/monkey_patches.rb +122 -0
- data/lib/super_diff/rspec.rb +19 -0
- data/lib/super_diff/value_inspection.rb +11 -0
- data/lib/super_diff/version.rb +3 -0
- data/lib/super_diff.rb +50 -0
- data/spec/examples.txt +46 -0
- data/spec/integration/rspec_spec.rb +261 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/support/color_helper.rb +49 -0
- data/spec/support/command_runner.rb +279 -0
- data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +76 -0
- data/spec/support/person.rb +23 -0
- data/spec/support/person_diff_formatter.rb +15 -0
- data/spec/support/person_operation_sequence.rb +14 -0
- data/spec/support/person_operational_sequencer.rb +19 -0
- data/spec/unit/equality_matcher_spec.rb +1233 -0
- data/super_diff.gemspec +23 -0
- metadata +153 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
module SuperDiff
|
2
|
+
module Test
|
3
|
+
class Person
|
4
|
+
attr_reader :name
|
5
|
+
|
6
|
+
def initialize(name:)
|
7
|
+
@name = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def ==(other)
|
11
|
+
other.is_a?(self.class) && other.name == name
|
12
|
+
end
|
13
|
+
|
14
|
+
def inspect
|
15
|
+
"#<#{self.class} name: #{name.inspect}>"
|
16
|
+
end
|
17
|
+
|
18
|
+
def attributes_for_super_diff
|
19
|
+
{ name: name }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module SuperDiff
|
2
|
+
module Test
|
3
|
+
class PersonDiffFormatter < ::SuperDiff::DiffFormatters::Object
|
4
|
+
def self.applies_to?(operations)
|
5
|
+
operations.is_a?(PersonOperationSequence)
|
6
|
+
end
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def value_class
|
11
|
+
SuperDiff::Test::Person
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module SuperDiff
|
2
|
+
module Test
|
3
|
+
class PersonOperationSequence < ::SuperDiff::OperationSequences::Base
|
4
|
+
def to_diff(indent_level:, collection_prefix:, add_comma:)
|
5
|
+
PersonDiffFormatter.call(
|
6
|
+
self,
|
7
|
+
indent_level: indent_level,
|
8
|
+
collection_prefix: collection_prefix,
|
9
|
+
add_comma: add_comma,
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module SuperDiff
|
2
|
+
module Test
|
3
|
+
class PersonOperationalSequencer < ::SuperDiff::OperationalSequencers::Object
|
4
|
+
def self.applies_to?(value)
|
5
|
+
value.is_a?(Person)
|
6
|
+
end
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def operation_sequence_class
|
11
|
+
PersonOperationSequence
|
12
|
+
end
|
13
|
+
|
14
|
+
def attribute_names
|
15
|
+
[:name]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|