BDD was offering a catch-all check step which simply consisted of a SELECT
statement. This PR splits this into a SELECT statement definition:
```
Given the SQL statement foobar
"""
SELECT foo FROM bar
"""
```
and a statement execution:
```
Then statement foobar returns
| foo |
| 0 |
```
This has several advantages:
* SQL statements can now go over multiple lines, making complex ones
indefinitely more readable
* execution can now include a `return exactly` like for the table check to
catch negative expectations
But most importantly: statements can be reused. That means you can basically
define arbitrary check functions for your database content by defining an SQL
statement in the Background section of your feature file and then use them in
all the scenarios. See the index creation tests for a practical use-case for
that.
Other changes sneaked into this PR:
* Remove the @needs-pg-index-includes tag. This was only needed for PG versions
10 and below which we don't support anymore.
* Add a 'substr' checker. This checks if the expected value is
contained in the response. This may sometimes more useful than the complex
regex checker as it avoids having to quote special regex expressions.
You can view, comment on, or merge this pull request online at:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2435
-- Commit Summary --
* bdd: use a SQL statement template for index checks
* bdd: remove needs include index check
* bdd: replace remaining SELECT steps with SQL templates
-- File Changes --
M tests/bdd/environment.py (8)
M tests/bdd/flex/delete-callbacks.feature (19)
M tests/bdd/flex/lua-index-definitions.feature (124)
M tests/bdd/regression/multipolygon.feature (28)
M tests/bdd/steps/steps_db.py (38)
-- Patch Links --
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2435.patch
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2435.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2435
You are receiving this because you are subscribed to this thread.
Message ID: <osm2pgsql-dev/osm2pgsql/pull/[email protected]>
_______________________________________________
Tile-serving mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/tile-serving