2017-04-21 12:31:08 +05:30
|
|
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2017-09-16 22:47:57 +05:30
|
|
|
package markup_test
|
2017-04-21 12:31:08 +05:30
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2017-09-16 22:47:57 +05:30
|
|
|
_ "code.gitea.io/gitea/modules/markdown"
|
|
|
|
. "code.gitea.io/gitea/modules/markup"
|
|
|
|
|
2017-04-21 12:31:08 +05:30
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMisc_IsReadmeFile(t *testing.T) {
|
|
|
|
trueTestCases := []string{
|
|
|
|
"readme",
|
|
|
|
"README",
|
|
|
|
"readME.mdown",
|
|
|
|
"README.md",
|
|
|
|
}
|
|
|
|
falseTestCases := []string{
|
|
|
|
"test.md",
|
|
|
|
"wow.MARKDOWN",
|
|
|
|
"LOL.mDoWn",
|
|
|
|
"test",
|
|
|
|
"abcdefg",
|
|
|
|
"abcdefghijklmnopqrstuvwxyz",
|
|
|
|
"test.md.test",
|
2017-05-09 19:50:22 +05:30
|
|
|
"readmf",
|
2017-04-21 12:31:08 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
for _, testCase := range trueTestCases {
|
|
|
|
assert.True(t, IsReadmeFile(testCase))
|
|
|
|
}
|
|
|
|
for _, testCase := range falseTestCases {
|
|
|
|
assert.False(t, IsReadmeFile(testCase))
|
|
|
|
}
|
|
|
|
}
|