Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitac70dee

Browse files
committed
test
1 parent1cdfd5d commitac70dee

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

‎test/compute-engine/collections.test.ts‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@ const expression: Expression = ['Add', 2, ['Multiply', 3, 'x']];
4545
constsymbol:Expression='x';
4646
constdict:Expression=[
4747
'Dictionary',
48-
['Tuple','x',1],
49-
['Tuple','y',2],
50-
['Tuple','z',3],
48+
['Tuple',{str:'x'},1],
49+
['Tuple',{str:'y'},2],
50+
['Tuple',{str:'z'},3],
5151
];
52+
53+
constdictShorthand:Expression={dict:{x:1,y:2,z:3}};
54+
5255
consttuple:Expression=['Tuple',7,10,13];
5356

5457
describe('COUNT',()=>{
@@ -94,8 +97,10 @@ describe('COUNT', () => {
9497
]
9598
`));
9699

97-
test('Count dict',()=>
98-
expect(evaluate(['Count',dict])).toMatchInlineSnapshot(`3`));
100+
test('Count dict',()=>{
101+
expect(evaluate(['Count',dict])).toMatchInlineSnapshot(`3`);
102+
expect(evaluate(['Count',dictShorthand])).toMatchInlineSnapshot(`3`);
103+
});
99104

100105
test('Count tuple',()=>
101106
expect(evaluate(['Count',tuple])).toMatchInlineSnapshot(`3`));
@@ -178,6 +183,22 @@ describe('TAKE', () => {
178183
1
179184
]
180185
`);
186+
187+
expect(evaluate(['Take',dictShorthand,1])).toMatchInlineSnapshot(`
188+
[
189+
"Take",
190+
[
191+
"Error",
192+
[
193+
"ErrorCode",
194+
"incompatible-type",
195+
"'indexed_collection'",
196+
"dictionary<finite_integer>"
197+
]
198+
],
199+
1
200+
]
201+
`);
181202
});
182203
});
183204

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp