summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2021-12-23 10:50:34 -0500
committerAustin Ziegler <austin@zieglers.ca>2022-07-04 20:26:10 -0400
commit089f932537a540af9c27dd03caf30eff6b4a0306 (patch)
tree9107279885b3650b5c655840ea690c24c9683852 /spec
parentcb9bebb30477e815cdbe8f8460f227f0940599a1 (diff)
downloaddiff-lcs-089f932537a540af9c27dd03caf30eff6b4a0306.tar.gz
standardrb --only Layout/ExtraSpacing --fix and ignore
Diffstat (limited to 'spec')
-rw-r--r--spec/change_spec.rb52
-rw-r--r--spec/hunk_spec.rb4
-rw-r--r--spec/sdiff_spec.rb2
-rw-r--r--spec/spec_helper.rb10
-rw-r--r--spec/traverse_balanced_spec.rb2
5 files changed, 40 insertions, 30 deletions
diff --git a/spec/change_spec.rb b/spec/change_spec.rb
index 237f621..42533ae 100644
--- a/spec/change_spec.rb
+++ b/spec/change_spec.rb
@@ -5,62 +5,62 @@ require "spec_helper"
describe Diff::LCS::Change do
describe "an add" do
subject { described_class.new("+", 0, "element") }
- it { should_not be_deleting }
- it { should be_adding }
- it { should_not be_unchanged }
- it { should_not be_changed }
+ it { should_not be_deleting }
+ it { should be_adding }
+ it { should_not be_unchanged }
+ it { should_not be_changed }
it { should_not be_finished_a }
it { should_not be_finished_b }
end
describe "a delete" do
subject { described_class.new("-", 0, "element") }
- it { should be_deleting }
- it { should_not be_adding }
- it { should_not be_unchanged }
- it { should_not be_changed }
+ it { should be_deleting }
+ it { should_not be_adding }
+ it { should_not be_unchanged }
+ it { should_not be_changed }
it { should_not be_finished_a }
it { should_not be_finished_b }
end
describe "an unchanged" do
subject { described_class.new("=", 0, "element") }
- it { should_not be_deleting }
- it { should_not be_adding }
- it { should be_unchanged }
- it { should_not be_changed }
+ it { should_not be_deleting }
+ it { should_not be_adding }
+ it { should be_unchanged }
+ it { should_not be_changed }
it { should_not be_finished_a }
it { should_not be_finished_b }
end
describe "a changed" do
subject { described_class.new("!", 0, "element") }
- it { should_not be_deleting }
- it { should_not be_adding }
- it { should_not be_unchanged }
- it { should be_changed }
+ it { should_not be_deleting }
+ it { should_not be_adding }
+ it { should_not be_unchanged }
+ it { should be_changed }
it { should_not be_finished_a }
it { should_not be_finished_b }
end
describe "a finished_a" do
subject { described_class.new(">", 0, "element") }
- it { should_not be_deleting }
- it { should_not be_adding }
- it { should_not be_unchanged }
- it { should_not be_changed }
- it { should be_finished_a }
+ it { should_not be_deleting }
+ it { should_not be_adding }
+ it { should_not be_unchanged }
+ it { should_not be_changed }
+ it { should be_finished_a }
it { should_not be_finished_b }
end
describe "a finished_b" do
subject { described_class.new("<", 0, "element") }
- it { should_not be_deleting }
- it { should_not be_adding }
- it { should_not be_unchanged }
- it { should_not be_changed }
+ it { should_not be_deleting }
+ it { should_not be_adding }
+ it { should_not be_unchanged }
+ it { should_not be_changed }
it { should_not be_finished_a }
- it { should be_finished_b }
+ it { should be_finished_b }
end
describe "as array" do
diff --git a/spec/hunk_spec.rb b/spec/hunk_spec.rb
index 339f4ab..c52a6fd 100644
--- a/spec/hunk_spec.rb
+++ b/spec/hunk_spec.rb
@@ -8,8 +8,8 @@ if String.method_defined?(:encoding)
describe Diff::LCS::Hunk do
let(:old_data) { ["Tu a un carté avec {count} itéms".encode("UTF-16LE")] }
let(:new_data) { ["Tu a un carte avec {count} items".encode("UTF-16LE")] }
- let(:pieces) { Diff::LCS.diff old_data, new_data }
- let(:hunk) { Diff::LCS::Hunk.new(old_data, new_data, pieces[0], 3, 0) }
+ let(:pieces) { Diff::LCS.diff old_data, new_data }
+ let(:hunk) { Diff::LCS::Hunk.new(old_data, new_data, pieces[0], 3, 0) }
it "produces a unified diff from the two pieces" do
expected = <<-EXPECTED.gsub(/^\s+/, "").encode("UTF-16LE").chomp
diff --git a/spec/sdiff_spec.rb b/spec/sdiff_spec.rb
index 9750519..aded301 100644
--- a/spec/sdiff_spec.rb
+++ b/spec/sdiff_spec.rb
@@ -27,6 +27,7 @@ describe "Diff::LCS.sdiff" do
let(:s1) { %w[abc def yyy xxx ghi jkl] }
let(:s2) { %w[abc dxf xxx ghi jkl] }
let(:result) {
+ # standard:disable Layout/ExtraSpacing
[
["=", [0, "abc"], [0, "abc"]],
["!", [1, "def"], [1, "dxf"]],
@@ -35,6 +36,7 @@ describe "Diff::LCS.sdiff" do
["=", [4, "ghi"], [3, "ghi"]],
["=", [5, "jkl"], [4, "jkl"]]
]
+ # standard:enable Layout/ExtraSpacing
}
it_has_behavior "compare sequences correctly"
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index af5ec23..55a7773 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -32,8 +32,8 @@ if ENV["COVERAGE"]
end
end
-file = Pathname.new(__FILE__).expand_path
-path = file.parent
+file = Pathname.new(__FILE__).expand_path
+path = file.parent
parent = path.parent
$:.unshift parent.join("lib")
@@ -107,6 +107,7 @@ module Diff::LCS::SpecHelper
end
def correct_forward_diff
+ # standard:disable Layout/ExtraSpacing
[
[
["-", 0, "a"]
@@ -129,9 +130,11 @@ module Diff::LCS::SpecHelper
["+", 11, "t"]
]
]
+ # standard:enable Layout/ExtraSpacing
end
def correct_backward_diff
+ # standard:disable Layout/ExtraSpacing
[
[
["+", 0, "a"]
@@ -154,9 +157,11 @@ module Diff::LCS::SpecHelper
["-", 11, "t"]
]
]
+ # standard:enable Layout/ExtraSpacing
end
def correct_forward_sdiff
+ # standard:disable Layout/ExtraSpacing
[
["-", [0, "a"], [0, nil]],
["=", [1, "b"], [0, "b"]],
@@ -172,6 +177,7 @@ module Diff::LCS::SpecHelper
["!", [9, "p"], [10, "s"]],
["+", [10, nil], [11, "t"]]
]
+ # standard:enable Layout/ExtraSpacing
end
def reverse_sdiff(forward_sdiff)
diff --git a/spec/traverse_balanced_spec.rb b/spec/traverse_balanced_spec.rb
index 4956acf..3a3f677 100644
--- a/spec/traverse_balanced_spec.rb
+++ b/spec/traverse_balanced_spec.rb
@@ -272,6 +272,7 @@ describe "Diff::LCS.traverse_balanced" do
describe "strings %q(abcd efgh ijkl mnopqrstuvwxyz) & %q()" do
s1 = "abcd efgh ijkl mnopqrstuvwxyz"
s2 = ""
+ # standard:disable Layout/ExtraSpacing
result = [
["<", 0, 0],
["<", 1, 0],
@@ -303,6 +304,7 @@ describe "Diff::LCS.traverse_balanced" do
["<", 27, 0],
["<", 28, 0]
]
+ # standard:enable Layout/ExtraSpacing
it_has_behavior "with a #change callback", s1, s2, result
it_has_behavior "without a #change callback", s1, s2, result