mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:37:12 +00:00
959bf6e1c3
Change-Id: I6cbad15f7151a1a5e1ece71f91ddfb826dca5de5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141762 Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Leaf Petersen <leafp@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com>
45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
// TODO(multitest): This was automatically migrated from a multitest and may
|
|
// contain strange or dead code.
|
|
|
|
// Copyright (c) 2012, 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 compile-time constants with string-interpolation.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
const str = "foo";
|
|
const m1 = const {"foo": 499};
|
|
const m2 = const {"$str": 499};
|
|
const m3 = const {
|
|
// Causes in a duplicate key error.
|
|
|
|
"foo": 499
|
|
};
|
|
const m4 = const {
|
|
// Causes in a duplicate key error.
|
|
|
|
"$str": 499
|
|
};
|
|
const m5 = const {"f" "o" "o": 499};
|
|
|
|
const mm1 = const {"afoo#foo": 499};
|
|
const mm2 = const {"a$str#$str": 499};
|
|
const mm3 = const {"a" "$str" "#" "foo": 499};
|
|
const mm4 = const {"a$str" "#$str": 499};
|
|
|
|
main() {
|
|
Expect.equals(1, m1.length);
|
|
Expect.equals(499, m1["foo"]);
|
|
Expect.identical(m1, m2);
|
|
Expect.identical(m1, m3);
|
|
Expect.identical(m1, m4);
|
|
Expect.identical(m1, m5);
|
|
|
|
Expect.equals(1, mm1.length);
|
|
Expect.equals(499, mm1["afoo#foo"]);
|
|
Expect.identical(mm1, mm2);
|
|
Expect.identical(mm1, mm3);
|
|
Expect.identical(mm1, mm4);
|
|
}
|