| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 class Conster { | 6 class Conster { |
| 7 const Conster(this.value); | 7 const Conster(this.value); |
| 8 | 8 |
| 9 final value; | 9 final value; |
| 10 | 10 |
| 11 toString() { | 11 toString() { |
| 12 return value.toString(); | 12 return value.toString(); |
| 13 } | 13 } |
| 14 } | 14 } |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 testEmpty(); | 17 testEmpty(); |
| 18 testInterpolation(); | 18 testInterpolation(); |
| 19 testMultiline(); | 19 testMultiline(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 testEmpty() { | 22 testEmpty() { |
| 23 Expect.equals("", (const Conster("" "" "")).toString()); | 23 Expect.equals("", (const Conster("" "" "")).toString()); |
| 24 Expect.equals("", (const Conster("" '' "")).toString()); | 24 Expect.equals("", (const Conster("" '' "")).toString()); |
| 25 Expect.equals("", (const Conster("" "" @"")).toString()); | 25 Expect.equals("", (const Conster("" "" @"")).toString()); |
| 26 | 26 |
| 27 Expect.equals("a", (const Conster("a" "")).toString()); | 27 Expect.equals("a", (const Conster("a" "")).toString()); |
| 28 Expect.equals("a", (const Conster("a" '')).toString()); | 28 Expect.equals("a", (const Conster("a" '')).toString()); |
| 29 Expect.equals("a", (const Conster("a" @'')).toString()); | 29 Expect.equals("a", (const Conster("a" @'')).toString()); |
| 30 | 30 |
| 31 Expect.equals("b", (const Conster('b' "")).toString()); | 31 Expect.equals("b", (const Conster('b' "")).toString()); |
| 32 Expect.equals("b", (const Conster('b' '')).toString()); | 32 Expect.equals("b", (const Conster('b' '')).toString()); |
| 33 Expect.equals("b", (const Conster('b' @'')).toString()); | 33 Expect.equals("b", (const Conster('b' @'')).toString()); |
| 34 | 34 |
| 35 Expect.equals("c", (const Conster(@'c' "")).toString()); | 35 Expect.equals("c", (const Conster(@'c' "")).toString()); |
| 36 Expect.equals("c", (const Conster(@'c' '')).toString()); | 36 Expect.equals("c", (const Conster(@'c' '')).toString()); |
| 37 Expect.equals("c", (const Conster(@'c' @'')).toString()); | 37 Expect.equals("c", (const Conster(@'c' @'')).toString()); |
| 38 | 38 |
| 39 Expect.equals("a", (const Conster("" "a")).toString()); | 39 Expect.equals("a", (const Conster("" "a")).toString()); |
| 40 Expect.equals("a", (const Conster("" 'a')).toString()); | 40 Expect.equals("a", (const Conster("" 'a')).toString()); |
| 41 Expect.equals("a", (const Conster("" @'a')).toString()); | 41 Expect.equals("a", (const Conster("" @'a')).toString()); |
| 42 | 42 |
| 43 Expect.equals("b", (const Conster('' "b")).toString()); | 43 Expect.equals("b", (const Conster('' "b")).toString()); |
| 44 Expect.equals("b", (const Conster('' 'b')).toString()); | 44 Expect.equals("b", (const Conster('' 'b')).toString()); |
| 45 Expect.equals("b", (const Conster('' @'b')).toString()); | 45 Expect.equals("b", (const Conster('' @'b')).toString()); |
| 46 | 46 |
| 47 Expect.equals("c", (const Conster(@'' "c")).toString()); | 47 Expect.equals("c", (const Conster(@'' "c")).toString()); |
| 48 Expect.equals("c", (const Conster(@'' 'c')).toString()); | 48 Expect.equals("c", (const Conster(@'' 'c')).toString()); |
| 49 Expect.equals("c", (const Conster(@'' @'c')).toString()); | 49 Expect.equals("c", (const Conster(@'' @'c')).toString()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 final s = "a"; | 52 const s = "a"; |
| 53 | 53 |
| 54 testInterpolation() { | 54 testInterpolation() { |
| 55 Expect.equals(@"ab", (const Conster("$s" "b")).toString()); | 55 Expect.equals(@"ab", (const Conster("$s" "b")).toString()); |
| 56 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()); | 57 Expect.equals(@"$sb", (const Conster(@'$s' "b")).toString()); |
| 58 | 58 |
| 59 Expect.equals(@"-a-b", (const Conster("-$s-" "b")).toString()); | 59 Expect.equals(@"-a-b", (const Conster("-$s-" "b")).toString()); |
| 60 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()); | 61 Expect.equals(@"-$s-b", (const Conster(@'-$s-' "b")).toString()); |
| 62 | 62 |
| 63 Expect.equals(@"ba", (const Conster('b' "$s")).toString()); | 63 Expect.equals(@"ba", (const Conster('b' "$s")).toString()); |
| 64 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()); | 65 Expect.equals(@"b$s", (const Conster('b' @'$s')).toString()); |
| 66 | 66 |
| 67 Expect.equals(@"b-a-", (const Conster('b' "-$s-")).toString()); | 67 Expect.equals(@"b-a-", (const Conster('b' "-$s-")).toString()); |
| 68 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()); | 69 Expect.equals(@"b-$s-", (const Conster('b' @'-$s-')).toString()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 testMultiline() { | 72 testMultiline() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 87 a""" "b" "e")).toString()); | 87 a""" "b" "e")).toString()); |
| 88 Expect.equals("a b e", (const Conster(""" | 88 Expect.equals("a b e", (const Conster(""" |
| 89 a""" " b" " e")).toString()); | 89 a""" " b" " e")).toString()); |
| 90 | 90 |
| 91 Expect.equals("abe", (const Conster(""" | 91 Expect.equals("abe", (const Conster(""" |
| 92 a""" """ | 92 a""" """ |
| 93 b""" """ | 93 b""" """ |
| 94 e""")).toString()); | 94 e""")).toString()); |
| 95 } | 95 } |
| 96 | 96 |
| OLD | NEW |