Skip to content

Commit ef9311e

Browse files
committed
tests: document edge case and fix the tests
Signed-off-by: Alexander Bezzubov <[email protected]>
1 parent 65b9545 commit ef9311e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

common_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,30 @@ type EnryTestSuite struct {
2525
samplesDir string
2626
}
2727

28-
func TestRegexpEdgeCases(t *testing.T) {
28+
func (s *EnryTestSuite) TestRegexpEdgeCases() {
2929
var regexpEdgeCases = []struct {
3030
lang string
3131
filename string
3232
}{
3333
{lang: "ActionScript", filename: "FooBar.as"},
3434
{lang: "Forth", filename: "asm.fr"},
3535
{lang: "X PixMap", filename: "cc-public_domain_mark_white.pm"},
36-
//{lang: "SQL", filename: "drop_stuff.sql"}, // Classifier strategy fails :/
36+
//{lang: "SQL", filename: "drop_stuff.sql"}, // https://github.com/src-d/enry/issues/194
3737
{lang: "Fstar", filename: "Hacl.Spec.Bignum.Fmul.fst"},
3838
{lang: "C++", filename: "Types.h"},
3939
}
4040

4141
for _, r := range regexpEdgeCases {
42-
filename := fmt.Sprintf(".linguist/samples/%s/%s", r.lang, r.filename)
42+
filename := fmt.Sprintf("%s/samples/%s/%s", s.tmpLinguist, r.lang, r.filename)
4343

4444
content, err := ioutil.ReadFile(filename)
45-
require.NoError(t, err)
45+
require.NoError(s.T(), err)
4646

4747
lang := GetLanguage(r.filename, content)
48-
t.Logf("File:%s, lang:%s", filename, lang)
48+
s.T().Logf("File:%s, lang:%s", filename, lang)
4949

5050
expLang, _ := data.LanguageByAlias(r.lang)
51-
require.EqualValues(t, expLang, lang)
51+
require.EqualValues(s.T(), expLang, lang)
5252
}
5353
}
5454

@@ -427,7 +427,8 @@ func (s *EnryTestSuite) TestGetLanguageByAlias() {
427427
func (s *EnryTestSuite) TestLinguistCorpus() {
428428
const filenamesDir = "filenames"
429429
var cornerCases = map[string]bool{
430-
"hello.ms": true, //TODO add instead .es
430+
"drop_stuff.sql": true, // https://github.com/src-d/enry/issues/194
431+
// .es and .ice fail heuristics parsing, but do not fail any tests
431432
}
432433

433434
var total, failed, ok, other int

0 commit comments

Comments
 (0)