You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
807 B

  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package markup_test
  5. import (
  6. "testing"
  7. . "code.gitea.io/gitea/modules/markup"
  8. _ "code.gitea.io/gitea/modules/markup/markdown"
  9. "github.com/stretchr/testify/assert"
  10. )
  11. func TestMisc_IsReadmeFile(t *testing.T) {
  12. trueTestCases := []string{
  13. "readme",
  14. "README",
  15. "readME.mdown",
  16. "README.md",
  17. }
  18. falseTestCases := []string{
  19. "test.md",
  20. "wow.MARKDOWN",
  21. "LOL.mDoWn",
  22. "test",
  23. "abcdefg",
  24. "abcdefghijklmnopqrstuvwxyz",
  25. "test.md.test",
  26. "readmf",
  27. }
  28. for _, testCase := range trueTestCases {
  29. assert.True(t, IsReadmeFile(testCase))
  30. }
  31. for _, testCase := range falseTestCases {
  32. assert.False(t, IsReadmeFile(testCase))
  33. }
  34. }