OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library gcloud.db.properties_test; | 5 library gcloud.db.properties_test; |
6 | 6 |
7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
8 | 8 |
9 import 'package:gcloud/db.dart'; | 9 import 'package:gcloud/db.dart'; |
10 import 'package:gcloud/datastore.dart' as datastore; | 10 import 'package:gcloud/datastore.dart' as datastore; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 var prop = const ListProperty(const BoolProperty()); | 110 var prop = const ListProperty(const BoolProperty()); |
111 | 111 |
112 expect(prop.validate(null, null), isFalse); | 112 expect(prop.validate(null, null), isFalse); |
113 expect(prop.validate(null, []), isTrue); | 113 expect(prop.validate(null, []), isTrue); |
114 expect(prop.validate(null, [true]), isTrue); | 114 expect(prop.validate(null, [true]), isTrue); |
115 expect(prop.validate(null, [true, false]), isTrue); | 115 expect(prop.validate(null, [true, false]), isTrue); |
116 expect(prop.validate(null, [true, false, 1]), isFalse); | 116 expect(prop.validate(null, [true, false, 1]), isFalse); |
117 expect(prop.encodeValue(null, []), equals(null)); | 117 expect(prop.encodeValue(null, []), equals(null)); |
118 expect(prop.encodeValue(null, [true]), equals(true)); | 118 expect(prop.encodeValue(null, [true]), equals(true)); |
119 expect(prop.encodeValue(null, [true, false]), equals([true, false])); | 119 expect(prop.encodeValue(null, [true, false]), equals([true, false])); |
| 120 expect(prop.encodeValue(null, true, forComparison: true), equals(true)); |
| 121 expect(prop.encodeValue(null, false, forComparison: true), equals(false)); |
| 122 expect(prop.encodeValue(null, null, forComparison: true), equals(null)); |
120 expect(prop.decodePrimitiveValue(null, null), equals([])); | 123 expect(prop.decodePrimitiveValue(null, null), equals([])); |
121 expect(prop.decodePrimitiveValue(null, []), equals([])); | 124 expect(prop.decodePrimitiveValue(null, []), equals([])); |
122 expect(prop.decodePrimitiveValue(null, true), equals([true])); | 125 expect(prop.decodePrimitiveValue(null, true), equals([true])); |
123 expect(prop.decodePrimitiveValue(null, [true, false]), | 126 expect(prop.decodePrimitiveValue(null, [true, false]), |
124 equals([true, false])); | 127 equals([true, false])); |
125 }); | 128 }); |
126 | 129 |
127 test('composed_list_property', () { | 130 test('composed_list_property', () { |
128 var prop = const ListProperty(const CustomProperty()); | 131 var prop = const ListProperty(const CustomProperty()); |
129 | 132 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 throw "Broken test"; | 234 throw "Broken test"; |
232 } | 235 } |
233 return _datastoreKey; | 236 return _datastoreKey; |
234 } | 237 } |
235 | 238 |
236 Map<String, Property> propertiesForModel(modelDescription) => null; | 239 Map<String, Property> propertiesForModel(modelDescription) => null; |
237 Model fromDatastoreEntity(datastore.Entity entity) => null; | 240 Model fromDatastoreEntity(datastore.Entity entity) => null; |
238 datastore.Entity toDatastoreEntity(Model model) => null; | 241 datastore.Entity toDatastoreEntity(Model model) => null; |
239 String fieldNameToPropertyName(String kind, String fieldName) => null; | 242 String fieldNameToPropertyName(String kind, String fieldName) => null; |
240 String kindName(Type type) => null; | 243 String kindName(Type type) => null; |
241 Object toDatastoreValue(String kind, String fieldName, Object value) => null; | 244 Object toDatastoreValue(String kind, String fieldName, Object value, {bool for
Comparison: false}) => null; |
242 } | 245 } |
OLD | NEW |