Fix test case

This commit is contained in:
Reinhard Pointner 2017-05-22 21:33:59 +08:00
parent e69b0dab18
commit c629fa7c0b
2 changed files with 12 additions and 6 deletions

View File

@ -100,15 +100,19 @@ public class ReleaseInfo {
// check file and folder for release group names
String[] groups = releaseGroup.get();
// try case-sensitive match
String match = matchLast(getReleaseGroupPattern(true), groups, name);
for (boolean strict : new boolean[] { true, false }) {
String match = matchLast(getReleaseGroupPattern(strict), groups, name);
if (match != null) {
return match;
if (match != null) {
// group pattern does not match closing brackets in GROUP[INDEX] patterns
if (match.lastIndexOf(']') < match.lastIndexOf('[')) {
return match + ']';
}
return match;
}
}
// try case-insensitive match
return matchLast(getReleaseGroupPattern(false), groups, name);
return null;
}
private Pattern languageTag;

View File

@ -20,6 +20,8 @@ public class ReleaseInfoTest {
@Test
public void getReleaseGroup() throws Exception {
assertEquals("aXXo", info.getReleaseGroup("Jurassic.Park[1993]DvDrip-aXXo"));
assertEquals("aXXo", info.getReleaseGroup("Jurassic.Park[1993]DvDrip-[aXXo]"));
assertEquals("aXXo[RARBG]", info.getReleaseGroup("Jurassic.Park[1993]DvDrip-aXXo[RARBG]"));
}
@Test