Fork to maintain patches against the official gitea for https://code.ceondo.com https://github.com/go-gitea/gitea

markup_test.go 800B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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/markdown"
  8. . "code.gitea.io/gitea/modules/markup"
  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. }