mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 17:36:59 +08:00
fix: parse signed hex and octal integers (#2749)
This commit is contained in:
@@ -189,6 +189,38 @@ var jsonScenarios = []formatScenario{
|
||||
expected: "{\n \"cat\": \"meow\"\n}\n",
|
||||
scenarioType: "encode",
|
||||
},
|
||||
{
|
||||
description: "Encode json: signed hex int",
|
||||
skipDoc: true,
|
||||
input: `+0x12`,
|
||||
indent: 0,
|
||||
expected: "18\n",
|
||||
scenarioType: "encode",
|
||||
},
|
||||
{
|
||||
description: "Encode json: negative hex int",
|
||||
skipDoc: true,
|
||||
input: `-0x12`,
|
||||
indent: 0,
|
||||
expected: "-18\n",
|
||||
scenarioType: "encode",
|
||||
},
|
||||
{
|
||||
description: "Encode json: signed octal int",
|
||||
skipDoc: true,
|
||||
input: `+0o22`,
|
||||
indent: 0,
|
||||
expected: "18\n",
|
||||
scenarioType: "encode",
|
||||
},
|
||||
{
|
||||
description: "Encode json: negative octal int",
|
||||
skipDoc: true,
|
||||
input: `-0o22`,
|
||||
indent: 0,
|
||||
expected: "-18\n",
|
||||
scenarioType: "encode",
|
||||
},
|
||||
{
|
||||
description: "Encode json: simple - in one line",
|
||||
input: `cat: meow # this is a comment, and it will be dropped.`,
|
||||
|
||||
Reference in New Issue
Block a user