<p></p>
<p>You could use some mock object for the osm2pgsql functionality provided by osm2pgsql:</p>
<p>(file osm2pgsql-mock-lua)</p>
<pre><code>local osm2pgsql = {}
local inspect = require('inspect')
function osm2pgsql.define_table(o)
local def_table = {}
function def_table.add_row(x, y)
print(inspect(y))
-- (store data somewhere for later retrieval in unit test)
end
return def_table
end
return osm2pgsql
</code></pre>
<p>... and use this mock object along with your original openstreetmap-carto.lua file to run some tests.</p>
<p>test.lua</p>
<pre><code>osm2pgsql = require 'osm2pgsql-mock'
require 'openstreetmap-carto'
x = {}
x.tags = {}
x.tags["highway"] = "bus_stop"
x.tags["layer"] = "1"
-- simulate callback function call by osm2pgsql
osm2pgsql.process_node(x)
-- todo: check results by calling another mock function in osm2pgsql
</code></pre>
<p>Execute test.lua:</p>
<pre><code>lua test.lua
{
highway = "bus_stop",
layer = "1",
tags = {
layer = "1"
}
}
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/issues/1130#issuecomment-633286967">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353QHWSJJOHYMFPWKF43RTF3JLANCNFSM4MLPW2VQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AA6353W3HKZJ5ZBTUYU4ZNDRTF3JLA5CNFSM4MLPW2V2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEW7TCNY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/issues/1130#issuecomment-633286967",
"url": "https://github.com/openstreetmap/osm2pgsql/issues/1130#issuecomment-633286967",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>