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

Side by Side Diff: frog/leg/lib/core.dart

Issue 9027003: Add support for Expect.equals in the Leg core library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 12 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 | « no previous file | frog/tests/leg_only/src/LoopIfPhiTest.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) 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 4
5 void print(var obj) { 5 void print(var obj) {
6 // TODO(ngeoffray): enable when the parser accepts it. 6 // TODO(ngeoffray): enable when the parser accepts it.
7 // obj = obj.toString(); 7 // obj = obj.toString();
8 var hasConsole = JS(@"typeof console == 'object'"); 8 var hasConsole = JS(@"typeof console == 'object'");
9 if (hasConsole) { 9 if (hasConsole) {
10 JS(@"console.log($0)", obj); 10 JS(@"console.log($0)", obj);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 throw "Unimplemented user-defined length."; 242 throw "Unimplemented user-defined length.";
243 } 243 }
244 244
245 class int {} 245 class int {}
246 class double {} 246 class double {}
247 class String {} 247 class String {}
248 class bool {} 248 class bool {}
249 class Object {} 249 class Object {}
250 class List<T> {} 250 class List<T> {}
251 251
252 class Expect {
253 static void equals(var expected, var actual) {
254 if (expected == actual) return;
255 print('Expect.equals(expected: <' + expected.toString() +
256 '>, actual:<' + actual.toString() + '> fails.');
257 throw 'Expect.equals failed.';
258 }
259 }
260
252 class Stopwatch { 261 class Stopwatch {
253 double startMs; 262 double startMs;
254 double elapsedMs; 263 double elapsedMs;
255 264
256 Stopwatch() { 265 Stopwatch() {
257 elapsedMs = 0.0; 266 elapsedMs = 0.0;
258 } 267 }
259 268
260 void start() { 269 void start() {
261 if (startMs == null) { 270 if (startMs == null) {
(...skipping 26 matching lines...) Expand all
288 return JS(@"Math.floor($0)", elapsedMs); 297 return JS(@"Math.floor($0)", elapsedMs);
289 } else { 298 } else {
290 return JS(@"Math.floor($0 + (Date.now() - $1))", elapsedMs, startMs); 299 return JS(@"Math.floor($0 + (Date.now() - $1))", elapsedMs, startMs);
291 } 300 }
292 } 301 }
293 302
294 int frequency() { 303 int frequency() {
295 return 1000; 304 return 1000;
296 } 305 }
297 } 306 }
OLDNEW
« no previous file with comments | « no previous file | frog/tests/leg_only/src/LoopIfPhiTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698