fix(maven): Correct order for versions with different length (#13552)

This commit is contained in:
Sergei Zharinov 2022-01-14 09:32:55 +03:00 committed by GitHub
parent fe72cd75c6
commit 68dfc27f39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -177,6 +177,13 @@ describe('versioning/maven/compare', () => {
${'1-milestone'} | ${'1-snapshot'} ${'1-milestone'} | ${'1-snapshot'}
${'1-abc'} | ${'1-xyz'} ${'1-abc'} | ${'1-xyz'}
${'Hoxton.RELEASE'} | ${'Hoxton.SR1'} ${'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 }) => { `('$x < $y', ({ x, y }) => {
expect(compare(x, y)).toBe(-1); expect(compare(x, y)).toBe(-1);
expect(compare(y, x)).toBe(1); expect(compare(y, x)).toBe(1);

View file

@ -140,7 +140,7 @@ function tokenize(versionStr: string, preserveMinorZeroes = false): Token[] {
} }
function nullFor(token: Token): Token { function nullFor(token: Token): Token {
return token.prefix === PREFIX_DOT return token.type === TYPE_NUMBER
? { ? {
prefix: token.prefix, prefix: token.prefix,
type: TYPE_NUMBER, type: TYPE_NUMBER,