diff schema/isrs_tests.sql @ 3561:453f15ba8030

Improve error handling in area generation Instead of hitting a NOT NULL constraint later on, raise an error if no candidate area for cutting is found.
author Tom Gottfried <tom@intevation.de>
date Fri, 31 May 2019 16:58:42 +0200
parents d316a6e41f54
children 4c585b5d4fe8
line wrap: on
line diff
--- a/schema/isrs_tests.sql	Fri May 31 16:54:09 2019 +0200
+++ b/schema/isrs_tests.sql	Fri May 31 16:58:42 2019 +0200
@@ -58,14 +58,21 @@
         5)),
     'ISRSrange_axis returns a valid simple feature');
 
-SELECT ok(
-    ISRSrange_area(ISRSrange_axis(isrsrange(
+SELECT throws_ok($$
+    SELECT ISRSrange_area('LINESTRING(0 0, 1 1)', NULL)
+    $$,
+    'P0002', NULL,
+    'ISRSrange_area fails if no input area is given');
+
+SELECT throws_ok($$
+    SELECT ISRSrange_area(ISRSrange_axis(isrsrange(
                 ('AT', 'XXX', '00001', '00000', 0)::isrs,
                 ('AT', 'XXX', '00001', '00000', 1)::isrs),
             5),
-        ST_SetSRID('POLYGON((0 1, 0 2, 1 2, 1 1, 0 1))'::geometry, 4326)
-    ) IS NULL,
-    'ISRSrange_area returns NULL, if given area does not intersect with axis');
+        ST_SetSRID('POLYGON((0 1, 0 2, 1 2, 1 1, 0 1))'::geometry, 4326))
+    $$,
+    'P0002', NULL,
+    'ISRSrange_area fails, if given area does not intersect with axis');
 
 SELECT results_eq($$
     SELECT every(ST_DWithin(