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-12 08:22:47 +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)
|
|
|
|
}
|