#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "$0")/.."

if rg -n '^[[:space:]]+StaticJsonDocument<kConfigJsonCapacity>[[:space:]]+[A-Za-z_][A-Za-z0-9_]*;' src/Config_Web.cpp; then
	echo "Config_Web.cpp still allocates kConfigJsonCapacity-sized StaticJsonDocument on the stack" >&2
	exit 1
fi

echo "Config_Web.cpp avoids stack-local kConfigJsonCapacity StaticJsonDocument allocations"
