From 7932e4ac6a6cc64c28f24172410983740ad1dd0a Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 26 Jun 2023 15:50:25 +0100 Subject: [PATCH] Testing: Invalid key decoding --- tests/grib_proj_string.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/grib_proj_string.sh b/tests/grib_proj_string.sh index c056554ce..9dc1e8557 100755 --- a/tests/grib_proj_string.sh +++ b/tests/grib_proj_string.sh @@ -80,5 +80,23 @@ ${tools_dir}/grib_set -s gridType=polar_stereographic $grib2_sample $tempGrib ${tools_dir}/grib_get -p projString $tempGrib > $tempText grep -q "proj=stere" $tempText +# Test invalid decode +set +e +${tools_dir}/grib_get -p projString:i $grib2_sample > $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "ERROR.*Cannot unpack projTargetString as long" $tempText +grep -q "Hint: Try unpacking as string" $tempText +set +e +${tools_dir}/grib_get -p projString:d $grib2_sample > $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "ERROR.*Cannot unpack projTargetString as double" $tempText +grep -q "Hint: Try unpacking as string" $tempText + + +# Clean up rm -f $tempGrib $tempText