Skip to content

Commit

Permalink
Autofix Rubocop Layout/SpaceInsideParens
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni committed Mar 3, 2023
1 parent 6f57e16 commit be0935e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
8 changes: 0 additions & 8 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ Layout/MultilineHashBraceLayout:
- 'test/sample/file.rb'
- 'test/tests.rb'

# Offense count: 12
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: space, compact, no_space
Layout/SpaceInsideParens:
Exclude:
- 'test/tests.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowSafeAssignment.
Expand Down
24 changes: 12 additions & 12 deletions test/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1195,52 +1195,52 @@ def test_locate_qual_index
Ox.default_options = $ox_object_options
doc = Ox.parse(locate_xml)
nodes = doc.locate('Family/Pete/?[0]')
assert_equal(['Kid1'], nodes.map { |e| e.value } )
assert_equal(['Kid1'], nodes.map { |e| e.value })
nodes = doc.locate('Family/Pete/?[1]')
assert_equal(['Nicole'], nodes.map { |e| e.value } )
assert_equal(['Nicole'], nodes.map { |e| e.value })
nodes = doc.locate('Family/Pete/?[2]')
assert_equal(['Kid2'], nodes.map { |e| e.value } )
assert_equal(['Kid2'], nodes.map { |e| e.value })
end

def test_locate_qual_less
Ox.default_options = $ox_object_options
doc = Ox.parse(locate_xml)
nodes = doc.locate('Family/Pete/?[<1]')
assert_equal(['Kid1'], nodes.map { |e| e.value } )
assert_equal(['Kid1'], nodes.map { |e| e.value })
end

def test_locate_qual_great
Ox.default_options = $ox_object_options
doc = Ox.parse(locate_xml)
nodes = doc.locate('Family/Pete/?[>1]')
assert_equal(['Kid2', 'Pamela'], nodes.map { |e| e.value } )
assert_equal(['Kid2', 'Pamela'], nodes.map { |e| e.value })
end

def test_locate_qual_last
Ox.default_options = $ox_object_options
doc = Ox.parse(locate_xml)
nodes = doc.locate('Family/Pete/?[-1]')
assert_equal(['Pamela'], nodes.map { |e| e.value } )
assert_equal(['Pamela'], nodes.map { |e| e.value })
end

def test_locate_qual_last_attr
Ox.default_options = $ox_object_options
doc = Ox.parse(locate_xml)
nodes = doc.locate('Family/Pete/?[-2]/@age')
assert_equal(['31'], nodes )
assert_equal(['31'], nodes)
end

def test_locate_attr_match
Ox.default_options = $ox_object_options
doc = Ox.parse(locate_xml)
nodes = doc.locate('Family/Pete/?[@age=32]')
assert_equal(['Kid1'], nodes.map { |e| e.value } )
assert_equal(['Kid1'], nodes.map { |e| e.value })

nodes = doc.locate('Family/Pete/Kid1[@age=32]')
assert_equal(['Kid1'], nodes.map { |e| e.value } )
assert_equal(['Kid1'], nodes.map { |e| e.value })

nodes = doc.locate('Family/Pete/Kid1[@age=31]')
assert_equal([], nodes.map { |e| e.value } )
assert_equal([], nodes.map { |e| e.value })
end

def test_locate_attr_presence
Expand Down Expand Up @@ -1418,7 +1418,7 @@ def test_namespace_no_strip
def test_namespace_strip_wild
Ox.default_options = $ox_generic_options
results = []
doc = Ox.load('<spaced:one><two spaced:out="no">inside</two></spaced:one>', :strip_namespace => true )
doc = Ox.load('<spaced:one><two spaced:out="no">inside</two></spaced:one>', :strip_namespace => true)
assert_equal(%|
<one>
<two out="no">inside</two>
Expand Down Expand Up @@ -1890,7 +1890,7 @@ def test_key_mod
}
ep = lambda { |k| k.downcase }
ap = lambda { |k| 'a' + k }
doc = Ox.load(xml, mode: :generic, attr_key_mod: ap, element_key_mod: ep )
doc = Ox.load(xml, mode: :generic, attr_key_mod: ap, element_key_mod: ep)
xml2 = Ox.dump(doc)
assert_equal(%{
<changeme ax="A"/>
Expand Down

0 comments on commit be0935e

Please sign in to comment.