mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-17 04:30:56 +01:00
Fix json parser (#80)
* fix #77: parse floats and nils as well and convert them to string
This commit is contained in:
@@ -180,6 +180,38 @@ func TestParserJSONInput(t *testing.T) {
|
||||
expect: Tabdata{},
|
||||
},
|
||||
|
||||
{
|
||||
// contains nil, int and float values
|
||||
name: "niljson",
|
||||
wanterror: false,
|
||||
input: `[
|
||||
{
|
||||
"NAME": "postgres-operator-7f4c7c8485-ntlns",
|
||||
"READY": "1/1",
|
||||
"STATUS": "Running",
|
||||
"RESTARTS": 0,
|
||||
"AGE": null,
|
||||
"X": 12,
|
||||
"Y": 34.222
|
||||
}
|
||||
]`,
|
||||
expect: Tabdata{
|
||||
columns: 7,
|
||||
headers: []string{"NAME", "READY", "STATUS", "RESTARTS", "AGE", "X", "Y"},
|
||||
entries: [][]string{
|
||||
[]string{
|
||||
"postgres-operator-7f4c7c8485-ntlns",
|
||||
"1/1",
|
||||
"Running",
|
||||
"0",
|
||||
"",
|
||||
"12",
|
||||
"34.222000",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
// one field missing + different order
|
||||
// but shall not fail
|
||||
|
||||
Reference in New Issue
Block a user