Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
b9eea82a
Commit
b9eea82a
authored
May 26, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
template: add tests for RawContents
parent
99a93009
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
template/parse_test.go
template/parse_test.go
+14
-0
template/test-fixtures/parse-contents.json
template/test-fixtures/parse-contents.json
+1
-0
No files found.
template/parse_test.go
View file @
b9eea82a
...
@@ -2,6 +2,7 @@ package template
...
@@ -2,6 +2,7 @@ package template
import
(
import
(
"reflect"
"reflect"
"strings"
"testing"
"testing"
"time"
"time"
)
)
...
@@ -284,3 +285,16 @@ func TestParse(t *testing.T) {
...
@@ -284,3 +285,16 @@ func TestParse(t *testing.T) {
}
}
}
}
}
}
func
TestParse_contents
(
t
*
testing
.
T
)
{
tpl
,
err
:=
ParseFile
(
fixtureDir
(
"parse-contents.json"
))
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
actual
:=
strings
.
TrimSpace
(
string
(
tpl
.
RawContents
))
expected
:=
`{"builders":[{"type":"test"}]}`
if
actual
!=
expected
{
t
.
Fatalf
(
"bad: %s
\n\n
%s"
,
actual
,
expected
)
}
}
template/test-fixtures/parse-contents.json
0 → 100644
View file @
b9eea82a
{
"builders"
:[{
"type"
:
"test"
}]}
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