tartrazine/extension_test.go

23 lines
598 B
Go
Raw Normal View History

2016-07-13 20:21:18 +00:00
package slinguist
import . "gopkg.in/check.v1"
func (s *TSuite) TestGetLanguageByExtension(c *C) {
lang, safe := GetLanguageByExtension("foo.foo")
c.Assert(lang, Equals, "Other")
c.Assert(safe, Equals, false)
lang, safe = GetLanguageByExtension("foo.go")
c.Assert(lang, Equals, "Go")
c.Assert(safe, Equals, true)
lang, safe = GetLanguageByExtension("foo.go.php")
2017-04-04 11:10:35 +00:00
c.Assert(lang, Equals, "Hack")
2016-07-13 20:21:18 +00:00
c.Assert(safe, Equals, false)
}
func (s *TSuite) TestGetLanguageExtensions(c *C) {
c.Assert(GetLanguageExtensions("foo"), HasLen, 0)
c.Assert(GetLanguageExtensions("C"), Not(HasLen), 0)
}