mirror of
https://github.com/tiennm99/hugoThemesSiteBuilder.git
synced 2026-10-16 00:14:57 +00:00
They have been very unreliable lately, presumably due people moving repos over from GitHub for similar reasons. Oh, the irony. Note that we could build using a Go proxy, which would have fixed the problem and made the builds faster, but people submitting the themes have not opted having their theme mirrored in a Go proxy server.
41 lines
871 B
Go
41 lines
871 B
Go
package buildcmd
|
|
|
|
import (
|
|
"testing"
|
|
|
|
qt "github.com/frankban/quicktest"
|
|
)
|
|
|
|
func TestFixReadmeContent(t *testing.T) {
|
|
c := qt.New(t)
|
|
|
|
// Issue #356
|
|
s := `
|
|
{{<details "summary title">}}
|
|
|
|
block content
|
|
|
|
{{</details>}}
|
|
`
|
|
c.Assert(fixReadmeContent(s), qt.Equals, "\n{{</*details \"summary title\"*/>}}\n\nblock content\n\n{{</*/details*/>}}\n")
|
|
|
|
s = `
|
|
{{% details "summary title" %}}
|
|
|
|
block content
|
|
|
|
{{% /details %}}
|
|
`
|
|
|
|
c.Assert(fixReadmeContent(s), qt.Equals, "\n{{%/* details \"summary title\" */%}}\n\nblock content\n\n{{%/* /details */%}}\n")
|
|
}
|
|
|
|
func TestSplitHosts(t *testing.T) {
|
|
c := qt.New(t)
|
|
|
|
c.Assert(splitHosts(""), qt.IsNil)
|
|
c.Assert(splitHosts(" , "), qt.IsNil)
|
|
c.Assert(splitHosts("codeberg.org"), qt.DeepEquals, []string{"codeberg.org"})
|
|
c.Assert(splitHosts(" codeberg.org, gitlab.com ,"), qt.DeepEquals, []string{"codeberg.org", "gitlab.com"})
|
|
}
|