Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // String concatenation test. | 4 // String concatenation test. |
| 5 | 5 |
| 6 interface V { | 6 interface V { |
| 7 static final Version = "7.3.5.3"; | 7 static final Version = "7.3.5.3"; |
| 8 } | 8 } |
| 9 | 9 |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 // Adding a string to a number is not supported. | 38 // Adding a string to a number is not supported. |
| 39 try { | 39 try { |
| 40 String cantDo = x + " should't work"; // throws noSuchMethodException. | 40 String cantDo = x + " should't work"; // throws noSuchMethodException. |
| 41 Expect.equals(1, 0); // this should never be executed. | 41 Expect.equals(1, 0); // this should never be executed. |
| 42 } catch(NoSuchMethodException e) { | 42 } catch(NoSuchMethodException e) { |
| 43 // In default mode. | 43 // In default mode. |
| 44 nofExceptions++; | 44 nofExceptions++; |
| 45 } catch (TypeError e) { | 45 } catch (TypeError e) { |
| 46 // In type checked mode. | 46 // In type checked mode. |
| 47 nofExceptions++; | 47 nofExceptions++; |
| 48 } catch (IllegalArgumentException e) { | |
| 49 // TODO(floitsch): IllegalArgumentException might not be correct. | |
|
kasperl
2012/02/15 11:54:49
Maybe explain this one a bit better? Is the string
floitsch
2012/02/15 13:11:43
Done.
| |
| 50 nofExceptions++; | |
| 48 } | 51 } |
| 49 | 52 |
| 50 // Check that compile time constants are canonicalized. | 53 // Check that compile time constants are canonicalized. |
| 51 // TODO(hausner): Add more examples once we concatenate | 54 // TODO(hausner): Add more examples once we concatenate |
| 52 // CT constants other than string literals at compile time. | 55 // CT constants other than string literals at compile time. |
| 53 var fake = "Milli" + " " + "Vanilli"; | 56 var fake = "Milli" + " " + "Vanilli"; |
| 54 Expect.equals(fake, "Milli Vanilli"); | 57 Expect.equals(fake, "Milli Vanilli"); |
| 55 Expect.equals(true, fake === "Milli Vanilli"); | 58 Expect.equals(true, fake === "Milli Vanilli"); |
| 56 Expect.equals(true, fake === "Milli " + 'Vanilli'); | 59 Expect.equals(true, fake === "Milli " + 'Vanilli'); |
| 57 | 60 |
| 58 Expect.equals(nofExceptions, 1); | 61 Expect.equals(nofExceptions, 1); |
| 59 } | 62 } |
| 60 } | 63 } |
| 61 | 64 |
| 62 main() { | 65 main() { |
| 63 StringConcatTest.testMain(); | 66 StringConcatTest.testMain(); |
| 64 } | 67 } |
| OLD | NEW |