Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
8817f7ba
Commit
8817f7ba
authored
Jun 07, 2018
by
Herbert Mühlburger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add test for 'ParseIntoString' and update test for 'ParseInto'
parent
1a728c6f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
parser_test.go
pkg/strvals/parser_test.go
+35
-1
No files found.
pkg/strvals/parser_test.go
View file @
8817f7ba
...
...
@@ -336,12 +336,13 @@ func TestParseInto(t *testing.T) {
"inner2"
:
"value2"
,
},
}
input
:=
"outer.inner1=value1,outer.inner3=value3"
input
:=
"outer.inner1=value1,outer.inner3=value3
,outer.inner4=4
"
expect
:=
map
[
string
]
interface
{}{
"outer"
:
map
[
string
]
interface
{}{
"inner1"
:
"value1"
,
"inner2"
:
"value2"
,
"inner3"
:
"value3"
,
"inner4"
:
4
,
},
}
...
...
@@ -362,6 +363,39 @@ func TestParseInto(t *testing.T) {
t
.
Errorf
(
"%s: Expected:
\n
%s
\n
Got:
\n
%s"
,
input
,
y1
,
y2
)
}
}
func
TestParseIntoString
(
t
*
testing
.
T
)
{
got
:=
map
[
string
]
interface
{}{
"outer"
:
map
[
string
]
interface
{}{
"inner1"
:
"overwrite"
,
"inner2"
:
"value2"
,
},
}
input
:=
"outer.inner1=1,outer.inner3=3"
expect
:=
map
[
string
]
interface
{}{
"outer"
:
map
[
string
]
interface
{}{
"inner1"
:
"1"
,
"inner2"
:
"value2"
,
"inner3"
:
"3"
,
},
}
if
err
:=
ParseIntoString
(
input
,
got
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
y1
,
err
:=
yaml
.
Marshal
(
expect
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
y2
,
err
:=
yaml
.
Marshal
(
got
)
if
err
!=
nil
{
t
.
Fatalf
(
"Error serializing parsed value: %s"
,
err
)
}
if
string
(
y1
)
!=
string
(
y2
)
{
t
.
Errorf
(
"%s: Expected:
\n
%s
\n
Got:
\n
%s"
,
input
,
y1
,
y2
)
}
}
func
TestToYAML
(
t
*
testing
.
T
)
{
// The TestParse does the hard part. We just verify that YAML formatting is
...
...
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