diff --git a/test/lint-variable-use-def.js b/test/lint-variable-use-def.js
index 4db11e91..ea7029c7 100644
--- a/test/lint-variable-use-def.js
+++ b/test/lint-variable-use-def.js
@@ -115,6 +115,38 @@ describe('variables are declared and used appropriately', () => {
);
});
+ it('variables in a loop header other than the loop variable must be declared', async () => {
+ await assertLint(
+ positioned`
+
+ 1. Let _c_ be a variable.
+ 1. For each integer _a_ of ${M}_b_ such that _c_ relates to _a_ in some way, do
+ 1. Something.
+
+ `,
+ {
+ ruleId: 'use-before-def',
+ nodeType: 'emu-alg',
+ message: 'could not find a preceding declaration for "b"',
+ }
+ );
+
+ await assertLint(
+ positioned`
+
+ 1. Let _b_ be a variable.
+ 1. For each integer _a_ of _b_ such that ${M}_c_ relates to _a_ in some way, do
+ 1. Something.
+
+ `,
+ {
+ ruleId: 'use-before-def',
+ nodeType: 'emu-alg',
+ message: 'could not find a preceding declaration for "c"',
+ }
+ );
+ });
+
it('explicit "declared" annotations should not be redundant', async () => {
await assertLint(
positioned`