| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 // Check that conditional expression can be a compile-time constant. | |
| 6 | |
| 7 import "package:expect/expect.dart"; | |
| 8 | |
| 9 const C1 = true; | |
| 10 const C2 = false; | |
| 11 | |
| 12 const nephew = C1 ? C2 ? "Tick" : "Trick" : "Track"; | |
| 13 | |
| 14 main() { | |
| 15 const a = true ? 5 : 10; | |
| 16 const b = C2 ? "Track" : C1 ? "Trick" : "Tick"; | |
| 17 | |
| 18 Expect.equals(5, a); | |
| 19 Expect.equals("Trick", nephew); | |
| 20 Expect.equals(nephew, b); | |
| 21 Expect.identical(nephew, b); | |
| 22 var s = const Symbol(nephew); | |
| 23 var msg = "Donald is $nephew's uncle."; | |
| 24 Expect.equals("Donald is Trick's uncle.", msg); | |
| 25 } | |
| OLD | NEW |