diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/jq.test | 39 | ||||
-rw-r--r-- | tests/local.supp | 14 | ||||
-rwxr-xr-x | tests/setup | 3 |
3 files changed, 55 insertions, 1 deletions
diff --git a/tests/jq.test b/tests/jq.test index a6a8d219..adc57889 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -1673,3 +1673,42 @@ false #null +# +# Tests to cover the new toliteral number functionality +# For an example see #1652 and other linked issues +# + +# We are backward and sanity compatible + +map(. == 1) +[1, 1.0, 1.000, 100e-2, 1e+0, 0.0001e4] +[true, true, true, true, true, true] + +# When no arithmetic is involved jq should preserve the literal value + +.[0] | tostring +[13911860366432393] +"13911860366432393" + +.x | tojson +{"x":13911860366432393} +"13911860366432393" + +13911860366432393 == 13911860366432392 +null +false + + +# Applying arithmetic to the value will truncate the result to double + +. - 10 +13911860366432393 +13911860366432382 + +.[0] - 10 +[13911860366432393] +13911860366432382 + +.x - 10 +{"x":13911860366432393} +13911860366432382 diff --git a/tests/local.supp b/tests/local.supp new file mode 100644 index 00000000..8bb878b0 --- /dev/null +++ b/tests/local.supp @@ -0,0 +1,14 @@ +{ + macos valgrind 1 + Memcheck:Leak + match-leak-kinds: possible + fun:calloc + fun:map_images_nolock + ... + fun:_dyld_objc_notify_register + fun:_objc_init + fun:_os_object_init + fun:libdispatch_init + fun:libSystem_initializer + ... +} diff --git a/tests/setup b/tests/setup index 4a96574d..bb5f62be 100755 --- a/tests/setup +++ b/tests/setup @@ -14,7 +14,8 @@ JQ=$JQBASEDIR/jq if [ -z "${NO_VALGRIND-}" ] && which valgrind > /dev/null; then VALGRIND="valgrind --error-exitcode=1 --leak-check=full \ - --suppressions=$JQTESTDIR/onig.supp" + --suppressions=$JQTESTDIR/onig.supp \ + --suppressions=$JQTESTDIR/local.supp" VG_EXIT0=--error-exitcode=0 Q=-q else |