Skip to content

Commit df85d35

Browse files
committed
Fix CI
By migrating to maxitest, since Quickdraw cannot install the difftastic gem properly since Quickdraw itself depends on it.
1 parent 0ef82a5 commit df85d35

14 files changed

+317
-287
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ gem "rake"
88
gem "rubyzip"
99
gem "rubocop"
1010
gem "ruby-lsp"
11-
gem "quickdraw", git: "https://github.com/joeldrapper/quickdraw.git"
11+
gem "maxitest"
1212
gem "openssl", "~> 4.0"

Gemfile.lock

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
GIT
2-
remote: https://github.com/joeldrapper/quickdraw.git
3-
revision: 850ed1c36d5d61f6b4a860ef5dc8cdbe97942397
4-
specs:
5-
quickdraw (0.1.0)
6-
difftastic (~> 0.1)
7-
io-watch (~> 0.6)
8-
91
PATH
102
remote: .
113
specs:
@@ -18,11 +10,13 @@ GEM
1810
ast (2.4.3)
1911
dispersion (0.2.0)
2012
prism
21-
io-watch (0.6.3)
2213
json (2.18.0)
2314
language_server-protocol (3.17.0.5)
2415
lint_roller (1.1.0)
2516
logger (1.6.5)
17+
maxitest (6.1.0)
18+
minitest (>= 5.20.0, < 5.28.0)
19+
minitest (5.27.0)
2620
openssl (4.0.0)
2721
parallel (1.27.0)
2822
parser (3.3.10.0)
@@ -75,8 +69,8 @@ PLATFORMS
7569

7670
DEPENDENCIES
7771
difftastic!
72+
maxitest
7873
openssl (~> 4.0)
79-
quickdraw!
8074
rake
8175
rubocop
8276
ruby-lsp

Rakefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
# frozen_string_literal: true
22

33
require "bundler/gem_tasks"
4+
require "rake/testtask"
5+
6+
Rake::TestTask.new(:test) do |t|
7+
t.libs << "test"
8+
t.libs << "lib"
9+
t.test_files = FileList["test/**/*_test.rb"]
10+
end
11+
12+
task default: :test

test/diff_files.test.rb

Lines changed: 0 additions & 92 deletions
This file was deleted.

test/diff_files_test.rb

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# frozen_string_literal: true
2+
3+
require_relative "test_helper"
4+
5+
class DiffFilesTest < Minitest::Spec
6+
it "diff_files nil" do
7+
differ = Difftastic::Differ.new(color: :never, tab_width: 2)
8+
output = differ.diff_files(nil, nil)
9+
10+
assert_nil output
11+
end
12+
13+
it "diff_files String" do
14+
differ = Difftastic::Differ.new(color: :never, tab_width: 2)
15+
a_path = "a_path_#{rand(10000)}.txt"
16+
b_path = "b_path_#{rand(10000)}.txt"
17+
18+
File.write(a_path, "A")
19+
File.write(b_path, "B")
20+
21+
output = differ.diff_files(a_path, b_path)
22+
23+
begin
24+
assert_equal "1 A 1 B", output
25+
ensure
26+
FileUtils.rm(a_path)
27+
FileUtils.rm(b_path)
28+
end
29+
end
30+
31+
it "diff_files Pathname" do
32+
differ = Difftastic::Differ.new(color: :never, tab_width: 2)
33+
a_path = "a_path_#{rand(10000)}.txt"
34+
b_path = "b_path_#{rand(10000)}.txt"
35+
36+
a = Pathname.new(a_path)
37+
b = Pathname.new(b_path)
38+
39+
a.write("A")
40+
b.write("B")
41+
42+
output = differ.diff_files(a, b)
43+
44+
begin
45+
assert_equal "1 A 1 B", output
46+
ensure
47+
FileUtils.rm(a_path)
48+
FileUtils.rm(b_path)
49+
end
50+
end
51+
52+
it "diff_files File" do
53+
differ = Difftastic::Differ.new(color: :never, tab_width: 2)
54+
a_path = "a_path_#{rand(10000)}.txt"
55+
b_path = "b_path_#{rand(10000)}.txt"
56+
57+
a = File.new(a_path, "w")
58+
b = File.new(b_path, "w")
59+
60+
a.write("A")
61+
b.write("B")
62+
63+
a.rewind
64+
b.rewind
65+
66+
output = differ.diff_files(a, b)
67+
68+
begin
69+
assert_equal "1 A 1 B", output
70+
ensure
71+
a.close
72+
b.close
73+
74+
FileUtils.rm(a_path)
75+
FileUtils.rm(b_path)
76+
end
77+
end
78+
79+
it "diff_files Tempfile" do
80+
differ = Difftastic::Differ.new(color: :never, tab_width: 2)
81+
a = Tempfile.new("a.txt")
82+
b = Tempfile.new("b.txt")
83+
84+
a.write("A")
85+
a.rewind
86+
87+
b.write("B")
88+
b.rewind
89+
90+
output = differ.diff_files(a, b)
91+
92+
begin
93+
assert_equal "1 A 1 B", output
94+
ensure
95+
a.unlink
96+
b.unlink
97+
end
98+
end
99+
end

test/difftastic.test.rb

Lines changed: 0 additions & 55 deletions
This file was deleted.

test/difftastic_test.rb

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# frozen_string_literal: true
2+
3+
require_relative "test_helper"
4+
5+
class DifftasticTest < Minitest::Spec
6+
it "diff_objects with color" do
7+
output = Difftastic::Differ.new(color: :always, tab_width: 2).diff_objects(
8+
[1, 2, 3],
9+
[3, 2, 1]
10+
)
11+
12+
assert_equal "\e[91;1m1 \e[0m[\e[91m1\e[0m, 2, \e[91m3\e[0m] \e[92;1m1 \e[0m[\e[92m3\e[0m, 2, \e[92m1\e[0m]", output
13+
end
14+
15+
it "empty set" do
16+
output = Difftastic::Differ.new.diff_objects(
17+
Set.new,
18+
Set.new([1, 2, 3])
19+
)
20+
21+
assert_equal %(1 Set[] 1 Set[1, 2, 3]), output
22+
end
23+
24+
it "empty array" do
25+
output = Difftastic::Differ.new(color: :never, tab_width: 2).diff_objects(
26+
[],
27+
[3, 2, 1]
28+
)
29+
30+
assert_equal "1 [] 1 [3, 2, 1]", output
31+
end
32+
33+
it "empty string" do
34+
output = Difftastic::Differ.new(color: :never, tab_width: 2).diff_objects(
35+
"",
36+
"String",
37+
)
38+
39+
assert_equal %(1 "" 1 "String"), output
40+
end
41+
42+
it "empty symbol" do
43+
output = Difftastic::Differ.new(color: :never, tab_width: 2).diff_objects(
44+
:"",
45+
:Symbol
46+
)
47+
48+
assert_equal %(1 :"" 1 :Symbol), output
49+
end
50+
51+
it "html" do
52+
a = "<html>\n\t<body>\n\t\t<h1>Hello, world!</h1>\n\t</body>\n</html>"
53+
b = "<html>\n\t<body>\n\t\t<h1>Goodbye, world!</h1>\n\t</body>\n</html>"
54+
55+
output = Difftastic::Differ.new(color: :always, tab_width: 2).diff_html(a, b)
56+
57+
assert_equal "\e[2m1 \e[0m<\e[1mhtml\e[0m> \e[2m1 \e[0m<\e[1mhtml\e[0m>\n\e[2m2 \e[0m <\e[1mbody\e[0m> \e[2m2 \e[0m <\e[1mbody\e[0m>\n\e[91;1m3 \e[0m <\e[1mh1\e[0m>\e[91;1;4mHello\e[0m\e[91m,\e[0m\e[91m \e[0m\e[91mworld\e[0m\e[91m!\e[0m</\e[1mh1\e[0m> \e[92;1m3 \e[0m <\e[1mh1\e[0m>\e[92;1;4mGoodbye\e[0m\e[92m,\e[0m\e[92m \e[0m\e[92mworld\e[0m\e[92m!\e[0m</\e[1mh1\e[0m>\n\e[2m4 \e[0m </\e[1mbody\e[0m> \e[2m4 \e[0m </\e[1mbody\e[0m>\n\e[2m5 \e[0m</\e[1mhtml\e[0m> \e[2m5 \e[0m</\e[1mhtml\e[0m>", output
58+
end
59+
end

test/display.test.rb

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)