mirror of https://github.com/apache/lucene.git
Fix backward compat tests in core
This commit is contained in:
parent
f2b2bfc414
commit
cf8c3c4f02
|
@ -71,8 +71,8 @@ public class TestSegmentInfos extends LuceneTestCase {
|
|||
SegmentInfo info =
|
||||
new SegmentInfo(
|
||||
dir,
|
||||
Version.LUCENE_10_0_0,
|
||||
Version.LUCENE_10_0_0,
|
||||
Version.LUCENE_11_0_0,
|
||||
Version.LUCENE_11_0_0,
|
||||
"_0",
|
||||
1,
|
||||
false,
|
||||
|
@ -90,7 +90,7 @@ public class TestSegmentInfos extends LuceneTestCase {
|
|||
sis.add(commitInfo);
|
||||
sis.commit(dir);
|
||||
sis = SegmentInfos.readLatestCommit(dir);
|
||||
assertEquals(Version.LUCENE_10_0_0, sis.getMinSegmentLuceneVersion());
|
||||
assertEquals(Version.LUCENE_11_0_0, sis.getMinSegmentLuceneVersion());
|
||||
assertEquals(Version.LATEST, sis.getCommitLuceneVersion());
|
||||
dir.close();
|
||||
}
|
||||
|
@ -106,8 +106,8 @@ public class TestSegmentInfos extends LuceneTestCase {
|
|||
SegmentInfo info =
|
||||
new SegmentInfo(
|
||||
dir,
|
||||
Version.LUCENE_10_0_0,
|
||||
Version.LUCENE_10_0_0,
|
||||
Version.LUCENE_11_0_0,
|
||||
Version.LUCENE_11_0_0,
|
||||
"_0",
|
||||
1,
|
||||
false,
|
||||
|
@ -126,8 +126,8 @@ public class TestSegmentInfos extends LuceneTestCase {
|
|||
info =
|
||||
new SegmentInfo(
|
||||
dir,
|
||||
Version.LUCENE_10_0_0,
|
||||
Version.LUCENE_10_0_0,
|
||||
Version.LUCENE_11_0_0,
|
||||
Version.LUCENE_11_0_0,
|
||||
"_1",
|
||||
1,
|
||||
false,
|
||||
|
@ -146,7 +146,7 @@ public class TestSegmentInfos extends LuceneTestCase {
|
|||
byte[] commitInfoId0 = sis.info(0).getId();
|
||||
byte[] commitInfoId1 = sis.info(1).getId();
|
||||
sis = SegmentInfos.readLatestCommit(dir);
|
||||
assertEquals(Version.LUCENE_10_0_0, sis.getMinSegmentLuceneVersion());
|
||||
assertEquals(Version.LUCENE_11_0_0, sis.getMinSegmentLuceneVersion());
|
||||
assertEquals(Version.LATEST, sis.getCommitLuceneVersion());
|
||||
assertEquals(
|
||||
StringHelper.idToString(commitInfoId0), StringHelper.idToString(sis.info(0).getId()));
|
||||
|
@ -277,8 +277,8 @@ public class TestSegmentInfos extends LuceneTestCase {
|
|||
SegmentInfo info =
|
||||
new SegmentInfo(
|
||||
dir,
|
||||
Version.LUCENE_9_0_0,
|
||||
Version.LUCENE_9_0_0,
|
||||
Version.LUCENE_10_0_0,
|
||||
Version.LUCENE_10_0_0,
|
||||
"_0",
|
||||
1,
|
||||
false,
|
||||
|
|
|
@ -33,24 +33,27 @@ public class TestVersion extends LuceneTestCase {
|
|||
assertTrue("LATEST must be always onOrAfter(" + v + ")", Version.LATEST.onOrAfter(v));
|
||||
}
|
||||
}
|
||||
assertTrue(Version.LUCENE_10_0_0.onOrAfter(Version.LUCENE_9_0_0));
|
||||
assertTrue(Version.LUCENE_11_0_0.onOrAfter(Version.fromBits(9, 0, 0)));
|
||||
assertTrue(Version.LUCENE_11_0_0.onOrAfter(Version.LUCENE_10_0_0));
|
||||
assertTrue(Version.LUCENE_11_0_0.onOrAfter(Version.LUCENE_10_1_0));
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
assertEquals("9.0.0", Version.LUCENE_9_0_0.toString());
|
||||
assertEquals("9.0.0", Version.fromBits(9, 0, 0).toString());
|
||||
assertEquals("10.0.0", Version.LUCENE_10_0_0.toString());
|
||||
assertEquals("10.1.0", Version.LUCENE_10_1_0.toString());
|
||||
assertEquals("11.0.0", Version.LUCENE_11_0_0.toString());
|
||||
}
|
||||
|
||||
public void testParseLeniently() throws Exception {
|
||||
assertEquals(Version.LUCENE_11_0_0, Version.parseLeniently("11.0"));
|
||||
assertEquals(Version.LUCENE_11_0_0, Version.parseLeniently("11.0.0"));
|
||||
assertEquals(Version.LUCENE_11_0_0, Version.parseLeniently("LUCENE_11_0"));
|
||||
assertEquals(Version.LUCENE_11_0_0, Version.parseLeniently("LUCENE_11_0_0"));
|
||||
assertEquals(Version.LUCENE_10_0_0, Version.parseLeniently("10.0"));
|
||||
assertEquals(Version.LUCENE_10_0_0, Version.parseLeniently("10.0.0"));
|
||||
assertEquals(Version.LUCENE_10_0_0, Version.parseLeniently("LUCENE_10_0"));
|
||||
assertEquals(Version.LUCENE_10_0_0, Version.parseLeniently("LUCENE_10_0_0"));
|
||||
assertEquals(Version.LUCENE_9_0_0, Version.parseLeniently("9.0"));
|
||||
assertEquals(Version.LUCENE_9_0_0, Version.parseLeniently("9.0.0"));
|
||||
assertEquals(Version.LUCENE_9_0_0, Version.parseLeniently("LUCENE_90"));
|
||||
assertEquals(Version.LUCENE_9_0_0, Version.parseLeniently("LUCENE_9_0"));
|
||||
assertEquals(Version.LUCENE_9_0_0, Version.parseLeniently("LUCENE_9_0_0"));
|
||||
|
||||
assertEquals(Version.LATEST, Version.parseLeniently("LATEST"));
|
||||
assertEquals(Version.LATEST, Version.parseLeniently("latest"));
|
||||
|
@ -108,7 +111,7 @@ public class TestVersion extends LuceneTestCase {
|
|||
|
||||
public void testParse() throws Exception {
|
||||
assertEquals(Version.LUCENE_10_0_0, Version.parse("10.0.0"));
|
||||
assertEquals(Version.LUCENE_9_0_0, Version.parse("9.0.0"));
|
||||
assertEquals(Version.LUCENE_11_0_0, Version.parse("11.0.0"));
|
||||
|
||||
// Version does not pass judgement on the major version:
|
||||
assertEquals(1, Version.parse("1.0").major);
|
||||
|
@ -116,7 +119,9 @@ public class TestVersion extends LuceneTestCase {
|
|||
}
|
||||
|
||||
public void testForwardsCompatibility() throws Exception {
|
||||
assertTrue(Version.parse("9.10.20").onOrAfter(Version.LUCENE_9_0_0));
|
||||
assertTrue(Version.parse("11.10.20").onOrAfter(Version.LUCENE_11_0_0));
|
||||
assertTrue(Version.parse("10.10.20").onOrAfter(Version.LUCENE_10_0_0));
|
||||
assertTrue(Version.parse("9.10.20").onOrAfter(Version.fromBits(9, 0, 0)));
|
||||
}
|
||||
|
||||
public void testParseExceptions() {
|
||||
|
|
Loading…
Reference in New Issue