minitest-difftastic 0.1.1 → 0.1.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/Gemfile.lock +4 -4
- data/README.md +2 -2
- data/lib/minitest/difftastic/version.rb +1 -1
- data/lib/minitest/difftastic_plugin.rb +6 -29
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64691f1a85d150dae7c9c7894282b4443d089f4c7538c407073d48af5dc15f1c
|
4
|
+
data.tar.gz: 0f8f076b354274432deae363a4e6b892b788a07f92a7523c445efa79a3b9e9a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff9ba0933ff4f965554e2adf8195c2768388425301dcc4b8e53ee070d62aea9cb88ed0e120e0f05c9c8ae8e642ed3561f4cd4b942682712a9aca910ec308b8ee
|
7
|
+
data.tar.gz: 3b7e5c719343600c1c3aff4c071793e9d5087b53b78d642371adb84c1c4a5d12a5968645f5079fbc0270da42fa58b1f06a6b3c721c712664ceda1dd44ab9a957
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
minitest-difftastic (0.1.
|
5
|
-
difftastic (~> 0.
|
4
|
+
minitest-difftastic (0.1.2)
|
5
|
+
difftastic (~> 0.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
11
|
base64 (0.1.1)
|
12
|
-
difftastic (0.0
|
13
|
-
difftastic (0.0
|
12
|
+
difftastic (0.2.0-arm64-darwin)
|
13
|
+
difftastic (0.2.0-x86_64-linux)
|
14
14
|
json (2.6.3)
|
15
15
|
language_server-protocol (3.17.0.3)
|
16
16
|
minitest (5.25.4)
|
data/README.md
CHANGED
@@ -22,10 +22,10 @@ Also works for Rails tests using `ActiveSupport::TestCase`.
|
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
25
|
-
Install the gem and add to the application's Gemfile by executing:
|
25
|
+
Install the gem and add to the application's Gemfile `test` group by executing:
|
26
26
|
|
27
27
|
```shell
|
28
|
-
bundle add minitest-difftastic
|
28
|
+
bundle add minitest-difftastic --group=test
|
29
29
|
```
|
30
30
|
|
31
31
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
@@ -5,44 +5,21 @@ require "difftastic"
|
|
5
5
|
# TODO: use refinements
|
6
6
|
module Minitest
|
7
7
|
module Assertions
|
8
|
-
MINIMUM_OFFSET = 29
|
9
|
-
TAB_WIDTH = 2
|
10
|
-
|
11
|
-
RED = "\e[91;1m"
|
12
|
-
GREEN = "\e[92;1m"
|
13
|
-
RESET = "\e[0m"
|
14
|
-
|
15
8
|
DIFFER = ::Difftastic::Differ.new(
|
16
9
|
color: :always,
|
17
|
-
tab_width:
|
18
|
-
syntax_highlight: :off
|
10
|
+
tab_width: 2,
|
11
|
+
syntax_highlight: :off,
|
12
|
+
left_label: "Expected",
|
13
|
+
right_label: "Actual"
|
19
14
|
)
|
20
15
|
|
21
16
|
alias diff_original diff
|
22
17
|
|
23
18
|
def diff(exp, act)
|
24
|
-
|
25
|
-
offset = actual_text_offset(diff.split("\n").first)
|
26
|
-
|
27
|
-
"\n#{RED}#{"Expected".ljust(offset)} #{GREEN}Actual#{RESET}\n#{diff}"
|
19
|
+
DIFFER.diff_objects(exp, act)
|
28
20
|
rescue StandardError => e
|
29
|
-
puts "Minitest::
|
21
|
+
puts "Minitest::Difftastic error: #{e.inspect} (#{e.backtrace[0]})"
|
30
22
|
diff_original(exp, act)
|
31
23
|
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def strip_ansi_formatting(string)
|
36
|
-
string.to_s.gsub(/\e\[[0-9;]*m/, "")
|
37
|
-
end
|
38
|
-
|
39
|
-
def actual_text_offset(line)
|
40
|
-
stripped_line = strip_ansi_formatting(line)
|
41
|
-
_lhs, rhs = stripped_line.split(/\s{#{TAB_WIDTH},}/, 2)
|
42
|
-
|
43
|
-
offset = stripped_line.index("#{" " * TAB_WIDTH}#{rhs}") + TAB_WIDTH - 1
|
44
|
-
|
45
|
-
[MINIMUM_OFFSET, offset].max
|
46
|
-
end
|
47
24
|
end
|
48
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-difftastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Roth
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: difftastic
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: '0.2'
|
27
27
|
description: Minitest Plugin to use difftastic for failed assertions
|
28
28
|
email:
|
29
29
|
- marco.roth@intergga.ch
|