Skip to content

Commit 73257e4

Browse files
MarkzipanCommit Queue
authored andcommitted
[tests] Porting VM tests for calling deleted class members to the hot reload framework
Change-Id: I0104f25f5522b38bfe09a9546d602a2b0884c008 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410942 Commit-Queue: Mark Zhou <[email protected]> Reviewed-by: Nate Biggs <[email protected]>
1 parent 1084ca1 commit 73257e4

File tree

24 files changed

+881
-0
lines changed

24 files changed

+881
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/c0819ff165a2557e6537700363594f2ddaf2a96e/runtime/vm/isolate_reload_test.cc#L3256
10+
11+
var retained;
12+
13+
class C {
14+
factory C.deleted() => new C();
15+
C();
16+
}
17+
18+
helper() {
19+
retained = () => C.deleted().toString();
20+
return retained();
21+
}
22+
23+
Future<void> main() async {
24+
helper();
25+
await hotReload();
26+
Expect.throws<NoSuchMethodError>(
27+
helper,
28+
(error) => '$error'.contains('deleted'),
29+
);
30+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/c0819ff165a2557e6537700363594f2ddaf2a96e/runtime/vm/isolate_reload_test.cc#L3256
10+
11+
var retained;
12+
13+
helper() {
14+
return retained();
15+
}
16+
17+
Future<void> main() async {
18+
helper();
19+
await hotReload();
20+
Expect.throws<NoSuchMethodError>(
21+
helper,
22+
(error) => '$error'.contains('deleted'),
23+
);
24+
}
25+
26+
/** DIFF **/
27+
/*
28+
29+
var retained;
30+
31+
-class C {
32+
- factory C.deleted() => new C();
33+
- C();
34+
-}
35+
-
36+
helper() {
37+
- retained = () => C.deleted().toString();
38+
return retained();
39+
}
40+
41+
*/
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/c0819ff165a2557e6537700363594f2ddaf2a96e/runtime/vm/isolate_reload_test.cc#L3287
10+
11+
var retained;
12+
13+
class C {
14+
factory C.deleted() => new C();
15+
C();
16+
}
17+
18+
helper() {
19+
retained = () => C.deleted().toString();
20+
return retained();
21+
}
22+
23+
Future<void> main() async {
24+
helper();
25+
await hotReload();
26+
Expect.throws<NoSuchMethodError>(
27+
helper,
28+
(error) => '$error'.contains('deleted'),
29+
);
30+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/c0819ff165a2557e6537700363594f2ddaf2a96e/runtime/vm/isolate_reload_test.cc#L3287
10+
11+
var retained;
12+
13+
class C {
14+
factory C.deleted(newParameter) => new C();
15+
C();
16+
}
17+
18+
helper() {
19+
return retained();
20+
}
21+
22+
Future<void> main() async {
23+
helper();
24+
await hotReload();
25+
Expect.throws<NoSuchMethodError>(
26+
helper,
27+
(error) => '$error'.contains('deleted'),
28+
);
29+
}
30+
31+
/** DIFF **/
32+
/*
33+
var retained;
34+
35+
class C {
36+
- factory C.deleted() => new C();
37+
+ factory C.deleted(newParameter) => new C();
38+
C();
39+
}
40+
41+
helper() {
42+
- retained = () => C.deleted().toString();
43+
return retained();
44+
}
45+
46+
*/
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/c0819ff165a2557e6537700363594f2ddaf2a96e/runtime/vm/isolate_reload_test.cc#L3318
10+
11+
var retained;
12+
13+
class C {
14+
factory C.deleted() => new C();
15+
C();
16+
}
17+
18+
helper() {
19+
retained = () => C.deleted().toString();
20+
return retained();
21+
}
22+
23+
Future<void> main() async {
24+
helper();
25+
await hotReload();
26+
Expect.throws<NoSuchMethodError>(
27+
helper,
28+
(error) => '$error'.contains('deleted'),
29+
);
30+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/c0819ff165a2557e6537700363594f2ddaf2a96e/runtime/vm/isolate_reload_test.cc#L3318
10+
11+
var retained;
12+
13+
helper() {
14+
return retained();
15+
}
16+
17+
Future<void> main() async {
18+
helper();
19+
await hotReload();
20+
Expect.throws<NoSuchMethodError>(
21+
helper,
22+
(error) => '$error'.contains('deleted'),
23+
);
24+
}
25+
26+
/** DIFF **/
27+
/*
28+
29+
var retained;
30+
31+
-class C {
32+
- factory C.deleted() => new C();
33+
- C();
34+
-}
35+
-
36+
helper() {
37+
- retained = () => C.deleted().toString();
38+
return retained();
39+
}
40+
41+
*/
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2980
10+
11+
var retained;
12+
13+
class C {
14+
static deleted() {
15+
return 'hello';
16+
}
17+
}
18+
19+
helper() {
20+
retained = () => C.deleted();
21+
return retained();
22+
}
23+
24+
Future<void> main() async {
25+
helper();
26+
await hotReload();
27+
Expect.throws<NoSuchMethodError>(
28+
helper,
29+
(error) => '$error'.contains('deleted'),
30+
);
31+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2980
10+
11+
var retained;
12+
helper() {
13+
return retained();
14+
}
15+
16+
Future<void> main() async {
17+
helper();
18+
await hotReload();
19+
Expect.throws<NoSuchMethodError>(
20+
helper,
21+
(error) => '$error'.contains('deleted'),
22+
);
23+
}
24+
25+
/** DIFF **/
26+
/*
27+
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2980
28+
29+
var retained;
30+
-
31+
-class C {
32+
- static deleted() {
33+
- return 'hello';
34+
- }
35+
-}
36+
-
37+
helper() {
38+
- retained = () => C.deleted();
39+
return retained();
40+
}
41+
42+
*/
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L3010
10+
11+
var retained;
12+
13+
class C {
14+
static deleted() {
15+
return 'hello';
16+
}
17+
}
18+
19+
helper() {
20+
retained = () => C.deleted();
21+
return retained();
22+
}
23+
24+
Future<void> main() async {
25+
helper();
26+
await hotReload();
27+
Expect.throws<NoSuchMethodError>(
28+
helper,
29+
(error) => '$error'.contains('deleted'),
30+
);
31+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:expect/expect.dart';
6+
import 'package:reload_test/reload_test_utils.dart';
7+
8+
// Adapted from:
9+
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L3010
10+
11+
var retained;
12+
13+
class C {
14+
static deleted(newParameter) {
15+
return 'hello';
16+
}
17+
}
18+
19+
helper() {
20+
return retained();
21+
}
22+
23+
Future<void> main() async {
24+
helper();
25+
await hotReload();
26+
Expect.throws<NoSuchMethodError>(
27+
helper,
28+
(error) => '$error'.contains('deleted'),
29+
);
30+
}
31+
32+
/** DIFF **/
33+
/*
34+
var retained;
35+
36+
class C {
37+
- static deleted() {
38+
+ static deleted(newParameter) {
39+
return 'hello';
40+
}
41+
}
42+
43+
helper() {
44+
- retained = () => C.deleted();
45+
return retained();
46+
}
47+
48+
*/

0 commit comments

Comments
 (0)