Skip to content

Commit 1a7c7f3

Browse files
committed
PR test feedback
1 parent 034b533 commit 1a7c7f3

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

dotnet/test/common/BiDi/Script/CallFunctionLocalValueTest.cs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CallFunctionLocalValueTest : BiDiTestFixture
2727
[Test]
2828
public void CanCallFunctionWithArgumentUndefined()
2929
{
30-
var undefined = new LocalValue.Undefined();
30+
var arg = new LocalValue.Undefined();
3131
Assert.That(async () =>
3232
{
3333
await context.Script.CallFunctionAsync($$"""
@@ -36,14 +36,14 @@ await context.Script.CallFunctionAsync($$"""
3636
throw new Error("Assert failed: " + arg);
3737
}
3838
}
39-
""", false, new() { Arguments = [undefined] });
39+
""", false, new() { Arguments = [arg] });
4040
}, Throws.Nothing);
4141
}
4242

4343
[Test]
4444
public void CanCallFunctionWithArgumentNull()
4545
{
46-
var @null = new LocalValue.Null();
46+
var arg = new LocalValue.Null();
4747
Assert.That(async () =>
4848
{
4949
await context.Script.CallFunctionAsync($$"""
@@ -52,14 +52,14 @@ await context.Script.CallFunctionAsync($$"""
5252
throw new Error("Assert failed: " + arg);
5353
}
5454
}
55-
""", false, new() { Arguments = [@null] });
55+
""", false, new() { Arguments = [arg] });
5656
}, Throws.Nothing);
5757
}
5858

5959
[Test]
6060
public void CanCallFunctionWithArgumentEmptyString()
6161
{
62-
var empty = new LocalValue.String(string.Empty);
62+
var arg = new LocalValue.String(string.Empty);
6363
Assert.That(async () =>
6464
{
6565
await context.Script.CallFunctionAsync($$"""
@@ -68,14 +68,14 @@ await context.Script.CallFunctionAsync($$"""
6868
throw new Error("Assert failed: " + arg);
6969
}
7070
}
71-
""", false, new() { Arguments = [empty] });
71+
""", false, new() { Arguments = [arg] });
7272
}, Throws.Nothing);
7373
}
7474

7575
[Test]
7676
public void CanCallFunctionWithArgumentNonEmptyString()
7777
{
78-
var whoaString = new LocalValue.String("whoa");
78+
var arg = new LocalValue.String("whoa");
7979
Assert.That(async () =>
8080
{
8181
await context.Script.CallFunctionAsync($$"""
@@ -84,7 +84,7 @@ await context.Script.CallFunctionAsync($$"""
8484
throw new Error("Assert failed: " + arg);
8585
}
8686
}
87-
""", false, new() { Arguments = [whoaString] });
87+
""", false, new() { Arguments = [arg] });
8888
}, Throws.Nothing);
8989
}
9090

@@ -93,7 +93,7 @@ public void CanCallFunctionWithArgumentRecentDate()
9393
{
9494
const string PinnedDateTimeString = "2025-03-09T00:30:33.083Z";
9595

96-
var date = new LocalValue.Date(PinnedDateTimeString);
96+
var arg = new LocalValue.Date(PinnedDateTimeString);
9797

9898
Assert.That(async () =>
9999
{
@@ -103,7 +103,7 @@ await context.Script.CallFunctionAsync($$"""
103103
throw new Error("Assert failed: " + arg);
104104
}
105105
}
106-
""", false, new() { Arguments = [date] });
106+
""", false, new() { Arguments = [arg] });
107107
}, Throws.Nothing);
108108
}
109109

@@ -112,7 +112,7 @@ public void CanCallFunctionWithArgumentEpochDate()
112112
{
113113
const string EpochString = "1970-01-01T00:00:00.000Z";
114114

115-
var epochDate = new LocalValue.Date(EpochString);
115+
var arg = new LocalValue.Date(EpochString);
116116

117117
Assert.That(async () =>
118118
{
@@ -122,14 +122,14 @@ await context.Script.CallFunctionAsync($$"""
122122
throw new Error("Assert failed: " + arg.toISOString());
123123
}
124124
}
125-
""", false, new() { Arguments = [epochDate] });
125+
""", false, new() { Arguments = [arg] });
126126
}, Throws.Nothing);
127127
}
128128

129129
[Test]
130130
public void CanCallFunctionWithArgumentNumberFive()
131131
{
132-
var number5 = new LocalValue.Number(5);
132+
var arg = new LocalValue.Number(5);
133133

134134
Assert.That(async () =>
135135
{
@@ -139,14 +139,14 @@ await context.Script.CallFunctionAsync($$"""
139139
throw new Error("Assert failed: " + arg);
140140
}
141141
}
142-
""", false, new() { Arguments = [number5] });
142+
""", false, new() { Arguments = [arg] });
143143
}, Throws.Nothing);
144144
}
145145

146146
[Test]
147147
public void CanCallFunctionWithArgumentNumberNegativeFive()
148148
{
149-
var numberMinus5 = new LocalValue.Number(-5);
149+
var arg = new LocalValue.Number(-5);
150150

151151
Assert.That(async () =>
152152
{
@@ -156,14 +156,14 @@ await context.Script.CallFunctionAsync($$"""
156156
throw new Error("Assert failed: " + arg);
157157
}
158158
}
159-
""", false, new() { Arguments = [numberMinus5] });
159+
""", false, new() { Arguments = [arg] });
160160
}, Throws.Nothing);
161161
}
162162

163163
[Test]
164164
public void CanCallFunctionWithArgumentNumberZero()
165165
{
166-
var number0 = new LocalValue.Number(0);
166+
var arg = new LocalValue.Number(0);
167167

168168
Assert.That(async () =>
169169
{
@@ -173,7 +173,7 @@ await context.Script.CallFunctionAsync($$"""
173173
throw new Error("Assert failed: " + arg);
174174
}
175175
}
176-
""", false, new() { Arguments = [number0] });
176+
""", false, new() { Arguments = [arg] });
177177
}, Throws.Nothing);
178178
}
179179

@@ -182,7 +182,7 @@ await context.Script.CallFunctionAsync($$"""
182182
[IgnoreBrowser(Selenium.Browser.Chrome, "Chromium can't handle -0 argument as a number: https://github.com/w3c/webdriver-bidi/issues/887")]
183183
public void CanCallFunctionWithArgumentNumberNegativeZero()
184184
{
185-
var minus0 = new LocalValue.Number(double.NegativeZero);
185+
var arg = new LocalValue.Number(double.NegativeZero);
186186

187187
Assert.That(async () =>
188188
{
@@ -192,14 +192,14 @@ await context.Script.CallFunctionAsync($$"""
192192
throw new Error("Assert failed: " + arg.toLocaleString());
193193
}
194194
}
195-
""", false, new() { Arguments = [minus0] });
195+
""", false, new() { Arguments = [arg] });
196196
}, Throws.Nothing);
197197
}
198198

199199
[Test]
200200
public void CanCallFunctionWithArgumentNumberPositiveInfinity()
201201
{
202-
var infinity = new LocalValue.Number(double.PositiveInfinity);
202+
var arg = new LocalValue.Number(double.PositiveInfinity);
203203

204204
Assert.That(async () =>
205205
{
@@ -209,14 +209,14 @@ await context.Script.CallFunctionAsync($$"""
209209
throw new Error("Assert failed: " + arg);
210210
}
211211
}
212-
""", false, new() { Arguments = [infinity] });
212+
""", false, new() { Arguments = [arg] });
213213
}, Throws.Nothing);
214214
}
215215

216216
[Test]
217217
public void CanCallFunctionWithArgumentNumberNegativeInfinity()
218218
{
219-
var minusInfinity = new LocalValue.Number(double.NegativeInfinity);
219+
var arg = new LocalValue.Number(double.NegativeInfinity);
220220

221221
Assert.That(async () =>
222222
{
@@ -226,14 +226,14 @@ await context.Script.CallFunctionAsync($$"""
226226
throw new Error("Assert failed: " + arg);
227227
}
228228
}
229-
""", false, new() { Arguments = [minusInfinity] });
229+
""", false, new() { Arguments = [arg] });
230230
}, Throws.Nothing);
231231
}
232232

233233
[Test]
234234
public void CanCallFunctionWithArgumentNumberNaN()
235235
{
236-
var nan = new LocalValue.Number(double.NaN);
236+
var arg = new LocalValue.Number(double.NaN);
237237
Assert.That(async () =>
238238
{
239239
await context.Script.CallFunctionAsync($$"""
@@ -242,14 +242,14 @@ await context.Script.CallFunctionAsync($$"""
242242
throw new Error("Assert failed: " + arg);
243243
}
244244
}
245-
""", false, new() { Arguments = [nan] });
245+
""", false, new() { Arguments = [arg] });
246246
}, Throws.Nothing);
247247
}
248248

249249
[Test]
250250
public void CanCallFunctionWithArgumentRegExp()
251251
{
252-
var regex = new LocalValue.RegExp(new LocalValue.RegExp.RegExpValue("foo*") { Flags = "g" });
252+
var arg = new LocalValue.RegExp(new LocalValue.RegExp.RegExpValue("foo*") { Flags = "g" });
253253

254254
Assert.That(async () =>
255255
{
@@ -259,14 +259,14 @@ await context.Script.CallFunctionAsync($$"""
259259
throw new Error("Assert failed: " + arg);
260260
}
261261
}
262-
""", false, new() { Arguments = [regex] });
262+
""", false, new() { Arguments = [arg] });
263263
}, Throws.Nothing);
264264
}
265265

266266
[Test]
267267
public void CanCallFunctionWithArgumentArray()
268268
{
269-
var hiString = new LocalValue.Array([new LocalValue.String("hi")]);
269+
var arg = new LocalValue.Array([new LocalValue.String("hi")]);
270270

271271
Assert.That(async () =>
272272
{
@@ -276,14 +276,14 @@ await context.Script.CallFunctionAsync($$"""
276276
throw new Error("Assert failed: " + arg);
277277
}
278278
}
279-
""", false, new() { Arguments = [hiString] });
279+
""", false, new() { Arguments = [arg] });
280280
}, Throws.Nothing);
281281
}
282282

283283
[Test]
284284
public void CanCallFunctionWithArgumentObject()
285285
{
286-
var obj = new LocalValue.Object([[new LocalValue.String("objKey"), new LocalValue.String("objValue")]]);
286+
var arg = new LocalValue.Object([[new LocalValue.String("objKey"), new LocalValue.String("objValue")]]);
287287

288288
Assert.That(async () =>
289289
{
@@ -293,7 +293,7 @@ await context.Script.CallFunctionAsync($$"""
293293
throw new Error("Assert failed: " + arg);
294294
}
295295
}
296-
""", false, new() { Arguments = [obj] });
296+
""", false, new() { Arguments = [arg] });
297297
}, Throws.Nothing);
298298
}
299299

@@ -317,7 +317,7 @@ await context.Script.CallFunctionAsync($$"""
317317
[Test]
318318
public void CanCallFunctionWithArgumentSet()
319319
{
320-
var argument = new LocalValue.Set([new LocalValue.String("setKey")]);
320+
var arg = new LocalValue.Set([new LocalValue.String("setKey")]);
321321

322322
Assert.That(async () =>
323323
{
@@ -327,7 +327,7 @@ await context.Script.CallFunctionAsync($$"""
327327
throw new Error("Assert failed: " + arg);
328328
}
329329
}
330-
""", false, new() { Arguments = [argument] });
330+
""", false, new() { Arguments = [arg] });
331331
}, Throws.Nothing);
332332
}
333333
}

dotnet/test/common/BiDi/Script/CallFunctionRemoteValueTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,13 @@ public async Task CanCallFunctionAndReturnArray()
182182
[Test]
183183
public async Task CanCallFunctionAndReturnObject()
184184
{
185-
var response = await context.Script.CallFunctionAsync("() => { return { key: 'value' }; }", false);
185+
var response = await context.Script.CallFunctionAsync("() => { return { objKey: 'objValue' }; }", false);
186186

187187
Assert.That(response.Result, Is.AssignableTo<RemoteValue.Object>());
188188

189189
var expected = new RemoteValue.Object
190190
{
191-
Value = [[new RemoteValue.String("key"), new RemoteValue.String("value")]]
191+
Value = [[new RemoteValue.String("objKey"), new RemoteValue.String("objValue")]]
192192
};
193193
Assert.That(((RemoteValue.Object)response.Result).Value, Is.EqualTo(expected.Value));
194194
}
@@ -198,13 +198,13 @@ public async Task CanCallFunctionAndReturnMap()
198198
{
199199
var expected = new RemoteValue.Map
200200
{
201-
Value = [[new RemoteValue.String("key"), new RemoteValue.String("value")]]
201+
Value = [[new RemoteValue.String("mapKey"), new RemoteValue.String("mapValue")]]
202202
};
203203

204204
var response = await context.Script.CallFunctionAsync($$"""
205205
() => {
206206
const map = new Map();
207-
map.set('key', 'value');
207+
map.set('mapKey', 'mapValue');
208208
return map;
209209
}
210210
""", false);
@@ -216,11 +216,11 @@ public async Task CanCallFunctionAndReturnMap()
216216
[Test]
217217
public async Task CanCallFunctionAndReturnSet()
218218
{
219-
var expected = new RemoteValue.Set { Value = [new RemoteValue.String("key")] };
219+
var expected = new RemoteValue.Set { Value = [new RemoteValue.String("setKey")] };
220220
var response = await context.Script.CallFunctionAsync($$"""
221221
() => {
222222
const set = new Set();
223-
set.add('key');
223+
set.add('setKey');
224224
return set;
225225
}
226226
""", false);

0 commit comments

Comments
 (0)