Skip to content

Commit a279ee1

Browse files
munificentCommit Queue
authored andcommitted
Reformat tests/dartdevc.
Change-Id: I043b7df217e5a479fa15375458bc643e2b38f3d0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399629 Reviewed-by: Srujan Gaddam <[email protected]> Auto-Submit: Bob Nystrom <[email protected]> Commit-Queue: Srujan Gaddam <[email protected]>
1 parent c77f2af commit a279ee1

File tree

8 files changed

+378
-243
lines changed

8 files changed

+378
-243
lines changed

tests/dartdevc/cast_error/library_uri_in_message_test.dart

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ void main() {
1515
} on TypeError catch (error) {
1616
var message = error.toString();
1717
expectStringContains(
18-
"Expected a value of type 'Animal' "
19-
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_b.dart)",
20-
message);
18+
"Expected a value of type 'Animal' "
19+
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_b.dart)",
20+
message,
21+
);
2122
expectStringContains(
22-
"but got one of type 'Animal' "
23-
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_a.dart)",
24-
message);
23+
"but got one of type 'Animal' "
24+
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_a.dart)",
25+
message,
26+
);
2527
}
2628
// Verify the libraries are properly ordered.
2729
var b = libB.Animal();
@@ -30,13 +32,15 @@ void main() {
3032
} on TypeError catch (error) {
3133
var message = error.toString();
3234
expectStringContains(
33-
"Expected a value of type 'Animal' "
34-
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_a.dart)",
35-
message);
35+
"Expected a value of type 'Animal' "
36+
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_a.dart)",
37+
message,
38+
);
3639
expectStringContains(
37-
"but got one of type 'Animal' "
38-
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_b.dart)",
39-
message);
40+
"but got one of type 'Animal' "
41+
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_b.dart)",
42+
message,
43+
);
4044
}
4145

4246
// Shows library URIs when one of the types is nullable.
@@ -45,13 +49,15 @@ void main() {
4549
} on TypeError catch (error) {
4650
var message = error.toString();
4751
expectStringContains(
48-
"Expected a value of type 'Animal?' "
49-
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_a.dart)",
50-
message);
52+
"Expected a value of type 'Animal?' "
53+
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_a.dart)",
54+
message,
55+
);
5156
expectStringContains(
52-
"but got one of type 'Animal' "
53-
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_b.dart)",
54-
message);
57+
"but got one of type 'Animal' "
58+
"(in org-dartlang-app:/tests/dartdevc/cast_error/lib_b.dart)",
59+
message,
60+
);
5561
}
5662

5763
// URIs are not displayed when the class names are different.
@@ -60,7 +66,8 @@ void main() {
6066
} on TypeError catch (error) {
6167
var message = error.toString();
6268
expectStringContains(
63-
"Expected a value of type 'String', but got one of type 'Animal'",
64-
message);
69+
"Expected a value of type 'String', but got one of type 'Animal'",
70+
message,
71+
);
6572
}
6673
}

tests/dartdevc/debugger/debugger_test.dart

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ JSObject getCurrentLibrary() =>
155155
// We can't use interop for this, as the lowering would be emitted as
156156
// `dart.global.eval('this')`, which does not evaluate to the same value as
157157
// `eval('this')`.
158-
_foreign_helper.JS('', 'this');
158+
_foreign_helper
159+
.JS('', 'this');
159160

160161
main() async {
161162
asyncStart();
@@ -167,7 +168,8 @@ main() async {
167168
// Cache blocker is a workaround for:
168169
// https://code.google.com/p/dart/issues/detail?id=11834
169170
var cacheBlocker = new DateTime.now().millisecondsSinceEpoch;
170-
var goldenUrl = '/root_dart/tests/dartdevc/debugger/'
171+
var goldenUrl =
172+
'/root_dart/tests/dartdevc/debugger/'
171173
'debugger_test_golden.txt?cacheBlock=$cacheBlocker';
172174

173175
String? golden;
@@ -177,17 +179,20 @@ main() async {
177179
print("Warning: couldn't load golden file from $goldenUrl");
178180
}
179181

180-
document.body!.append(new ScriptElement()
181-
..type = 'text/javascript'
182-
..innerHtml = r"""
182+
document.body!.append(
183+
new ScriptElement()
184+
..type = 'text/javascript'
185+
..innerHtml = r"""
183186
window.PackageJSClass = function PackageJSClass(x) {
184187
this.x = x;
185188
};
186-
""");
189+
""",
190+
);
187191

188-
var _devtoolsFormatter = (devtoolsFormatters![0]
189-
as ExternalDartReference<_debugger.JsonMLFormatter>)
190-
.toDartObject;
192+
var _devtoolsFormatter =
193+
(devtoolsFormatters![0]
194+
as ExternalDartReference<_debugger.JsonMLFormatter>)
195+
.toDartObject;
191196

192197
var actual = new StringBuffer();
193198

@@ -200,15 +205,19 @@ window.PackageJSClass = function PackageJSClass(x) {
200205
// to expected output.
201206
void addGolden(String name, JSAny value) {
202207
var text = format(value);
203-
actual.write('Test: $name\n'
204-
'Value:\n'
205-
'$text\n'
206-
'-----------------------------------\n');
208+
actual.write(
209+
'Test: $name\n'
210+
'Value:\n'
211+
'$text\n'
212+
'-----------------------------------\n',
213+
);
207214
}
208215

209216
void addFormatterGoldens(String name, Object? object, [Object? config]) {
210217
addGolden(
211-
'$name formatting header', _devtoolsFormatter.header(object, config));
218+
'$name formatting header',
219+
_devtoolsFormatter.header(object, config),
220+
);
212221
addGolden('$name formatting body', _devtoolsFormatter.body(object, config));
213222
}
214223

@@ -258,10 +267,11 @@ window.PackageJSClass = function PackageJSClass(x) {
258267

259268
addNestedFormatterGoldens('Iterable', iterable);
260269

261-
var s = new Set()
262-
..add("foo")
263-
..add(42)
264-
..add(true);
270+
var s =
271+
new Set()
272+
..add("foo")
273+
..add(42)
274+
..add(true);
265275
addNestedFormatterGoldens('Set', s);
266276
});
267277

@@ -332,13 +342,14 @@ window.PackageJSClass = function PackageJSClass(x) {
332342
lib['link'] = () {}.toJS;
333343
}
334344
addFormatterGoldens(
335-
'Test library',
336-
// TODO(srujzs): We have to construct a `Library` manually here,
337-
// whereas the `LibraryModuleFormatter` does that for us automatically
338-
// when we format the module. We should add properties to libraries so
339-
// that we can detect them as a library. Once we have support for that,
340-
// revisit this and the formatter code.
341-
_debugger.Library('debugger_test', lib));
345+
'Test library',
346+
// TODO(srujzs): We have to construct a `Library` manually here,
347+
// whereas the `LibraryModuleFormatter` does that for us automatically
348+
// when we format the module. We should add properties to libraries so
349+
// that we can detect them as a library. Once we have support for that,
350+
// revisit this and the formatter code.
351+
_debugger.Library('debugger_test', lib),
352+
);
342353
});
343354

344355
group('StackTrace formatting', () {
@@ -364,11 +375,15 @@ window.PackageJSClass = function PackageJSClass(x) {
364375

365376
group('Generics formatting', () {
366377
addNestedFormatterGoldens(
367-
'TestGenericClass', new TestGenericClass<int, List>(42));
378+
'TestGenericClass',
379+
new TestGenericClass<int, List>(42),
380+
);
368381
addNestedFormatterGoldens(
369-
'TestGenericClassJSInterop',
370-
new TestGenericClass<PackageJSClass<JSString>, int>(
371-
new PackageJSClass("Hello".toJS)));
382+
'TestGenericClassJSInterop',
383+
new TestGenericClass<PackageJSClass<JSString>, int>(
384+
new PackageJSClass("Hello".toJS),
385+
),
386+
);
372387
});
373388

374389
test('verify golden match', () {
@@ -394,8 +409,9 @@ window.PackageJSClass = function PackageJSClass(x) {
394409
textField.style
395410
..width = '800px'
396411
..height = '400px';
397-
document.body!.append(new Element.tag('h3')
398-
..innerHtml = helpMessage.replaceAll('\n', '<br>'));
412+
document.body!.append(
413+
new Element.tag('h3')..innerHtml = helpMessage.replaceAll('\n', '<br>'),
414+
);
399415
document.body!.append(textField);
400416
document.body!.onClick.listen((_) {
401417
textField.select();

tests/dartdevc/developer_events_test.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ void testRegisterExtensionWarningMessage() {
8383

8484
consoleWarnLog.clear();
8585

86-
var testHandler = (String s, Map<String, String> m) async =>
87-
ServiceExtensionResponse.result('test result');
86+
var testHandler =
87+
(String s, Map<String, String> m) async =>
88+
ServiceExtensionResponse.result('test result');
8889

8990
expect(consoleWarnLog.isEmpty, true);
9091

@@ -93,9 +94,9 @@ void testRegisterExtensionWarningMessage() {
9394
// A warning message was issued about calling `registerExtension()` from
9495
// dart:developer.
9596
expect(
96-
consoleWarnLog.single
97-
.contains('registerExtension() from dart:developer'),
98-
true);
97+
consoleWarnLog.single.contains('registerExtension() from dart:developer'),
98+
true,
99+
);
99100

100101
registerExtension('ext.method1', testHandler);
101102
registerExtension('ext.method2', testHandler);
@@ -169,8 +170,9 @@ void testRegisterExtension() {
169170
dwdsVersion = '1.0.0-for-test';
170171
expect(registerEventLog.isEmpty, true);
171172

172-
var testHandler = (String s, Map<String, String> m) async =>
173-
ServiceExtensionResponse.result('test result');
173+
var testHandler =
174+
(String s, Map<String, String> m) async =>
175+
ServiceExtensionResponse.result('test result');
174176
registerExtension('ext.method0', testHandler);
175177

176178
expect(registerEventLog.single, 'ext.method0');

tests/dartdevc/js_interop_test.dart

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ void main() {
163163

164164
// Assignment to instance field.
165165
_someClass = helper.JS(
166-
'',
167-
'{"jsInstanceMethod": function(f) {return f();}, '
168-
'"jsNonFunctionField": {"stringField":"hello js"}, '
169-
'"jsFunctionFieldGetter": function(f) {return f();}}');
166+
'',
167+
'{"jsInstanceMethod": function(f) {return f();}, '
168+
'"jsNonFunctionField": {"stringField":"hello js"}, '
169+
'"jsFunctionFieldGetter": function(f) {return f();}}',
170+
);
170171
Expect.throws((() {
171172
someClass.jsFunctionFieldSetter = () => 'hello';
172173
}));
@@ -328,23 +329,30 @@ void main() {
328329
method(wrappedDartStaticMethod);
329330

330331
// Non-function fields
331-
Expect.equals('hello js', someClass.jsNonFunctionField.stringField,
332-
'Does not wrap access to a field');
332+
Expect.equals(
333+
'hello js',
334+
someClass.jsNonFunctionField.stringField,
335+
'Does not wrap access to a field',
336+
);
333337

334338
// No such method errors from interop calls.
335339
// The current behavior is that DDC does not treat these errors from the
336340
// JavaScript side as a LegacyJavaScriptObject.
337341
Expect.throwsNoSuchMethodError(
338-
() => context.callMethod('eval', ['self.foo()']));
342+
() => context.callMethod('eval', ['self.foo()']),
343+
);
339344
Expect.throws<interceptors.JSNoSuchMethodError>(
340-
() => context.callMethod('eval', ['self.foo()']));
345+
() => context.callMethod('eval', ['self.foo()']),
346+
);
341347
var error = Expect.throws(() => context.callMethod('eval', ['self.foo()']));
342348
Expect.notType<interceptors.LegacyJavaScriptObject>(error);
343349
Expect.notEquals(interceptors.LegacyJavaScriptObject, error.runtimeType);
344350
Expect.throwsNoSuchMethodError(
345-
() => context.callMethod('eval', ['self.foo.bar()']));
351+
() => context.callMethod('eval', ['self.foo.bar()']),
352+
);
346353
Expect.throws<interceptors.JSNoSuchMethodError>(
347-
() => context.callMethod('eval', ['self.foo.bar()']));
354+
() => context.callMethod('eval', ['self.foo.bar()']),
355+
);
348356
error = Expect.throws(() => context.callMethod('eval', ['self.foo.bar()']));
349357
Expect.notType<interceptors.LegacyJavaScriptObject>(error);
350358
Expect.notEquals(interceptors.LegacyJavaScriptObject, error.runtimeType);

0 commit comments

Comments
 (0)