File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ def major_or_minor_and_tail(s)
102102 if s . nil? || s . empty?
103103 major_or_minor , tail = nil , nil
104104 else
105+ raise "Invalid version '#{ s } ': must not end in '.'" if s [ -1 ] == '.'
105106 tokens = s . match ( /^([^\. ]+)(?:\. (.*))?/ )
106107
107108 major_or_minor , tail = tokens [ 1 ..-1 ]
@@ -116,6 +117,7 @@ def micro_and_qualifier(s)
116117 if s . nil? || s . empty?
117118 micro , qualifier = nil , nil
118119 else
120+ raise "Invalid version '#{ s } ': must not end in '_'" if s [ -1 ] == '_'
119121 tokens = s . match ( /^([^\_ ]+)(?:_(.*))?/ )
120122
121123 micro , qualifier = tokens [ 1 ..-1 ]
Original file line number Diff line number Diff line change 129129 expect { JavaBuildpack ::VersionResolver . resolve ( '1.6.0_25' , [ '+' ] ) } . to raise_error
130130 end
131131
132+ it 'should raise an exception when a version ends with a component separator' do
133+ expect { JavaBuildpack ::VersionResolver . resolve ( '1.' , [ '1.' ] ) } . to raise_error
134+ expect { JavaBuildpack ::VersionResolver . resolve ( '1.7.' , [ '1.7.' ] ) } . to raise_error
135+ expect { JavaBuildpack ::VersionResolver . resolve ( '1.7.0_' , [ '1.7.0_' ] ) } . to raise_error
136+ end
137+
132138end
You can’t perform that action at this time.
0 commit comments