mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 05:38:04 +00:00
fix tests
This commit is contained in:
parent
a125495eec
commit
bb9cb0c60e
@ -111,7 +111,7 @@ true: true
|
|||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
t.Error(result.Error)
|
t.Error(result.Error)
|
||||||
}
|
}
|
||||||
expectedOutput := `{"5":{"null":{"0.1":"deeply","false":"things"}},"true":true}
|
expectedOutput := `{"true":true,"5":{"null":{"0.1":"deeply","false":"things"}}}
|
||||||
`
|
`
|
||||||
test.AssertResult(t, expectedOutput, result.Output)
|
test.AssertResult(t, expectedOutput, result.Output)
|
||||||
}
|
}
|
||||||
@ -583,7 +583,7 @@ func TestReadMergeAnchorsExplodeJsonCmd(t *testing.T) {
|
|||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
t.Error(result.Error)
|
t.Error(result.Error)
|
||||||
}
|
}
|
||||||
expectedOutput := `{"bar":{"b":2,"c":"oldbar","thing":"coconut"},"foo":{"a":"original","thing":"coolasdf","thirsty":"yep"},"foobar":{"a":"original","c":3,"thing":"ice","thirsty":"yep","thirty":"well beyond"},"foobarList":{"a":"original","b":2,"c":"newbar","thing":"coconut","thirsty":"yep"}}
|
expectedOutput := `{"foo":{"a":"original","thing":"coolasdf","thirsty":"yep"},"bar":{"b":2,"thing":"coconut","c":"oldbar"},"foobarList":{"c":"newbar","b":2,"thing":"coconut","a":"original","thirsty":"yep"},"foobar":{"thirty":"well beyond","thing":"ice","c":3,"a":"original","thirsty":"yep"}}
|
||||||
`
|
`
|
||||||
test.AssertResult(t, expectedOutput, result.Output)
|
test.AssertResult(t, expectedOutput, result.Output)
|
||||||
}
|
}
|
||||||
@ -962,6 +962,7 @@ b:
|
|||||||
value: 3
|
value: 3
|
||||||
- name: sam
|
- name: sam
|
||||||
value: 4
|
value: 4
|
||||||
|
ab: must appear last
|
||||||
`
|
`
|
||||||
test.AssertResult(t, expectedOutput, result.Output)
|
test.AssertResult(t, expectedOutput, result.Output)
|
||||||
}
|
}
|
||||||
@ -1001,6 +1002,7 @@ b:
|
|||||||
value: 3
|
value: 3
|
||||||
- name: sam
|
- name: sam
|
||||||
value: 4
|
value: 4
|
||||||
|
ab: must appear last
|
||||||
`
|
`
|
||||||
test.AssertResult(t, expectedOutput, result.Output)
|
test.AssertResult(t, expectedOutput, result.Output)
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
{"a":"Easy! as one two three","b":{"c":2,"d":[3,4],"e":[{"name":"fred","value":3},{"name":"sam","value":4}]}}
|
{"a":"Easy! as one two three","b":{"c":2,"d":[3,4],"e":[{"name":"fred","value":3},{"name":"sam","value":4}]},"ab":"must appear last"}
|
||||||
|
@ -166,7 +166,9 @@ func (o orderedMap) MarshalJSON() ([]byte, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
buf.WriteByte(':')
|
buf.WriteByte(':')
|
||||||
enc.Encode(el.V)
|
if err := enc.Encode(el.V); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if idx != len(o.kv)-1 {
|
if idx != len(o.kv)-1 {
|
||||||
buf.WriteByte(',')
|
buf.WriteByte(',')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user