LTS: firmware matcher needs to learn to migrate

#5015

relevant helper method
This commit is contained in:
rusefi 2023-01-30 08:27:13 -05:00
parent ba0527a905
commit df3f924dc5
3 changed files with 28 additions and 1 deletions

View File

@ -2,5 +2,11 @@ plugins {
id 'java'
}
apply from: '../../android/dependencies.gradle'
// TODO: rename folder to core_io
// this CORE module cannot depend on model/ini!
// this CORE module cannot depend on model/ini!
dependencies {
testImplementation global_libs.junit
}

View File

@ -35,4 +35,13 @@ public class BundleUtil {
bundle = bundle == null ? "unknown bundle" : bundle;
return bundle;
}
public static String getBundleTarget(String s) {
if (s == null)
return null;
int lastDot = s.lastIndexOf('.');
if (lastDot == -1)
throw new IllegalStateException("Dot expected somewhere in [" + s + "]");
return s.substring(lastDot + 1);
}
}

View File

@ -0,0 +1,12 @@
package com.rusefi.core.io;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class BundleUtilTest {
@Test
public void testExtractBundleTarget() {
assertEquals("proteus_f7", BundleUtil.getBundleTarget("rusefi.snapshot.proteus_f7"));
}
}