summaryrefslogtreecommitdiffstats
path: root/modules/markup/markup_test.go
diff options
context:
space:
mode:
authorKhaled Hamed <khaled.hamedt@gmail.com>2019-01-14 21:15:06 +0200
committertechknowlogick <hello@techknowlogick.com>2019-01-14 14:15:06 -0500
commitbd759652965078c0cd5b948c94345ce5b73fd0d1 (patch)
tree9a3ecf0f7aaa13db0b87169c3dad077647e564b0 /modules/markup/markup_test.go
parent6868378673f5bb21eac54719d719557b32448db6 (diff)
downloadgitea-bd759652965078c0cd5b948c94345ce5b73fd0d1.tar.gz
gitea-bd759652965078c0cd5b948c94345ce5b73fd0d1.zip
Prioritize "readme.md" (#5691)
* prioritize readme.md * Improve IsReadmeFile * Add more tests
Diffstat (limited to 'modules/markup/markup_test.go')
-rw-r--r--modules/markup/markup_test.go22
1 files changed, 22 insertions, 0 deletions
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]))
+ }
}