dart-sdk/tests/language/switch/bad_case_runtime_test.dart
Robert Nystrom 5a27ea139e Migrate language_2/switch to NNBD.
Change-Id: Idbf338099414c78e1bb6ee2852c41495fb53f70b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151471
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2020-06-17 02:17:36 +00:00

40 lines
779 B
Dart

// TODO(multitest): This was automatically migrated from a multitest and may
// contain strange or dead code.
// Copyright (c) 2013, 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.
// Test reporting a compile-time error if case expressions do not all have
// the same type or are of type double.
import "package:expect/expect.dart";
void main() {
Expect.equals("IV", caesarSays(4));
Expect.equals(null, caesarSays(2));
Expect.equals(null, archimedesSays(3.14));
}
caesarSays(n) {
switch (n) {
case 1:
return "I";
case 4:
return "IV";
}
return null;
}
archimedesSays(n) {
return null;
}