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

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

Issue 12743005: Revert "Remove Expect from core library." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload (first upload failed). Created 7 years, 9 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
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 // Dart test program to test integer div by zero. 4 // Dart test program to test integer div by zero.
5 5
6 import "package:expect/expect.dart";
7
8 class DivByZeroTest { 6 class DivByZeroTest {
9 7
10 static double divBy(int a, int b) { 8 static double divBy(int a, int b) {
11 var result = a/b; 9 var result = a/b;
12 return 1.0 * result; 10 return 1.0 * result;
13 } 11 }
14 12
15 static bool moustacheDivBy(int a, int b) { 13 static bool moustacheDivBy(int a, int b) {
16 var val = null; 14 var val = null;
17 try { 15 try {
18 val = a~/b; 16 val = a~/b;
19 } catch (e) { 17 } catch (e) {
20 return true; 18 return true;
21 } 19 }
22 print("Should not have gotten: $val"); 20 print("Should not have gotten: $val");
23 return false; 21 return false;
24 } 22 }
25 23
26 static void testMain() { 24 static void testMain() {
27 Expect.isTrue(divBy(0, 0).isNaN); 25 Expect.isTrue(divBy(0, 0).isNaN);
28 Expect.isTrue(moustacheDivBy(0, 0)); 26 Expect.isTrue(moustacheDivBy(0, 0));
29 } 27 }
30 } 28 }
31 29
32 main() { 30 main() {
33 DivByZeroTest.testMain(); 31 DivByZeroTest.testMain();
34 } 32 }
OLDNEW
« no previous file with comments | « tests/language/disable_privacy_test.dart ('k') | tests/language/div_with_power_of_two_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698