Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: tests/language/string_interpolation_and_buffer_test.dart

Issue 1291583002: Fix analyzer tests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/language/language_analyzer2.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Test to ensure that StringBuffer and string interpolation behaves 5 // Test to ensure that StringBuffer and string interpolation behaves
6 // the same and fail fast. 6 // the same and fail fast.
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 class ToStringWrapper { 10 class ToStringWrapper {
11 final value; 11 final value;
12 12
13 ToStringWrapper(this.value); 13 ToStringWrapper(this.value);
14 14
15 toString() => value; 15 toString() => value;
16 } 16 }
17 17
18 wrap(value) => new ToStringWrapper(value); 18 wrap(value) => new ToStringWrapper(value);
19 19
20 final bool checkedMode = computeCheckedMode();
21 bool computeCheckedMode() {
22 try {
23 int x = "foo";
24 } on Error {
25 return true;
26 }
27 return false;
28 }
29
20 main() { 30 main() {
21 bool checkedMode = false;
22 assert(checkedMode = true);
23 interpolate(object) { 31 interpolate(object) {
24 var result; 32 var result;
25 if (checkedMode && object != null) { 33 if (checkedMode && object != null) {
26 try { 34 try {
27 result = '${wrap(object)}'; 35 result = '${wrap(object)}';
28 } on TypeError { 36 } on TypeError {
29 return 'Error'; 37 return 'Error';
30 } on ArgumentError { 38 } on ArgumentError {
31 return 'Error'; // Checked mode. 39 return 'Error'; // Checked mode.
32 } 40 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 Expect.equals('Error', buffer([1])); 105 Expect.equals('Error', buffer([1]));
98 Expect.equals('Error', buffer(new Object())); 106 Expect.equals('Error', buffer(new Object()));
99 107
100 Expect.equals('Error', initBuffer(null)); 108 Expect.equals('Error', initBuffer(null));
101 Expect.equals('Success', initBuffer("")); 109 Expect.equals('Success', initBuffer(""));
102 Expect.equals('Success', initBuffer("string")); 110 Expect.equals('Success', initBuffer("string"));
103 Expect.equals('Error', initBuffer([])); 111 Expect.equals('Error', initBuffer([]));
104 Expect.equals('Error', initBuffer([1])); 112 Expect.equals('Error', initBuffer([1]));
105 Expect.equals('Error', initBuffer(new Object())); 113 Expect.equals('Error', initBuffer(new Object()));
106 } 114 }
OLDNEW
« no previous file with comments | « tests/language/language_analyzer2.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698