fix getLanguage when arguments are null

This commit is contained in:
Manuel Carmona
2017-09-07 14:17:56 +02:00
parent 0fe0a97f67
commit 1d7b975743
2 changed files with 29 additions and 4 deletions

View File

@@ -18,6 +18,17 @@ public class EnryTest {
assertEquals("PHP", Enry.getLanguage("foobar.php", code.getBytes()));
}
@Test
public void getLanguageWithNullContent() {
assertEquals("Python", Enry.getLanguage("foo.py", null));
}
@Test
public void getLanguageWithNullFilename() {
byte[] content = "#!/usr/bin/env python".getBytes();
assertEquals("Python", Enry.getLanguage(null, content));
}
@Test
public void getLanguageByContent() {
String code = "<?php $foo = bar();";