diff-lcs 2.0.0.beta.1 → 2.0.0.beta.2
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 +4 -4
- data/CHANGELOG.md +30 -5
- data/CONTRIBUTING.md +8 -3
- data/CONTRIBUTORS.md +19 -9
- data/Manifest.txt +88 -70
- data/README.md +13 -9
- data/Rakefile +90 -22
- data/SECURITY.md +1 -10
- data/integration/compare/array_diff_spec.rb +10 -0
- data/integration/compare/hash_diff_spec.rb +25 -0
- data/integration/compare/string_diff_spec.rb +10 -0
- data/integration/rspec_differ_spec.rb +26 -0
- data/integration/rspec_expectations_spec.rb +32 -0
- data/integration/runner +20 -0
- data/lib/diff/lcs/change.rb +21 -16
- data/lib/diff/lcs/ldiff.rb +9 -4
- data/lib/diff/lcs/version.rb +1 -1
- data/spec/hunk_spec.rb +32 -34
- data/spec/ldiff_spec.rb +7 -7
- data/spec/spec_helper.rb +4 -12
- data/test/fixtures/ldiff/output.diff-c +7 -0
- data/test/fixtures/ldiff/output.diff-u +5 -0
- data/test/fixtures/ldiff/output.diff.bin2 +1 -0
- data/test/fixtures/ldiff/output.diff.bin2-c +1 -0
- data/test/fixtures/ldiff/output.diff.bin2-e +1 -0
- data/test/fixtures/ldiff/output.diff.bin2-f +1 -0
- data/test/fixtures/ldiff/output.diff.bin2-u +1 -0
- data/{spec → test}/fixtures/ldiff/output.diff.chef-c +2 -2
- data/test/fixtures/ldiff/output.diff.chef-u +9 -0
- data/{spec → test}/fixtures/ldiff/output.diff.chef2-c +2 -2
- data/{spec → test}/fixtures/ldiff/output.diff.chef2-u +2 -2
- data/test/fixtures/ldiff/output.diff.empty.vs.four_lines-c +9 -0
- data/test/fixtures/ldiff/output.diff.empty.vs.four_lines-u +7 -0
- data/test/fixtures/ldiff/output.diff.four_lines.vs.empty-c +9 -0
- data/test/fixtures/ldiff/output.diff.four_lines.vs.empty-u +7 -0
- data/test/fixtures/ldiff/output.diff.issue95_trailing_context-c +9 -0
- data/test/fixtures/ldiff/output.diff.issue95_trailing_context-u +6 -0
- data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1-c +2 -2
- data/test/fixtures/ldiff/output.diff.missing_new_line1-u +9 -0
- data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2-c +2 -2
- data/test/fixtures/ldiff/output.diff.missing_new_line2-u +9 -0
- data/test/test_block.rb +34 -0
- data/test/test_change.rb +234 -0
- data/test/test_diff.rb +53 -0
- data/test/test_helper.rb +225 -0
- data/test/test_hunk.rb +72 -0
- data/test/test_issues.rb +168 -0
- data/test/test_lcs.rb +47 -0
- data/test/test_ldiff.rb +89 -0
- data/test/test_patch.rb +362 -0
- data/test/test_sdiff.rb +167 -0
- data/test/test_traverse_balanced.rb +322 -0
- data/test/test_traverse_sequences.rb +187 -0
- metadata +130 -96
- data/spec/fixtures/ldiff/output.diff-c +0 -7
- data/spec/fixtures/ldiff/output.diff-u +0 -5
- data/spec/fixtures/ldiff/output.diff.bin2 +0 -1
- data/spec/fixtures/ldiff/output.diff.bin2-c +0 -1
- data/spec/fixtures/ldiff/output.diff.bin2-e +0 -1
- data/spec/fixtures/ldiff/output.diff.bin2-f +0 -1
- data/spec/fixtures/ldiff/output.diff.bin2-u +0 -1
- data/spec/fixtures/ldiff/output.diff.chef-u +0 -9
- data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-c +0 -9
- data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-u +0 -7
- data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-c +0 -9
- data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-u +0 -7
- data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-c +0 -9
- data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-u +0 -6
- data/spec/fixtures/ldiff/output.diff.missing_new_line1-u +0 -9
- data/spec/fixtures/ldiff/output.diff.missing_new_line2-u +0 -9
- /data/{spec → test}/fixtures/123_x +0 -0
- /data/{spec → test}/fixtures/456_x +0 -0
- /data/{spec → test}/fixtures/aX +0 -0
- /data/{spec → test}/fixtures/bXaX +0 -0
- /data/{spec → test}/fixtures/ds1.csv +0 -0
- /data/{spec → test}/fixtures/ds2.csv +0 -0
- /data/{spec → test}/fixtures/empty +0 -0
- /data/{spec → test}/fixtures/file1.bin +0 -0
- /data/{spec → test}/fixtures/file2.bin +0 -0
- /data/{spec → test}/fixtures/four_lines +0 -0
- /data/{spec → test}/fixtures/four_lines_with_missing_new_line +0 -0
- /data/{spec → test}/fixtures/ldiff/diff.missing_new_line1-e +0 -0
- /data/{spec → test}/fixtures/ldiff/diff.missing_new_line1-f +0 -0
- /data/{spec → test}/fixtures/ldiff/diff.missing_new_line2-e +0 -0
- /data/{spec → test}/fixtures/ldiff/diff.missing_new_line2-f +0 -0
- /data/{spec → test}/fixtures/ldiff/error.diff.chef-e +0 -0
- /data/{spec → test}/fixtures/ldiff/error.diff.chef-f +0 -0
- /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line1-e +0 -0
- /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line1-f +0 -0
- /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line2-e +0 -0
- /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line2-f +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.bin1 +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.bin1-c +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.bin1-e +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.bin1-f +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.bin1-u +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.chef +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.chef2 +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.chef2-d +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.empty.vs.four_lines +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.empty.vs.four_lines-e +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.empty.vs.four_lines-f +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.four_lines.vs.empty +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.four_lines.vs.empty-e +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.four_lines.vs.empty-f +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.issue95_trailing_context +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.issue95_trailing_context-e +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.issue95_trailing_context-f +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1 +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1-e +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1-f +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2 +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2-e +0 -0
- /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2-f +0 -0
- /data/{spec → test}/fixtures/new-chef +0 -0
- /data/{spec → test}/fixtures/new-chef2 +0 -0
- /data/{spec → test}/fixtures/old-chef +0 -0
- /data/{spec → test}/fixtures/old-chef2 +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fb47e6f9ca29177bf13307762b66d1dc6daa799440bb52791dab584bc7ad1258
|
|
4
|
+
data.tar.gz: 572a4b3da413bc87eebbc36dfd7d1b66002c28e9e126784f6c74f3516047c96f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 837bfe7fcbdfb8d79946e60006d804ac3ed7ebe1a312525e51124ae34fe83a295b25b58a0b16e0e588e396563fb2b544540e98d10602afeaa42af360663e70e1
|
|
7
|
+
data.tar.gz: 671e433b132c818058850eb30a90309e603e6edff7472ee411129e40a81ad7ca5976f224f7924d4572c31eba283e8c40c64ec97b0fd5e9cf02651844235df3ce
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 2.0.0.beta.
|
|
3
|
+
## 2.0.0.beta.2 / 2025-01-22
|
|
4
4
|
|
|
5
5
|
This release has significant **breaking changes**.
|
|
6
6
|
|
|
@@ -35,6 +35,27 @@ This release has significant **breaking changes**.
|
|
|
35
35
|
Most callers are using `Diff::LCS.lcs` and modern Ruby did-you-mean support
|
|
36
36
|
should assist with this update.
|
|
37
37
|
|
|
38
|
+
- `Diff::LCS::Change` objects implemented the comparison operator (`<=>`)
|
|
39
|
+
incorrectly. Comparisons are now done so that the `position` is compared
|
|
40
|
+
first, then the `action` (by index of `VALID_ACTIONS`), and finally the
|
|
41
|
+
element. `Diff::LCS::ContextChange` works similarly, comparing the old and new
|
|
42
|
+
positions prior to comparing the actions by index.
|
|
43
|
+
|
|
44
|
+
The order of `VALID_ACTIONS` was changed for the index order to make sense.
|
|
45
|
+
|
|
46
|
+
- `ldiff` now implements `-` as a filename option for standard input. This is
|
|
47
|
+
used for integration testing with RSpec like this:
|
|
48
|
+
|
|
49
|
+
```console
|
|
50
|
+
rspec -Ilib -rdiff/lcs integration/failure/array_diff_spec.rb 2>&1 |
|
|
51
|
+
ruby -Ilib bin/ldiff -U integration/golden/array_diff.txt -
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- diff-lcs no longer uses RSpec as its test suite, but instead uses Minitest.
|
|
55
|
+
The conversion to Minitest and the new RSpec integration tests
|
|
56
|
+
(`rake integration`) were written with the assistance of [Kiro][kiro] and
|
|
57
|
+
verified manually, with portions changed as required.
|
|
58
|
+
|
|
38
59
|
## 1.6.2 / 2025-05-12
|
|
39
60
|
|
|
40
61
|
- Handle upcoming changes to the `cgi` gem in Ruby 3.5 ([#147][pull-147])
|
|
@@ -60,8 +81,9 @@ This release has significant **breaking changes**.
|
|
|
60
81
|
|
|
61
82
|
## 1.6.0 / 2025-02-13
|
|
62
83
|
|
|
63
|
-
- Baptiste Courtois (@annih) has done significant work on
|
|
64
|
-
work better, contributing a number of issues and pull
|
|
84
|
+
- Baptiste Courtois ([@annih][gh-user-annih]) has done significant work on
|
|
85
|
+
making `bin/ldiff` work better, contributing a number of issues and pull
|
|
86
|
+
requests. These include:
|
|
65
87
|
|
|
66
88
|
- Separation of command parsing from diff-generation in `Diff::LCS::Ldiff`
|
|
67
89
|
code extraction making it easier to use separately from the `bin/ldiff`
|
|
@@ -420,8 +442,8 @@ This release has significant **breaking changes**.
|
|
|
420
442
|
|
|
421
443
|
## 1.1.1 / 2004-09-25
|
|
422
444
|
|
|
423
|
-
- Fixed bug #891 (Set returned from patch command does not
|
|
424
|
-
part).
|
|
445
|
+
- Fixed bug [#891][gh-issue-891] (Set returned from patch command does not
|
|
446
|
+
contain last equal part).
|
|
425
447
|
|
|
426
448
|
- Fixed a problem with callback initialisation code (it assumed that all
|
|
427
449
|
callbacks passed as classes can be initialised; now, it rescues NoMethodError
|
|
@@ -552,3 +574,6 @@ This release has significant **breaking changes**.
|
|
|
552
574
|
[standard ruby]: https://github.com/standardrb/standard
|
|
553
575
|
[tidelift]: https://tidelift.com/security
|
|
554
576
|
[tp]: https://guides.rubygems.org/trusted-publishing/
|
|
577
|
+
[kiro]: https://kiro.dev
|
|
578
|
+
[gh-user-annih]: https://github.com/annih
|
|
579
|
+
[gh-issue-891]: https://github.com/halostatue/diff-lcs/issues/891
|
data/CONTRIBUTING.md
CHANGED
|
@@ -13,7 +13,11 @@ diff-lcs is governed under the [Contributor Covenant Code of Conduct][cccoc].
|
|
|
13
13
|
I have several guidelines to contributing code through pull requests:
|
|
14
14
|
|
|
15
15
|
- All code changes require tests. In most cases, this will be added or updated
|
|
16
|
-
unit tests. I use [
|
|
16
|
+
unit tests. I use [Minitest][minitest].
|
|
17
|
+
|
|
18
|
+
- There are integration tests with RSpec which must not be broken, accessible
|
|
19
|
+
through `rake integration`. This requires a non-bundled RSpec,
|
|
20
|
+
`gem install rspec`.
|
|
17
21
|
|
|
18
22
|
- I use code formatters, static analysis tools, and linting to ensure consistent
|
|
19
23
|
styles and formatting. There should be no warning output from test run
|
|
@@ -115,8 +119,9 @@ required metadata trailers are:
|
|
|
115
119
|
[dco]: licences/dco.txt
|
|
116
120
|
[hoe]: https://github.com/seattlerb/hoe
|
|
117
121
|
[issues]: https://github.com/halostatue/diff-lcs/issues
|
|
118
|
-
[
|
|
122
|
+
[minitest]: https://github.com/seattlerb/minitest
|
|
123
|
+
[rspec]: https://rspec.info/documentation/
|
|
119
124
|
[standardrb]: https://github.com/standardrb/standard
|
|
120
|
-
[tpope-qcm]:
|
|
125
|
+
[tpope-qcm]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
|
121
126
|
[trailers1]: https://git-scm.com/docs/git-interpret-trailers
|
|
122
127
|
[trailers2]: https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---trailerlttokengtltvaluegt
|
data/CONTRIBUTORS.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
# Contributors
|
|
2
2
|
|
|
3
|
-
- Austin Ziegler (@halostatue) created diff-lcs.
|
|
3
|
+
- Austin Ziegler ([@halostatue][gh-user-halostatue]) created diff-lcs.
|
|
4
4
|
|
|
5
5
|
Thanks to everyone else who has contributed to diff-lcs over the years:
|
|
6
6
|
|
|
7
|
-
- @ginriki
|
|
8
|
-
- @joshbronson
|
|
9
|
-
- @kevinmook
|
|
10
|
-
- @mckaz
|
|
7
|
+
- [@ginriki][gh-user-ginriki]
|
|
8
|
+
- [@joshbronson][gh-user-joshbronson]
|
|
9
|
+
- [@kevinmook][gh-user-kevinmook]
|
|
10
|
+
- [@mckaz][gh-user-mckaz]
|
|
11
11
|
- Akinori Musha
|
|
12
12
|
- Artem Ignatyev
|
|
13
13
|
- Brandon Fish
|
|
14
|
-
- Baptiste Courtois (@annih)
|
|
14
|
+
- Baptiste Courtois ([@annih][gh-user-annih])
|
|
15
15
|
- Camille Drapier
|
|
16
16
|
- Cédric Boutillier
|
|
17
|
-
- @earlopain
|
|
17
|
+
- [@earlopain][gh-user-earlopain]
|
|
18
18
|
- Gregg Kellogg
|
|
19
19
|
- Jagdeep Singh
|
|
20
20
|
- Jason Gladish
|
|
21
21
|
- Jon Rowe
|
|
22
22
|
- Josef Strzibny
|
|
23
|
-
- Josep (@apuratepp)
|
|
23
|
+
- Josep ([@apuratepp][gh-user-apuratepp])
|
|
24
24
|
- Josh Bronson
|
|
25
25
|
- Jun Aruga
|
|
26
26
|
- Justin Steele
|
|
@@ -44,6 +44,16 @@ Thanks to everyone else who has contributed to diff-lcs over the years:
|
|
|
44
44
|
- Ryan Lovelett
|
|
45
45
|
- Scott Steele
|
|
46
46
|
- Simon Courtois
|
|
47
|
-
- Tien (@tiendo1011)
|
|
47
|
+
- Tien ([@tiendo1011][gh-user-tiendo1011])
|
|
48
48
|
- Tomas Jura
|
|
49
49
|
- Vít Ondruch
|
|
50
|
+
|
|
51
|
+
[gh-user-halostatue]: https://github.com/halostatue
|
|
52
|
+
[gh-user-ginriki]: https://github.com/ginriki
|
|
53
|
+
[gh-user-joshbronson]: https://github.com/joshbronson
|
|
54
|
+
[gh-user-kevinmook]: https://github.com/kevinmook
|
|
55
|
+
[gh-user-mckaz]: https://github.com/mckaz
|
|
56
|
+
[gh-user-annih]: https://github.com/annih
|
|
57
|
+
[gh-user-earlopain]: https://github.com/earlopain
|
|
58
|
+
[gh-user-apuratepp]: https://github.com/apuratepp
|
|
59
|
+
[gh-user-tiendo1011]: https://github.com/tiendo1011
|
data/Manifest.txt
CHANGED
|
@@ -8,6 +8,12 @@ README.md
|
|
|
8
8
|
Rakefile
|
|
9
9
|
SECURITY.md
|
|
10
10
|
bin/ldiff
|
|
11
|
+
integration/compare/array_diff_spec.rb
|
|
12
|
+
integration/compare/hash_diff_spec.rb
|
|
13
|
+
integration/compare/string_diff_spec.rb
|
|
14
|
+
integration/rspec_differ_spec.rb
|
|
15
|
+
integration/rspec_expectations_spec.rb
|
|
16
|
+
integration/runner
|
|
11
17
|
lib/diff-lcs.rb
|
|
12
18
|
lib/diff/lcs.rb
|
|
13
19
|
lib/diff/lcs/array.rb
|
|
@@ -24,76 +30,6 @@ licenses/artistic.txt
|
|
|
24
30
|
licenses/dco.txt
|
|
25
31
|
spec/change_spec.rb
|
|
26
32
|
spec/diff_spec.rb
|
|
27
|
-
spec/fixtures/123_x
|
|
28
|
-
spec/fixtures/456_x
|
|
29
|
-
spec/fixtures/aX
|
|
30
|
-
spec/fixtures/bXaX
|
|
31
|
-
spec/fixtures/ds1.csv
|
|
32
|
-
spec/fixtures/ds2.csv
|
|
33
|
-
spec/fixtures/empty
|
|
34
|
-
spec/fixtures/file1.bin
|
|
35
|
-
spec/fixtures/file2.bin
|
|
36
|
-
spec/fixtures/four_lines
|
|
37
|
-
spec/fixtures/four_lines_with_missing_new_line
|
|
38
|
-
spec/fixtures/ldiff/diff.missing_new_line1-e
|
|
39
|
-
spec/fixtures/ldiff/diff.missing_new_line1-f
|
|
40
|
-
spec/fixtures/ldiff/diff.missing_new_line2-e
|
|
41
|
-
spec/fixtures/ldiff/diff.missing_new_line2-f
|
|
42
|
-
spec/fixtures/ldiff/error.diff.chef-e
|
|
43
|
-
spec/fixtures/ldiff/error.diff.chef-f
|
|
44
|
-
spec/fixtures/ldiff/error.diff.missing_new_line1-e
|
|
45
|
-
spec/fixtures/ldiff/error.diff.missing_new_line1-f
|
|
46
|
-
spec/fixtures/ldiff/error.diff.missing_new_line2-e
|
|
47
|
-
spec/fixtures/ldiff/error.diff.missing_new_line2-f
|
|
48
|
-
spec/fixtures/ldiff/output.diff
|
|
49
|
-
spec/fixtures/ldiff/output.diff-c
|
|
50
|
-
spec/fixtures/ldiff/output.diff-u
|
|
51
|
-
spec/fixtures/ldiff/output.diff.bin1
|
|
52
|
-
spec/fixtures/ldiff/output.diff.bin1-c
|
|
53
|
-
spec/fixtures/ldiff/output.diff.bin1-e
|
|
54
|
-
spec/fixtures/ldiff/output.diff.bin1-f
|
|
55
|
-
spec/fixtures/ldiff/output.diff.bin1-u
|
|
56
|
-
spec/fixtures/ldiff/output.diff.bin2
|
|
57
|
-
spec/fixtures/ldiff/output.diff.bin2-c
|
|
58
|
-
spec/fixtures/ldiff/output.diff.bin2-e
|
|
59
|
-
spec/fixtures/ldiff/output.diff.bin2-f
|
|
60
|
-
spec/fixtures/ldiff/output.diff.bin2-u
|
|
61
|
-
spec/fixtures/ldiff/output.diff.chef
|
|
62
|
-
spec/fixtures/ldiff/output.diff.chef-c
|
|
63
|
-
spec/fixtures/ldiff/output.diff.chef-u
|
|
64
|
-
spec/fixtures/ldiff/output.diff.chef2
|
|
65
|
-
spec/fixtures/ldiff/output.diff.chef2-c
|
|
66
|
-
spec/fixtures/ldiff/output.diff.chef2-d
|
|
67
|
-
spec/fixtures/ldiff/output.diff.chef2-u
|
|
68
|
-
spec/fixtures/ldiff/output.diff.empty.vs.four_lines
|
|
69
|
-
spec/fixtures/ldiff/output.diff.empty.vs.four_lines-c
|
|
70
|
-
spec/fixtures/ldiff/output.diff.empty.vs.four_lines-e
|
|
71
|
-
spec/fixtures/ldiff/output.diff.empty.vs.four_lines-f
|
|
72
|
-
spec/fixtures/ldiff/output.diff.empty.vs.four_lines-u
|
|
73
|
-
spec/fixtures/ldiff/output.diff.four_lines.vs.empty
|
|
74
|
-
spec/fixtures/ldiff/output.diff.four_lines.vs.empty-c
|
|
75
|
-
spec/fixtures/ldiff/output.diff.four_lines.vs.empty-e
|
|
76
|
-
spec/fixtures/ldiff/output.diff.four_lines.vs.empty-f
|
|
77
|
-
spec/fixtures/ldiff/output.diff.four_lines.vs.empty-u
|
|
78
|
-
spec/fixtures/ldiff/output.diff.issue95_trailing_context
|
|
79
|
-
spec/fixtures/ldiff/output.diff.issue95_trailing_context-c
|
|
80
|
-
spec/fixtures/ldiff/output.diff.issue95_trailing_context-e
|
|
81
|
-
spec/fixtures/ldiff/output.diff.issue95_trailing_context-f
|
|
82
|
-
spec/fixtures/ldiff/output.diff.issue95_trailing_context-u
|
|
83
|
-
spec/fixtures/ldiff/output.diff.missing_new_line1
|
|
84
|
-
spec/fixtures/ldiff/output.diff.missing_new_line1-c
|
|
85
|
-
spec/fixtures/ldiff/output.diff.missing_new_line1-e
|
|
86
|
-
spec/fixtures/ldiff/output.diff.missing_new_line1-f
|
|
87
|
-
spec/fixtures/ldiff/output.diff.missing_new_line1-u
|
|
88
|
-
spec/fixtures/ldiff/output.diff.missing_new_line2
|
|
89
|
-
spec/fixtures/ldiff/output.diff.missing_new_line2-c
|
|
90
|
-
spec/fixtures/ldiff/output.diff.missing_new_line2-e
|
|
91
|
-
spec/fixtures/ldiff/output.diff.missing_new_line2-f
|
|
92
|
-
spec/fixtures/ldiff/output.diff.missing_new_line2-u
|
|
93
|
-
spec/fixtures/new-chef
|
|
94
|
-
spec/fixtures/new-chef2
|
|
95
|
-
spec/fixtures/old-chef
|
|
96
|
-
spec/fixtures/old-chef2
|
|
97
33
|
spec/hunk_spec.rb
|
|
98
34
|
spec/issues_spec.rb
|
|
99
35
|
spec/lcs_spec.rb
|
|
@@ -103,3 +39,85 @@ spec/sdiff_spec.rb
|
|
|
103
39
|
spec/spec_helper.rb
|
|
104
40
|
spec/traverse_balanced_spec.rb
|
|
105
41
|
spec/traverse_sequences_spec.rb
|
|
42
|
+
test/fixtures/123_x
|
|
43
|
+
test/fixtures/456_x
|
|
44
|
+
test/fixtures/aX
|
|
45
|
+
test/fixtures/bXaX
|
|
46
|
+
test/fixtures/ds1.csv
|
|
47
|
+
test/fixtures/ds2.csv
|
|
48
|
+
test/fixtures/empty
|
|
49
|
+
test/fixtures/file1.bin
|
|
50
|
+
test/fixtures/file2.bin
|
|
51
|
+
test/fixtures/four_lines
|
|
52
|
+
test/fixtures/four_lines_with_missing_new_line
|
|
53
|
+
test/fixtures/ldiff/diff.missing_new_line1-e
|
|
54
|
+
test/fixtures/ldiff/diff.missing_new_line1-f
|
|
55
|
+
test/fixtures/ldiff/diff.missing_new_line2-e
|
|
56
|
+
test/fixtures/ldiff/diff.missing_new_line2-f
|
|
57
|
+
test/fixtures/ldiff/error.diff.chef-e
|
|
58
|
+
test/fixtures/ldiff/error.diff.chef-f
|
|
59
|
+
test/fixtures/ldiff/error.diff.missing_new_line1-e
|
|
60
|
+
test/fixtures/ldiff/error.diff.missing_new_line1-f
|
|
61
|
+
test/fixtures/ldiff/error.diff.missing_new_line2-e
|
|
62
|
+
test/fixtures/ldiff/error.diff.missing_new_line2-f
|
|
63
|
+
test/fixtures/ldiff/output.diff
|
|
64
|
+
test/fixtures/ldiff/output.diff-c
|
|
65
|
+
test/fixtures/ldiff/output.diff-u
|
|
66
|
+
test/fixtures/ldiff/output.diff.bin1
|
|
67
|
+
test/fixtures/ldiff/output.diff.bin1-c
|
|
68
|
+
test/fixtures/ldiff/output.diff.bin1-e
|
|
69
|
+
test/fixtures/ldiff/output.diff.bin1-f
|
|
70
|
+
test/fixtures/ldiff/output.diff.bin1-u
|
|
71
|
+
test/fixtures/ldiff/output.diff.bin2
|
|
72
|
+
test/fixtures/ldiff/output.diff.bin2-c
|
|
73
|
+
test/fixtures/ldiff/output.diff.bin2-e
|
|
74
|
+
test/fixtures/ldiff/output.diff.bin2-f
|
|
75
|
+
test/fixtures/ldiff/output.diff.bin2-u
|
|
76
|
+
test/fixtures/ldiff/output.diff.chef
|
|
77
|
+
test/fixtures/ldiff/output.diff.chef-c
|
|
78
|
+
test/fixtures/ldiff/output.diff.chef-u
|
|
79
|
+
test/fixtures/ldiff/output.diff.chef2
|
|
80
|
+
test/fixtures/ldiff/output.diff.chef2-c
|
|
81
|
+
test/fixtures/ldiff/output.diff.chef2-d
|
|
82
|
+
test/fixtures/ldiff/output.diff.chef2-u
|
|
83
|
+
test/fixtures/ldiff/output.diff.empty.vs.four_lines
|
|
84
|
+
test/fixtures/ldiff/output.diff.empty.vs.four_lines-c
|
|
85
|
+
test/fixtures/ldiff/output.diff.empty.vs.four_lines-e
|
|
86
|
+
test/fixtures/ldiff/output.diff.empty.vs.four_lines-f
|
|
87
|
+
test/fixtures/ldiff/output.diff.empty.vs.four_lines-u
|
|
88
|
+
test/fixtures/ldiff/output.diff.four_lines.vs.empty
|
|
89
|
+
test/fixtures/ldiff/output.diff.four_lines.vs.empty-c
|
|
90
|
+
test/fixtures/ldiff/output.diff.four_lines.vs.empty-e
|
|
91
|
+
test/fixtures/ldiff/output.diff.four_lines.vs.empty-f
|
|
92
|
+
test/fixtures/ldiff/output.diff.four_lines.vs.empty-u
|
|
93
|
+
test/fixtures/ldiff/output.diff.issue95_trailing_context
|
|
94
|
+
test/fixtures/ldiff/output.diff.issue95_trailing_context-c
|
|
95
|
+
test/fixtures/ldiff/output.diff.issue95_trailing_context-e
|
|
96
|
+
test/fixtures/ldiff/output.diff.issue95_trailing_context-f
|
|
97
|
+
test/fixtures/ldiff/output.diff.issue95_trailing_context-u
|
|
98
|
+
test/fixtures/ldiff/output.diff.missing_new_line1
|
|
99
|
+
test/fixtures/ldiff/output.diff.missing_new_line1-c
|
|
100
|
+
test/fixtures/ldiff/output.diff.missing_new_line1-e
|
|
101
|
+
test/fixtures/ldiff/output.diff.missing_new_line1-f
|
|
102
|
+
test/fixtures/ldiff/output.diff.missing_new_line1-u
|
|
103
|
+
test/fixtures/ldiff/output.diff.missing_new_line2
|
|
104
|
+
test/fixtures/ldiff/output.diff.missing_new_line2-c
|
|
105
|
+
test/fixtures/ldiff/output.diff.missing_new_line2-e
|
|
106
|
+
test/fixtures/ldiff/output.diff.missing_new_line2-f
|
|
107
|
+
test/fixtures/ldiff/output.diff.missing_new_line2-u
|
|
108
|
+
test/fixtures/new-chef
|
|
109
|
+
test/fixtures/new-chef2
|
|
110
|
+
test/fixtures/old-chef
|
|
111
|
+
test/fixtures/old-chef2
|
|
112
|
+
test/test_block.rb
|
|
113
|
+
test/test_change.rb
|
|
114
|
+
test/test_diff.rb
|
|
115
|
+
test/test_helper.rb
|
|
116
|
+
test/test_hunk.rb
|
|
117
|
+
test/test_issues.rb
|
|
118
|
+
test/test_lcs.rb
|
|
119
|
+
test/test_ldiff.rb
|
|
120
|
+
test/test_patch.rb
|
|
121
|
+
test/test_sdiff.rb
|
|
122
|
+
test/test_traverse_balanced.rb
|
|
123
|
+
test/test_traverse_sequences.rb
|
data/README.md
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
# Diff::LCS
|
|
2
2
|
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
- code :: https://github.com/halostatue/diff-lcs
|
|
6
|
-
- bugs :: https://github.com/halostatue/diff-lcs/issues
|
|
7
|
-
- rdoc :: http://rubydoc.info/github/halostatue/diff-lcs
|
|
3
|
+
[![RubyGems Version][shield-gems]][rubygems] ![Coveralls][shield-coveralls]
|
|
4
|
+
[![Build Status][shield-ci]][ci-workflow]
|
|
8
5
|
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
- code :: <https://github.com/halostatue/diff-lcs>
|
|
7
|
+
- issues :: <https://github.com/halostatue/diff-lcs/issues>
|
|
8
|
+
- docs :: <https://halostatue.github.io/diff-lcs/>
|
|
9
|
+
- changelog :: <https://github.com/halostatue/diff-lcs/blob/main/CHANGELOG.md>
|
|
12
10
|
|
|
13
11
|
## Description
|
|
14
12
|
|
|
@@ -88,5 +86,11 @@ Subsequences</em>, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor
|
|
|
88
86
|
improvements to improve the speed. A simplified description of the algorithm,
|
|
89
87
|
originally written for the Perl version, was written by Mark-Jason Dominus.
|
|
90
88
|
|
|
89
|
+
[ci-workflow]: https://github.com/halostatue/diff-lcs/actions/workflows/ci.yml
|
|
90
|
+
[coveralls]: https://coveralls.io/github/halostatue/diff-lcs?branch=main
|
|
91
|
+
[perl]: https://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/
|
|
92
|
+
[rubygems]: https://rubygems.org/gems/diff-lcs
|
|
93
|
+
[shield-ci]: https://img.shields.io/github/actions/workflow/status/halostatue/diff-lcs/ci.yml?style=for-the-badge "Build Status"
|
|
94
|
+
[shield-coveralls]: https://img.shields.io/coverallsCoverage/github/halostatue/diff-lcs?style=for-the-badge
|
|
95
|
+
[shield-gems]: https://img.shields.io/gem/v/diff-lcs?style=for-the-badge "Version"
|
|
91
96
|
[smalltalk]: ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st
|
|
92
|
-
[perl]: http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/
|
data/Rakefile
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
require "rubygems"
|
|
2
|
-
require "rspec"
|
|
3
|
-
require "rspec/core/rake_task"
|
|
4
2
|
require "hoe"
|
|
5
3
|
require "rake/clean"
|
|
6
4
|
require "rdoc/task"
|
|
5
|
+
require "minitest/test_task"
|
|
7
6
|
|
|
8
7
|
Hoe.plugin :halostatue
|
|
9
|
-
Hoe.plugin :rubygems
|
|
10
8
|
|
|
11
9
|
Hoe.plugins.delete :debug
|
|
12
10
|
Hoe.plugins.delete :newb
|
|
13
11
|
Hoe.plugins.delete :publish
|
|
14
12
|
Hoe.plugins.delete :signing
|
|
13
|
+
Hoe.plugins.delete :test
|
|
15
14
|
|
|
16
15
|
hoe = Hoe.spec "diff-lcs" do
|
|
17
16
|
developer("Austin Ziegler", "halostatue@gmail.com")
|
|
@@ -27,10 +26,12 @@ hoe = Hoe.spec "diff-lcs" do
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
extra_dev_deps << ["hoe", "~> 4.0"]
|
|
30
|
-
extra_dev_deps << ["hoe-halostatue", "~>
|
|
31
|
-
extra_dev_deps << ["
|
|
29
|
+
extra_dev_deps << ["hoe-halostatue", "~> 3.0"]
|
|
30
|
+
extra_dev_deps << ["minitest", "~> 6.0"]
|
|
31
|
+
extra_dev_deps << ["minitest-autotest", "~> 1.0"]
|
|
32
|
+
extra_dev_deps << ["minitest-focus", "~> 1.1"]
|
|
32
33
|
extra_dev_deps << ["rake", ">= 10.0", "< 14"]
|
|
33
|
-
extra_dev_deps << ["rdoc", ">= 6.
|
|
34
|
+
extra_dev_deps << ["rdoc", ">= 6.0", "< 8"]
|
|
34
35
|
extra_dev_deps << ["simplecov", "~> 0.9"]
|
|
35
36
|
extra_dev_deps << ["simplecov-lcov", "~> 0.9"]
|
|
36
37
|
extra_dev_deps << ["standard", "~> 1.50"]
|
|
@@ -38,24 +39,33 @@ hoe = Hoe.spec "diff-lcs" do
|
|
|
38
39
|
extra_dev_deps << ["fasterer", "~> 0.11"]
|
|
39
40
|
end
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
Minitest::TestTask.create :test
|
|
43
|
+
Minitest::TestTask.create :coverage do |t|
|
|
44
|
+
formatters = <<-RUBY.split($/).join(" ")
|
|
45
|
+
SimpleCov::Formatter::MultiFormatter.new([
|
|
46
|
+
SimpleCov::Formatter::HTMLFormatter,
|
|
47
|
+
SimpleCov::Formatter::LcovFormatter,
|
|
48
|
+
SimpleCov::Formatter::SimpleFormatter
|
|
49
|
+
])
|
|
50
|
+
RUBY
|
|
51
|
+
t.test_prelude = <<-RUBY.split($/).join("; ")
|
|
52
|
+
require "simplecov"
|
|
53
|
+
require "simplecov-lcov"
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Rake::Task["spec"].execute
|
|
55
|
+
SimpleCov::Formatter::LcovFormatter.config do |config|
|
|
56
|
+
config.report_with_single_file = true
|
|
57
|
+
config.lcov_file_name = "lcov.info"
|
|
51
58
|
end
|
|
52
|
-
end
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
SimpleCov.start "test_frameworks" do
|
|
61
|
+
enable_coverage :branch
|
|
62
|
+
primary_coverage :branch
|
|
63
|
+
formatter #{formatters}
|
|
64
|
+
end
|
|
65
|
+
RUBY
|
|
66
|
+
end
|
|
56
67
|
|
|
57
|
-
task default: :
|
|
58
|
-
task test: :spec unless Rake::Task["test"].prereqs.include?("spec")
|
|
68
|
+
task default: :test
|
|
59
69
|
|
|
60
70
|
task :version do
|
|
61
71
|
require "diff/lcs/version"
|
|
@@ -64,10 +74,68 @@ end
|
|
|
64
74
|
|
|
65
75
|
RDoc::Task.new do |config|
|
|
66
76
|
config.title = "diff-lcs"
|
|
67
|
-
# config.main = "lib/diff/lcs.rb"
|
|
68
77
|
config.main = "README.md"
|
|
69
78
|
config.rdoc_dir = "doc"
|
|
70
|
-
config.rdoc_files = hoe.spec.require_paths
|
|
79
|
+
config.rdoc_files = hoe.spec.require_paths + hoe.spec.extra_rdoc_files -
|
|
80
|
+
FileList["integration/golden/*.txt", "Manifest.txt"].to_a
|
|
71
81
|
config.markup = "markdown"
|
|
72
82
|
end
|
|
73
83
|
task docs: :rerdoc
|
|
84
|
+
|
|
85
|
+
def rspec_to_golden(file)
|
|
86
|
+
File.join("integration/golden", File.basename(file, "_spec.rb")) + ".txt"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def normalize_rspec_output(data)
|
|
90
|
+
data
|
|
91
|
+
.gsub(/Randomized with seed \d+/, "Randomized with seed XXXXX")
|
|
92
|
+
.gsub(/Finished in [\d.]+ seconds/, "Finished in X.XXXXX seconds")
|
|
93
|
+
.gsub(/files took [\d.]+ seconds to load/, "files took X.XXXXX seconds to load")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def unbundled(&block)
|
|
97
|
+
if defined?(Bundler)
|
|
98
|
+
Bundler.with_unbundled_env(&block)
|
|
99
|
+
else
|
|
100
|
+
block.call
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
rspecs = FileList["integration/compare/*_spec.rb"]
|
|
105
|
+
|
|
106
|
+
namespace :integration do
|
|
107
|
+
desc "Compare RSpec output with and without diff-lcs 2"
|
|
108
|
+
task :compare do
|
|
109
|
+
require "tempfile"
|
|
110
|
+
base = Tempfile.create("baseline") { _1.path }
|
|
111
|
+
work = Tempfile.create("working") { _1.path }
|
|
112
|
+
|
|
113
|
+
unbundled { sh "gem install rspec" }
|
|
114
|
+
|
|
115
|
+
rspecs.to_a.each do |rspec_file|
|
|
116
|
+
basename = File.basename(rspec_file, "_spec.rb")
|
|
117
|
+
|
|
118
|
+
base_contents = unbundled { `integration/runner rspec #{rspec_file} 2>&1` }
|
|
119
|
+
base_contents = normalize_rspec_output(base_contents)
|
|
120
|
+
|
|
121
|
+
work_contents = unbundled { `integration/runner rspec -Ilib -rdiff/lcs #{rspec_file} 2>&1` }
|
|
122
|
+
work_contents = normalize_rspec_output(work_contents)
|
|
123
|
+
|
|
124
|
+
if base_contents == work_contents
|
|
125
|
+
puts "#{basename}: OK"
|
|
126
|
+
else
|
|
127
|
+
puts "#{basename}: FAIL"
|
|
128
|
+
|
|
129
|
+
File.write(base, base_contents)
|
|
130
|
+
File.write(work, work_contents)
|
|
131
|
+
|
|
132
|
+
unbundled { sh "integration/runner -Ilib bin/ldiff -U #{base} #{work}" }
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
desc "Run RSpec integration tests with diff-lcs 2.0"
|
|
139
|
+
task integration: ["integration:compare"] do
|
|
140
|
+
sh "rspec -Ilib -r diff/lcs integration/*_spec.rb"
|
|
141
|
+
end
|
data/SECURITY.md
CHANGED
|
@@ -30,16 +30,7 @@ All issues raised must be demonstrated on the minimum supported Ruby version.
|
|
|
30
30
|
Report vulnerabilities via the [Tidelift security contact][tidelift]. Tidelift
|
|
31
31
|
will coordinate the fix and disclosure.
|
|
32
32
|
|
|
33
|
-
Alternatively, create a [private vulnerability report][advisory] with GitHub
|
|
34
|
-
send an email to [security@ruby.halostatue.ca][email] with the text `diff-lcs`
|
|
35
|
-
in the subject. Emails sent to this address should be encrypted using [age][age]
|
|
36
|
-
with the following public key:
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
age1fc6ngxmn02m62fej5cl30lrvwmxn4k3q2atqu53aatekmnqfwumqj4g93w
|
|
40
|
-
```
|
|
33
|
+
Alternatively, create a [private vulnerability report][advisory] with GitHub.
|
|
41
34
|
|
|
42
35
|
[advisory]: https://github.com/halostatue/diff-lcs/security/advisories/new
|
|
43
|
-
[age]: https://github.com/FiloSottile/age
|
|
44
|
-
[email]: mailto:security@ruby.halostatue.ca
|
|
45
36
|
[tidelift]: https://tidelift.com/security
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Array diff failure" do
|
|
4
|
+
it "shows diff for array with different elements" do
|
|
5
|
+
expected = ["apple", "banana", "cherry", "date", "elderberry"]
|
|
6
|
+
actual = ["apple", "blueberry", "cherry", "date", "elderberry"]
|
|
7
|
+
|
|
8
|
+
expect(actual).to eq(expected)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Hash diff failure" do
|
|
4
|
+
it "shows diff for nested hash mismatch" do
|
|
5
|
+
expected = {
|
|
6
|
+
name: "John",
|
|
7
|
+
age: 30,
|
|
8
|
+
address: {
|
|
9
|
+
city: "New York",
|
|
10
|
+
zip: "10001"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
actual = {
|
|
15
|
+
name: "John",
|
|
16
|
+
age: 35,
|
|
17
|
+
address: {
|
|
18
|
+
city: "Boston",
|
|
19
|
+
zip: "10001"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
expect(actual).to eq(expected)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe "String diff failure" do
|
|
4
|
+
it "shows diff for multiline string mismatch" do
|
|
5
|
+
expected = "line1\nline2\nline3\nline4\nline5\n"
|
|
6
|
+
actual = "line1\nchanged\nline3\nline4\nline5\n"
|
|
7
|
+
|
|
8
|
+
expect(actual).to eq(expected)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Integration test to verify diff-lcs 2.0 works with RSpec's differ
|
|
4
|
+
# This runs RSpec with diff-lcs 1.x installed but loads the repo version
|
|
5
|
+
|
|
6
|
+
RSpec.describe "Diff::LCS 2.0 with RSpec::Support::Differ" do
|
|
7
|
+
let(:differ) { RSpec::Support::Differ.new }
|
|
8
|
+
|
|
9
|
+
it "produces diff output for multiline strings" do
|
|
10
|
+
expected = "foo\nzap\nbar\n"
|
|
11
|
+
actual = "foo\nbar\nzap\n"
|
|
12
|
+
|
|
13
|
+
diff = differ.diff(actual, expected)
|
|
14
|
+
|
|
15
|
+
expect(diff).to be_a(String)
|
|
16
|
+
expect(diff).not_to be_empty
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "handles identical strings" do
|
|
20
|
+
str = "same\n"
|
|
21
|
+
diff = differ.diff(str, str)
|
|
22
|
+
|
|
23
|
+
# May return empty or just newline depending on implementation
|
|
24
|
+
expect(diff.strip).to be_empty
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Integration test for RSpec expectation failures that use diff-lcs
|
|
4
|
+
# Verifies that diff output is generated correctly with diff-lcs 2.0
|
|
5
|
+
|
|
6
|
+
RSpec.describe "Diff::LCS 2.0 with RSpec expectations" do
|
|
7
|
+
it "produces diff for failed multiline string equality" do
|
|
8
|
+
expect {
|
|
9
|
+
expect("foo\nbar\nbaz").to eq("foo\nqux\nbaz")
|
|
10
|
+
}.to raise_error(RSpec::Expectations::ExpectationNotMetError) do |error|
|
|
11
|
+
expect(error.message).to include("Diff:")
|
|
12
|
+
expect(error.message).to match(/[-+](qux|bar)/)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "produces diff for failed hash equality" do
|
|
17
|
+
expect {
|
|
18
|
+
expect({a: 1, b: 2}).to eq({a: 1, b: 3})
|
|
19
|
+
}.to raise_error(RSpec::Expectations::ExpectationNotMetError) do |error|
|
|
20
|
+
expect(error.message).to include("Diff:")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "does not crash when comparing complex objects" do
|
|
25
|
+
obj1 = {a: [1, 2, 3], b: "test"}
|
|
26
|
+
obj2 = {a: [1, 4, 3], b: "test"}
|
|
27
|
+
|
|
28
|
+
expect {
|
|
29
|
+
expect(obj1).to eq(obj2)
|
|
30
|
+
}.to raise_error(RSpec::Expectations::ExpectationNotMetError)
|
|
31
|
+
end
|
|
32
|
+
end
|
data/integration/runner
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "rbconfig"
|
|
4
|
+
require "rubygems"
|
|
5
|
+
|
|
6
|
+
if ENV["CI"]
|
|
7
|
+
vendor_dir = Dir.glob(File.join(Dir.pwd, "vendor", "bundle", "{ruby,jruby,truffleruby}", "*")).max
|
|
8
|
+
unless vendor_dir && Dir.exist?(vendor_dir)
|
|
9
|
+
fail "vendor bundle not found; expected vendor/bundle/ruby/*"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Prefer vendored gems, fall back to system gem dir
|
|
13
|
+
ENV["GEM_HOME"] = vendor_dir
|
|
14
|
+
ENV["GEM_PATH"] = "#{vendor_dir}:#{Gem.default_dir}"
|
|
15
|
+
|
|
16
|
+
# Ensure Gem.path is updated for the running process (affects Gem.lookup)
|
|
17
|
+
Gem.use_paths(ENV["GEM_HOME"], ENV["GEM_PATH"].split(":"))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
exec RbConfig.ruby, "-S", *ARGV
|