Skip to content

Conversation

@lonvia
Copy link
Collaborator

@lonvia lonvia commented Nov 29, 2025

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.

Also introduces substring matching.
Postgrsql versions without the feature are no longer supported.
@joto joto merged commit b9a86d0 into osm2pgsql-dev:master Nov 29, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants