Chromium Code Reviews| Index: runtime/observatory/tests/service/next_through_is_and_as_test.dart |
| diff --git a/runtime/observatory/tests/service/next_through_is_and_as_test.dart b/runtime/observatory/tests/service/next_through_is_and_as_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ed71835c2d0cc922ed189e3386afecbb2892895e |
| --- /dev/null |
| +++ b/runtime/observatory/tests/service/next_through_is_and_as_test.dart |
| @@ -0,0 +1,62 @@ |
| +import 'test_helper.dart'; |
|
Kevin Millikin (Google)
2017/02/08 15:37:52
License header.
jensj
2017/02/13 14:04:16
Done.
|
| +import 'service_test_common.dart'; |
| + |
| +const int LINE_A = 8; |
| +const String file = "next_through_is_and_as_test.dart"; |
| + |
| +code() { |
| + var i = 42.42; |
| + var hex = 0x42; |
| + if (i is int) { |
| + print("i is int"); |
| + int x = i as int; |
| + if (x.isEven) { |
| + print("it's even even!"); |
| + } else { |
| + print("but it's not even even!"); |
| + } |
| + } |
| + if (i is! int) { |
| + print("i is not int"); |
| + } |
| + if (hex is int) { |
| + print("hex is int"); |
| + int x = hex as int; |
| + if (x.isEven) { |
| + print("it's even even!"); |
| + } else { |
| + print("but it's not even even!"); |
| + } |
| + } |
| + if (hex is! int) { |
| + print("hex is not int"); |
| + } |
| +} |
| + |
| +List<String> stops = []; |
| +List<String> expected = [ |
| + "$file:${LINE_A+0}:9", |
| + "$file:${LINE_A+1}:11", |
| + "$file:${LINE_A+2}:9", |
| + "$file:${LINE_A+11}:9", |
| + "$file:${LINE_A+12}:5", |
| + "$file:${LINE_A+14}:11", |
| + "$file:${LINE_A+15}:5", |
| + "$file:${LINE_A+16}:17", |
| + "$file:${LINE_A+17}:11", |
| + "$file:${LINE_A+18}:7", |
| + "$file:${LINE_A+23}:11", |
| + "$file:${LINE_A+26}:1" |
| +]; |
| + |
| +var tests = [ |
| + hasPausedAtStart, |
| + setBreakpointAtLine(LINE_A), |
| + runStepThroughProgramRecordingStops(stops), |
| + checkRecordedStops(stops, expected) |
| +]; |
| + |
| +main(args) { |
| + runIsolateTestsSynchronous(args, tests, |
| + testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); |
| +} |