Skip to content

Commit 23e5a62

Browse files
committed
fix tests
1 parent 28f81c5 commit 23e5a62

File tree

5 files changed

+68
-6
lines changed

5 files changed

+68
-6
lines changed

test/expr-parser.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ describe('expression parsing', () => {
1919
it('calls', async () => {
2020
await assertLintFree(`
2121
<emu-alg>
22+
1. Let _foo_ be a variable.
2223
1. Let _x_ be _foo_().
2324
1. Set _x_ to _foo_( ).
2425
1. Set _x_ to _foo_.[[Bar]]().
@@ -41,8 +42,9 @@ describe('expression parsing', () => {
4142
it('record-spec', async () => {
4243
await assertLintFree(`
4344
<emu-alg>
45+
1. Let _entries_ be a List.
4446
1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do
45-
1. Something.
47+
1. Use _p_.
4648
</emu-alg>
4749
`);
4850
});
@@ -54,17 +56,20 @@ describe('expression parsing', () => {
5456
0,
5557
1,
5658
».
59+
1. Use _x_.
5760
</emu-alg>
5861
`);
5962
});
6063

6164
it('trailing comma in multi-line call', async () => {
6265
await assertLintFree(`
6366
<emu-alg>
67+
1. Let _foo_ be a function.
6468
1. Let _x_ be _foo_(
6569
0,
6670
1,
6771
).
72+
1. Use _x_.
6873
</emu-alg>
6974
`);
7075
});
@@ -76,6 +81,7 @@ describe('expression parsing', () => {
7681
[[X]]: 0,
7782
[[Y]]: 1,
7883
}.
84+
1. Use _x_.
7985
</emu-alg>
8086
`);
8187
});
@@ -87,6 +93,7 @@ describe('expression parsing', () => {
8793
1. Let _x_ be a new Record { [[Foo]]: 0, <ins>[[Bar]]: 1</ins> }.
8894
1. Let _x_ be a new Record { [[Foo]]: 0, <ins>[[Bar]]: 1, [[Baz]]: 2</ins> }.
8995
1. Let _x_ be a new Record { [[Foo]]: 0, <ins>[[Bar]]: 1,</ins> [[Baz]]: 2 }.
96+
1. Use _x_.
9097
</emu-alg>
9198
`);
9299
});
@@ -127,7 +134,9 @@ describe('expression parsing', () => {
127134
await assertLint(
128135
positioned`
129136
<emu-alg>
137+
1. Let _foo_ and _a_ be variables.
130138
1. Let _x_ be «_foo_(_a_${M}»).
139+
1. Use _x_.
131140
</emu-alg>
132141
`,
133142
{
@@ -143,6 +152,7 @@ describe('expression parsing', () => {
143152
positioned`
144153
<emu-alg>
145154
1. Let _x_ be «${M},».
155+
1. Use _x_.
146156
</emu-alg>
147157
`,
148158
{
@@ -170,7 +180,9 @@ describe('expression parsing', () => {
170180
await assertLint(
171181
positioned`
172182
<emu-alg>
183+
1. Let _foo_ be a function.
173184
1. Let _x_ be _foo_(${M},)».
185+
1. Use _x_.
174186
</emu-alg>
175187
`,
176188
{
@@ -183,7 +195,9 @@ describe('expression parsing', () => {
183195
await assertLint(
184196
positioned`
185197
<emu-alg>
198+
1. Let _foo_ and _a_ be variables.
186199
1. Let _x_ be _foo_(_a_, ${M}).
200+
1. Use _x_.
187201
</emu-alg>
188202
`,
189203
{
@@ -199,6 +213,7 @@ describe('expression parsing', () => {
199213
positioned`
200214
<emu-alg>
201215
1. Let _x_ be the Record { ${M}}.
216+
1. Use _x_.
202217
</emu-alg>
203218
`,
204219
{
@@ -214,6 +229,7 @@ describe('expression parsing', () => {
214229
positioned`
215230
<emu-alg>
216231
1. Let _x_ be the Record { ${M}[x]: 0 }.
232+
1. Use _x_.
217233
</emu-alg>
218234
`,
219235
{
@@ -229,6 +245,7 @@ describe('expression parsing', () => {
229245
positioned`
230246
<emu-alg>
231247
1. Let _x_ be the Record { [[A]]: 0, [[${M}A]]: 0 }.
248+
1. Use _x_.
232249
</emu-alg>
233250
`,
234251
{
@@ -244,6 +261,7 @@ describe('expression parsing', () => {
244261
positioned`
245262
<emu-alg>
246263
1. Let _x_ be the Record { [[A]], [[B]]${M}: 0 }.
264+
1. Use _x_.
247265
</emu-alg>
248266
`,
249267
{
@@ -257,6 +275,7 @@ describe('expression parsing', () => {
257275
positioned`
258276
<emu-alg>
259277
1. Let _x_ be the Record { [[A]]: 0, [[B]]${M} }.
278+
1. Use _x_.
260279
</emu-alg>
261280
`,
262281
{

test/lint-algorithms.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ describe('linting algorithms', () => {
4545
it('repeat', async () => {
4646
await assertLint(
4747
positioned`<emu-alg>
48+
1. Let _x_ be a variable.
4849
1. Repeat, while _x_ < 10${M}
4950
1. Foo.
5051
</emu-alg>`,
@@ -59,6 +60,7 @@ describe('linting algorithms', () => {
5960
it('inline if', async () => {
6061
await assertLint(
6162
positioned`<emu-alg>
63+
1. Let _x_ be a variable.
6264
1. If _x_, then${M}
6365
</emu-alg>`,
6466
{
@@ -72,6 +74,7 @@ describe('linting algorithms', () => {
7274
it('inline if-then', async () => {
7375
await assertLint(
7476
positioned`<emu-alg>
77+
1. Let _x_ be a variable.
7578
1. If _x_, ${M}then do something.
7679
</emu-alg>`,
7780
{
@@ -85,6 +88,7 @@ describe('linting algorithms', () => {
8588
it('multiline if', async () => {
8689
await assertLint(
8790
positioned`<emu-alg>
91+
1. Let _x_ be a variable.
8892
1. If _x_,${M}
8993
1. Foo.
9094
</emu-alg>`,
@@ -97,6 +101,7 @@ describe('linting algorithms', () => {
97101

98102
await assertLint(
99103
positioned`<emu-alg>
104+
1. Let _x_ be a variable.
100105
1. If _x_${M}; then
101106
1. Foo.
102107
</emu-alg>`,
@@ -112,6 +117,7 @@ describe('linting algorithms', () => {
112117
it('else if', async () => {
113118
await assertLint(
114119
positioned`<emu-alg>
120+
1. Let _x_ and _y_ be variables.
115121
1. If _x_, foo.
116122
1. Else${M}, if _y_, bar.
117123
</emu-alg>`,
@@ -199,6 +205,7 @@ describe('linting algorithms', () => {
199205
1. ${M}Let _constructorText_ be the source text
200206
<pre><code class="javascript">constructor() {}</code></pre>
201207
1. Foo.
208+
1. Use _constructorText_.
202209
</emu-alg>`,
203210
{
204211
ruleId,
@@ -219,6 +226,7 @@ describe('linting algorithms', () => {
219226
it('negative', async () => {
220227
await assertLintFree(`
221228
<emu-alg>
229+
1. Let _x_, _y_, and _z_ be variables.
222230
1. If foo, bar.
223231
1. Else if foo, bar.
224232
1. Else, bar.
@@ -250,7 +258,9 @@ describe('linting algorithms', () => {
250258
1. Substep.
251259
1. Let _constructorText_ be the source text
252260
<pre><code class="javascript">constructor() {}</code></pre>
253-
1. Set _constructor_ to _parse_(_constructorText_, _methodDefinition_).
261+
1. Let _parse_ be a method.
262+
1. Let _constructor_ be a variable.
263+
1. Set _constructor_ to _parse_(_constructorText_).
254264
1. <mark>A highlighted line.</mark>
255265
1. <ins>Amend the spec with this.</ins>
256266
1. <del>Remove this from the spec.</del>
@@ -413,6 +423,7 @@ describe('linting algorithms', () => {
413423
await assertLint(
414424
positioned`
415425
<emu-alg>
426+
1. Let _y_ be a List.
416427
1. For each ${M}_x_ of _y_, do foo.
417428
</emu-alg>`,
418429
{
@@ -426,6 +437,8 @@ describe('linting algorithms', () => {
426437
it('negative', async () => {
427438
await assertLintFree(`
428439
<emu-alg>
440+
1. Let _y_ be a List.
441+
1. Let _S_ be a Set.
429442
1. For each String _x_ of _y_, do foo.
430443
1. For each element _x_ of _y_, do foo.
431444
1. For each integer _x_ such that _x_ &in; _S_, do foo.

test/lint-spelling.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ describe('spelling', () => {
4545
it('*0*', async () => {
4646
await assertLint(
4747
positioned`
48-
<emu-alg>1. If _x_ is ${M}*0*<sub>𝔽</sub>, do foo.</emu-alg>
48+
<emu-alg>
49+
1. Let _x_ be a value.
50+
1. If _x_ is ${M}*0*<sub>𝔽</sub>, do foo.
51+
</emu-alg>
4952
`,
5053
{
5154
ruleId: 'spelling',

test/lint.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ describe('linting whole program', () => {
482482
positioned`
483483
<emu-alg>
484484
1. Let _s_ be |${M}Example|.
485+
1. Return _s_.
485486
</emu-alg>
486487
`,
487488
{
@@ -503,6 +504,7 @@ describe('linting whole program', () => {
503504
<emu-grammar>Statement: \`;\`</emu-grammar>
504505
<emu-alg>
505506
1. Let _s_ be |${M}Statements|.
507+
1. Return _s_.
506508
</emu-alg>
507509
</emu-clause>
508510
`,
@@ -554,6 +556,7 @@ describe('linting whole program', () => {
554556
</emu-grammar>
555557
<emu-alg>
556558
1. Let _s_ be |Example1|.
559+
1. Return _s_.
557560
</emu-alg>
558561
<p>Discuss: |Example1|.</p>
559562
<p>Discuss: <emu-nt>Example1</emu-nt>.</p>

0 commit comments

Comments
 (0)