+ln=0
+state=plaintext
+
+# shellcheck disable=SC2086
+context_get () { printenv "ctx_${1}${depth}"; }
+context_set () { export "ctx_${1}${depth}=${2}"; }
+
+context_push () {
+ context_set plan ""
+ context_set count 0
+ context_set test_before_plan no
+ context_set test_after_plan no
+ context_set expect ""
+ context_set bail no
+ context_set strict no
+}
+
+context_pop () {
+ if [ "$(context_get count)" -gt 0 ] && [ -z "$(context_get plan)" ]
+ then
+ ship_line "Missing a plan at line ${ln}."
+ status=1
+ elif [ "$(context_get test_before_plan)" = "yes" ] && [ "$(context_get test_after_plan)" = "yes" ]
+ then
+ ship_line "A plan line may only be placed before or after all tests."
+ status=1
+ elif [ "$(context_get plan)" != "" ] && [ "$(context_get expect)" -gt "$(context_get count)" ]
+ then
+ ship_line "Expected $(context_get expect) tests but only ${testcount} ran."
+ status=1
+ fi
+}
+
+depth=0
+context_push
+