| 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 | |
| 6 class Conster { | |
| 7 const Conster(this.value); | |
| 8 | |
| 9 final value; | |
| 10 | |
| 11 toString() { | |
| 12 return value.toString(); | |
| 13 } | |
| 14 } | |
| 15 | |
| 16 main() { | |
| 17 testEmpty(); | |
| 18 testInterpolation(); | |
| 19 testMultiline(); | |
| 20 } | |
| 21 | |
| 22 testEmpty() { | |
| 23 Expect.equals("", (const Conster("" "" "")).toString()); | |
| 24 Expect.equals("", (const Conster("" '' "")).toString()); | |
| 25 Expect.equals("", (const Conster("" "" @"")).toString()); | |
| 26 | |
| 27 Expect.equals("a", (const Conster("a" "")).toString()); | |
| 28 Expect.equals("a", (const Conster("a" '')).toString()); | |
| 29 Expect.equals("a", (const Conster("a" @'')).toString()); | |
| 30 | |
| 31 Expect.equals("b", (const Conster('b' "")).toString()); | |
| 32 Expect.equals("b", (const Conster('b' '')).toString()); | |
| 33 Expect.equals("b", (const Conster('b' @'')).toString()); | |
| 34 | |
| 35 Expect.equals("c", (const Conster(@'c' "")).toString()); | |
| 36 Expect.equals("c", (const Conster(@'c' '')).toString()); | |
| 37 Expect.equals("c", (const Conster(@'c' @'')).toString()); | |
| 38 | |
| 39 Expect.equals("a", (const Conster("" "a")).toString()); | |
| 40 Expect.equals("a", (const Conster("" 'a')).toString()); | |
| 41 Expect.equals("a", (const Conster("" @'a')).toString()); | |
| 42 | |
| 43 Expect.equals("b", (const Conster('' "b")).toString()); | |
| 44 Expect.equals("b", (const Conster('' 'b')).toString()); | |
| 45 Expect.equals("b", (const Conster('' @'b')).toString()); | |
| 46 | |
| 47 Expect.equals("c", (const Conster(@'' "c")).toString()); | |
| 48 Expect.equals("c", (const Conster(@'' 'c')).toString()); | |
| 49 Expect.equals("c", (const Conster(@'' @'c')).toString()); | |
| 50 } | |
| 51 | |
| 52 final s = "a"; | |
| 53 | |
| 54 testInterpolation() { | |
| 55 Expect.equals(@"ab", (const Conster("$s" "b")).toString()); | |
| 56 Expect.equals(@"ab", (const Conster('$s' "b")).toString()); | |
| 57 Expect.equals(@"$sb", (const Conster(@'$s' "b")).toString()); | |
| 58 | |
| 59 Expect.equals(@"-a-b", (const Conster("-$s-" "b")).toString()); | |
| 60 Expect.equals(@"-a-b", (const Conster('-$s-' "b")).toString()); | |
| 61 Expect.equals(@"-$s-b", (const Conster(@'-$s-' "b")).toString()); | |
| 62 | |
| 63 Expect.equals(@"ba", (const Conster('b' "$s")).toString()); | |
| 64 Expect.equals(@"ba", (const Conster('b' '$s')).toString()); | |
| 65 Expect.equals(@"b$s", (const Conster('b' @'$s')).toString()); | |
| 66 | |
| 67 Expect.equals(@"b-a-", (const Conster('b' "-$s-")).toString()); | |
| 68 Expect.equals(@"b-a-", (const Conster('b' '-$s-')).toString()); | |
| 69 Expect.equals(@"b-$s-", (const Conster('b' @'-$s-')).toString()); | |
| 70 } | |
| 71 | |
| 72 testMultiline() { | |
| 73 Expect.equals("abe", | |
| 74 (const Conster("a" | |
| 75 "b" | |
| 76 "e")).toString()); | |
| 77 Expect.equals("a b e", | |
| 78 (const Conster("a " | |
| 79 "b " | |
| 80 "e")).toString()); | |
| 81 Expect.equals("a b e", | |
| 82 (const Conster("a" | |
| 83 " b" | |
| 84 " e")).toString()); | |
| 85 | |
| 86 Expect.equals("abe", (const Conster(""" | |
| 87 a""" "b" "e")).toString()); | |
| 88 Expect.equals("a b e", (const Conster(""" | |
| 89 a""" " b" " e")).toString()); | |
| 90 | |
| 91 Expect.equals("abe", (const Conster(""" | |
| 92 a""" """ | |
| 93 b""" """ | |
| 94 e""")).toString()); | |
| 95 } | |
| 96 | |
| OLD | NEW |