FileNamePatternTest.java (logback-1.2.3) | : | FileNamePatternTest.java (logback-v_1.2.7) | ||
---|---|---|---|---|
skipping to change at line 57 | skipping to change at line 57 | |||
pp = new FileNamePattern("foo%i.xixo", context); | pp = new FileNamePattern("foo%i.xixo", context); | |||
assertEquals("foo3.xixo", pp.convertInt(3)); | assertEquals("foo3.xixo", pp.convertInt(3)); | |||
pp = new FileNamePattern("foo%i.log", context); | pp = new FileNamePattern("foo%i.log", context); | |||
assertEquals("foo3.log", pp.convertInt(3)); | assertEquals("foo3.log", pp.convertInt(3)); | |||
pp = new FileNamePattern("foo.%i.log", context); | pp = new FileNamePattern("foo.%i.log", context); | |||
assertEquals("foo.3.log", pp.convertInt(3)); | assertEquals("foo.3.log", pp.convertInt(3)); | |||
pp = new FileNamePattern("foo.%3i.log", context); | ||||
assertEquals("foo.003.log", pp.convertInt(3)); | ||||
pp = new FileNamePattern("foo.%1i.log", context); | ||||
assertEquals("foo.43.log", pp.convertInt(43)); | ||||
// pp = new FileNamePattern("%i.foo\\%", context); | // pp = new FileNamePattern("%i.foo\\%", context); | |||
// assertEquals("3.foo%", pp.convertInt(3)); | // assertEquals("3.foo%", pp.convertInt(3)); | |||
// pp = new FileNamePattern("\\%foo", context); | // pp = new FileNamePattern("\\%foo", context); | |||
// assertEquals("%foo", pp.convertInt(3)); | // assertEquals("%foo", pp.convertInt(3)); | |||
} | } | |||
@Test | @Test | |||
// test ways for dealing with flowing i converter, as in "foo%ix" | // test ways for dealing with flowing i converter, as in "foo%ix" | |||
public void flowingI() { | public void flowingI() { | |||
skipping to change at line 148 | skipping to change at line 154 | |||
@Test | @Test | |||
public void asRegexByDate() { | public void asRegexByDate() { | |||
Calendar cal = Calendar.getInstance(); | Calendar cal = Calendar.getInstance(); | |||
cal.set(2003, 4, 20, 17, 55); | cal.set(2003, 4, 20, 17, 55); | |||
{ | { | |||
FileNamePattern fnp = new FileNamePattern("foo-%d{yyyy.MM.dd}-%i.txt ", context); | FileNamePattern fnp = new FileNamePattern("foo-%d{yyyy.MM.dd}-%i.txt ", context); | |||
String regex = fnp.toRegexForFixedDate(cal.getTime()); | String regex = fnp.toRegexForFixedDate(cal.getTime()); | |||
assertEquals("foo-2003.05.20-(\\d{1,3}).txt", regex); | assertEquals("foo-2003.05.20-(\\d{1,5}).txt", regex); | |||
} | } | |||
{ | { | |||
FileNamePattern fnp = new FileNamePattern("\\toto\\foo-%d{yyyy\\MM\\ dd}-%i.txt", context); | FileNamePattern fnp = new FileNamePattern("\\toto\\foo-%d{yyyy\\MM\\ dd}-%i.txt", context); | |||
String regex = fnp.toRegexForFixedDate(cal.getTime()); | String regex = fnp.toRegexForFixedDate(cal.getTime()); | |||
assertEquals("/toto/foo-2003/05/20-(\\d{1,3}).txt", regex); | assertEquals("/toto/foo-2003/05/20-(\\d{1,5}).txt", regex); | |||
} | } | |||
} | } | |||
@Test | @Test | |||
public void asRegex() { | public void asRegex() { | |||
{ | { | |||
FileNamePattern fnp = new FileNamePattern("foo-%d{yyyy.MM.dd}-%i.txt ", context); | FileNamePattern fnp = new FileNamePattern("foo-%d{yyyy.MM.dd}-%i.txt ", context); | |||
String regex = fnp.toRegex(); | String regex = fnp.toRegex(); | |||
assertEquals("foo-\\d{4}\\.\\d{2}\\.\\d{2}-\\d{1,2}.txt", regex); | assertEquals("foo-\\d{4}\\.\\d{2}\\.\\d{2}-\\d{1,2}.txt", regex); | |||
} | } | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 8 lines changed or added |