-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathmain.0.dart
55 lines (45 loc) · 1.51 KB
/
main.0.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Adapted from:
// https://github.com/dart-lang/sdk/blob/8df8de82b38fae8e9ae1c310fef4f8b735649fd4/pkg/front_end/test/hot_reload_e2e_test.dart
import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';
import 'b.dart';
import 'c.dart';
f() => "$line part2";
Future<void> main() async {
// Initial program is valid.
var last = f();
Expect.equals('part1 part2', last);
Expect.equals(0, hotReloadGeneration);
await hotReload();
// Reload after leaf library modification.
last = f();
Expect.equals('part3 part2', last);
Expect.equals(1, hotReloadGeneration);
await hotReload();
// Reload after non-leaf library modification.
last = f();
Expect.equals('part3 part4', last);
Expect.equals(2, hotReloadGeneration);
await hotReload();
// Reload after whole program modification.
last = f();
Expect.equals('part5 part6', last);
Expect.equals(3, hotReloadGeneration);
await hotReload();
// Reload top-level field.
last = f();
var topLevel = g();
Expect.equals('part4 part6', last);
Expect.equals('a', topLevel);
Expect.equals(4, hotReloadGeneration);
await hotReload();
// Reload top-level field.
last = f();
topLevel = g();
Expect.equals('part4 part6', last);
Expect.equals('ac', topLevel);
Expect.equals(5, hotReloadGeneration);
}