Skip to content

Commit

Permalink
fix(maven): Correct order for versions with different length (#13552)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov authored Jan 14, 2022
1 parent fe72cd7 commit 68dfc27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/versioning/maven/compare.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ describe('versioning/maven/compare', () => {
${'1-milestone'} | ${'1-snapshot'}
${'1-abc'} | ${'1-xyz'}
${'Hoxton.RELEASE'} | ${'Hoxton.SR1'}
${'2.0'} | ${'2.0-PFD2'}
${'2.0'} | ${'2.0.SP1'}
${'2.0-PFD2'} | ${'2.0.SP1'}
${'1.3.9'} | ${'1.3.9.fix-log4j2'}
${'1-0.alpha'} | ${'1'}
${'1-0.beta'} | ${'1'}
${'1-0.alpha'} | ${'1-0.beta'}
`('$x < $y', ({ x, y }) => {
expect(compare(x, y)).toBe(-1);
expect(compare(y, x)).toBe(1);
Expand Down
2 changes: 1 addition & 1 deletion lib/versioning/maven/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function tokenize(versionStr: string, preserveMinorZeroes = false): Token[] {
}

function nullFor(token: Token): Token {
return token.prefix === PREFIX_DOT
return token.type === TYPE_NUMBER
? {
prefix: token.prefix,
type: TYPE_NUMBER,
Expand Down

0 comments on commit 68dfc27

Please sign in to comment.