Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5f3aff2c
Commit
5f3aff2c
authored
Aug 21, 2015
by
Daniel Martí
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix struct input test in jsonpath
parent
1313e3b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
jsonpath.go
pkg/util/jsonpath/jsonpath.go
+1
-1
jsonpath_test.go
pkg/util/jsonpath/jsonpath_test.go
+1
-1
No files found.
pkg/util/jsonpath/jsonpath.go
View file @
5f3aff2c
...
@@ -217,7 +217,7 @@ func (j *JSONPath) evalArray(input []reflect.Value, node *ArrayNode) ([]reflect.
...
@@ -217,7 +217,7 @@ func (j *JSONPath) evalArray(input []reflect.Value, node *ArrayNode) ([]reflect.
value
,
isNil
:=
template
.
Indirect
(
value
)
value
,
isNil
:=
template
.
Indirect
(
value
)
if
isNil
||
(
value
.
Kind
()
!=
reflect
.
Array
&&
value
.
Kind
()
!=
reflect
.
Slice
)
{
if
isNil
||
(
value
.
Kind
()
!=
reflect
.
Array
&&
value
.
Kind
()
!=
reflect
.
Slice
)
{
return
input
,
fmt
.
Errorf
(
"%v is not array or slice"
,
value
)
return
input
,
fmt
.
Errorf
(
"%v is not array or slice"
,
value
.
Type
()
)
}
}
params
:=
node
.
Params
params
:=
node
.
Params
if
!
params
[
0
]
.
Known
{
if
!
params
[
0
]
.
Known
{
...
...
pkg/util/jsonpath/jsonpath_test.go
View file @
5f3aff2c
...
@@ -162,7 +162,7 @@ func TestStructInput(t *testing.T) {
...
@@ -162,7 +162,7 @@ func TestStructInput(t *testing.T) {
failStoreTests
:=
[]
jsonpathTest
{
failStoreTests
:=
[]
jsonpathTest
{
{
"invalid identfier"
,
"{hello}"
,
storeData
,
"unrecongnized identifier hello"
},
{
"invalid identfier"
,
"{hello}"
,
storeData
,
"unrecongnized identifier hello"
},
{
"nonexistent field"
,
"{.hello}"
,
storeData
,
"hello is not found"
},
{
"nonexistent field"
,
"{.hello}"
,
storeData
,
"hello is not found"
},
{
"invalid array"
,
"{.Labels[0]}"
,
storeData
,
"
<map[string]int Value>
is not array or slice"
},
{
"invalid array"
,
"{.Labels[0]}"
,
storeData
,
"
map[string]int
is not array or slice"
},
{
"invalid filter operator"
,
"{.Book[?(@.Price<>10)]}"
,
storeData
,
"unrecognized filter operator <>"
},
{
"invalid filter operator"
,
"{.Book[?(@.Price<>10)]}"
,
storeData
,
"unrecognized filter operator <>"
},
{
"redundent end"
,
"{range .Labels.*}{@}{end}{end}"
,
storeData
,
"not in range, nothing to end"
},
{
"redundent end"
,
"{range .Labels.*}{@}{end}{end}"
,
storeData
,
"not in range, nothing to end"
},
}
}
...
...
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