Skip to content

Commit 1209f6f

Browse files
committed
Improve @lookup test coverage
1 parent 884904b commit 1209f6f

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

src/end-to-end.test.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,4 +456,59 @@ testCases(endToEnd, code => code)('end-to-end tests', [
456456
}.output`,
457457
either.makeRight('it works!'),
458458
],
459+
[
460+
// Lookups should never target keyword expression properties.
461+
`{
462+
{
463+
0: "it works!",
464+
result: { 0: "@lookup", 1: { 0: 0 } }
465+
}.result
466+
{
467+
1: "it works!",
468+
result: { 0: "@lookup", 1: { key: 1 } }
469+
}.result
470+
{
471+
key: "it works!",
472+
result: { 0: "@lookup", 1: { key: key } }
473+
}.result
474+
{
475+
body: "it works!",
476+
result: { 0: "@function", 1: { parameter: _, body: :body } }(_)
477+
}.result
478+
{
479+
parameter: "it works!",
480+
result: { 0: "@function", 1: { parameter: _, body: :parameter } }(_)
481+
}.result
482+
{
483+
1: "it works!",
484+
result: { 0: "@function", 1: { 0: _, 1: :1 } }(_)
485+
}.result
486+
{
487+
0: "it works!",
488+
result: { 0: "@function", 1: { 0: _, 1: :0 } }(_)
489+
}.result
490+
{
491+
1: "it works!",
492+
result: { 0: "@lookup", 1: { key: 1 } }
493+
}.result
494+
{
495+
1: "it does not work"
496+
result: {
497+
1: "it works!",
498+
result: { 0: "@lookup", 1: { key: 1 } }
499+
}.result
500+
}.result
501+
}`,
502+
either.makeRight({
503+
0: 'it works!',
504+
1: 'it works!',
505+
2: 'it works!',
506+
3: 'it works!',
507+
4: 'it works!',
508+
5: 'it works!',
509+
6: 'it works!',
510+
7: 'it works!',
511+
8: 'it works!',
512+
}),
513+
],
459514
])

0 commit comments

Comments
 (0)