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

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

Issue 11125005: Support for type dynamic in VM (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/setter3_test.dart ('k') | tests/language/type_vm_test.dart » ('j') | 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 // VMOptions=--no_show_internal_names 4 // VMOptions=--no_show_internal_names
5 // 5 //
6 // Dart test program testing type casts. 6 // Dart test program testing type casts.
7 7
8 // Test that the initializer expression gets properly skipped. 8 // Test that the initializer expression gets properly skipped.
9 bool b = "foo" as double; 9 bool b = "foo" as double;
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 int result = 0; 125 int result = 0;
126 Function anyFunction; 126 Function anyFunction;
127 f() { }; 127 f() { };
128 anyFunction = f as Function; // No error. 128 anyFunction = f as Function; // No error.
129 anyFunction = null as Function; // No error. 129 anyFunction = null as Function; // No error.
130 try { 130 try {
131 var i = f as int; // Throws a TypeError if type checks are enabled. 131 var i = f as int; // Throws a TypeError if type checks are enabled.
132 } on TypeError catch (error) { 132 } on TypeError catch (error) {
133 result = 1; 133 result = 1;
134 Expect.equals("int", error.dstType); 134 Expect.equals("int", error.dstType);
135 Expect.equals("() => Dynamic", error.srcType); 135 Expect.equals("() => dynamic", error.srcType);
136 Expect.equals("type cast", error.dstName); 136 Expect.equals("type cast", error.dstName);
137 int pos = error.url.lastIndexOf("/", error.url.length); 137 int pos = error.url.lastIndexOf("/", error.url.length);
138 if (pos == -1) { 138 if (pos == -1) {
139 pos = error.url.lastIndexOf("\\", error.url.length); 139 pos = error.url.lastIndexOf("\\", error.url.length);
140 } 140 }
141 String subs = error.url.substring(pos + 1, error.url.length); 141 String subs = error.url.substring(pos + 1, error.url.length);
142 Expect.equals("type_cast_vm_test.dart", subs); 142 Expect.equals("type_cast_vm_test.dart", subs);
143 Expect.equals(131, error.line); 143 Expect.equals(131, error.line);
144 Expect.equals(17, error.column); 144 Expect.equals(17, error.column);
145 } 145 }
146 return result; 146 return result;
147 } 147 }
148 148
149 static testMain() { 149 static testMain() {
150 Expect.equals(1, test()); 150 Expect.equals(1, test());
151 Expect.equals(1, testSideEffect()); 151 Expect.equals(1, testSideEffect());
152 Expect.equals(1, testArgument()); 152 Expect.equals(1, testArgument());
153 Expect.equals(1, testReturn()); 153 Expect.equals(1, testReturn());
154 Expect.equals(1, testField()); 154 Expect.equals(1, testField());
155 Expect.equals(1, testAnyFunction()); 155 Expect.equals(1, testAnyFunction());
156 } 156 }
157 } 157 }
158 158
159 159
160 main() { 160 main() {
161 TypeTest.testMain(); 161 TypeTest.testMain();
162 } 162 }
OLDNEW
« no previous file with comments | « tests/language/setter3_test.dart ('k') | tests/language/type_vm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698