mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-18 22:23:07 -03:00
get jnaerator from a jitpack jar
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
This commit is contained in:
@ -37,11 +37,15 @@ public class Enry {
|
||||
* If there are more than one possible language, it returns the first
|
||||
* language in alphabetical order and safe to false.
|
||||
*
|
||||
* @param content of the file
|
||||
* @param filename name of the file with the extension
|
||||
* @param content of the file
|
||||
* @return guessed result
|
||||
*/
|
||||
public static Guess getLanguageByContent(byte[] content) {
|
||||
GetLanguageByContent_return.ByValue res = nativeLib.GetLanguageByContent(toGoByteSlice(content));
|
||||
public static Guess getLanguageByContent(String filename, byte[] content) {
|
||||
GetLanguageByContent_return.ByValue res = nativeLib.GetLanguageByContent(
|
||||
toGoString(filename),
|
||||
toGoByteSlice(content)
|
||||
);
|
||||
return new Guess(toJavaString(res.r0), toJavaBool(res.r1));
|
||||
}
|
||||
|
||||
|
@ -18,14 +18,13 @@ public class EnryTest {
|
||||
assertEquals("PHP", Enry.getLanguage("foobar.php", code.getBytes()));
|
||||
}
|
||||
|
||||
// TODO: this is a bug in enry, fix when it's fixed there
|
||||
@Test(expected = AssertionError.class)
|
||||
@Test
|
||||
public void getLanguageByContent() {
|
||||
String code = "<?php $foo = bar();";
|
||||
assertGuess(
|
||||
"PHP",
|
||||
true,
|
||||
Enry.getLanguageByContent(code.getBytes())
|
||||
Enry.getLanguageByContent("foo.php", code.getBytes())
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user