mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-09-20 07:21:22 +00:00
Expose IsTest Method (#1)
This commit is contained in:
parent
81f5d81b7b
commit
821f01cdde
@ -237,4 +237,14 @@ public class Enry {
|
||||
public static synchronized String getColor(String language) {
|
||||
return toJavaString(nativeLib.GetColor(toGoString(language)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports whether the given path is a test path or not.
|
||||
*
|
||||
* @param path of the file or directory
|
||||
* @return whether it's test or not
|
||||
*/
|
||||
public static synchronized boolean isTest(String path) {
|
||||
return toJavaBool(nativeLib.IsTest(toGoString(path)));
|
||||
}
|
||||
}
|
||||
|
@ -169,6 +169,14 @@ public class EnryTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isTest() {
|
||||
assertTrue(Enry.isTest("test_foo.py"));
|
||||
assertTrue(Enry.isTest("test/java/tech/sourced/enry/EnryTest.java"));
|
||||
assertFalse(Enry.isTest("foo.py"));
|
||||
assertFalse(Enry.isTest("src/java/foo.java"));
|
||||
}
|
||||
|
||||
void assertGuess(String language, boolean safe, Guess guess) {
|
||||
assertEquals(language, guess.language);
|
||||
assertEquals(safe, guess.safe);
|
||||
|
@ -136,6 +136,11 @@ func GetColor(language string) string {
|
||||
return enry.GetColor(language)
|
||||
}
|
||||
|
||||
//export IsTest
|
||||
func IsTest(path string) bool {
|
||||
return enry.IsTest(path)
|
||||
}
|
||||
|
||||
func strSliceCopy(result *[]*C.char, slice []string) {
|
||||
for _, str := range slice {
|
||||
*result = append(*result, C.CString(str))
|
||||
|
Loading…
Reference in New Issue
Block a user