-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #805 from hairyhenderson/let-csv-read-more-input-t…
…ypes-804 Allow data.ToCSV to handle more general input types
- Loading branch information
Showing
3 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| //+build integration | ||
|
|
||
| package integration | ||
|
|
||
| import ( | ||
| . "gopkg.in/check.v1" | ||
|
|
||
| "gotest.tools/v3/fs" | ||
| "gotest.tools/v3/icmd" | ||
| ) | ||
|
|
||
| // This suite contains integration tests to make sure that (some of) the examples | ||
| // in the gomplate docs work correctly | ||
| type DocExamplesSuite struct { | ||
| tmpDir *fs.Dir | ||
| } | ||
|
|
||
| var _ = Suite(&DocExamplesSuite{}) | ||
|
|
||
| func (s *DocExamplesSuite) SetUpSuite(c *C) { | ||
| s.tmpDir = fs.NewDir(c, "gomplate-inttests") | ||
| } | ||
|
|
||
| func (s *DocExamplesSuite) TearDownSuite(c *C) { | ||
| s.tmpDir.Remove() | ||
| } | ||
|
|
||
| func (s *DocExamplesSuite) TestDataExamples(c *C) { | ||
| result := icmd.RunCommand(GomplateBin, | ||
| "-i", "{{ $rows := (jsonArray `[[\"first\",\"second\"],[\"1\",\"2\"],[\"3\",\"4\"]]`) }}{{ data.ToCSV \";\" $rows }}", | ||
| ) | ||
| expected := "first;second\r\n1;2\r\n3;4\r\n" | ||
| result.Assert(c, icmd.Expected{ExitCode: 0, Out: expected}) | ||
| } |