mirror of
https://github.com/caddyserver/caddy.git
synced 2025-11-16 11:17:46 +08:00
caddyfile: Add heredoc support to fmt command (#6056)
This commit is contained in:
@@ -362,6 +362,76 @@ block {
|
||||
|
||||
block {
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
description: "keep heredoc as-is",
|
||||
input: `block {
|
||||
heredoc <<HEREDOC
|
||||
Here's more than one space Here's more than one space
|
||||
HEREDOC
|
||||
}
|
||||
`,
|
||||
expect: `block {
|
||||
heredoc <<HEREDOC
|
||||
Here's more than one space Here's more than one space
|
||||
HEREDOC
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
description: "Mixing heredoc with regular part",
|
||||
input: `block {
|
||||
heredoc <<HEREDOC
|
||||
Here's more than one space Here's more than one space
|
||||
HEREDOC
|
||||
respond "More than one space will be eaten" 200
|
||||
}
|
||||
|
||||
block2 {
|
||||
heredoc <<HEREDOC
|
||||
Here's more than one space Here's more than one space
|
||||
HEREDOC
|
||||
respond "More than one space will be eaten" 200
|
||||
}
|
||||
`,
|
||||
expect: `block {
|
||||
heredoc <<HEREDOC
|
||||
Here's more than one space Here's more than one space
|
||||
HEREDOC
|
||||
respond "More than one space will be eaten" 200
|
||||
}
|
||||
|
||||
block2 {
|
||||
heredoc <<HEREDOC
|
||||
Here's more than one space Here's more than one space
|
||||
HEREDOC
|
||||
respond "More than one space will be eaten" 200
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
description: "Heredoc as regular token",
|
||||
input: `block {
|
||||
heredoc <<HEREDOC "More than one space will be eaten"
|
||||
}
|
||||
`,
|
||||
expect: `block {
|
||||
heredoc <<HEREDOC "More than one space will be eaten"
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
description: "Escape heredoc",
|
||||
input: `block {
|
||||
heredoc \<<HEREDOC
|
||||
respond "More than one space will be eaten" 200
|
||||
}
|
||||
`,
|
||||
expect: `block {
|
||||
heredoc \<<HEREDOC
|
||||
respond "More than one space will be eaten" 200
|
||||
}
|
||||
`,
|
||||
},
|
||||
} {
|
||||
|
||||
Reference in New Issue
Block a user