File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ def abbreviate(path_or_parsed)
47
47
end
48
48
components = [ ]
49
49
component = nil
50
- previous_op = nil
51
50
while parsed . size > 0
52
51
op = parsed . shift
53
52
case op
@@ -119,10 +118,12 @@ def abbreviate(path_or_parsed)
119
118
component << op . inspect
120
119
component << ")"
121
120
end
122
- previous_op = op
123
121
end
124
- if components == [ "" ]
122
+ case components
123
+ when [ "" ]
125
124
"/"
125
+ when [ "" , "" ]
126
+ "//"
126
127
else
127
128
components . join ( "/" )
128
129
end
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ def test_document
16
16
abbreviate ( "/" ) )
17
17
end
18
18
19
+ def test_descendant_or_self_only
20
+ assert_equal ( "//" ,
21
+ abbreviate ( "/descendant-or-self::node()/" ) )
22
+ end
23
+
19
24
def test_descendant_or_self_absolute
20
25
assert_equal ( "//a/b" ,
21
26
abbreviate ( "/descendant-or-self::node()/a/b" ) )
You can’t perform that action at this time.
0 commit comments