mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 14:40:43 +03:00
Apply gofmt -s
This commit is contained in:
parent
8557e2cbb8
commit
6e1b0e0c00
7 changed files with 44 additions and 46 deletions
|
@ -59,9 +59,9 @@ var shortCodeLexerTests = []shortCodeLexerTest{
|
|||
tstLeftNoMD, tstSC1, tstRightNoMD, tstLeftNoMD, tstSCClose, tstSC1,
|
||||
{tError, 0, "unclosed shortcode"}}},
|
||||
{"Youtube id", `{{< sc1 -ziL-Q_456igdO-4 >}}`, []item{
|
||||
tstLeftNoMD, tstSC1, item{tScParam, 0, "-ziL-Q_456igdO-4"}, tstRightNoMD, tstEOF}},
|
||||
tstLeftNoMD, tstSC1, {tScParam, 0, "-ziL-Q_456igdO-4"}, tstRightNoMD, tstEOF}},
|
||||
{"non-alphanumerics param quoted", `{{< sc1 "-ziL-.%QigdO-4" >}}`, []item{
|
||||
tstLeftNoMD, tstSC1, item{tScParam, 0, "-ziL-.%QigdO-4"}, tstRightNoMD, tstEOF}},
|
||||
tstLeftNoMD, tstSC1, {tScParam, 0, "-ziL-.%QigdO-4"}, tstRightNoMD, tstEOF}},
|
||||
|
||||
{"two params", `{{< sc1 param1 param2 >}}`, []item{
|
||||
tstLeftNoMD, tstSC1, tstParam1, tstParam2, tstRightNoMD, tstEOF}},
|
||||
|
@ -74,21 +74,21 @@ var shortCodeLexerTests = []shortCodeLexerTest{
|
|||
tstLeftNoMD, tstSCClose, tstSC1, tstRightNoMD, tstEOF}},
|
||||
{"nested complex", `{{< sc1 >}}ab{{% sc2 param1 %}}cd{{< sc3 >}}ef{{< /sc3 >}}gh{{% /sc2 %}}ij{{< /sc1 >}}kl`, []item{
|
||||
tstLeftNoMD, tstSC1, tstRightNoMD,
|
||||
item{tText, 0, "ab"},
|
||||
{tText, 0, "ab"},
|
||||
tstLeftMD, tstSC2, tstParam1, tstRightMD,
|
||||
item{tText, 0, "cd"},
|
||||
{tText, 0, "cd"},
|
||||
tstLeftNoMD, tstSC3, tstRightNoMD,
|
||||
item{tText, 0, "ef"},
|
||||
{tText, 0, "ef"},
|
||||
tstLeftNoMD, tstSCClose, tstSC3, tstRightNoMD,
|
||||
item{tText, 0, "gh"},
|
||||
{tText, 0, "gh"},
|
||||
tstLeftMD, tstSCClose, tstSC2, tstRightMD,
|
||||
item{tText, 0, "ij"},
|
||||
{tText, 0, "ij"},
|
||||
tstLeftNoMD, tstSCClose, tstSC1, tstRightNoMD,
|
||||
item{tText, 0, "kl"}, tstEOF,
|
||||
{tText, 0, "kl"}, tstEOF,
|
||||
}},
|
||||
|
||||
{"two quoted params", `{{< sc1 "param nr. 1" "param nr. 2" >}}`, []item{
|
||||
tstLeftNoMD, tstSC1, item{tScParam, 0, "param nr. 1"}, item{tScParam, 0, "param nr. 2"}, tstRightNoMD, tstEOF}},
|
||||
tstLeftNoMD, tstSC1, {tScParam, 0, "param nr. 1"}, {tScParam, 0, "param nr. 2"}, tstRightNoMD, tstEOF}},
|
||||
{"two named params", `{{< sc1 param1="Hello World" param2="p2Val">}}`, []item{
|
||||
tstLeftNoMD, tstSC1, tstParam1, tstVal, tstParam2, {tScParamVal, 0, "p2Val"}, tstRightNoMD, tstEOF}},
|
||||
{"escaped quotes", `{{< sc1 param1=\"Hello World\" >}}`, []item{
|
||||
|
@ -97,13 +97,13 @@ var shortCodeLexerTests = []shortCodeLexerTest{
|
|||
tstLeftNoMD, tstSC1, tstParam1, tstRightNoMD, tstEOF}},
|
||||
{"escaped quotes inside escaped quotes", `{{< sc1 param1=\"Hello \"escaped\" World\" >}}`, []item{
|
||||
tstLeftNoMD, tstSC1, tstParam1,
|
||||
item{tScParamVal, 0, `Hello `}, {tError, 0, `got positional parameter 'escaped'. Cannot mix named and positional parameters`}}},
|
||||
{tScParamVal, 0, `Hello `}, {tError, 0, `got positional parameter 'escaped'. Cannot mix named and positional parameters`}}},
|
||||
{"escaped quotes inside nonescaped quotes",
|
||||
`{{< sc1 param1="Hello \"escaped\" World" >}}`, []item{
|
||||
tstLeftNoMD, tstSC1, tstParam1, item{tScParamVal, 0, `Hello "escaped" World`}, tstRightNoMD, tstEOF}},
|
||||
tstLeftNoMD, tstSC1, tstParam1, {tScParamVal, 0, `Hello "escaped" World`}, tstRightNoMD, tstEOF}},
|
||||
{"escaped quotes inside nonescaped quotes in positional param",
|
||||
`{{< sc1 "Hello \"escaped\" World" >}}`, []item{
|
||||
tstLeftNoMD, tstSC1, item{tScParam, 0, `Hello "escaped" World`}, tstRightNoMD, tstEOF}},
|
||||
tstLeftNoMD, tstSC1, {tScParam, 0, `Hello "escaped" World`}, tstRightNoMD, tstEOF}},
|
||||
{"unterminated quote", `{{< sc1 param2="Hello World>}}`, []item{
|
||||
tstLeftNoMD, tstSC1, tstParam2, {tError, 0, "unterminated quoted string in shortcode parameter-argument: 'Hello World>}}'"}}},
|
||||
{"one named param, one not", `{{< sc1 param1="Hello World" p2 >}}`, []item{
|
||||
|
@ -119,11 +119,11 @@ var shortCodeLexerTests = []shortCodeLexerTest{
|
|||
tstLeftNoMD, tstSC1, tstParam1,
|
||||
{tError, 0, "got named parameter 'param2'. Cannot mix named and positional parameters"}}},
|
||||
{"commented out", `{{</* sc1 */>}}`, []item{
|
||||
item{tText, 0, "{{<"}, item{tText, 0, " sc1 "}, item{tText, 0, ">}}"}, tstEOF}},
|
||||
{tText, 0, "{{<"}, {tText, 0, " sc1 "}, {tText, 0, ">}}"}, tstEOF}},
|
||||
{"commented out, missing close", `{{</* sc1 >}}`, []item{
|
||||
{tError, 0, "comment must be closed"}}},
|
||||
{"commented out, misplaced close", `{{</* sc1 >}}*/`, []item{
|
||||
item{tText, 0, "{{<"}, item{tText, 0, " sc1 >}}"}, {tError, 0, "comment ends before the right shortcode delimiter"}}},
|
||||
{tText, 0, "{{<"}, {tText, 0, " sc1 >}}"}, {tError, 0, "comment ends before the right shortcode delimiter"}}},
|
||||
}
|
||||
|
||||
func TestShortcodeLexer(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue