mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-12 22:42:23 +00:00
Merge pull request #106 from bzz/test/empty-content
Add failing test for empty file content
This commit is contained in:
commit
3d63a636bb
@ -58,7 +58,7 @@ class GoUtils {
|
|||||||
static GoSlice.ByValue toGoByteSlice(byte[] bytes) {
|
static GoSlice.ByValue toGoByteSlice(byte[] bytes) {
|
||||||
int length = 0;
|
int length = 0;
|
||||||
Pointer ptr = null;
|
Pointer ptr = null;
|
||||||
if (bytes != null) {
|
if (bytes != null && bytes.length > 0) {
|
||||||
length = bytes.length;
|
length = bytes.length;
|
||||||
ptr = ptrFromBytes(bytes);
|
ptr = ptrFromBytes(bytes);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,12 @@ public class EnryTest {
|
|||||||
assertEquals("Python", Enry.getLanguage("foo.py", null));
|
assertEquals("Python", Enry.getLanguage("foo.py", null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLanguageWithEmptyContent() {
|
||||||
|
assertEquals("Go", Enry.getLanguage("baz.go", "".getBytes()));
|
||||||
|
assertEquals("Go", Enry.getLanguage("baz.go", null));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getLanguageWithNullFilename() {
|
public void getLanguageWithNullFilename() {
|
||||||
byte[] content = "#!/usr/bin/env python".getBytes();
|
byte[] content = "#!/usr/bin/env python".getBytes();
|
||||||
|
Loading…
Reference in New Issue
Block a user