From bd759652965078c0cd5b948c94345ce5b73fd0d1 Mon Sep 17 00:00:00 2001 From: Khaled Hamed Date: Mon, 14 Jan 2019 21:15:06 +0200 Subject: Prioritize "readme.md" (#5691) * prioritize readme.md * Improve IsReadmeFile * Add more tests --- modules/markup/markup_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'modules/markup/markup_test.go') diff --git a/modules/markup/markup_test.go b/modules/markup/markup_test.go index b0ebfae57d..118fa2632b 100644 --- a/modules/markup/markup_test.go +++ b/modules/markup/markup_test.go @@ -19,6 +19,7 @@ func TestMisc_IsReadmeFile(t *testing.T) { "README", "readME.mdown", "README.md", + "readme.i18n.md", } falseTestCases := []string{ "test.md", @@ -37,4 +38,25 @@ func TestMisc_IsReadmeFile(t *testing.T) { for _, testCase := range falseTestCases { assert.False(t, IsReadmeFile(testCase)) } + + trueTestCasesStrict := [][]string{ + {"readme", ""}, + {"readme.md", ".md"}, + {"readme.txt", ".txt"}, + } + falseTestCasesStrict := [][]string{ + {"readme", ".md"}, + {"readme.md", ""}, + {"readme.md", ".txt"}, + {"readme.md", "md"}, + {"readmee.md", ".md"}, + {"readme.i18n.md", ".md"}, + } + + for _, testCase := range trueTestCasesStrict { + assert.True(t, IsReadmeFile(testCase[0], testCase[1])) + } + for _, testCase := range falseTestCasesStrict { + assert.False(t, IsReadmeFile(testCase[0], testCase[1])) + } } -- cgit v1.2.3