mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:27:17 +00:00
5a27ea139e
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>
40 lines
779 B
Dart
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;
|
|
}
|