Closed MarDiehl closed 1 month ago
the error is
--- /tmp/tmp.3VOEwfva1W 2023-09-26 10:45:04.296399978 +0200
+++ /tmp/tmp.nIOU0yBdZ3 2023-09-26 10:45:04.299733412 +0200
@@ -15,13 +15,13 @@
"product": [
{
"description": "Basketball",
- "price": 450.00,
+ "price": 450,
"quantity": 4,
"sku": "BL394D"
},
{
"description": "Super Hoop",
- "price": 2392.00,
+ "price": 2392,
"quantity": 1,
"sku": "BL4438H"
}
not ok 256 UGM3 - Spec Example 2.27. Invoice (JSON)
FAIL: testsuite-json.test 256 UGM3 - Spec Example 2.27. Invoice (JSON)
so somehow floats with trailing zeros are changed to integers.
I only see this error if jq
(https://jqlang.github.io/jq/) is installed. The version that fails is 1.7 from https://archlinux.org/packages/extra/x86_64/jq/
The issue seems to be related to the new jq release (https://github.com/jqlang/jq/releases/tag/jq-1.7). the test fails for libfyaml 0.8 and 0.9
Yes, I would guess this would be a problem. I need to think about how to control jq output.
The expected JSON file contains integers, the yaml file doesn't:
"product": [
{
"sku": "BL394D",
"quantity": 4,
"description": "Basketball",
"price": 450
},
{
"sku": "BL4438H",
"quantity": 1,
"description": "Super Hoop",
"price": 2392
}
],
product:
- sku : BL394D
quantity : 4
description : Basketball
price : 450.00
- sku : BL4438H
quantity : 1
description : Super Hoop
price : 2392.00
This looks like a problem with the test itself. Libfyaml behaves correctly by not changing the type -- at least that's what I'd expect. Maybe jq converted floats to ints during canonicalization, which has been changed in newer versions? That would mask that the difference in outputs was always present. I'm running into the same failure with jq 1.6, btw.
E: It's probably this PR 1752. From the changes to the manual:
jq will also try to maintain the original decimal precision of the provided number literal. See below for examples. [...]
- program: 'map([., . == 1]) | tojson' input: '[1, 1.000, 1.0, 100e-2]' output: ['"[[1,true],[1.000,true],[1.0,true],[1.00,true]]"']
The real problem is that libfyaml does not do (yet on master) object conversions due to only supporting the built-in schema (i.e. all scalars are strings).
Arguably the test will have to be skipped while this is the case, and I will revisit when schema support lands in master.
when building the AUR package, I encounter a failing test (testsuite-json.test 256 UGM3). Log file is attached.
There are also a few compiler warning:
test-suite.log