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

Unified Diff: tests/language/number_identifier_test.dart

Issue 23868006: Change language/number_identifier_test to be correct. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/number_identifier_test.dart
diff --git a/tests/language/number_identifier_test.dart b/tests/language/number_identifier_test.dart
index b66f5388d7a453c60c660e285c939d8b5acf9a94..0fc76fd84b11536d7af04db818ff4d384d1777da 100644
--- a/tests/language/number_identifier_test.dart
+++ b/tests/language/number_identifier_test.dart
@@ -2,7 +2,36 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import "package:expect/expect.dart";
+
main() {
- 1is int; /// 01: compile-time error
- 1as int; /// 02: compile-time error
+ // Integer literals.
+ Expect.isTrue(2is int);
+ Expect.equals(2, 2as int);
+ Expect.isTrue(-2is int);
+ Expect.equals(-2, -2as int);
+ Expect.isTrue(0x10is int);
+ Expect.isTrue(-0x10is int);
+ // "a" will be part of hex literal, the following "s" is an error.
+ 0x10as int; /// 01: compile-time error
+ 0x; /// 04: compile-time error
+
+ // Double literals.
+ Expect.isTrue(2.0is double);
+ Expect.equals(2.0, 2.0as double);
+ Expect.isTrue(-2.0is double);
+ Expect.equals(-2.0, -2.0as double);
+ Expect.isTrue(.2is double);
+ Expect.equals(0.2, .2as double);
+ Expect.isTrue(1e2is double);
+ Expect.equals(1e2, 1e2as double);
+ Expect.isTrue(1e-2is double);
+ Expect.equals(1e-2, 1e-2as double);
+ Expect.isTrue(1e+2is double);
+ Expect.equals(1e+2, 1e+2as double);
+ Expect.throws(() => 1.e+2, /// 05: ok
+ (e) => e is NoSuchMethodError && /// 05: continued
+ e.memberName == const Symbol("e")); /// 05: continued
hausner 2013/09/05 20:10:24 NoSuchMethodError does not have an accessor called
ahe 2013/09/05 20:12:27 Good catch, thank you for fixing it!
+ 1e; /// 02: compile-time error
+ 1x; /// 03: compile-time error
}
« no previous file with comments | « tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698