Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
a62a7f7c
Commit
a62a7f7c
authored
9 years ago
by
Guilherme Rezende
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new optional block tests to setup/templates_test.go
parent
9d456bba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
config/setup/templates_test.go
config/setup/templates_test.go
+20
-2
No files found.
config/setup/templates_test.go
View file @
a62a7f7c
...
...
@@ -2,8 +2,9 @@ package setup
import
(
"fmt"
"github.com/mholt/caddy/middleware/templates"
"testing"
"github.com/mholt/caddy/middleware/templates"
)
func
TestTemplates
(
t
*
testing
.
T
)
{
...
...
@@ -40,7 +41,11 @@ func TestTemplates(t *testing.T) {
if
fmt
.
Sprint
(
myHandler
.
Rules
[
0
]
.
IndexFiles
)
!=
fmt
.
Sprint
(
indexFiles
)
{
t
.
Errorf
(
"Expected %v to be the Default Index files"
,
indexFiles
)
}
if
myHandler
.
Rules
[
0
]
.
Delims
!=
[
2
]
string
{}
{
t
.
Errorf
(
"Expected %v to be the Default Delims"
,
[
2
]
string
{})
}
}
func
TestTemplatesParse
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
inputTemplateConfig
string
...
...
@@ -50,19 +55,32 @@ func TestTemplatesParse(t *testing.T) {
{
`templates /api1`
,
false
,
[]
templates
.
Rule
{{
Path
:
"/api1"
,
Extensions
:
defaultTemplateExtensions
,
Delims
:
[
2
]
string
{},
}}},
{
`templates /api2 .txt .htm`
,
false
,
[]
templates
.
Rule
{{
Path
:
"/api2"
,
Extensions
:
[]
string
{
".txt"
,
".htm"
},
Delims
:
[
2
]
string
{},
}}},
{
`templates /api3 .htm .html
{
`templates /api3 .htm .html
templates /api4 .txt .tpl `
,
false
,
[]
templates
.
Rule
{{
Path
:
"/api3"
,
Extensions
:
[]
string
{
".htm"
,
".html"
},
Delims
:
[
2
]
string
{},
},
{
Path
:
"/api4"
,
Extensions
:
[]
string
{
".txt"
,
".tpl"
},
Delims
:
[
2
]
string
{},
}}},
{
`templates {
path /api5
ext .html
between {% %}
}`
,
false
,
[]
templates
.
Rule
{{
Path
:
"/api5"
,
Extensions
:
[]
string
{
".html"
},
Delims
:
[
2
]
string
{
"{%"
,
"%}"
},
}}},
}
for
i
,
test
:=
range
tests
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment