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

Unified Diff: tests/html/indexeddb_1_test.dart

Issue 26308004: Update idb tests to verify correct number behavior. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: retry Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/indexeddb_1_test.dart
diff --git a/tests/html/indexeddb_1_test.dart b/tests/html/indexeddb_1_test.dart
index c57f8d11838cd3e83e4f8fee5e05ef91fe17825c..db0944385eaa390a5b67c7e60e173ad1c545b88a 100644
--- a/tests/html/indexeddb_1_test.dart
+++ b/tests/html/indexeddb_1_test.dart
@@ -37,7 +37,8 @@ Future testUpgrade() {
}
testReadWrite(key, value, matcher,
- [dbName, storeName = STORE_NAME, version = VERSION]) => () {
+ [dbName, storeName = STORE_NAME, version = VERSION,
+ stringifyResult = false]) => () {
if (dbName == null) {
dbName = nextDatabaseName();
}
@@ -60,7 +61,13 @@ testReadWrite(key, value, matcher,
return transaction.objectStore(storeName).getObject(key);
}).then((object) {
db.close();
- expect(object, matcher);
+ if (stringifyResult) {
+ // Stringify the numbers to verify that we're correctly returning ints
+ // as ints vs doubles.
+ expect(object.toString(), matcher);
+ } else {
+ expect(object, matcher);
+ }
}).whenComplete(() {
if (db != null) {
db.close();
@@ -70,7 +77,8 @@ testReadWrite(key, value, matcher,
};
testReadWriteTyped(key, value, matcher,
- [dbName, storeName = STORE_NAME, version = VERSION]) => () {
+ [dbName, storeName = STORE_NAME, version = VERSION,
+ stringifyResult = false]) => () {
if (dbName == null) {
dbName = nextDatabaseName();
}
@@ -95,7 +103,13 @@ testReadWriteTyped(key, value, matcher,
return transaction.objectStore(storeName).getObject(key);
}).then((object) {
db.close();
- expect(object, matcher);
+ if (stringifyResult) {
+ // Stringify the numbers to verify that we're correctly returning ints
+ // as ints vs doubles.
+ expect(object.toString(), matcher);
+ } else {
+ expect(object, matcher);
+ }
}).whenComplete(() {
if (db != null) {
db.close();
@@ -110,6 +124,10 @@ void testTypes(testFunction) {
test('List', testFunction(123, [1, 2, 3], equals([1, 2, 3])));
test('List 2', testFunction(123, [2, 3, 4], equals([2, 3, 4])));
test('bool', testFunction(123, [true, false], equals([true, false])));
+ test('largeInt', testFunction(123, 1371854424211,
+ equals("1371854424211"), null, STORE_NAME, VERSION, true));
+ test('largeIntInMap', testFunction(123, {'time': 4503599627370492},
+ equals("{time: 4503599627370492}"), null, STORE_NAME, VERSION, true));
blois 2013/10/17 22:16:15 Can you add a double test or two here too?
var now = new DateTime.now();
test('DateTime', testFunction(123, now,
predicate((date) =>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698